Permalink
Browse files

done.

  • Loading branch information...
1 parent bf5f594 commit 227634eeab2d45f54cf6d08a35bf1d74436fe55b Informpro committed Jun 1, 2011
Showing with 29 additions and 6 deletions.
  1. +2 −2 cms_db_update.php
  2. +27 −4 templates/common/cms/cms_menu_block_list_body.tpl
View
@@ -116,10 +116,10 @@
AJAX_message_die($result_ar);
exit;
}
- if (($cat > 0) && !empty($_POST['list_' . $cat]))
+ if (($cat > 0) && !empty($_POST['item']))
{
$item_order = 0;
- foreach($_POST['list_' . $cat] as $menu_item_id)
+ foreach($_POST['item'] as $menu_item_id)
{
$item_order++;
$sql = "UPDATE " . CMS_NAV_MENU_TABLE . " SET menu_order = '" . $item_order . "' WHERE menu_item_id = '" . $menu_item_id . "'";
@@ -79,13 +79,36 @@
<script type="text/javascript">
//<![CDATA[
+var sort_info_box = $('sort-info-box'),
+ box_updated = '<div id="result-box" style="height: 16px; border: solid 1px #228822; background: #77dd99;"><span class="text_green">{L_MENU_UPDATED}<\/span><\/span>',
+ lists = {},
+ page_url = ip_root_path;
+page_url += 'cms_db_update.';
+page_url += php_ext;
+
+
<!-- BEGIN cat_row -->
-function update_order_{cat_row.CAT_CB_ID}()
+lists[{cat_row.CAT_CB_ID}] = $('#list_{cat_row.CAT_CB_ID}');
+
+function update_order(cat)
{
- var request_options = {method: 'post', parameters: 'mode=update_menu_order&cat=' + {cat_row.CAT_CB_ID} + '&' + Sortable.serialize("list_{cat_row.CAT_CB_ID}") + '&sid=' + S_SID};
- new Ajax.Request(ip_root_path + 'cms_db_update.' + php_ext, request_options);
+ var request_options = 'mode=update_menu_order&cat=';
+ request_options += cat;
+ request_options += '&';
+ request_options += lists[cat].sortable('serialize');
+ request_options += '&sid=';
+ request_options += S_SID;
+ $.post(page_url, request_options);
}
-Sortable.create('list_{cat_row.CAT_CB_ID}', {handle: 'icon-edit-move', onUpdate: function(){update_order_{cat_row.CAT_CB_ID}(); $('sort-info-box').show(); $('sort-info-box').innerHTML = box_begin + '{L_MENU_UPDATED}' + box_end; new Effect.Highlight('result-box', {duration: 0.5}); window.setTimeout("new Effect.Fade('sort-info-box', {duration: 0.5})", 2500);}});
+lists[{cat_row.CAT_CB_ID}].sortable(
+{
+ update: function()
+ {
+ update_order({cat_row.CAT_CB_ID});
+ sort_info_box.show().html(box_updated);
+ setTimeout({ sort_info_box.html('').hide(); }, 2500);
+ }
+}).disableSelection();
<!-- END cat_row -->
//]]>
</script>

0 comments on commit 227634e

Please sign in to comment.