[isidorus-cvs] r73 - in trunk/src/ajax: css javascripts

Lukas Giessmann lgiessmann at common-lisp.net
Sun Jun 28 16:35:38 UTC 2009


Author: lgiessmann
Date: Sun Jun 28 12:35:36 2009
New Revision: 73

Log:
ajax-client: fixed a bug with disabling the datatype frames; fixed a style-bug with disabling frames; added css stylesheets

Modified:
   trunk/src/ajax/css/frame.css
   trunk/src/ajax/css/main.css
   trunk/src/ajax/javascripts/constants.js
   trunk/src/ajax/javascripts/create.js
   trunk/src/ajax/javascripts/datamodel.js
   trunk/src/ajax/javascripts/requests.js

Modified: trunk/src/ajax/css/frame.css
==============================================================================
--- trunk/src/ajax/css/frame.css	(original)
+++ trunk/src/ajax/css/frame.css	Sun Jun 28 12:35:36 2009
@@ -11,15 +11,17 @@
 
 ul.fragmentFrame {
     list-style-type: none;
+    padding-left: 0px;
 }
 
-caption {
+ul.fragmentFrame table > caption {
     font-size: 1.5em;
     font-weight: bold;
 }
 
 td.controlColumn {
     background-color: #eaeaee;
+    width: 13px;
 }
 
 tr.showHiddenRows {
@@ -31,11 +33,337 @@
     font-size: 1.2em;
 }
 
+li.instanceOfFrame > div {
+    margin-left: 10px;
+}
+
+li.instanceOfFrame > div > input[type="button"]{
+    margin-left: 24px;
+}
+
 input[value="generate fragment"] {
     margin-top: 10px;
     margin-bottom: 10px;
 }
 
+input[value="validate fragment"] {
+    float: right;
+}
+
 input[value="commit fragment"] {
+    margin-left: 5px;
     float: right;
+}
+
+
+/* === remove/add buttons in any kind of rows =============================== */
+div.textrowWithoutRemoveButton span{
+    display: inline-block;
+    width: 20px;
+    margin-left: 2px;
+    margin-right: 2px;
+    text-align: center;
+}
+
+div.textrowWithRemoveButton span{
+    display: inline-block;
+    width: 20px;
+    margin-left: 2px;
+    margin-right: 2px;
+    text-align: center;
+}
+
+div.selectrowWithoutRemoveButton span{
+    display: inline-block;
+    width: 20px;
+    margin-left: 2px;
+    margin-right: 2px;
+    text-align: center;
+}
+
+div.selectrowWithRemoveButton span{
+    display: inline-block;
+    width: 20px;
+    margin-left: 2px;
+    margin-right: 2px;
+    text-align: center;
+}
+
+input[type="text"] {
+    background-color: #white;
+    border: 1px solid darkgray;
+    margin-bottom: 1px;
+    margin-top: 1px;
+}
+
+input[type="text"][readonly="readonly"] {
+    background-color: #eaeaee;
+    border: 1px solid darkgray;
+    margin-bottom: 1px;
+    margin-top: 1px;
+}
+
+
+div.textrowWithRemoveButton > input[type="text"]{
+    margin-left: 0px;
+    font-weight: normal;
+}
+
+div.textrowWithoutRemoveButton > input[type="text"]{
+    margin-left: 24px;
+    font-weight: normal;
+}
+
+div.selectrowWithRemoveButton > select {
+    margin-left: 0px;
+    font-weight: normal;
+}
+
+div.selectrowWithoutRemoveButton > select {
+    margin-left: 24px;
+    font-weight: normal;
+}
+
+textarea {
+    margin-left: 24px;
+    background-color: white;
+    border: 1px solid darkgray;
+    margin-bottom: 1px;
+    margin-top: 1px;
+}
+
+textarea[readonly="readonly"] {
+    margin-left: 24px;
+    background-color: #eaeaee;
+    border: 1px solid darkgray;
+    margin-bottom: 1px;
+    margin-top: 1px;
+}
+
+
+/* === topic frame ========================================================== */
+table.topicFrame {
+    width: 1022px;
+    border-collapse: collapse;
+    border: 1px solid #d1d1d3;
+}
+
+table.topicFrame > tr > td.description {
+    width: 163px;
+}
+
+table.topicFrame > tr > td.content {
+    width: 854px;
+}
+
+table.topicFrame > tr.topicIdFrame {
+    background-color: #f6f7f9;
+}
+
+table.topicFrame > tr.subjectLocatorFrame {
+    background-color: #f6f7f9;
+}
+
+table.topicFrame > tr.nameContainer {
+    background-color: #f6f7f9;
+}
+
+table.topicFrame:hover {
+    border: 1px solid #ff7f00;
+}
+
+
+/* === name frame =========================================================== */
+table.topicFrame table.nameFrame {
+    width: 851px;
+    margin-top: 2px;
+    margin-bottom: 2px;
+    margin-left: 1px;
+    border-collapse: collapse;
+    border: 1px solid #d1d1d3;
+}
+
+table.topicFrame table.nameFrame td.description {
+    width: 142px;
+}
+
+table.topicFrame table.nameFrame td.content {
+    width: 689px;
+}
+
+table.topicFrame table.nameFrame > tr.typeFrame {
+    background-color: white;
+}
+
+table.topicFrame table.nameFrame > tr.valueFrame {
+    background-color: white;
+}
+
+table.topicFrame table.nameFrame:hover {
+    border: 1px solid #ff7f00;
+}
+
+
+/* === variant frame ======================================================== */
+table.nameFrame div.variantFrame {
+    margin-left: 24px;
+}
+
+table.nameFrame table.variantFrame {
+    width: 667px;
+    margin-top: 2px;
+    margin-bottom: 2px;
+    border-collapse: collapse;
+    border: 1px solid #d1d1d3;
+}
+
+table.nameFrame table.variantFrame > tr > td.description {
+    width: 142px;
+}
+
+table.nameFrame table.variantFrame > tr > td.content {
+    width: 505px;
+}
+
+table.nameFrame table.variantFrame tr.scopeContainer {
+    background-color: white;
+}
+
+table.nameFrame table.variantFrame tr.datatypeFrame {
+    background-color: white;
+}
+
+table.nameFrame table.variantFrame:hover {
+    border: 1px solid #ff7f00;
+}
+
+
+/* === occurrence frame ===================================================== */
+table.topicFrame table.occurrenceFrame {
+    width: 851px;
+    margin-top: 2px;
+    margin-bottom: 2px;
+    margin-left: 1px;
+    border-collapse: collapse;
+    border: 1px solid #d1d1d3;
+}
+
+table.topicFrame table.occurrenceFrame td.description {
+    width: 142px;
+}
+
+table.topicFrame table.occurrenceFrame td.content {
+    width: 689px;
+}
+
+table.topicFrame table.occurrenceFrame > tr.typeFrame {
+    background-color: #f6f7f9;
+}
+
+table.topicFrame table.occurrenceFrame > tr.valueFrame {
+    background-color: #f6f7f9;
+}
+
+table.topicFrame table.occurrenceFrame:hover {
+    border: 1px solid #ff7f00;
+}
+
+
+/* === association container / association frame ============================ */
+div.associationContainer {
+    margin-top: 30px;
+}
+
+table.associationContainer {
+    border-collapse: collapse;
+    width: 1022px;
+    border: 1px solid #d1d1d3;
+}
+
+table.associationContainer:hover {
+    border: 1px solid #ff7f00;
+}
+
+table.associationFrame {
+    border-collapse: collapse;
+    margin-left: 1px;
+    margin-top: 1px;
+    margin-bottom: 1px;
+    border: 1px solid #d1d1d3;
+    width: 1018px;
+}
+
+table.associationFrame:hover {
+    border: 1px solid #ff7f00;
+}
+
+table.associationFrame > tr > td.description {
+    width: 142px;
+}
+
+table.associationFrame > tr > td.content {
+    width: 853px;
+}
+
+table.associationFrame > tr.itemIdentityFrame {
+    background-color: #f6f7f9;
+}
+
+table.associationFrame > tr.scopeContainer {
+    background-color: #f6f7f9;
+}
+
+
+
+
+/* === associationrole frame ================================================ */
+table.associationFrame table.roleFrame {
+    width: 853px;
+    margin-left: 1px;
+    margin-top: 2px;
+    margin-bottom: 2px;
+    border-collapse: collapse;
+    border: 1px solid #d1d1d3;
+}
+
+table.associationFrame table.roleFrame:hover {
+    border: 1px solid #ff7f00;
+}
+
+table.associationFrame table.roleFrame > tr > td.description {
+    width: 142px;
+}
+
+table.associationFrame table.roleFrame > tr > td.content {
+    width: 692px;
+}
+
+table.roleFrame > tr.typeFrame {
+    background-color: #f6f7f9;
+}
+
+
+
+/* === tmId frame  ========================================================== */
+div.tmIdFrame {
+    margin-top: 30px;
+}
+
+table.tmIdFrame {
+    width: 1023px;
+    border-collapse: collapse;
+    border: 1px solid #d1d1d3;
+    background-color: #f6f7f9;
+}
+
+table.tmIdFrame:hover {
+    border: 1px solid #ff7f00;
+}
+
+li.tmIdFrame {
+    margin-bottom: 10px;
+}
+
+table.tmIdFrame input[type="text"] {
+    margin-left: 12px;
 }
\ No newline at end of file

Modified: trunk/src/ajax/css/main.css
==============================================================================
--- trunk/src/ajax/css/main.css	(original)
+++ trunk/src/ajax/css/main.css	Sun Jun 28 12:35:36 2009
@@ -27,6 +27,7 @@
 }
 
 h1 {
+    clear: left;
     margin-left: 10px;
     padding-top: 20px;
 }
@@ -61,5 +62,5 @@
 
 img.ajaxLoader {
     display: none;
-    margin-left: 412px; /* the image has a width of 100px */
+    margin-left: 412px; /* the image has a width of 100px --> 1024/2 - 100 = 412*/
 }
\ No newline at end of file

Modified: trunk/src/ajax/javascripts/constants.js
==============================================================================
--- trunk/src/ajax/javascripts/constants.js	(original)
+++ trunk/src/ajax/javascripts/constants.js	Sun Jun 28 12:35:36 2009
@@ -12,7 +12,7 @@
 
 // --- Some constants fot the http connections via the XMLHttpRequest-Object
 var TIMEOUT = 10000; // const TIMEOUT = 10000 --> "const" doesn't work under IE
-var HOST_PREF = "http://143.93.190.237:8000/"; //"http://localhost:8000/"; // of the form "http://(.+)/"
+var HOST_PREF = "http://192.168.178.29:8000/"; //"http://localhost:8000/"; // of the form "http://(.+)/"
 var GET_PREFIX = HOST_PREF + "json/get/";
 var GET_STUB_PREFIX = HOST_PREF + "json/topicstubs/";
 var TMCL_TYPE_URL = HOST_PREF + "json/tmcl/type/";
@@ -37,95 +37,53 @@
 var MAX_INT = "MAX_INT";
 var MMAX_INT = "*";
 
+
+// --- some css-styles
+var DISABLED_BACKGROUND_COLOR = {"backgroundColor" : "#eaeaee"};
+
+
 // --- Contains most css classes used in this project
 // --- There should be called only the function to be sure to don't override
 // --- the original values.
-var CLASSES = {"__divPage__" : "page",
-	       "__divSubPage__" : "subPage",
-	       "__divContent__" : "content",
-	       "__divTextrowWithRemoveButton__" : "textrowWithRemoveButton",
-	       "__divTextrowWithoutRemoveButton__" : "textrowWithoutRemoveButton",
-	       "__divSelectrowWithRemoveButton__" : "selectrowWithRemoveButton",
-	       "__divSelectrowWithoutRemoveButton__" : "selectrowWithoutRemoveButton",
-	       "__spanClickable__" : "clickable",
-	       "__notVisible__" : "notvisible",
-	       "__divError__" : "errorMessage",
-	       "__ulFragmentFrame__" : "fragmentFrame",
-	       "__tableTopicFrame__" : "topicFrame",
-	       "__trTopicIdFrame__" : "topicIdFrame",
-	       "__tdContent__" : "content",
-	       "__tdDescription__" : "description",
-	       "__divInstanceOfFrame__" : "instanceOfFrame",
-	       "__divItemIdentityFrame__" : "itemIdentityFrame",
-	       "__divSubjectLocatorFrame__" : "subjectLocatorFrame",
-	       "__divSubjectIdentifierFrame__" : "subjectIdentifierFrame",
-	       "__divNameContainer__" : "nameContainer",
-	       "__divNameFrame__" : "nameFrame",
-	       "__trControlColumn__" : "controlColumn",
-	       "__trShowHiddenRows__" : "showHiddenRows",
-	       "__trTypeFrame__" : "typeFrame",
-	       "__divScopeFrame__" : "scopeFrame",
-	       "__divScopeContainer__" : "scopeContainer",
-	       "__divValueFrame__" : "valueFrame",
-	       "__divVariantFrame__" : "variantFrame",
-	       "__divVariantContainer__" : "variantContainer",
-	       "__divDatatypeFrame__" : "datatypeFrame",
-	       "__divOccurrenceContainer__" : "occurrenceContainer",
-	       "__divOccurrenceFrame__" : "occurrenceFrame",
-	       "__divAssociationContainer__" : "associationContainer",
-	       "__divAssociationFrame__" : "associationFrame",
-	       "__divRoleContainer__" : "roleContainer",
-	       "__divRoleFrame__" : "roleFrame",
-	       "__divPlayerFrame__" : "playerFrame",
-	       "__spanDeselect__" : "deselect",
-	       "__divFog__" : "fog",
-	       "__inputCommitButton__" : "commitButton",
-	       "__divTmIdFrame__" : "tmIdFrame",
-	       "__divLoad__" : "loadFrame",
-	       "__imgAjaxLoader__" : "ajaxLoader",
-	       "__divEditFrame__" : "editFrame",
-
-	       "page" : function(){ return this.__divPage__; },
-	       "subPage" : function(){ return this.__divSubPage__; },
-	       "content" : function(){ return this.__divContent__; },
-	       "textrowWithRemoveButton" : function(){ return this.__divTextrowWithRemoveButton__; },
-	       "textrowWithoutRemoveButton" : function(){ return this.__divTextrowWithoutRemoveButton__; },
-	       "selectrowWithRemoveButton" : function(){ return this.__divSelectrowWithRemoveButton__; },
-	       "selectrowWithoutRemoveButton" : function(){ return this.__divSelectrowWithoutRemoveButton__; },
-	       "clickable" : function(){ return this.__spanClickable__; },
-	       "notVisible" : function(){ return this.__notVisible__; },
-	       "error" : function(){ return this.__divError__; },	       "fragmentFrame" : function(){ return this.__ulFragmentFrame__; },
-	       "topicFrame" : function(){ return this.__tableTopicFrame__; },
-	       "topicIdFrame" : function(){ return this.__trTopicIdFrame__; },
-	       "content" : function(){ return this.__tdContent__; },
-	       "description" : function(){ return this.__tdDescription__; },
-	       "instanceOfFrame" : function(){ return this.__divInstanceOfFrame__; },
-	       "itemIdentityFrame" : function(){ return this.__divItemIdentityFrame__; },
-	       "subjectLocatorFrame" : function(){ return this.__divSubjectLocatorFrame__; },
-	       "subjectIdentifierFrame" : function(){ return this.__divSubjectIdentifierFrame__; },
-	       "nameContainer" : function(){ return this.__divNameContainer__; },
-	       "nameFrame" : function(){ return this.__divNameFrame__; },
-	       "controlColumn" : function(){ return this.__trControlColumn__; },
-	       "showHiddenRows" : function(){ return this.__trShowHiddenRows__; },
-	       "typeFrame" : function(){ return this.__trTypeFrame__; },
-	       "scopeFrame" : function(){ return this.__divScopeFrame__; },
-	       "scopeContainer" : function(){ return this.__divScopeContainer__; },
-	       "valueFrame" : function(){ return this.__divValueFrame__; },
-	       "variantFrame" : function(){ return this.__divVariantFrame__; },
-	       "variantContainer" : function(){ return this.__divVariantContainer__; },
-	       "datatypeFrame" : function(){ return this.__divDatatypeFrame__; },
-	       "occurrenceContainer" : function(){ return this.__divOccurrenceContainer__; },
-	       "occurrenceFrame" : function(){ return this.__divOccurrenceFrame__; },
-	       "associationContainer" : function(){ return this.__divAssociationContainer__; },
-	       "associationFrame" : function(){ return this.__divAssociationFrame__; },
-	       "roleContainer" : function(){ return this.__divRoleContainer__; },
-	       "roleFrame" : function(){ return this.__divRoleFrame__; },
-	       "playerFrame" : function(){ return this.__divPlayerFrame__; },
-	       "deselect" : function(){ return this.__spanDeselect__; },
-	       "fog" : function(){ return this.__divFog__; },
-	       "commitButton" : function(){ return this.__inputCommitButton__; },
-	       "tmIdFrame" : function(){ return this.__divTmIdFrame__; },
-	       "load" : function(){ return this.__divLoad__; },
-	       "ajaxLoader" : function(){ return this.__imgAjaxLoader__; },
-	       "editFrame" : function(){ return this.__divEditFrame__; }
+var CLASSES = {"page" : function(){ return "page"; },
+	       "subPage" : function(){ return "subPage"; },
+	       "content" : function(){ return "content"; },
+	       "textrowWithRemoveButton" : function(){ return "textrowWithRemoveButton"; },
+	       "textrowWithoutRemoveButton" : function(){ return "textrowWithoutRemoveButton"; },
+	       "selectrowWithRemoveButton" : function(){ return "selectrowWithRemoveButton"; },
+	       "selectrowWithoutRemoveButton" : function(){ return "selectrowWithoutRemoveButton"; },
+	       "clickable" : function(){ return "clickable"; },
+	       "error" : function(){ return "errorMessage" },
+	       "fragmentFrame" : function(){ return "fragmentFrame"; },
+	       "topicFrame" : function(){ return "topicFrame"; },
+	       "topicIdFrame" : function(){ return "topicIdFrame"; },
+	       "content" : function(){ return "content"; },
+	       "description" : function(){ return "description"; },
+	       "instanceOfFrame" : function(){ return "instanceOfFrame"; },
+	       "itemIdentityFrame" : function(){ return "itemIdentityFrame"; },
+	       "subjectLocatorFrame" : function(){ return "subjectLocatorFrame"; },
+	       "subjectIdentifierFrame" : function(){ return "subjectIdentifierFrame"; },
+	       "nameContainer" : function(){ return "nameContainer"; },
+	       "nameFrame" : function(){ return "nameFrame"; },
+	       "controlColumn" : function(){ return "controlColumn"; },
+	       "showHiddenRows" : function(){ return "showHiddenRows"; },
+	       "typeFrame" : function(){ return "typeFrame"; },
+	       "scopeFrame" : function(){ return "scopeFrame"; },
+	       "scopeContainer" : function(){ return "scopeContainer"; },
+	       "valueFrame" : function(){ return "valueFrame"; },
+	       "variantFrame" : function(){ return "variantFrame"; },
+	       "variantContainer" : function(){ return "variantContainer"; },
+	       "datatypeFrame" : function(){ return "datatypeFrame"; },
+	       "occurrenceContainer" : function(){ return "occurrenceContainer"; },
+	       "occurrenceFrame" : function(){ return "occurrenceFrame"; },
+	       "associationContainer" : function(){ return "associationContainer"; },
+	       "associationFrame" : function(){ return "associationFrame"; },
+	       "roleContainer" : function(){ return "roleContainer"; },
+	       "roleFrame" : function(){ return "roleFrame"; },
+	       "playerFrame" : function(){ return "playerFrame"; },
+	       "commitButton" : function(){ return "commitButton"; },
+	       "tmIdFrame" : function(){ return "tmIdFrame"; },
+	       "load" : function(){ return "loadFrame"; },
+	       "ajaxLoader" : function(){ return "ajaxLoader"; },
+	       "editFrame" : function(){ return "editFrame"; }
 	      };
\ No newline at end of file

Modified: trunk/src/ajax/javascripts/create.js
==============================================================================
--- trunk/src/ajax/javascripts/create.js	(original)
+++ trunk/src/ajax/javascripts/create.js	Sun Jun 28 12:35:36 2009
@@ -101,6 +101,17 @@
 	tmId.isValid();
     }
 
+    var validateButton = new Element("input", {"type" : "button", "value" : "validate fragment"});
+    validateButton.observe("click", function(event){
+	var ret = true;
+	if(topic.isValid() === false) ret = false;
+	if(associations && associations.isValid() === false) ret = false;
+	if(tmId.isValid() === false) ret = false;
+
+	if(ret === true) alert("Fragment is valid!");
+	else alert("Fragment is not valid!");
+    }); 
+
     var commitButton = new Element("input", {"type" : "button", "value" : "commit fragment"})
     commitButton.observe("click", function(event){
 	// --- validates the given data
@@ -146,7 +157,8 @@
     });
 
     var liCB = new Element("li", {"class" : CLASSES.commitButton()});
-    liCB.update(commitButton);
+    liCB.insert({"top" : validateButton});
+    liCB.insert({"top" : commitButton});
     liTm.insert({"after" : liCB});
 }
 

Modified: trunk/src/ajax/javascripts/datamodel.js
==============================================================================
--- trunk/src/ajax/javascripts/datamodel.js	(original)
+++ trunk/src/ajax/javascripts/datamodel.js	Sun Jun 28 12:35:36 2009
@@ -95,7 +95,7 @@
                                          this.__regExpString__ = regexp;
                                          this.__frame__.writeAttribute({"class" : CLASSES.textrowWithRemoveButton()});
                                          this.__content__.remove();
-                                         this.__content__ = new Element("input", {"type" : "text", "value" : content});
+                                         this.__content__ = new Element("input", {"type" : "text", "value" : content, "size" : 40});
                                          this.__dblClickHandler__ = dblClickHandler;
                                          if(cssTitle && cssTitle.length){
 					     this.__content__.writeAttribute({"title" : cssTitle});
@@ -1156,7 +1156,7 @@
 						 this.__table__.insert({"bottom" : newRow(CLASSES.scopeContainer(), "Scope", new Element("div"))});
 						 
 						 // --- resource value and datatype
-						 makeResource(this, contents, null, null, null);
+						 makeResource(this, contents, null, null, null, {"rows" : 3, "cols" : 40});
 						 
 						 this.getFrame().observe("dblclick", function(event){
 						     dblClickHandler(owner, event);
@@ -1225,25 +1225,25 @@
 					 },
 					 "disable" : function(){
 					     this.hideError();
-					     this.__itemIdentity__.disable();
+					     disableItemIdentity(this);
 					     // TODO: scope
-					     this.__value__.writeAttribute({"readonly" : "readonly"});
-					     this.__datatype__.__frames__[0].disable();
+					     this.__table__.select("tr." + CLASSES.scopeContainer())[0].setStyle(DISABLED_BACKGROUND_COLOR);
+					     disableValue(this);
+					     disableDatatype(this);
 					     this.hideRemoveButton();
 					     this.hideAddButton();
-					     this.getFrame().setStyle({"backgroundColor" : "#edeceb"});
-					     this.getFrame().setStyle({"border" : "1px solid darkgrey"});
+					     this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);
 					     this.__disabled__ = true;
 					 },
 					 "enable" : function(){
-					     this.__itemIdentity__.enable();
+					     enableItemIdentity(this);
 					     // TODO: scope
-					     this.__value__.removeAttribute("readonly");
-					     this.__datatype__.__frames__[0].enable();
+					     this.__table__.select("tr." + CLASSES.scopeContainer())[0].removeAttribute("style");
+					     enableValue(this);
+					     enableDatatype(this);
 					     if(this.__owner__.__frames__.length > 1) this.showRemoveButton();
 					     this.showAddButton();
-					     this.getFrame().setStyle({"backgroundColor" : "inherit"});
-					     this.getFrame().setStyle({"border" : "none"});
+					     this.getFrame().removeAttribute("style");
 					     this.__disabled__ = false;
 					 },
 					 "minimize" : function(){
@@ -1392,11 +1392,9 @@
 					      // --- name element will be shown
 					      function addSecondShowHandler(myself){
 						  myself.__table__.select("tr")[0].observe("click", function(event){
-						      try{
-							  for(var i = 0; i != myself.__variants__.__container__.__frames__.length; ++i){
-							      myself.__variants__.__container__.__frames__[i].minimize();
-							  }
-						      }catch(tmp){ alert(tmp);}
+						      for(var i = 0; i != myself.__variants__.__container__.__frames__.length; ++i){
+							  myself.__variants__.__container__.__frames__[i].minimize();
+						      }
 						  });
 					      }
 					      
@@ -1450,25 +1448,23 @@
 				      },
 				      "disable" : function(){
 					  this.hideError();
-					  this.__itemIdentity__.disable();
-					  this.__type__.__frames__[0].disable();
-					  this.__scope__.disable();
-					  this.__value__.__frames__[0].disable();
-					  this.__variants__.disable();
-					  this.getFrame().setStyle({"backgroundColor" : "#edeceb"});
-					  this.getFrame().setStyle({"border" : "1px solid darkgrey"});
+					  disableItemIdentity(this);
+					  disableType(this);
+					  disableScope(this);
+					  disableValue(this);
+					  disableVariants(this);
+					  this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);
 					  this.getFrame().writeAttribute({"title" : this.__cssTitle__});
 					  this.hideAddButton();
 					  this.__disabled__ = true;
 				      },
 				      "enable" : function(){
-					  this.__itemIdentity__.enable();
-					  this.__type__.__frames__[0].enable();
-					  this.__scope__.enable();
-					  this.__value__.__frames__[0].enable();
-					  this.__variants__.enable();
-					  this.getFrame().setStyle({"backgroundColor" : "inherit"});
-					  this.getFrame().setStyle({"border" : "none"});
+					  enableItemIdentity(this);
+					  enableType(this);
+					  enableScope(this);
+					  enableValue(this);
+					  enableVariants(this);
+					  this.getFrame().removeAttribute("style");
 					  this.getFrame().removeAttribute("title");
 					  checkRemoveAddButtons(this.__owner__, 1, this.__max__, this);
 					  this.__disabled__ = false;
@@ -1755,7 +1751,7 @@
 						    var cssTitle = "No constraint found for this occurrence";
 						    if(noConstraint === false) cssTitle = "min: " + _min + "   max: " + _max + "   regular expression: " + constraint.regexp;
 						    this.__cssTitle__ = cssTitle;
-						    makeResource(this, contents, constraint, (occurrenceTypes ? occurrenceTypes[0].datatypeConstraint : null), cssTitle);
+						    makeResource(this, contents, constraint, (occurrenceTypes ? occurrenceTypes[0].datatypeConstraint : null), cssTitle, {"rows" : 5, "cols" : 60});
 
 						    this.getFrame().observe("dblclick", function(event){
 							dblClickHandler(owner, event);
@@ -1827,27 +1823,25 @@
 						    else trs[i].hide();
 						}
 					    },
-					    "disable" : function(){
+					    "disable" : function(){try{
 						this.hideError();
-						this.__itemIdentity__.disable();
-						this.__type__.__frames__[0].disable();
-						this.__scope__.disable();
-						this.__value__.writeAttribute({"readonly" : "readonly"});
-						this.__datatype__.__frames__[0].disable();
-						this.getFrame().setStyle({"backgroundColor" : "#edeceb"});
-						this.getFrame().setStyle({"border" : "1px solid darkgrey"});
+						disableItemIdentity(this);
+						disableType(this);;
+						disableScope(this);
+						disableValue(this);
+						disableDatatype(this);
+						this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);
 						this.getFrame().writeAttribute({"title" : this.__cssTitle__});
 						this.hideAddButton();
-						this.__disabled__ = true;
+						this.__disabled__ = true;}catch(err){ alert("err: " + err); }
 					    },
 					    "enable" : function(){
-						this.__itemIdentity__.enable();
-						this.__type__.__frames__[0].enable();
-						this.__scope__.enable();
-						this.__value__.removeAttribute("readonly");
-						this.__datatype__.__frames__[0].enable();
-						this.getFrame().setStyle({"backgroundColor" : "inherit"});
-						this.getFrame().setStyle({"border" : "none"});
+						enableItemIdentity(this);
+						enableType(this);;
+						enableScope(this);
+						enableValue(this);
+						enableDatatype(this);
+						this.getFrame().removeAttribute("style");
 						this.getFrame().removeAttribute("title");
 						checkRemoveAddButtons(this.__owner__, 1, this.__max__, this);
 						this.__disabled__ = false;
@@ -2479,19 +2473,17 @@
 				      },
 				      "disable" : function(){
 					  this.hideError();
-					  this.__itemIdentity__.disable();
-					  this.__type__.__frames__[0].disable();
-					  this.__player__.__frames__[0].disable();
-					  this.getFrame().setStyle({"backgroundColor" : "#edeceb"});
-					  this.getFrame().setStyle({"border" : "1px solid darkgrey"});
+					  disableItemIdentity(this);
+					  disableType(this);
+					  disablePlayer(this);
+					  this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);
 					  this.__disabled__ = true;
 				      },
 				      "enable" : function(){
-					  this.__itemIdentity__.enable();
-					  this.__type__.__frames__[0].enable();
-					  this.__player__.__frames__[0].enable();
-					  this.getFrame().setStyle({"backgroundColor" : "inherit"});
-					  this.getFrame().setStyle({"border" : "none"});
+					  enableItemIdentity(this);
+					  enableType(this);
+					  enablePlayer(this);
+					  this.getFrame().removeAttribute("style");
 					  this.__disabled__ = false;
 				      }});
 
@@ -3569,25 +3561,23 @@
 					     },
 					     "disable" : function(){
 						 this.hideError();
-						 this.__itemIdentity__.disable();
-						 this.__roles__.disable();
-						 this.__type__.__frames__[0].disable();
-						 this.__scope__.disable();
+						 disableItemIdentity(this);
+						 disableRole(this);
+						 disableType(this);
+						 disableScope(this);
 						 this.hideRemoveButton();
 						 this.hideAddButton();
-						 this.getFrame().setStyle({"backgroundColor" : "#edeceb"});
-						 this.getFrame().setStyle({"border" : "1px solid darkgrey"});
+						 this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);
 						 this.__disabled__ = true;
 					     },
 					     "enable" : function(){
-						 this.__itemIdentity__.enable();
-						 this.__roles__.enable();
-						 this.__type__.__frames__[0].enable();
-						 this.__scope__.enable();
+						 enableItemIdentity(this);
+						 enableRole(this);
+						 enableType(this);
+						 enableScope(this);
 						 if(this.__owner__.__frames__.length > 1 || !this.__constraints__ || this.__constraints__.length !== 0) this.showRemoveButton();
 						 if(this.__constraints__ && this.__constraints__.length !== 0) this.showAddButton();
-						 this.getFrame().setStyle({"backgroundColor" : "inherit"});
-						 this.getFrame().setStyle({"border" : "none"});
+						 this.getFrame().removeAttribute("style");
 						 this.__disabled__ = false;
 					     }});
 
@@ -3712,7 +3702,7 @@
                                               this.__caption__ = new Element("caption", {"class" : CLASSES.clickable()}).update("Topic Map ID");
                                               this.__table__.update(this.__caption__);
                                               var value = contents && contents.length !== 0 ? decodeURI(contents[0]) : "";
-                                              this.__contentrow__ = new Element("input", {"type" : "text", "value" : value});
+                                              this.__contentrow__ = new Element("input", {"type" : "text", "value" : value, "size" : 40});
                                               this.__tr__ = new Element("tr", {"class" : CLASSES.tmIdFrame()});
                                               var td =new Element("td", {"class" : CLASSES.content()});
                                               this.__tr__.update(td);
@@ -3968,8 +3958,9 @@
 
 
 // --- sets the resource value and datatype of names and occurrences
-function makeResource(myself, content, constraints, datatypeConstraint, cssTitle)
+function makeResource(myself, content, constraints, datatypeConstraint, cssTitle, size)
 {
+    if(!size) size = {"rows" : 3, "cols" : 40};
     var value = "";
     var datatype = "";
     if(content && content.resourceRef && content.resourceRef.length !== 0){
@@ -3989,18 +3980,20 @@
 	this.__datatype__.__frames__[0].remove();
 	this.__datatype__ = new Object();
     }catch(err){}
-    myself.__value__ = new Element("textarea", {"rows" : 3}).setValue(value);
+    myself.__value__ = new Element("textarea", size).setValue(value);
     myself.__table__.insert({"bottom" : newRow(CLASSES.valueFrame(), "Resource Value", myself.__value__)});
     if(cssTitle && cssTitle.length !== 0) myself.__value__.writeAttribute({"title" : cssTitle});
 
     // --- datatype
     myself.__datatype__ = new Object();
-    if(datatypeConstraint && datatypeConstraint.length !== 0){
+    if((datatypeConstraint && datatypeConstraint.length !== 0) || datatype === ANY_URI){
 	new TextrowC(datatypeConstraint, datatypeConstraint, myself.__datatype__, 1, 1, null);
 	myself.__datatype__.__frames__[0].getFrame().select("input")[0].writeAttribute({"readonly" : "readonly"});
+	myself.__datatypeIsSet__ = true;
     }
     else {
 	new TextrowC(datatype, ".*", myself.__datatype__, 1, 1, null);
+	myself.__datatypeIsSet__ = false;
     }
     myself.__table__.insert({"bottom" : newRow(CLASSES.datatypeFrame(), "Datatype", myself.__datatype__.__frames__[0].getFrame())});
 }
@@ -4153,4 +4146,88 @@
     var tr = newRow(CLASSES.typeFrame(), "Type", new SelectrowC(types, myself.__type__, 1, 1).getFrame());
     myself.__table__.insert({"bottom" : tr});
     return types;
+}
+
+// --- some helper to enable/disable some table rows
+
+function disableItemIdentity(myself)
+{
+    myself.__itemIdentity__.disable();
+    myself.__table__.select("tr." + CLASSES.itemIdentityFrame())[0].setStyle(DISABLED_BACKGROUND_COLOR);
+}
+function enableItemIdentity(myself)
+{
+    myself.__itemIdentity__.enable();
+    myself.__table__.select("tr." + CLASSES.itemIdentityFrame())[0].removeAttribute("style");
+}
+function disableType(myself)
+{
+    myself.__type__.__frames__[0].disable();
+    myself.__table__.select("tr." + CLASSES.typeFrame())[0].setStyle(DISABLED_BACKGROUND_COLOR);
+}
+function enableType(myself)
+{
+    myself.__type__.__frames__[0].enable();
+    myself.__table__.select("tr." + CLASSES.typeFrame())[0].removeAttribute("style");
+}
+function disableScope(myself){
+    myself.__scope__.disable();
+    myself.__table__.select("tr." + CLASSES.scopeContainer())[0].setStyle(DISABLED_BACKGROUND_COLOR);
+}
+function enableScope(myself)
+{
+    myself.__scope__.enable();
+    myself.__table__.select("tr." + CLASSES.scopeContainer())[0].removeAttribute("style");
+}
+function disableValue(myself)
+{
+    try{ myself.__value__.__frames__[0].disable(); } catch(err){}
+    try{ myself.__value__.writeAttribute({"readonly" : "readonly"}); } catch(err){}
+    myself.__table__.select("tr." + CLASSES.valueFrame())[0].setStyle(DISABLED_BACKGROUND_COLOR);
+}
+function enableValue(myself)
+{
+    try{ myself.__value__.__frames__[0].enable(); } catch(err){}
+    try{ myself.__value__.removeAttribute("readonly"); } catch(err){}
+    myself.__table__.select("tr." + CLASSES.valueFrame())[0].removeAttribute("style");
+}
+function disableDatatype(myself)
+{
+    myself.__datatype__.__frames__[0].disable();
+    myself.__table__.select("tr." + CLASSES.datatypeFrame())[0].setStyle(DISABLED_BACKGROUND_COLOR);
+}
+function enableDatatype(myself)
+{
+    if(myself.__datatypeIsSet__ === false) myself.__datatype__.__frames__[0].enable();
+    myself.__table__.select("tr." + CLASSES.datatypeFrame())[0].removeAttribute("style");
+}
+function disableVariants(myself)
+{
+    myself.__variants__.disable();
+    myself.__table__.select("tr." + CLASSES.variantContainer())[0].setStyle(DISABLED_BACKGROUND_COLOR);
+}
+function enableVariants(myself)
+{
+    myself.__variants__.enable();
+    myself.__table__.select("tr." + CLASSES.variantContainer())[0].removeAttribute("style");
+}
+function disableRole(myself)
+{
+    myself.__roles__.disable();
+    myself.__table__.select("tr." + CLASSES.roleContainer())[0].setStyle(DISABLED_BACKGROUND_COLOR);
+}
+function enableRole(myself)
+{
+    myself.__roles__.enable();
+    myself.__table__.select("tr." + CLASSES.roleContainer())[0].removeAttribute("style");
+}
+function disablePlayer(myself)
+{
+    myself.__player__.__frames__[0].disable();
+    myself.__table__.select("tr." + CLASSES.playerFrame())[0].setStyle(DISABLED_BACKGROUND_COLOR);
+}
+function enablePlayer(myself)
+{
+    myself.__player__.__frames__[0].enable();
+    myself.__table__.select("tr." + CLASSES.playerFrame())[0].removeAttribute("style");
 }
\ No newline at end of file

Modified: trunk/src/ajax/javascripts/requests.js
==============================================================================
--- trunk/src/ajax/javascripts/requests.js	(original)
+++ trunk/src/ajax/javascripts/requests.js	Sun Jun 28 12:35:36 2009
@@ -16,6 +16,7 @@
 {
     return setTimeout(function(){
 	alert("The AJAX request for \"" + url + "\" timed out. Please check your network connection!");
+	hideLoad();
     }, time);
 }
 




More information about the Isidorus-cvs mailing list