[isidorus-cvs] r76 - trunk/src/ajax/javascripts

Lukas Giessmann lgiessmann at common-lisp.net
Mon Jun 29 08:33:22 UTC 2009


Author: lgiessmann
Date: Mon Jun 29 04:33:22 2009
New Revision: 76

Log:
ajax-client: fixed a bug that accurrs when there are no valid topic instances or topic types

Modified:
   trunk/src/ajax/javascripts/constants.js
   trunk/src/ajax/javascripts/create.js
   trunk/src/ajax/javascripts/datamodel.js
   trunk/src/ajax/javascripts/edit.js

Modified: trunk/src/ajax/javascripts/constants.js
==============================================================================
--- trunk/src/ajax/javascripts/constants.js	(original)
+++ trunk/src/ajax/javascripts/constants.js	Mon Jun 29 04:33:22 2009
@@ -38,10 +38,6 @@
 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.

Modified: trunk/src/ajax/javascripts/create.js
==============================================================================
--- trunk/src/ajax/javascripts/create.js	(original)
+++ trunk/src/ajax/javascripts/create.js	Mon Jun 29 04:33:22 2009
@@ -38,8 +38,14 @@
 	    }
 	    var instanceOf = null;
 	    try{
-		instanceOf = new InstanceOfC(json.flatten().sort(), innerMakeFragment);
-		liTopicSelect.insert({"bottom" : instanceOf.getFrame()});
+		if(json === null){
+		    var err = new Element("div", {"class" : CLASSES.error()}).update("There exist no valid topic types!<br/>Please update the TMCL-model.");
+		    liTopicSelect.insert({"bottom" : err});   
+		}
+		else {
+		    instanceOf = new InstanceOfC(json.flatten().sort(), innerMakeFragment);
+		    liTopicSelect.insert({"bottom" : instanceOf.getFrame()});
+		}
 	    }
 	    catch(innerErr){
 		alert("There occurred an error by creating an InstanceOfC frame, please reload this page!\n\n" + innerErr);

Modified: trunk/src/ajax/javascripts/datamodel.js
==============================================================================
--- trunk/src/ajax/javascripts/datamodel.js	(original)
+++ trunk/src/ajax/javascripts/datamodel.js	Mon Jun 29 04:33:22 2009
@@ -4239,88 +4239,4 @@
     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/edit.js
==============================================================================
--- trunk/src/ajax/javascripts/edit.js	(original)
+++ trunk/src/ajax/javascripts/edit.js	Mon Jun 29 04:33:22 2009
@@ -48,8 +48,14 @@
 	    var edit = null;
 	    
 	    try{
-		edit = new EditC(json.flatten().sort(), innerMakeFragment);
-		liTopicSelect.insert({"bottom" : edit.getFrame()});
+		if(json === null){
+		    var err = new Element("div", {"class" : CLASSES.error()}).update("There exist no valid topic instances!<br/>Please update the TMCL-model or create some new instances.");
+		    liTopicSelect.insert({"bottom" : err});   
+		}
+		else {
+		    edit = new EditC(json.flatten().sort(), innerMakeFragment);
+		    liTopicSelect.insert({"bottom" : edit.getFrame()});
+		}
 	    }
 	    catch(err){
 		alert("There occurred an error by creating an EditC frame, please reload this page!\n\n" + err);




More information about the Isidorus-cvs mailing list