Index: openacs-4/packages/lors/tcl/lors-imscp-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/lors-imscp-procs.tcl,v
diff -u -r1.13 -r1.13.2.1
--- openacs-4/packages/lors/tcl/lors-imscp-procs.tcl 13 Jul 2006 16:23:00 -0000 1.13
+++ openacs-4/packages/lors/tcl/lors-imscp-procs.tcl 13 Apr 2007 17:22:41 -0000 1.13.2.1
@@ -590,6 +590,8 @@
}
]
+ set next_sort_order [db_string get_max "select coalesce(max(sort_order)+1,1) from ims_cp_items where org_id=:org_id"]
+ db_dml set_sort_order "update ims_cp_items set sort_order = :next_sort_order where ims_item_id = :item_id"
# }
if {![empty_string_p $dotlrn_permission]} {
Index: openacs-4/packages/lorsm/www/admin/reorder-items.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm/www/admin/reorder-items.tcl,v
diff -u -r1.1 -r1.1.2.1
--- openacs-4/packages/lorsm/www/admin/reorder-items.tcl 31 Dec 2006 00:36:04 -0000 1.1
+++ openacs-4/packages/lorsm/www/admin/reorder-items.tcl 13 Apr 2007 17:22:41 -0000 1.1.2.1
@@ -13,9 +13,9 @@
db_list lock_rows "select ims_item_id from ims_cp_items where parent_item=:parent_item for update"
if { $dir eq "up" } {
- set next_sort_order [expr { $sort_order - 1 }]
+ set next_sort_order [db_string get_prev_sort_order "" -default 1]
} else {
- set next_sort_order [expr { $sort_order + 1 }]
+ set next_sort_order [db_string get_next_sort_order "" -default 1]
}
db_dml swap_sort_orders "
Index: openacs-4/packages/lorsm/www/admin/reorder-items.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm/www/admin/reorder-items.xql,v
diff -u -r1.1 -r1.1.2.1
--- openacs-4/packages/lorsm/www/admin/reorder-items.xql 31 Dec 2006 00:36:04 -0000 1.1
+++ openacs-4/packages/lorsm/www/admin/reorder-items.xql 13 Apr 2007 17:22:41 -0000 1.1.2.1
@@ -24,5 +24,17 @@
+
+
+ select sort_order from ims_cp_items where parent_item=:parent_item and sort_order > :sort_order order by sort_order limit 1
+
+
+
+
+
+ select sort_order from ims_cp_items where parent_item=:parent_item and sort_order < :sort_order order by sort_order desc limit 1
+
+
+