fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [6945] Various JS changes, new functions and consolid


From: Petur Thorsteinsson
Subject: [Fmsystem-commits] [6945] Various JS changes, new functions and consolidation of code
Date: Sun, 06 Feb 2011 21:01:28 +0000

Revision: 6945
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6945
Author:   peturbjorn
Date:     2011-02-06 21:01:27 +0000 (Sun, 06 Feb 2011)
Log Message:
-----------
Various JS changes, new functions and consolidation of code

Modified Paths:
--------------
    branches/dev-bim2/property/js/yahoo/bim.modellist.js

Modified: branches/dev-bim2/property/js/yahoo/bim.modellist.js
===================================================================
--- branches/dev-bim2/property/js/yahoo/bim.modellist.js        2011-02-06 
21:00:31 UTC (rev 6944)
+++ branches/dev-bim2/property/js/yahoo/bim.modellist.js        2011-02-06 
21:01:27 UTC (rev 6945)
@@ -52,26 +52,53 @@
                path_update["menuaction"] = 
"property.uibim.displayModelInformation";
                var postUrl = phpGWLink('index.php',path_update);
                var modelDatabaseId = this.getAttribute("value");  
//getAttribute("value");
-               var form = document.createElement("form");
-       form.setAttribute("method", "post");
-               form.setAttribute("action", postUrl);
-               var hiddenField = document.createElement("input");
-        hiddenField.setAttribute("type", "hidden");
-        hiddenField.setAttribute("name", "modelId");
-        hiddenField.setAttribute("value", modelDatabaseId);
-               form.appendChild(hiddenField);
-               document.body.appendChild(form);
-       form.submit();
+               
createAppendSubmitModelIdForm(postUrl,"modelId",modelDatabaseId);
+       };
+       YUI().use("event-delegate", function(Y){
+               Y.delegate("click", loadModelInfoCall, "#bimModelList2", 
"button.info");
+       });
+};
 
 
-
-               //var Y = new YUI({ debug : true });
+function doDelegateModelView(){
+       function loadModelViewCall(e) {
+               var path_update = new Array();
+               path_update["menuaction"] = "property.uibimitem.showItems";
+               var postUrl = phpGWLink('index.php',path_update);
+               var modelDatabaseId = this.getAttribute("value");  
//getAttribute("value");
+               
createAppendSubmitModelIdForm(postUrl,"modelId",modelDatabaseId);
        };
        YUI().use("event-delegate", function(Y){
-               Y.delegate("click", loadModelInfoCall, "#bimModelList2", 
"button.info");
+               Y.delegate("click", loadModelViewCall, "#bimModelList2", 
"button.view");
        });
 };
-
+function doDelegateViewItem(){
+       function loadViewItemCall(e) {
+               YUI().use('node', function(Y) {
+                       var path_update = new Array();
+                       path_update["menuaction"] = 
"property.uibimitem.showBimItem";
+                       var postUrl = phpGWLink('index.php',path_update);
+                       var guid = e.currentTarget.getContent();
+                       createAppendSubmitModelIdForm(postUrl,"modelGuid",guid);
+               });
+       };
+       
+       YUI().use("event-delegate", function(Y){
+               Y.delegate("click", loadViewItemCall, "#bimItems", "td.guid");
+       });
+};
+function createAppendSubmitModelIdForm(postUrl, varName, varValue) {
+       var form = document.createElement("form");
+       form.setAttribute("method", "post");
+       form.setAttribute("action", postUrl);
+       var hiddenField = document.createElement("input");
+    hiddenField.setAttribute("type", "hidden");
+    hiddenField.setAttribute("name", varName);
+    hiddenField.setAttribute("value", varValue);
+       form.appendChild(hiddenField);
+       document.body.appendChild(form);
+       form.submit();
+}
 /*
 function populateModelList() {
        YUI().use('io-base','node', function(Y) {
@@ -145,40 +172,26 @@
                                cell = currentRow.invoke("insertCell", 
cellIndex++);
                                
cell.appendChild(document.createTextNode(bimModel.used));
                                cell = currentRow.invoke("insertCell", 
cellIndex++);
-                               
cell.appendChild(createLoadButton(bimModel.databaseId));
+                               
cell.appendChild(createFunctionButton(bimModel.databaseId, "view", "View"));
                                cell = currentRow.invoke("insertCell", 
cellIndex++);
-                               
cell.appendChild(createDeleteButton(bimModel.databaseId));
+                               
cell.appendChild(createFunctionButton(bimModel.databaseId, "load", "Load"));
                                cell = currentRow.invoke("insertCell", 
cellIndex++);
-                               
cell.appendChild(createInfoButton(bimModel.databaseId));
+                               
cell.appendChild(createFunctionButton(bimModel.databaseId, "del", "Remove"));
+                               cell = currentRow.invoke("insertCell", 
cellIndex++);
+                               
cell.appendChild(createFunctionButton(bimModel.databaseId, "info", "Info"));
                                
                                rowCount++;
                        }
                        hideLoadingDiv();
                        Y.log("Success handler is complete.", "info", 
"example");
                }
-               
-               function createDeleteButton(modelId) {
+               function createFunctionButton(modelId, buttonClass, buttonText) 
{
                        var buttonNode = document.createElement("button");
                        buttonNode.setAttribute('value', modelId);
-                       buttonNode.setAttribute('class', "del");
-                       
buttonNode.appendChild(document.createTextNode("Remove"));
+                       buttonNode.setAttribute('class', buttonClass);
+                       
buttonNode.appendChild(document.createTextNode(buttonText));
                        return buttonNode;
                }
-               
-               function createLoadButton(modelId) {
-                       var buttonNode = document.createElement("button");
-                       buttonNode.setAttribute('value', modelId);
-                       buttonNode.setAttribute('class', "load");
-                       buttonNode.appendChild(document.createTextNode("Load"));
-                       return buttonNode;
-               }
-               function createInfoButton(modelId) {
-                       var buttonNode = document.createElement("button");
-                       buttonNode.setAttribute('value', modelId);
-                       buttonNode.setAttribute('class', "info");
-                       buttonNode.appendChild(document.createTextNode("Info"));
-                       return buttonNode;
-               }
  
                //Provide a function that can help debug failed
                //requests:
@@ -417,7 +430,7 @@
 console.log(Event.delegate("container44", "click", onLIClick, "li"));
 
 })();
-*/
+
 YUI().use('node-base', function(Y) {
                Y.on("load",  getModelList);
                
@@ -425,4 +438,4 @@
        //      Y.on("load", doDelegateDeleteModel);
 
                }); 
-
+*/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]