Commit info for scoop/lib/Scoop:
Modified Files:
Macros.pm
Log Message:
Committed:
* hulver's fix for macro categories
* admin tools documentation for macros
* cleanup of the last few blocks that weren't filed in the new categories
--janra
Index: Macros.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Macros.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -r1.1 -r1.2
132,135c132,137
< my $save = $S->{CGI}->param('save');
< my $delete = $S->{CGI}->param('delete');
< my $edit = $S->{CGI}->param('edit');
< my $category = $S->{CGI}->param('cat') || 'Add New';
---
>
> my $item = $S->{CGI}->param('item');
> my $save = $S->{CGI}->param('save');
> my $delete = $S->{CGI}->param('delete');
> my $edit = $S->{CGI}->param('edit');
> my $mode = $S->{CGI}->param('mode') || 'Add New';
166,173c168,176
<
< # write changes if there are any
< if( $save && $save eq 'Save' && ! $delete) {
< $update_msg = $S->_save_macro_changes( \@macro_array, $category );
< } elsif( $save && $save eq 'Save' && $delete ) {
< $update_msg = $S->_delete_macro();
< }
<
---
> # write changes if there are any
> if ($save && $save eq 'Save') {
> if ($delete) {
> $update_msg = $S->_delete_macro();
> } else {
> $update_msg = $S->_save_macro_changes( \@macro_array, $mode, $item );
> }
> }
>
180c183
< if( $category eq 'Add New' ) {
---
> if ($mode eq 'Add New' || $mode eq 'edit') {
182,183c185
< $form_body = $S->_make_newmacro_tool( \@macro_array, $edit );
< #warn qq(edit_macros: calling _make_newmacro_tool [$edit]);
---
> $form_body = $S->_make_newmacro_tool( \@macro_array, $edit, $item );
186,187c188
< $form_body = $S->_make_macro_table( \@macro_array, $category );
< #warn qq(edit_macros: calling _make_macro_table [$category]);
---
> $form_body = $S->_make_macro_table( \@macro_array, $item );
189d189
<
192c192
< $content =~ s/%%category%%/$category/g;
---
> $content =~ s/%%category%%/$item/g;
203c203,204
< my $edit = shift;
---
> my $edit = shift || 'Get';
> my $item = shift;
217a219,220
>
> $v = $item if $v eq '';
236a240,241
> <input type="hidden" name="mode" value="edit" />
> <input type="hidden" name="item" value="$v" />
245c250
< if( $macro->{name} eq $S->{CGI}->param('macro') && $edit && $edit eq 'Get' ) {
---
> if( $macro->{name} eq $v && $edit && $edit eq 'Get' ) {
322c327
< $name = qq|<a href="%%rootdir%%/admin/macros?edit=GET;macro=$macro->{name}">$macro->{name}</a>|;
---
> $name = qq|<a href="%%rootdir%%/admin/macros/edit/$macro->{name}">$macro->{name}</a>|;
333c338,341
< $content = "
---
> $content = qq|
> <input type="hidden" name="item" value="$category" />
> <input type="hidden" name="mode" value="catedit" />
>
335c343
< ";
---
> |;
413c421,422
< my $category = shift;
---
> my $mode = shift;
> my $item = shift;
422c431
< if( $category eq 'Add New' ) {
---
> if( $mode eq 'Add New' || $mode eq 'edit' ) {
556c565
< if ( $category ne 'Add New' and $macrolist ne '' ) {
---
> if ( $mode ne 'Add New' and $macrolist ne '' ) {
558c567
< } elsif( $category eq 'Add New' ) {
---
> } elsif( $mode eq 'Add New' ) {
599c608
< $catrow =~ s/%%item_url%%/All/;
---
> $catrow =~ s/%%item_url%%/multi\/All/;
620c629
< my $urlcat = $S->urlify($cat);
---
> my $urlcat = $S->urlify("$cat");
625c634
< $catrow =~ s/%%item_url%%/$urlcat/;
---
> $catrow =~ s/%%item_url%%/multi\/$urlcat/;