source: products/qPloneTabs/trunk/skins/qPloneTabs/javascripts/qplonetabs.js @ 488

Last change on this file since 488 was 35, checked in by myroslav, 21 years ago

reverting edits in the tag

File size: 24.2 KB
Line 
1/* Global variables */
2
3var gBeforeReorderData = [];        // storage for actions before sorting
4var gBeforeReorderFragment = null;  // document fragment for insertion in UL after clicking cancel button after reorder
5var gBeforeEditData = {};           // hash for storage tabs fields before editing
6var category = 'portal_tabs';
7
8/* Main part - rules for element on our form */
9
10var myrules = {
11  '#app #reorder' : function(el){
12    el.onclick = function(ev){
13      var ev = ev ? ev : window.event;
14      // remember current actions state for 'cancel sorting' case
15//       gBeforeReorderFragment = document.getElementById('tabslist').innerHTML;
16      var lis = $A($('tabslist').getElementsByTagName('LI'));
17      gBeforeReorderData = [];
18      lis.each(function(el, idx) {
19          gBeforeReorderData.push(grepInfo(el));
20      });
21
22      shiftClassNames('app', 'viewing', 'sorting');
23      Sortable.create('tabslist', {handle: 'drag-handle'});
24      removeEdition('tabslist');
25      Event.stop(ev);
26      return false;
27    }
28  },
29  '#app #save' : function(el){
30    el.onclick = function(ev){
31      var ev = ev?ev:window.event, params = 'category='+category;
32      $A($('tabslist').getElementsByTagName('INPUT')).findAll(function(h){return h.type=='hidden';}).each(function(f,idx){params += '&idxs='+f.value;});
33      new Ajax.Request('qpt_reorder',
34        {method: 'post',
35         parameters: params,
36         onSuccess: function(request){
37           var lis = $A($('tabslist').getElementsByTagName('LI')),
38               inputs = function(li){return $A(li.getElementsByTagName('INPUT'))};
39           lis.each(function(el,idx){
40             inputs(el).each(function(inpt){
41               inpt.type == 'hidden' ? inpt.value = idx : inpt.name = inpt.name.replace(/i\d+_/, 'i'+idx+'_');
42             });
43           });
44           shiftClassNames('app', 'sorting', 'viewing');
45           Sortable.destroy('tabslist');
46           new Effect.Highlight('tabslist',{});
47           updateGlobalSections();
48         },
49         onComplete: function(request){Behaviour.apply();}
50        }
51      );
52      Event.stop(ev);
53      return false;
54    }
55  },
56  '#app #cancel' : function(el){
57    el.onclick = function(ev){
58      var ev = ev ? ev : window.event;
59      Sortable.destroy('tabslist');
60      shiftClassNames('app', 'sorting', 'viewing');
61
62      // update action to before sorting state
63//      Element.update('tabslist', gBeforeReorderFragment);
64      var tabslist = $('tabslist');
65      tabslist.innerHTML = "";
66      for (var i = 0, li; li = gBeforeReorderData[i]; i++) {
67          tabslist.appendChild(recoverAction(li));
68      }
69
70      el.attachEvent ? ieHover() : '';
71      Behaviour.apply();
72      Event.stop(ev);
73      return false;
74    }
75  },
76  '#app .csshover li' : function(el){
77    if (Element.hasClassName(el, 'onHover')) {Element.removeClassName(el, 'onHover');};
78  },
79  '#app .visibility' : function(el){
80    el.onclick = function(ev) {
81      var ev = ev?ev:window.event, li = Event.findElement(ev, 'LI'),
82          num = $A($('tabslist').getElementsByTagName('LI')).indexOf(li),
83          params = {
84            onSuccess: function(request){
85              if (Element.hasClassName(li, 'invisible')) {
86                Element.removeClassName(li, 'invisible');
87              }
88              else {
89                Element.addClassName(li, 'invisible');
90              };
91              updateGlobalSections();
92            },
93            onFailure: function(request){
94              var message = (/Error Value\s*<\/dt>\s*<dd>(.*?)<\/dd>/i).exec(request.responseText);
95              window.alert(message[1]);
96            }
97          };
98      if (Event.findElement(ev, 'UL').id == 'roottabs'){
99        params['parameters'] = 'id='+el.id+'&visibility='+el.checked;
100        new Ajax.Request('qpt_setvisibility', params);
101      }
102      else {
103        params['parameters'] = 'category='+category+'&num='+num+'&visibility='+el.checked+'&'+Form.serialize(li.getElementsByTagName('FORM')[0]);
104        new Ajax.Request('qpt_edit', params);
105      };
106      if (ev.stopPropagation) {ev.stopPropagation();}
107      else {ev.cancelBubble = true;};
108      return true;
109    }
110  },
111  '#app .delete' : function(el){
112    el.onclick = function(ev){
113      var ev = ev?ev:window.event, item = el.parentNode,
114          num = $A($('tabslist').getElementsByTagName('LI')).indexOf(item);
115      new Ajax.Request('qpt_delete',
116        {parameters:'category='+category+'&idx='+num+'&id=' + item.id.replace('tabslist_', ''),
117         onComplete: function(request) {
118           new Effect.Fade(item, {duration: 0.3, afterFinish: function(){
119             Element.remove(item);
120             var lis = $A($('tabslist').getElementsByTagName('LI')),
121                 inputs = function(li){return $A(li.getElementsByTagName('INPUT'))};
122             if (lis.length > 0) {
123               lis.each(function(el,idx){
124                 inputs(el).each(function(inpt){
125                   inpt.type=='hidden'?inpt.value=idx:inpt.name=inpt.name.replace(/i\d+_/, 'i'+idx+'_');
126                 });
127               });
128             } else {
129                 Element.addClassName('reorder', 'noitems');
130             };
131           }});
132           updateGlobalSections();
133         }
134        }
135      );
136      Event.stop(ev);
137      return false;
138    }
139  },
140  '#app .headerAdvanced' : function(el){
141    el.onclick =  function(ev){
142      var ev = ev?ev:window.event, dl = Event.findElement(ev, 'DL'),
143          dd = dl.getElementsByTagName('DD')[0];
144      if (!Element.visible(dd)) {
145        shiftClassNames(dl, 'collapsedBlock', 'expandedBlock');
146        Effect.BlindDown(dd, {duration:0.1});
147      }
148      else {
149        shiftClassNames(dl, 'expandedBlock', 'collapsedBlock');
150        Effect.BlindUp(dd, {duration:0.1});
151      };
152      Event.stop(ev);
153      return false;
154    }
155  },
156  '#app #tabslist li' : function(el){
157    el.onclick = function(ev){
158      if (!el.sel) el.sel = true;
159      else {return;};
160      var ev = ev?ev:window.event,
161          inputs = $A(el.getElementsByTagName('FORM')[0].getElementsByTagName('INPUT')), tmp = [];
162      inputs.each(function(e,idx){(0<idx && idx<5)?tmp.push(e.value):''});
163      gBeforeEditData[el.id] = tmp;
164      Element.addClassName(el, 'editing');
165      inputs[1].focus();
166      return true;
167    };
168  },
169  '#app #tabslist input.editsave' : function(el){
170    el.onclick = function(ev){
171      var ev = ev?ev:window.event, v = validateField,
172          li = Event.findElement(ev, 'LI'), tds = Event.findElement(ev, 'FORM').getElementsByTagName('INPUT'), title = $F(tds[1]);
173      if (v('actname',title) && v('actid',$F(tds[3]))) {
174         var dl = li.getElementsByTagName('DL')[1], dd = dl.getElementsByTagName('DD')[0];
175         var num = $A($('tabslist').getElementsByTagName('LI')).indexOf(li);
176         new Ajax.Request('qpt_edit',
177           {parameters:'category='+category+'&num='+num+'&'+Form.serialize(Event.findElement(ev, 'FORM')),
178            onSuccess: function(request){
179              new Effect.BlindUp(dd, {
180                duration : 0.1,
181                afterFinish : function(){
182                  shiftClassNames(dl, 'expandedBlock', 'collapsedBlock');
183                  Element.removeClassName(li, 'editing');
184                  li.id = 'tabslist_'+title;
185                  var spans = li.getElementsByTagName('SPAN');
186                  Element.update(spans[1], title);
187                  Element.update(spans[0], $F(tds[2]));
188                  Behaviour.apply();
189                }
190              });
191              updateGlobalSections();
192            },
193            onFailure: function(request){
194              var message = (/Error Value\s*<\/dt>\s*<dd>(.*?)<\/dd>/i).exec(request.responseText);
195              window.alert(message[1]);
196            },
197            onComplete: function(request){if (li.sel) {li.sel = null;};}
198           }
199         );
200      };
201      Event.stop(ev);
202      return false;
203    }
204  },
205  '#app #tabslist input.editcancel' : function(el){
206    el.onclick = function(ev){
207      var ev = ev?ev:window.event, li = Event.findElement(ev, 'LI'),
208          inputs = $A(li.getElementsByTagName('FORM')[0].getElementsByTagName('INPUT')),
209          values = $A(gBeforeEditData[li.id]),
210          dl = li.getElementsByTagName('DL')[1], dd = dl.getElementsByTagName('DD')[0];
211      values.each(function(el,idx){inputs[idx+1].value = el});
212      if (Element.visible(dd)) {
213        Effect.BlindUp(dd, {
214          duration : 0.1,
215          afterFinish : function(){
216              shiftClassNames(dl, 'expandedBlock', 'collapsedBlock');
217              Element.removeClassName(li, 'editing');
218          }
219        });
220      }
221      else {Element.removeClassName(li, 'editing');};
222      if (li.sel) {li.sel = null;};
223      Event.stop(ev);
224      return false;
225    }
226  },
227  '#app #addaction' : function(el){
228    el.onsubmit = function(ev){
229        document.getElementById('actname').blur();
230        return false;
231    };
232  },
233  '#app #actname' : function(el){
234    var re = new RegExp('[^a-zA-Z0-9-_~,.\\$\\(\\)# ]','g'), initialVal = $F(el);
235    el.onfocus = function(){Element.addClassName('addaction', 'adding');};
236    el.onkeyup = function() {
237      var name = $F(el), id = $F('actid');
238      if (id == initialVal.replace(re,'') || id == name.replace(re,'')) {
239        $('actid').value = name.replace(re,'');
240        initialVal = name;
241      };
242    };
243  },
244  '#app #buttonadd' : function(el){
245    el.onclick = function(ev){
246      var ev = ev?ev:window.event, v = validateField;
247      if (v('actname',$F('actname')) && v('actid',$F('actid'))) {
248        var idx = $('tabslist').getElementsByTagName('LI').length;
249        new Ajax.Request('qpt_add',
250          {parameters:'category='+category+'&idx='+idx+'&'+Form.serialize('addaction'),
251           onSuccess: function(request){
252             var dl = $('addaction').getElementsByTagName('DL')[3], dd = dl.getElementsByTagName('DD')[0];
253             Effect.BlindUp(dd, {
254               duration : 0.1,
255               afterFinish : function(){
256                 shiftClassNames(dl, 'expandedBlock', 'collapsedBlock');
257                 new Insertion.Bottom('tabslist', request.responseText);
258                 Form.reset('addaction');
259                 Element.removeClassName('addaction', 'adding');
260                 var dls = $A($('tabslist').getElementsByTagName('DL')).findAll(
261                   function(dl){return Element.hasClassName(dl, 'collapseAdvanced');}
262                 );
263                 collapseLi(dls[dls.length-1]);
264                 if ($A($('tabslist').getElementsByTagName('LI').length > 0)) {
265                     Element.removeClassName('reorder', 'noitems');
266                 };
267                 ieHover();
268                 Behaviour.apply();
269               }
270             });
271             updateGlobalSections();
272           },
273           onFailure: function(request){
274             var message = (/Error Value\s*<\/dt>\s*<dd>(.*?)<\/dd>/i).exec(request.responseText);
275             window.alert(message[1]);
276           }
277          }
278        );
279      };
280      return true;
281    }
282  },
283  '#app #buttoncancel' : function(el){
284    el.onclick = function(ev){
285      var ev = ev ? ev : window.event, dl = $('addaction').getElementsByTagName('DL')[3], dd = dl.getElementsByTagName('DD')[0];
286      Effect.BlindUp(dd, {
287        duration : 0.1,
288        afterFinish : function(){
289          shiftClassNames(dl, 'expandedBlock', 'collapsedBlock');
290          Form.reset('addaction');
291          Element.removeClassName('addaction', 'adding');
292          Behaviour.apply();
293       }
294      });
295      Event.stop(ev);
296      return false;
297    }
298  },
299  '#app #generated_tabs' : function(el){
300    el.onclick = function(ev){
301      new Ajax.Request('qpt_setproperty', {
302        parameters : 'generated_tabs='+el.checked,
303        onSuccess : function(){
304          new Ajax.Updater({success:'roottabs'}, 'qpt_getroottabs', {
305            method : 'get',
306            onComplete : function(){
307              el.attachEvent?ieHover():'';
308              Behaviour.apply();
309              updateGlobalSections();
310            }
311          });
312       }
313      });
314    }
315  }
316};
317
318/* Registerin previous rules with Behaviour.js */
319
320Behaviour.register(myrules);
321
322/* Registering global handlers for Ajax requests through Prototype */
323
324var globalHandlers = {
325  onCreate: function(){Element.addClassName('app', 'working');},
326  onComplete: function() {if(Ajax.activeRequestCount == 0) Element.removeClassName('app', 'working');}
327};
328
329Ajax.Responders.register(globalHandlers);
330
331/* Adding event listeners for hovering in IE & collapsing Advanced sections on loading */
332
333Event.observe(window, 'load', collapseAdvanced);
334Event.observe(window, 'load', function() {
335    var category_input = document.getElementById('actions_category');
336    if (category_input && typeof(category_input.value) != 'undefined') {
337        category_input.value ? category = category_input.value : {};
338    };
339});
340Event.observe(window, 'unload', function() {
341    // cleanup memory to prevent memory lack
342    delete gBeforeReorderFragment;
343    delete gBeforeEditData;
344    delete gBeforeReorderData
345});
346
347if (window.attachEvent) {Event.observe(window, 'load', ieHover, false);}
348
349/* Utility functions */
350
351function ieHover(){
352  $A($('app').getElementsByTagName('LI')).each(function(el){
353    if (el.attachEvent){
354      if (!el.hovers) el.hovers = {};
355      if (el.hovers['hover']) return;
356      el.hovers['hover'] = true;
357      el.attachEvent('onmouseover', function(){
358        if (!Element.hasClassName(el, 'onHover')) {Element.addClassName(el, 'onHover');};
359      });
360      el.attachEvent('onmouseout',  function(){Element.removeClassName(el, 'onHover');});
361    }
362  });
363};
364
365function collapseLi(dl) {
366  var dd = dl.getElementsByTagName('DD')[0];
367  if (!Element.hasClassName(dl, 'collapsedBlock') && Element.visible(dd)) {
368    shiftClassNames(dl, 'expandedBlock', 'collapsedBlock');
369  };
370  Element.hide(dd);
371};
372
373function collapseAdvanced() {
374  var dls = $A($('app').getElementsByTagName('DL')).findAll(
375    function(dl){return Element.hasClassName(dl, 'collapseAdvanced');}
376  );
377  $A(dls).each(collapseLi);
378};
379
380function shiftClassNames(el, from, to) {
381  Element.removeClassName(el, from);
382  Element.addClassName(el, to);
383};
384
385function validateField(id, val) {
386  var re = new RegExp('[^a-zA-Z0-9-_~,.\$\(\)# ]','g');
387  if (!val) {
388    window.alert(id.replace(/act/,'') + ' field is required!');
389    document.getElementById(id).focus();
390    return false;
391  }
392  else {
393    er = id != 'actid' ? true : val.search(re) == -1 ? true : false;
394    if (!er) {
395      window.alert(val+' is not a legal name.\n The following characters are invalid:' + val.match(re).toString());
396      document.getElementById(id).focus();
397    }
398  }
399  return er;
400};
401
402function removeEdition(el) {
403  var el = el ? el : 'tabslist';
404  $A($(el).getElementsByTagName('LI')).each(function(li,idx){if(li != el) li.onclick=function(event){return false;};});
405};
406
407
408// API for updating global_sections tabs
409
410function updateGlobalSections() {
411    new Ajax.Updater({success : 'portal-globalnav'}, 'qpt_globalsections', {
412            method : 'post',
413            insertion : Insertion.Instead
414    });
415}
416
417// Insertion object defined in prototype javascript library
418Insertion.Instead = Class.create();
419Insertion.Instead.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
420  initialize: function(element, content) {
421    this.element = $(element);
422    this.content = content.stripScripts();
423
424    var ul = document.createElement("UL");
425    ul.id = "portal-globalnav";
426    ul.innerHTML = this.content;
427
428    var parent = this.element.parentNode;
429    parent.removeChild(this.element);
430    parent.appendChild(ul);
431
432    setTimeout(function() {content.evalScripts()}, 10);
433  }
434
435});
436
437//**********************************************
438
439//    Fixed bug: innerHTML return not actual data, now used DOM
440
441
442function grepInfo(li) {
443   
444    // grep li state
445    var info = {"li.id" : li.id, "li.title": li.title, "li.className" : li.className};
446   
447    // grep visibility checkbox state
448    var vis_box = li.getElementsByTagName("INPUT")[0];
449    info["vis_box.checked"] = vis_box.checked;
450    info["vis_box.name"] = vis_box.name;
451   
452    var spans = li.getElementsByTagName("SPAN");
453   
454    // grep url helper state
455    info["url_helper.text"] = spans[0].innerHTML;
456   
457    // grep tab title state
458    info["tab_title.text"] = spans[1].innerHTML;
459   
460    // grep edit form state
461    var edit_form = li.getElementsByTagName("FORM")[0];
462    info["edit_form.name"] = edit_form.name;
463    info["edit_form.action"] = edit_form.action;
464   
465    var inputs = edit_form.getElementsByTagName("INPUT");
466   
467    // grep hidden input index value
468    info["input_idx.value"] = inputs[0].value;
469   
470    // grep action name input state
471    info["input_name.name"] = inputs[1].name;
472    info["input_name.value"] = inputs[1].value;
473   
474    // grep dl advanced section class name
475    info["dl_advanced.className"] = edit_form.getElementsByTagName("DL")[1].className;
476    info["dd_advanced.style.display"] = edit_form.getElementsByTagName("DD")[1].style.display;
477   
478    // grep url input state
479    info["input_url.name"] = inputs[2].name;
480    info["input_url.value"] = inputs[2].value;
481   
482    // grep id input state
483    info["input_id.name"] = inputs[3].name;
484    info["input_id.value"] = inputs[3].value;
485   
486    // grep condition input state
487    info["input_condition.name"] = inputs[4].name;
488    info["input_condition.value"] = inputs[4].value;
489   
490    // grep buttons state
491    info["save_button.value"] = inputs[5].value;
492    info["cancel_button.value"] = inputs[6].value;
493   
494    return info;
495}
496
497function recoverAction(info) {
498   
499    // create list item and assign corresponding attributes
500    var li = document.createElement("LI");
501    li.id = info["li.id"];
502    li.title = info["li.title"];
503    li.className = info["li.className"];
504   
505    // create drag handle image and assign corresponding attributes
506    var drag_handle = document.createElement("IMG");
507    drag_handle.className = "drag-handle";
508    drag_handle.src = "drag.gif";
509    drag_handle.alt = "";
510    drag_handle.height = "11";
511    drag_handle.width = "25";
512   
513    li.appendChild(drag_handle);
514   
515    // create bridge div element for visibility checkbox
516    var bridge = document.createElement("DIV");
517    bridge.className = "bridge";
518   
519    // create checkbox for visibility control
520    var vis_box = document.createElement("INPUT");
521    vis_box.type = "checkbox";
522    vis_box.className = "visibility";
523    vis_box.value = "1";
524    vis_box.title = "visibility";
525    vis_box.name = info["vis_box.name"];
526   
527    bridge.appendChild(vis_box);
528
529    // buggy IE
530    if (info["vis_box.checked"]) {
531        vis_box.setAttribute("checked", "checked");
532        vis_box.defaultChecked = true;
533    }
534
535    li.appendChild(bridge);
536   
537    // create Delete link
538    var del_link = document.createElement("A");
539    del_link.className = "delete";
540    del_link.href = "#";
541    del_link.appendChild(document.createTextNode("Delete"));
542   
543    li.appendChild(del_link);
544   
545    // create url-helper element
546    var url_helper = document.createElement("SPAN");
547    url_helper.className = "url-helper";
548    url_helper.appendChild(document.createTextNode(info["url_helper.text"]));
549   
550    li.appendChild(url_helper);
551   
552    // create tab title element
553    var tab_title = document.createElement("SPAN");
554    tab_title.className = "tab-title";
555    tab_title.appendChild(document.createTextNode(info["tab_title.text"]));
556   
557    li.appendChild(tab_title);
558   
559    // create edit form
560    var edit_form = document.createElement("FORM");
561    edit_form.className = "editform";
562    edit_form.method = "post";
563    edit_form.name = info["edit_form.name"];
564    edit_form.action = info["edit_form.action"];
565   
566    // create hidden input with index value
567    var input_idx = document.createElement("INPUT");
568    input_idx.type = "hidden";
569    input_idx.name = "idx";
570    input_idx.value = info["input_idx.value"];
571   
572    edit_form.appendChild(input_idx);
573   
574    // create dl element for name input section
575    var dl_name = document.createElement("DL");
576    var dt_name = document.createElement("DT");
577    var name_label = document.createElement("LABEL");
578    name_label.appendChild(document.createTextNode("Name"));
579   
580    dt_name.appendChild(name_label);
581    dl_name.appendChild(dt_name);
582   
583    // crete input for action name
584    var dd_name = document.createElement("DD");
585    var input_name = document.createElement("INPUT");
586    input_name.type = "text";
587    input_name.size = "30";
588    input_name.name = info["input_name.name"];
589    input_name.value = info["input_name.value"];
590   
591    dd_name.appendChild(input_name);
592    dl_name.appendChild(dd_name);
593    edit_form.appendChild(dl_name);
594   
595    // create dl element for advanced inputs
596    var dl_advanced = document.createElement("DL");
597    dl_advanced.className = info["dl_advanced.className"];
598   
599    // create collapsible header
600    var dt_advanced = document.createElement("DT");
601    dt_advanced.className = "headerAdvanced";
602    dt_advanced.appendChild(document.createTextNode("Advanced"));
603   
604    dl_advanced.appendChild(dt_advanced);
605   
606    // create collapsible content
607    var dd_advanced = document.createElement("DD");
608    dd_advanced.className = "contentAdvanced";
609    dd_advanced.style.display = info["dd_advanced.style.display"];
610   
611    // add URL section
612    // add url header
613    var dl_url = document.createElement("DL");
614    var dt_url = document.createElement("DT");
615    var label_url = document.createElement("LABEL");
616    label_url.appendChild(document.createTextNode("URL (Expression)"));
617   
618    dt_url.appendChild(label_url);
619    dl_url.appendChild(dt_url);
620   
621    //add url value
622    var dd_url = document.createElement("DD");
623    var input_url = document.createElement("INPUT");
624    input_url.type = "text";
625    input_url.size = "30";
626    input_url.name = info["input_url.name"];
627    input_url.value = info["input_url.value"];
628   
629    dd_url.appendChild(input_url);
630    dl_url.appendChild(dd_url);
631    dd_advanced.appendChild(dl_url);
632   
633    // add ID section
634    // add id header
635    var dl_id = document.createElement("DL");
636    var dt_id = document.createElement("DT");
637    var label_id = document.createElement("LABEL");
638    label_id.appendChild(document.createTextNode("Id"));
639   
640    dt_id.appendChild(label_id);
641    dl_id.appendChild(dt_id);
642   
643    //add id value
644    var dd_id = document.createElement("DD");
645    var input_id = document.createElement("INPUT");
646    input_id.type = "text";
647    input_id.name = info["input_id.name"];
648    input_id.value = info["input_id.value"];
649   
650    dd_id.appendChild(input_id);
651    dl_id.appendChild(dd_id);
652    dd_advanced.appendChild(dl_id);
653   
654    // add Condition section
655    // add condition header
656    var dl_condition = document.createElement("DL");
657    var dt_condition = document.createElement("DT");
658    var label_condition = document.createElement("LABEL");
659    label_condition.appendChild(document.createTextNode("Condition (Expression)"));
660   
661    dt_condition.appendChild(label_condition);
662    dl_condition.appendChild(dt_condition);
663   
664    //add condition value
665    var dd_condition = document.createElement("DD");
666    var input_condition = document.createElement("INPUT");
667    input_condition.type = "text";
668    input_condition.size = "30";
669    input_condition.name = info["input_condition.name"];
670    input_condition.value = info["input_condition.value"];
671   
672    dd_condition.appendChild(input_condition);
673    dl_condition.appendChild(dd_condition);
674    dd_advanced.appendChild(dl_condition);
675   
676    // add visual clear div to advanced dd element
677    var visual_clear = document.createElement("DIV");
678    visual_clear.className = "visualClear";
679    visual_clear.appendChild = document.createTextNode("<!-- -->");
680   
681    dd_advanced.appendChild(visual_clear);
682    dl_advanced.appendChild(dd_advanced);
683    edit_form.appendChild(dl_advanced);
684   
685    // create div element for form controls
686    var form_controls = document.createElement("DIV");
687   
688    // add save button
689    var save_button = document.createElement("INPUT");
690    save_button.type = "submit";
691    save_button.className = "editsave";
692    save_button.value = info["save_button.value"];
693    form_controls.appendChild(save_button);
694   
695    // add cancel button
696    var cancel_button = document.createElement("INPUT");
697    cancel_button.type = "submit";
698    cancel_button.className = "editcancel";
699    cancel_button.value = info["cancel_button.value"];
700    form_controls.appendChild(cancel_button);
701   
702    edit_form.appendChild(form_controls);
703    li.appendChild(edit_form);
704
705    return li;
706}
Note: See TracBrowser for help on using the repository browser.