/[gnue]/gnue-appserver/extensions/webfrontend/gnue-forms.js
ViewVC logotype

Diff of /gnue-appserver/extensions/webfrontend/gnue-forms.js

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

revision 1.1 by siesel, Fri Sep 19 07:43:54 2003 UTC revision 1.2 by siesel, Mon Sep 22 21:50:37 2003 UTC
# Line 48  var gnue_forms_version = "0.0.3";  //jho Line 48  var gnue_forms_version = "0.0.3";  //jho
48  // ****************************************************  // ****************************************************
49  var doc;  var doc;
50    
51  function getObjById(id) {  function getObjById_unsecure(id) {
52    if (document.all)   /* MSIE, Konqueror, Opera: --- */    if (document.all)   /* MSIE, Konqueror, Opera: --- */
53      return eval("document.all."+id);      return eval("document.all."+id);
54    else    else
# Line 59  function getObjById(id) { Line 59  function getObjById(id) {
59    return val;    return val;
60  }  }
61    
62    function getObjById(id) {
63      val= getObjById_unsecure(id);
64      if (val==undefined) {
65        alert("Couldn't access object '"+id+"'! Probably the forms file has errors.");
66      };
67      return val;
68    }
69    
70  function GTypecastF() {  function GTypecastF() {
71    this.text = function(obj,field,value) {    this.text = function(obj,field,value) {
72      obj[field]=value;      obj[field]=value;
# Line 646  function GFEntry(myparent) { Line 654  function GFEntry(myparent) {
654    }    }
655    this._toHTML=function () {    this._toHTML=function () {
656      this._init();      this._init();
657      r ='<input type="text" id="'+this.name+'_field"';      r ='<input type="text" id="'+this.block+"_"+this.field+'_field"';
658      r+='" onfocus="form.gotoBlock('+"'"+this._block.name+"');"+'"'      r+='" onfocus="form.gotoBlock('+"'"+this.block+"');"+'"'
659      r+='>';      r+='>';
660      return r;      return r;
661    }    }
# Line 661  function GFField(myparent) { Line 669  function GFField(myparent) {
669    }    }
670    this._toHTML=function () {    this._toHTML=function () {
671      this._init();      this._init();
672      r ='<input type="text" id="'+this.name+'_field"';      return '';
     r+='" onfocus="form.gotoBlock('+"'"+this._block.name+"');"+'"'  
     r+='>';  
     return r;  
673    }    }
674  }  }
675  GFLabel.prototype=new GObj();  GFLabel.prototype=new GObj();
# Line 775  function GFForm(myparent){ Line 780  function GFForm(myparent){
780        return false;        return false;
781      }      }
782      // hide login dialog        // hide login dialog  
783      ld=getObjById("loginForm");      ld=getObjById_unsecure("loginForm");
784      if (ld != undefined) {      if (ld != undefined) {
785        ld.style.visibility = "hidden";        ld.style.visibility = "hidden";
786      }      }
# Line 928  function GFForm(myparent){ Line 933  function GFForm(myparent){
933      }      }
934      this.sess.close(this.sessid,0);      this.sess.close(this.sessid,0);
935      getObjById("status").innerHTML="Logged Out";      getObjById("status").innerHTML="Logged Out";
936      ld=getObjById("loginForm");      ld=getObjById_unsecure("loginForm");
937      if (ld != undefined) {      if (ld != undefined) {
938        ld.style.visibility = "visible";        ld.style.visibility = "visible";
939      }      }
# Line 1057  function GFBlock(name,con){ Line 1062  function GFBlock(name,con){
1062        
1063    // get the corresponding entry element to a field    // get the corresponding entry element to a field
1064    this.getEntryElem = function(fname) {    this.getEntryElem = function(fname) {
1065      return getObjById(this.fields[fname]+"_field");      return getObjById(this.name+"_"+this.fields[fname]+"_field");
1066    }    }
1067    // get the corresponding entry element to a field    // get the corresponding entry element to a field
1068    this.getEntryName = function(fname) {    this.getEntryName = function(fname) {
# Line 1065  function GFBlock(name,con){ Line 1070  function GFBlock(name,con){
1070    }    }
1071    // fetch entry value    // fetch entry value
1072    this.getEntry = function(fname) {    this.getEntry = function(fname) {
1073      e=getObjById(this.fields[fname]+"_field");      e=getObjById_unsecure(this.name+"_"+this.fields[fname]+"_field");
1074      if (e!=undefined) {      if (e!=undefined) {
1075        return e.value;        return e.value;
1076      } else {      } else {
# Line 1074  function GFBlock(name,con){ Line 1079  function GFBlock(name,con){
1079      }      }
1080    }    }
1081    this.setEntry = function(fname,newval) {    this.setEntry = function(fname,newval) {
1082      getObjById(this.fields[fname]+"_field").value=newval;      getObjById(this.name+"_"+this.fields[fname]+"_field").value=newval;
1083    }    }
1084    this.init = function() {    this.init = function() {
1085      // build list of field out of children      // build list of field out of children
# Line 1168  function GFBlock(name,con){ Line 1173  function GFBlock(name,con){
1173      // 2. Update Statusbar / this should possibly moved into      // 2. Update Statusbar / this should possibly moved into
1174      //    the GFForm object      //    the GFForm object
1175            
1176      pos=getObjById("pos");      pos=getObjById_unsecure("pos");
1177    
1178      // first check if statusbar exists      // first check if statusbar exists
1179      if (pos==undefined) {      if (pos==undefined) {
# Line 1325  function GFPage(myparent) { Line 1330  function GFPage(myparent) {
1330          child=this._children[i];          child=this._children[i];
1331          //      alert(child._type+" : "+child.name)          //      alert(child._type+" : "+child.name)
1332          if (child._type=='GFEntry') {          if (child._type=='GFEntry') {
1333            getObjById(child.field+"_field").style.visibility=value;            getObjById(child.block+"_"+child.field+"_field").style.visibility=value;
1334          };          };
1335          if (child._type=='GFLabel') {          if (child._type=='GFLabel') {
1336            getObjById(child.name+"_label").style.visibility=value;            getObjById(child.name+"_label").style.visibility=value;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26