[fusion-commits] r2714 - in trunk/widgets: . Redline widgetinfo

svn_fusion at osgeo.org svn_fusion at osgeo.org
Thu May 23 22:58:39 PDT 2013


Author: jng
Date: 2013-05-23 22:58:39 -0700 (Thu, 23 May 2013)
New Revision: 2714

Modified:
   trunk/widgets/Redline.js
   trunk/widgets/Redline/markupmain.php
   trunk/widgets/widgetinfo/redline.xml
Log:
#565: Add a new AutoCreateOnStartup extension property. If true and RedlineGeometryFormat and DataStoreFormat are specified, invoking the widget will auto-create the redline data store and bypass the management UI and straight into the edit redline page.

Modified: trunk/widgets/Redline/markupmain.php
===================================================================
--- trunk/widgets/Redline/markupmain.php	2013-05-24 03:54:15 UTC (rev 2713)
+++ trunk/widgets/Redline/markupmain.php	2013-05-24 05:58:39 UTC (rev 2714)
@@ -21,7 +21,12 @@
     $defaultCmd = null;
     $defaultFormat = null;
     $defaultGeomType = null;
+    $createOnStartup = false;
 
+    if (array_key_exists("AUTOCREATE", $args)) {
+        $createOnStartup = ($args["AUTOCREATE"] == "1");
+    }
+
     if (array_key_exists("REDLINEFORMAT", $args) && array_key_exists("REDLINEGEOMTYPE", $args)) {
         if (strcmp($args["REDLINEFORMAT"], "SDF") == 0) {
             $defaultFormat = $args["REDLINEFORMAT"];
@@ -367,6 +372,10 @@
             var map = parent.Fusion.getMapByName(mapName);
             map.reloadMap();
         <?php } ?>
+        
+        <? if ($defaultFormat != null && $defaultGeomType != null && $createOnStartup == true) { ?>
+            SubmitCreateCommand(<?= $defaultCmd ?>, <?= $defaultGeomType ?>);
+        <? } ?>
         }
     </script>
 

Modified: trunk/widgets/Redline.js
===================================================================
--- trunk/widgets/Redline.js	2013-05-24 03:54:15 UTC (rev 2713)
+++ trunk/widgets/Redline.js	2013-05-24 05:58:39 UTC (rev 2714)
@@ -59,6 +59,10 @@
     
     // Indicates the default geometry types the user can record
     defaultRedlineGeometryTypes: 0,
+    
+    // If we have a redline data store and geom format specified, auto-create the data store and go to the
+    // edit redline page 
+    bCreateOnStartup: false,
 
     initializeWidget: function(widgetTag) {
         var json = widgetTag.extension;
@@ -84,10 +88,14 @@
                     if (geomTypes == 1 || geomTypes == 2 || geomTypes == 4) {
                         this.defaultDataStoreFormat = json.DataStoreFormat[0];
                         this.defaultRedlineGeometryType = geomTypes;
+                        if (json.AutoCreateOnStartup)
+                            this.bCreateOnStartup = (json.AutoCreateOnStartup[0] == "true");
                     }
                 } else {
                     this.defaultDataStoreFormat = json.DataStoreFormat[0];
                     this.defaultRedlineGeometryType = geomTypes;
+                    if (json.AutoCreateOnStartup)
+                        this.bCreateOnStartup = (json.AutoCreateOnStartup[0] == "true");
                 }
             }
         }
@@ -154,6 +162,7 @@
         if (this.widget.defaultDataStoreFormat != null && this.widget.defaultRedlineGeometryType > 0) {
             params.push('REDLINEFORMAT=' + this.widget.defaultDataStoreFormat);
             params.push('REDLINEGEOMTYPE=' + this.widget.defaultRedlineGeometryType);
+            params.push('AUTOCREATE=' + (this.widget.bCreateOnStartup ? "1" : "0"));
         }
 
         if (url.indexOf('?') < 0) {

Modified: trunk/widgets/widgetinfo/redline.xml
===================================================================
--- trunk/widgets/widgetinfo/redline.xml	2013-05-24 03:54:15 UTC (rev 2713)
+++ trunk/widgets/widgetinfo/redline.xml	2013-05-24 05:58:39 UTC (rev 2714)
@@ -97,4 +97,12 @@
         <DefaultValue>7</DefaultValue>
         <IsMandatory>false</IsMandatory>
     </Parameter>
+    <Parameter>
+        <Name>AutoCreateOnStartup</Name>
+        <Description>If DataStoreFormat and RedlineGeometryFormat parameters are specified, determines if the redline data store is automatically created on widget invocation. If true, the widget starts off in the Redline editing page instead of the Redline Management page</Description>
+        <Type>boolean</Type>
+        <Label>AutoCreateOnStartup</Label>
+        <DefaultValue>true</DefaultValue>
+        <IsMandatory>false</IsMandatory>
+    </Parameter>
 </WidgetInfo>



More information about the fusion-commits mailing list