/[webpac2]/Webpacus/root/js/search.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /Webpacus/root/js/search.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 322 by dpavlin, Sun Dec 25 23:31:59 2005 UTC revision 324 by dpavlin, Sun Dec 25 23:32:04 2005 UTC
# Line 60  function get_page_nr() { Line 60  function get_page_nr() {
60  function reset_page_nr( nr ) {  function reset_page_nr( nr ) {
61          if (! nr) nr = 1;          if (! nr) nr = 1;
62          Logger.info('reset_page_nr to '+nr);          Logger.info('reset_page_nr to '+nr);
63          page_nr = nr;          $('page_nr').value = nr;
         $('page_nr').value = page_nr;  
64  }  }
65    
66  /* syntaxtic sugar */  /* syntaxtic sugar */
# Line 217  function search_via_link(attr, val, temp Line 216  function search_via_link(attr, val, temp
216          return false;          return false;
217  }  }
218    
219  ;/* save search and add element for it in search form */  /* save search and add element for it in search form */
220    
221    var attr_rows = new Array();
222    
223  function save_search( attr, val ) {  function save_search( attr, val ) {
224          Logger.info('save_search '+attr+','+val+')');          Logger.info('save_search('+attr+','+val+')');
225    
226          var t=$('search_table');          var t=$('search_table');
227          if (! t) {          if (! t) {
228                  Logger.error("can't find search_table");                  Logger.error("can't find search_table");
229                  return;                  return undef;
230          }          }
231          Logger.debug('reset results_form');          Logger.debug('reset results_form');
232          Form.reset('results_form');          Form.reset('results_form');
233    
234          var row_nr = t.rows.length;          var t_row_nr = t.rows.length;
235          Logger.debug('adding row '+row_nr);          var tr = t.insertRow( t_row_nr );
236          var tr = t.insertRow( t.rows.length );  
237            if (! tr) {
238                    Logger.error("can't create row "+t_row_nr);
239                    return undef;
240            }
241    
242            var row_nr = attr_rows.length;
243            attr_rows[ row_nr ] = t_row_nr;
244    
245            Logger.debug('added row '+t_row_nr+' to table [offset: '+row_nr+']');
246    
247          var td = tr.insertCell(0);          var td = tr.insertCell(0);
248          td.setAttribute('align', 'right');          td.setAttribute('align', 'right');
# Line 248  function save_search( attr, val ) { Line 258  function save_search( attr, val ) {
258          el.setAttribute('disabled', 'true');          el.setAttribute('disabled', 'true');
259          el.setAttribute('name', attr);          el.setAttribute('name', attr);
260          el.setAttribute('id', '_attr_'+attr+'_id');          el.setAttribute('id', '_attr_'+attr+'_id');
261          el.setAttribute('size', val.length < 60 ? val.length : 60);          el.setAttribute('size', val.length < 60 ? 60: val.length);
262          el.setAttribute('value', val );          el.setAttribute('value', unescape( val ) );
263          td.appendChild(el);          td.appendChild(el);
264    
265          var el = document.createElement('input');          var el = document.createElement('input');
266          el.setAttribute('type', 'button');          el.setAttribute('type', 'button');
267          el.setAttribute('value', '-');          el.setAttribute('value', '-');
268          el.onclick = function () {          el.onclick = function () {
269                  Logger.info('remove:' + attr + ' row:'+row_nr);                  if (attr_rows[row_nr] == -1) {
270                  t.deleteRow( row_nr );                          Logger.error('row '+row_nr+' allready deleted');
271                            return false;
272                    }
273                    Logger.info('remove:' + attr + ' row:'+row_nr+' ['+attr_rows[row_nr]+']');
274                    t.deleteRow( attr_rows[row_nr] );
275    
276                    attr_rows[row_nr] = -1;
277                    for (var i=(row_nr + 1); i < attr_rows.length; i++) {
278                            attr_rows[i]--;
279                            Logger.debug('moved '+i+' to '+attr_rows[i]);
280                    }
281                  submit_results_form();                  submit_results_form();
282                  return false;                  return false;
283          }          }

Legend:
Removed from v.322  
changed lines
  Added in v.324

  ViewVC Help
Powered by ViewVC 1.1.26