Displaying differences for changeset
 
display as  

css/styles.css

@@ -38,6 +38,10 @@
 #yieldUnitCol
 {width: 89px;}
 
+.ui-datepicker
+
+    z-index: 9999 !important;
+}
 .errorCell
 {
     border: 3px solid #f33;
@@ -54,7 +58,7 @@
   min-width: 20px;
   position: relative;
   background-color: #E4E6EB;
-  background-image: url("images/bump.jpg");
+  background-image: url("../images/bump.jpg");
   background-repeat: repeat;
   background-size: 3px, 3px; 
   cursor: move;

js/rotationbuilder.js

@@ -104,7 +104,7 @@
 }
 var rowForDelete;
 var lastSelectedRow;
-$(function()
+$( function()
 {
     //init date
     $("#addRow").click(addRowClick);
@@ -116,7 +116,8 @@
     $('#operationsjsTree').bind('select_node.jstree', selectOperation);
     $('#cropsjsTree').bind('select_node.jstree', selectCrop);
     $('#resjsTree').bind('select_node.jstree', selectResidue);
-
+    
+    
 
     //init operations
     $("#operationsjsTree").jstree(
@@ -513,7 +514,7 @@
     {
         var crop = crops[getObjectIdx(selected.node.id, "crop")];
         cropEditing.value = selected.node.text;
-        $(cropEditing).parent().parent().find('.yieldUnitInput').val(crop.harvestUnits);
+        $(cropEditing).parent().parent().find('.yieldUnitInput').val(crop.yieldUnit);
         $(cropEditing).parent().parent().find('.yieldInput').val(crop.defaultYield);
         $('#cropsjsTree').dialog("close");
     }
@@ -540,34 +541,63 @@
     {
         type: "POST",
         contentType: "application/json",
-        url: "http://csip.engr.colostate.edu:8083/csip-lmod/d/operation/1.1", //"http://csip.engr.colostate.edu:8083/csip-lmod/d/operation/1.1",
+        url: "http://csip.engr.colostate.edu:8083/csip-crlmod/d/operation/1.1",
         data: "{\"metainfo\":{},\"parameter\":[{\"name\": \"limit\", \"value\": \"all\"}]}",
-        success: gotOperations
+        success: gotOperations,
+        error: errorOperations
+        
     });
 }
 
+function errorOperations(jqXHR, exception)
+{
+     var msg = '';
+        if (jqXHR.status === 0) {
+            msg = 'Unable to connect.\n Verify Network.';
+        } else if (jqXHR.status == 404) {
+            msg = 'Requested page not found. [404]';
+        } else if (jqXHR.status == 500) {
+            msg = 'Internal Server Error [500].';
+        } else if (exception === 'parsererror') {
+            msg = 'Requested JSON parse failed.';
+        } else if (exception === 'timeout') {
+            msg = 'Time out error.';
+        } else if (exception === 'abort') {
+            msg = 'Ajax request aborted.';
+        } else {
+            msg = 'Uncaught Error.\n' + jqXHR.responseText;
+        }
+}
+
 function gotOperations(data, status, xhr)
 {
     // Parse the returned json data
-    // Use jQuery's each to iterate over the opts value
-
+    // Use jQuery's each to iterate over the ops value
+    if(data.result == null)
+    {
+        alert(data.metainfo.error);
+        return false;
+    }
+    
     operations = data.result[0].value.operations;
     $.each(operations, function(i, d)
     {
-        if (!paths.has(d.path))
+        var path = getObjectPath(d, "operation");
+        if (path != "" && !paths.has(path))
         {
-            paths.add(d.path);
+            paths.add(path);
             $('#operationsjsTree').jstree().create_node('#',
             {
-                id: d.path,
-                text: d.path
+                id: path,
+                text: path
             });
         }
-
-        $('#operationsjsTree').jstree().create_node(d.path,
+        if(path == "")
+            path = "#";
+        $('#operationsjsTree').jstree().create_node(path,
         {
-            id: d.file_key,
-            data: d.file_key.toString(),
+            id: d.id,
+            data: d.id.toString(),
             text: d.name,
             icon: 'jstree-file'
         });
@@ -581,7 +611,7 @@
     {
         type: "POST",
         contentType: "application/json",
-        url: "http://csip.engr.colostate.edu:8083/csip-lmod/d/crop/1.0",
+        url: "http://csip.engr.colostate.edu:8083/csip-crlmod/d/crop/1.1",
         data: "{\"metainfo\":{},\"parameter\":[{\"name\": \"limit\", \"value\": \"all\"}]}",
         success: gotCrops
     });
@@ -589,23 +619,35 @@
 
 function gotCrops(data, status, xhr)
 {
+    //check to make sure result even exists.
+    if(data.result == null)
+    {
+        alert(data.metainfo.error);
+        return false;
+    }
+    
     crops = data.result[0].value.crops;
     $.each(crops, function(i, d)
     {
-        if (!paths.has(d.path))
+        var path = getObjectPath(d, "crop");
+        
+        if (path != "" && !paths.has(path))
         {
-            paths.add(d.path);
+            paths.add(path);
             $('#cropsjsTree').jstree().create_node('#',
             {
-                id: d.path,
-                text: d.path
+                id: path,
+                text: path
             });
         }
 
-        $('#cropsjsTree').jstree().create_node(d.path,
+        if(path == "")
+            path = "#";
+        
+        $('#cropsjsTree').jstree().create_node(path,
         {
-            id: d.file_key,
-            data: d.file_key.toString(),
+            id: d.id,
+            data: d.id.toString(),
             text: d.name,
             icon: 'jstree-file'
         });
@@ -620,31 +662,42 @@
     {
         type: "POST",
         contentType: "application/json",
-        url: "http://csip.engr.colostate.edu:8083/csip-lmod/d/residue/1.0",
-        data: "{\"metainfo\":{},\"parameter\":[{\"name\": \"limit\", \"value\": \"20\"}]}",
+        url: "http://csip.engr.colostate.edu:8083/csip-crlmod/d/residue/1.1",
+        data: "{\"metainfo\":{},\"parameter\":[{\"name\": \"limit\", \"value\": \"all\"}]}",
         success: gotResidues
     });
 }
 
 function gotResidues(data, status, xhr)
 {
+    if(data.result == null)
+    {
+        alert(data.metainfo.error);
+        return false;
+    }
+    
     residues = data.result[0].value.residues;
     $.each(residues, function(i, d)
     {
-        if (!paths.has(d.path))
+        var path = getObjectPath(d, "operation");
+        
+        if (path != "" && !paths.has(path))
         {
-            paths.add(d.path);
+            paths.add(path);
             $('#resjsTree').jstree().create_node('#',
             {
-                id: d.path,
-                text: d.path
+                id: path,
+                text: path
             });
         }
-
-        $('#resjsTree').jstree().create_node(d.path,
+        
+        if(path == "")
+            path = "#";
+        
+        $('#resjsTree').jstree().create_node(path,
         {
-            id: d.file_key,
-            data: d.file_key.toString(),
+            id: d.id,
+            data: d.id.toString(),
             text: d.name,
             icon: 'jstree-file'
         });
@@ -712,7 +765,7 @@
     validateManagement();
 }
 
-function getObjectIdx(fileKey, objectType)
+function getObjectIdx(id, objectType)
 {
     var index = -1;
     var list;
@@ -731,7 +784,7 @@
 
     $.each(list, function(i, d)
     {
-        if (d.file_key == fileKey)
+        if (d.id == id)
             index = i;
     });
 
@@ -765,6 +818,37 @@
     return index;    
 }
 
+function getObjectPath(object, objectType)
+{
+    var prefix;
+    switch (objectType)
+    {
+        case "operation":
+            prefix = "opGroup";
+            break;
+        case "crop":
+            prefix = "cropGroup";
+            break;
+        case "residue":
+            prefix = "resGroup";
+            break;
+    }
+    
+    var path = "";
+    if(object[prefix + "1"] != null)
+        path += object[prefix + "1"];
+    if(object[prefix + "2"] != null)
+        path += "/" + object[prefix + "2"];
+    if(object[prefix + "3"] != null)
+        path += "/" + object[prefix + "3"];
+    if(object[prefix + "4"] != null)
+        path += "/" + object[prefix + "4"];
+    if(object[prefix + "5"] != null)
+        path += "/" + object[prefix + "5"];
+    
+    return path;
+}
+
 function makeTablesResizeable()
 {
     var thElm;