diff options
author | cvs2git <cvs2git> | 2002-08-12 06:17:10 +0000 |
---|---|---|
committer | cvs2git <cvs2git> | 2002-08-12 06:17:10 +0000 |
commit | 160be29a0dc62e79a4fb95d2ab8c0c7e5996760e (patch) | |
tree | 94ebadb17321b138fd7bfd9a5c379eec97c5d328 /rt/webrt/Admin/Elements/ModifyKeyword | |
parent | 3ef62a0570055da710328937e7f65dbb2c027c62 (diff) |
This commit was manufactured by cvs2svn to create branch 'BESTPRACTICAL'.
Diffstat (limited to 'rt/webrt/Admin/Elements/ModifyKeyword')
-rw-r--r-- | rt/webrt/Admin/Elements/ModifyKeyword | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/rt/webrt/Admin/Elements/ModifyKeyword b/rt/webrt/Admin/Elements/ModifyKeyword deleted file mode 100644 index 4b01c3692..000000000 --- a/rt/webrt/Admin/Elements/ModifyKeyword +++ /dev/null @@ -1,95 +0,0 @@ -<FORM METHOD="get" ACTION="<%$RT::WebPath%>/Admin/Keywords/Modify.html"> -[<%$title |n %>]<BR> - -<INPUT TYPE="hidden" NAME="id" VALUE="<% $id %>"> -Keyword <INPUT NAME="Name" VALUE="<% $Keyword->Name %>"><BR> - -Parent <SELECT NAME="Parent"> - <OPTION VALUE=""<% defined($Keyword->Parent) ? '' : ' SELECTED' %>>-</OPTION> -%while ( $parent = $parents->Next ) { - <OPTION VALUE="<% $parent->id %>"<% defined($Keyword->Parent) && $parent->id == $Keyword->Parent ? ' SELECTED' : '' %>><% $parent->Name %></OPTION> -%} -</SELECT> - - -Kids <FONT SIZE="-2">(separate by -<INPUT TYPE="radio" NAME="delim" VALUE="n"<% $delim eq 'n' ? ' CHECKED' : '' %>> -line or -<INPUT TYPE="radio" NAME="delim" VALUE="s"<% $delim eq 's' ? ' CHECKED' : '' %>> -whitespace)</FONT><BR> - -<TEXTAREA NAME="Kids" ROWS=4><% $kidstring %></TEXTAREA> -<BR> - -<& /Elements/Submit, Label => $submit &> -</FORM> - -<%INIT> - -my $Keyword = new RT::Keyword($session{CurrentUser}); -my ($title, $submit, %kids, $kid); - -if ( $Create ) { - $title = "Create a new Keyword"; - $submit = "Create"; - $id = "new"; - %kids = (); - $Parent = ''; #silence -} elsif ( $id eq 'new' ) { - $id = $Keyword->Create( Name => $Name, Parent => $Parent ) - or Abort("can't create keyword Name=>$Name, Parent=>$Parent"); -} else { - $Keyword->Load($id) || Abort("Can't load keyword id $id"); - #foreach my $field ( grep eval "defined(\$$_)", qw( Name Parent )) { - # eval "\$Keyword->Set(\$field=>\$$field); #sigh - #} - $Keyword->SetName($Name) if defined($Name); - $Keyword->SetParent($Parent) if defined($Parent); -} - -$title = "Modify the Keyword <B>". $Keyword->Name. "</B>"; -$submit = "Modify"; - -my $kids = new RT::Keywords($session{CurrentUser}); -$kids->Limit( FIELD => 'Parent', VALUE => $id, OPERATOR => '=' ); -$kids{$kid->Name} = $kid while $kid = $kids->Next; - -if ( defined($Kids) ) { - my %newkids; - if ( $delim eq 'n' ) { - %newkids = map { $_=>1 } split(/\n/, $Kids); - } elsif ( $delim eq 's' ) { - %newkids = map { $_=>1 } split(' ', $Kids); - } else { - Abort("'$delim' isn't a valid keyword delimiter."); - } - foreach ( grep { ! defined($newkids{$_}) } keys %kids ) { - $kids{$_}->Delete; - delete $kids{$_}; - } - foreach ( grep { ! defined($kids{$_}) } keys %newkids ) { - $kids{$_} = new RT::Keyword($session{CurrentUser}); - $kids{$_}->Create( Name => $_, Parent => $id ) - or Abort("can't create keyword Name=>$_, Parent=>$id"); - } - -} - - -my $parent; -my $parents = new RT::Keywords($session{CurrentUser}); -$parents->UnLimit; - -$delim = ( grep /\s/, keys %kids ) ? 'n' : 's'; -my $kidstring = join("\n", keys %kids); - -</%INIT> - -<%ARGS> -$id => undef -$Create => undef -$Name => undef -$Parent => undef -$Kids => undef -$delim => undef -</%ARGS> |