includes/clientside/static/paginate.js
changeset 909 94c1ff984286
parent 875 0c3dd4c166c0
child 1132 05fe0039d952
equal deleted inserted replaced
908:44302dd20d62 909:94c1ff984286
   266   {
   266   {
   267     divs[i].innerHTML = pg_control;
   267     divs[i].innerHTML = pg_control;
   268   }
   268   }
   269 }
   269 }
   270 
   270 
   271 window.paginator_goto = function(parentobj, this_page, num_pages, perpage, url_string)
   271 window.paginator_goto = function(parentobj, this_page, num_pages, perpage, additive, url_string)
   272 {
   272 {
   273   load_component('flyin');
   273   load_component('flyin');
   274   
   274   
   275   var height = $dynano(parentobj).Height();
   275   var height = $dynano(parentobj).Height();
   276   var width  = $dynano(parentobj).Width();
   276   var width  = $dynano(parentobj).Width();
   284   div.className = 'question-box';
   284   div.className = 'question-box';
   285   div.style.margin = '1px 0 0 2px';
   285   div.style.margin = '1px 0 0 2px';
   286   var vtmp = 'input_' + Math.floor(Math.random() * 1000000);
   286   var vtmp = 'input_' + Math.floor(Math.random() * 1000000);
   287   var regex = new RegExp('\"', 'g');
   287   var regex = new RegExp('\"', 'g');
   288   var submit_target = ( typeof(url_string) == 'object' ) ? ( toJSONString(url_string) ).replace(regex, '\'') : 'unescape(\'' + escape(url_string) + '\')';
   288   var submit_target = ( typeof(url_string) == 'object' ) ? ( toJSONString(url_string) ).replace(regex, '\'') : 'unescape(\'' + escape(url_string) + '\')';
   289   var onclick = 'paginator_submit(this, '+num_pages+', '+perpage+', '+submit_target+'); return false;';
   289   var onclick = 'paginator_submit(this, '+num_pages+', '+perpage+', '+additive+', '+submit_target+'); return false;';
   290   div.innerHTML = $lang.get('paginate_lbl_goto_page') + '<br /><input type="text" size="2" style="padding: 1px; font-size: 8pt;" value="'+(parseInt(this_page)+1)+'" id="'+vtmp+'" />&emsp;<a href="#" onclick="'+onclick+'" style="font-size: 14pt; text-decoration: none;">&raquo;</a>&emsp;<a href="#" onclick="var _pn = this.parentNode; setTimeout(function() { _pn.parentNode.removeChild(_pn); }, 2000); fly_out_top(this.parentNode, false, true); return false;" style="font-size: 14pt; text-decoration: none;">&times;</a>';
   290   div.innerHTML = $lang.get('paginate_lbl_goto_page') + '<br /><input type="text" size="2" style="padding: 1px; font-size: 8pt;" value="'+(parseInt(this_page)+1)+'" id="'+vtmp+'" />&emsp;<a href="#" onclick="'+onclick+'" style="font-size: 14pt; text-decoration: none;">&raquo;</a>&emsp;<a href="#" onclick="var _pn = this.parentNode; setTimeout(function() { _pn.parentNode.removeChild(_pn); }, 2000); fly_out_top(this.parentNode, false, true); return false;" style="font-size: 14pt; text-decoration: none;">&times;</a>';
   291   
   291   
   292   var body = document.getElementsByTagName('body')[0];
   292   var body = document.getElementsByTagName('body')[0];
   293   domObjChangeOpac(0, div);
   293   domObjChangeOpac(0, div);
   294   
   294   
   313   var divh = $dynano(div).Width();
   313   var divh = $dynano(div).Width();
   314   left_pos = left_pos - divh;
   314   left_pos = left_pos - divh;
   315   div.style.left = left_pos + 'px';
   315   div.style.left = left_pos + 'px';
   316 }
   316 }
   317 
   317 
   318 window.paginator_submit = function(obj, max, perpage, formatstring)
   318 window.paginator_submit = function(obj, max, perpage, additive, formatstring)
   319 {
   319 {
   320   var userinput = obj.previousSibling.previousSibling.value;
   320   var userinput = obj.previousSibling.previousSibling.value;
   321   userinput = parseInt(userinput);
   321   userinput = parseInt(userinput);
   322   var offset = ( userinput - 1 ) * perpage;
   322   var offset = (( userinput - 1 ) * perpage) + additive;
   323   if ( userinput > max || isNaN(userinput) || userinput < 1 )
   323   if ( userinput > max || isNaN(userinput) || userinput < 1 )
   324   {
   324   {
   325     load_component(['messagebox', 'fadefilter', 'flyin']);
   325     load_component(['messagebox', 'fadefilter', 'flyin']);
   326     new MessageBox(MB_OK|MB_ICONSTOP, $lang.get('paginate_err_bad_page_title'), $lang.get('paginate_err_bad_page_body', { max: max }));
   326     new MessageBox(MB_OK|MB_ICONSTOP, $lang.get('paginate_err_bad_page_title'), $lang.get('paginate_err_bad_page_body', { max: max }));
   327     return false;
   327     return false;