Index: trunk/kernel/admin_templates/incs/script.js =================================================================== diff -u -r5041 -r5042 --- trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 5041) +++ trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 5042) @@ -69,15 +69,10 @@ setArrayValue($hooks, $function_name, $hook_type, $hook_body); } -function resort_grid(prefix_special, field, form_action, $ajax) +function resort_grid(prefix_special, field, $ajax) { set_hidden_field(prefix_special + '_Sort1', field); - if ($ajax) { - $Catalog.submit_event(prefix_special, 'OnSetSorting'); - } - else { - submit_event(prefix_special, 'OnSetSorting', null, form_action); - } + submit_event(prefix_special, 'OnSetSorting', null, null, $ajax); } function direct_sort_grid($prefix_special,$field,$direction,$field_pos) @@ -100,21 +95,24 @@ submit_event($prefix_special,'OnSetPerPage'); } -function submit_event(prefix_special,event,t,form_action) +function submit_event(prefix_special, event, t, form_action, $ajax) { - if (isset(event)) { - set_hidden_field('events['+prefix_special+']', event); + if ($ajax) { + return $Catalog.submit_event(prefix_special, event, t); } - if(isset(t)) set_hidden_field('t', t); - if( isset(form_action) ) - { + if (event) { + set_hidden_field('events[' + prefix_special + ']', event); + } + if (t) set_hidden_field('t', t); + + if (form_action) { var old_env = ''; - if ( !form_action.match(/\?/) ) { + if (!form_action.match(/\?/)) { document.getElementById($form_name).action.match(/.*(\?.*)/); old_env = RegExp.$1; } - document.getElementById($form_name).action = form_action+old_env; + document.getElementById($form_name).action = form_action + old_env; } submit_kernel_form(); } @@ -199,10 +197,10 @@ alert(s); } -function go_to_page(prefix_special, page) +function go_to_page(prefix_special, page, $ajax) { set_hidden_field(prefix_special+'_Page', page); - submit_event(prefix_special); + submit_event(prefix_special, null, null, null, $ajax); } function go_to_list(prefix_special, tab) @@ -498,25 +496,34 @@ function getRealLeft(el) { + if (typeof(el) == 'string') { + el = document.getElementById(el); + } xPos = el.offsetLeft; tempEl = el.offsetParent; while (tempEl != null) { xPos += tempEl.offsetLeft; tempEl = tempEl.offsetParent; } + // if (obj.x) return obj.x; return xPos; } function getRealTop(el) { + if (typeof(el) == 'string') { + el = document.getElementById(el); + } yPos = el.offsetTop; tempEl = el.offsetParent; while (tempEl != null) { yPos += tempEl.offsetTop; tempEl = tempEl.offsetParent; } + +// if (obj.y) return obj.y; return yPos; } @@ -980,4 +987,10 @@ { document.cookie = $Name+'=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/'; } + } + + function addElement($dst_element, $tag_name) { + var $new_element = document.createElement($tag_name.toUpperCase()); + $dst_element.appendChild($new_element); + return $new_element; } \ No newline at end of file