/[webpac2]/Webpacus/root/js/webpac.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/webpac.js

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

revision 203 by dpavlin, Fri Dec 2 23:01:25 2005 UTC revision 270 by dpavlin, Sat Dec 17 00:37:12 2005 UTC
# Line 130  function hide_searching() { Line 130  function hide_searching() {
130          load record nr in some template          load record nr in some template
131  */  */
132    
133  function load_rec(nr, tmp_template_filename) {  function load_rec(record_uri, tmp_template_filename) {
134          if (! tmp_template_filename) tmp_template_filename = template_filename;          if (! tmp_template_filename) tmp_template_filename = template_filename;
135          Logger.info('load_rec '+nr+' in '+tmp_template_filename);          Logger.info('load_rec '+record_uri+' in '+tmp_template_filename);
136    
137          var results_form = $('results_form');          var results_form = $('results_form');
138    
139          if (results_form) {          if (results_form) {
140                  var args = '?mfn='+nr+'&template_filename='+tmp_template_filename;                  var args = '?record_uri='+record_uri+'&template_filename='+tmp_template_filename;
141                  Logger.debug('Ajax.Updater(results,/search/record) '+args);                  Logger.debug('Ajax.Updater(results,/search/record) '+args);
142    
143                  new Ajax.Updater( 'results', '/search/record'+args, {                  new Ajax.Updater( 'results', '/search/record'+args, {
# Line 157  function load_rec(nr, tmp_template_filen Line 157  function load_rec(nr, tmp_template_filen
157          return false;          return false;
158  }  }
159    
160    var WebPAC = { };
161    
162  /*  /*
163          autocompleter which isn't (a suggest box)          autocompleter which isn't (a suggest box)
164          - don't just on first option on appear          - don't just on first option on appear
# Line 164  function load_rec(nr, tmp_template_filen Line 166  function load_rec(nr, tmp_template_filen
166          - added configurable width (content width? centered?)          - added configurable width (content width? centered?)
167          - add icon which means suggest          - add icon which means suggest
168    
169          hopefully, this implementation won't break when I update prototype next time :-)          hopefully, this implementation won't break (much) when I update
170            prototype next time :-)
171  */  */
172    
173  Object.extend(Object.extend(Ajax.Autocompleter.prototype, Autocompleter.Base.prototype), {  
174    WebPAC.Suggest = Class.create();
175    Logger.debug('Created WebPAC.Suggest Class');
176    Object.extend(Object.extend(WebPAC.Suggest.prototype, Ajax.Autocompleter.prototype), {
177    initialize: function(element, update, url, options) {    initialize: function(element, update, url, options) {
178            this.baseInitialize(element, update, options);      this.baseInitialize(element, update, options);
179      this.options.asynchronous  = true;      this.options.asynchronous  = true;
180      this.options.onComplete    = this.onComplete.bind(this);      this.options.onComplete    = this.onComplete.bind(this);
181      this.options.defaultParams = this.options.parameters || null;      this.options.defaultParams = this.options.parameters || null;
182      this.url                   = url;      this.url                   = url;
183      this.ignoreReturn = true;      this.ignoreReturn = true;
184    
185        Logger.debug('WebPAC.Sugget initialize '+element+','+update+','+url);
186    
187      this.options.onShow = function(element, update) {      this.options.onShow = function(element, update) {
188        if(!update.style.position || update.style.position=='absolute') {        if(!update.style.position || update.style.position=='absolute') {
189          update.style.position = 'absolute';          update.style.position = 'absolute';
190          Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight});          Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight});
191        }        }
192        new Element.show(update);        new Element.show(update);
193        Logger.debug('Ajax.Suggest.onShow');        Logger.debug('WebPAC.Suggest.onShow');
194      };      };
195    
196      this.options.onHide = function(element, update) {      this.options.onHide = function(element, update) {
197          new Element.hide(update);          new Element.hide(update);
198          Logger.debug('Ajax.Suggest.onHide');          Logger.debug('WebPAC.Suggest.onHide');
199      };      };
200    },    },
201    
# Line 201  Object.extend(Object.extend(Ajax.Autocom Line 209  Object.extend(Object.extend(Ajax.Autocom
209      if(this.options.defaultParams)      if(this.options.defaultParams)
210        this.options.parameters += '&' + this.options.defaultParams;        this.options.parameters += '&' + this.options.defaultParams;
211    
212      Logger.debug('Ajax.Suggest called '+this.url);      Logger.debug('WebPAC.Suggest called '+this.url);
213      new Ajax.Request(this.url, this.options);      new Ajax.Request(this.url, this.options);
214    },    },
215    
216    onComplete: function(request) {    onComplete: function(request) {
217      Logger.debug('Ajax.Suggest onComplete called');      Logger.debug('WebPAC.Suggest onComplete called');
218      this.updateChoices(request.responseText);      this.updateChoices(request.responseText);
219    },    },
220    
# Line 218  Object.extend(Object.extend(Ajax.Autocom Line 226  Object.extend(Object.extend(Ajax.Autocom
226    markNext: function() {    markNext: function() {
227      if(this.index < this.entryCount-1) this.index++      if(this.index < this.entryCount-1) this.index++
228      //  else this.index = 0;      //  else this.index = 0;
229    },    }
230    
231    });
232    
233    /*
234            WebPAC.Updater
235    */
236    
237    WebPAC.Updater = Class.create();
238    Logger.debug('Created WebPAC.Updater Class');
239    Object.extend(WebPAC.Updater.prototype, {
240      initialize: function(container, url, options) {
241        Logger.debug('WebPAC.Updater initialize '+container+','+url+','+options);
242        this.updater = new Ajax.Updater(container, url, options);
243        $('_ajax').value = 1;
244        if ($('_ajax').value) Logger.info("using AJAX");
245      }
246  });  });
247    

Legend:
Removed from v.203  
changed lines
  Added in v.270

  ViewVC Help
Powered by ViewVC 1.1.26