[isidorus-cvs] r50 - trunk/src/ajax/javascripts
Lukas Giessmann
lgiessmann at common-lisp.net
Fri Jun 19 08:53:40 UTC 2009
Author: lgiessmann
Date: Fri Jun 19 04:53:38 2009
New Revision: 50
Log:
ajax-client: fixed the following bugs: (1) by requesting all needed topicStubs now there will be requested the instanceOf-topics, too. (2) by showing the "loading"-.GIF and changing the sub-page at the same time - the .Gif will be first set to the initial state, so it won't be removed accidentally anymore. (3) the fragment will be REALLY sent to the server - the "onSuccessFun" will be executed after a succeeded validation. (4) after a bad validation there appears an alert-window with a corresponding message, the same behaviour occurrs by sending the data to the server
Modified:
trunk/src/ajax/javascripts/create.js
trunk/src/ajax/javascripts/datamodel.js
trunk/src/ajax/javascripts/edit.js
trunk/src/ajax/javascripts/home.js
trunk/src/ajax/javascripts/navi.js
trunk/src/ajax/javascripts/requests.js
trunk/src/ajax/javascripts/search.js
Modified: trunk/src/ajax/javascripts/create.js
==============================================================================
--- trunk/src/ajax/javascripts/create.js (original)
+++ trunk/src/ajax/javascripts/create.js Fri Jun 19 04:53:38 2009
@@ -14,8 +14,8 @@
{
var content = new Element("div", {"class" : CLASSES.content()});
var header = new Element("h1").update("Create a Topic");
- content.insert(header, {"position" : "bottom"});
- $(CLASSES.subPage()).insert(content, {"position" : "bottom"});
+ content.insert({"bottom" : header});
+ $(CLASSES.subPage()).insert({"bottom" : content});
try{
var fragmentFrame = new Element("ul", {"class" : CLASSES.fragmentFrame()});
@@ -59,7 +59,10 @@
if(associations.isValid() === false) ret = false;
if(tmId.isValid() === false) ret = false;
- if(ret === false) return;
+ if(ret === false){
+ alert("The fragment wasn't committed!");
+ return;
+ }
// --- if the validation succeeded the fragment will be sent to the server
var tPsis = topic.getContent().subjectIdentifiers;
@@ -67,7 +70,7 @@
if(associations){
referencedTopics = referencedTopics.concat(associations.getReferencedTopics()).without(CURRENT_TOPIC).uniq();
}
-
+
function onSuccessHandler(topicStubs){
var tsStr = "null";
if(topicStubs && topicStubs.length !== 0){
@@ -90,7 +93,6 @@
// --- currently there is not needed a special handling for errors
// --- occurred during this operation
}
-
getTopicStubs(referencedTopics, onSuccessHandler, onErrorHandler);
});
var liCB = new Element("li", {"class" : CLASSES.commitButton()});
@@ -121,7 +123,7 @@
makeInstanceOfFrame(liTopicSelect);
}catch(err){
- alert(err);
+ alert("From makeCreate(): " + err);
}
}
Modified: trunk/src/ajax/javascripts/datamodel.js
==============================================================================
--- trunk/src/ajax/javascripts/datamodel.js (original)
+++ trunk/src/ajax/javascripts/datamodel.js Fri Jun 19 04:53:38 2009
@@ -1805,6 +1805,12 @@
}
}
}
+
+ if(this.__instanceOfs__){
+ for(var i = 0; i !== this.__instanceOfs__.length; ++i){
+ if(referencedTopics.indexOf(this.__instanceOfs__[i][0]) === -1) referencedTopics.push(this.__instanceOfs__[i][0]);
+ }
+ }
return referencedTopics;
}});
Modified: trunk/src/ajax/javascripts/edit.js
==============================================================================
--- trunk/src/ajax/javascripts/edit.js (original)
+++ trunk/src/ajax/javascripts/edit.js Fri Jun 19 04:53:38 2009
@@ -14,5 +14,13 @@
{
var content = new Element("div", {"class" : CLASSES.content()});
var header = new Element("h1").update("Edit a Topic");
- $(CLASSES.subPage()).insert((content.insert(header, {"position" : "bottom"})), {"position" : "bottom"});
+ content.insert({"bottom" : header});
+ $(CLASSES.subPage()).insert({"bottom" : content});
+
+ try{
+
+ }
+ catch(err){
+ alert("From makeEdit(): " + err);
+ }
}
Modified: trunk/src/ajax/javascripts/home.js
==============================================================================
--- trunk/src/ajax/javascripts/home.js (original)
+++ trunk/src/ajax/javascripts/home.js Fri Jun 19 04:53:38 2009
@@ -14,5 +14,6 @@
{
var content = new Element("div", {"class" : CLASSES.content()});
var header = new Element("h1").update("Topic Map Overview");
- $(CLASSES.subPage()).insert((content.insert(header, {"position" : "bottom"})), {"position" : "bottom"});
+ content.insert({"bottom" : header});
+ $(CLASSES.subPage()).insert({"bottom" : content});
}
Modified: trunk/src/ajax/javascripts/navi.js
==============================================================================
--- trunk/src/ajax/javascripts/navi.js (original)
+++ trunk/src/ajax/javascripts/navi.js Fri Jun 19 04:53:38 2009
@@ -44,6 +44,7 @@
PAGES.current = newPage;
// --- removes the old content
+ hideLoad(); // to prevent the load-gif of beeing removed when it is used in the error-div
$(CLASSES.subPage()).update();
// --- creates the new content
Modified: trunk/src/ajax/javascripts/requests.js
==============================================================================
--- trunk/src/ajax/javascripts/requests.js (original)
+++ trunk/src/ajax/javascripts/requests.js Fri Jun 19 04:53:38 2009
@@ -29,7 +29,7 @@
function fun(xhr){
try{
clearTimeout(timeFun);
- removeLoad();
+ hideLoad();
handler(xhr);
}
catch(err) {alert("err: " + err); }
@@ -41,7 +41,7 @@
// --- Removes all divs with the class ajaxLoader. The inner image with the
// --- class ajaxLoader will be moved to the top of div.content and the
// --- display attribute will be set to none;
-function removeLoad()
+function hideLoad()
{
var img = $$("img." + CLASSES.ajaxLoader());
if(img.length === 1){
@@ -162,19 +162,20 @@
neededTime += delta;
if(delta > maxTimeout && psis && psis.length !== 0){
alert("From getTopicStubs(): Please check your network-connection - the request timed out!!!");
- removeLoad();
+ hideLoad();
onFailureHandler();
return;
}
if(topicStubs.length === psis.length){
- removeLoad();
+ hideLoad();
+ onSuccessHandler(topicStubs);
+
}
else setTimeout(checkRequests, delta);
}
checkRequests();
-
}
catch(err){
alert("From getTopicStubs(): Could not request topicStubs information for: " + psis + "\n\n" + err);
Modified: trunk/src/ajax/javascripts/search.js
==============================================================================
--- trunk/src/ajax/javascripts/search.js (original)
+++ trunk/src/ajax/javascripts/search.js Fri Jun 19 04:53:38 2009
@@ -14,5 +14,6 @@
{
var content = new Element("div", {"class" : CLASSES.content()});
var header = new Element("h1").update("Search a Topic");
- $(CLASSES.subPage()).insert((content.insert(header, {"position" : "bottom"})), {"position" : "bottom"});
+ content.insert({"bottom" : header});
+ $(CLASSES.subPage()).insert({"bottom" : content});
}
More information about the Isidorus-cvs
mailing list