Configurable sort order:
authorJamie Cameron <jcameron@webmin.com>
Mon, 18 Aug 2008 23:51:56 +0000 (23:51 +0000)
committerJamie Cameron <jcameron@webmin.com>
Mon, 18 Aug 2008 23:51:56 +0000 (23:51 +0000)
cluster-copy/CHANGELOG
cluster-copy/config.info [new file with mode: 0644]
cluster-copy/index.cgi

index 3538a88..9ab5f55 100644 (file)
@@ -11,3 +11,5 @@ A command to run before copying can now be specified, and both the before and af
 Made the backup email contents translatable.
 ---- Changes since 1.310 ----
 Added checkboxes and a button for deleting multiple cluster copies at once.
+---- Changes since 1.430 ----
+Added a Module Config setting to control the default sort order.
diff --git a/cluster-copy/config.info b/cluster-copy/config.info
new file mode 100644 (file)
index 0000000..1fe056f
--- /dev/null
@@ -0,0 +1 @@
+sort_mode=Sort copy commands by,1,0-Order created,1-Filename,2-Destination servers
index 30d3de0..e6d3f11 100755 (executable)
@@ -2,13 +2,23 @@
 # Show all scheduled cluster copy jobs
 
 require './cluster-copy-lib.pl';
-&ui_print_header(undef, $text{'index_title'}, "", "intro", 0, 1);
+&ui_print_header(undef, $text{'index_title'}, "", "intro", 1, 1);
 
 @links = ( &select_all_link("d"),
           &select_invert_link("d"),
           "<a href='edit.cgi?new=1'>$text{'index_add'}</a>" );
 
+# Get and sort jobs
 @jobs = &list_copies();
+if ($config{'sort_mode'} == 1) {
+       # By filename
+       @jobs = sort { $a->{'files'} cmp $b->{'files'} } @jobs;
+       }
+elsif ($config{'sort_mode'} == 2) {
+       # By destination server
+       @jobs = sort { $a->{'servers'} cmp $b->{'servers'} } @jobs;
+       }
+
 if (@jobs) {
        print &ui_form_start("delete.cgi", "post");
        print &ui_links_row(\@links);