[fusion-commits] r2655 - in trunk: text widgets/Redline/classes widgets/Redline/templates

svn_fusion at osgeo.org svn_fusion at osgeo.org
Fri Mar 8 01:54:46 PST 2013


Author: jng
Date: 2013-03-08 01:54:46 -0800 (Fri, 08 Mar 2013)
New Revision: 2655

Modified:
   trunk/text/en
   trunk/widgets/Redline/classes/markupmanager.php
   trunk/widgets/Redline/templates/markupfeaturesource.xml
Log:
#551: Fix upload function and add support for SQLite redline data files

Modified: trunk/text/en
===================================================================
--- trunk/text/en	2013-03-08 09:32:42 UTC (rev 2654)
+++ trunk/text/en	2013-03-08 09:54:46 UTC (rev 2655)
@@ -318,7 +318,7 @@
 # Redline Upload
 REDLINEUPLOAD           = Upload Redline
 REDLINEDATAFILE         = Redline Data File
-REDLINEUPLOADNOTE       = Note: Data file must be a SDF file and you can only upload data files that have either been originally created by this widget or have an identical feature schema.
+REDLINEUPLOADNOTE       = Note: Data file must be a SDF, SQLite or SHP file and you can only upload data files that have either been originally created by this widget or have an identical feature schema.<br><br>For SHP files, you must upload a zip file containing the SHP file and its associated files (.dbf, .idx, .shx, etc)
 REDLINEUPLOADREQUIRED   = Redline Data File not specified
 REDLINEUPLOADTEXT       = Upload
 REDLINEUPLOADCLOSE      = Close

Modified: trunk/widgets/Redline/classes/markupmanager.php
===================================================================
--- trunk/widgets/Redline/classes/markupmanager.php	2013-03-08 09:32:42 UTC (rev 2654)
+++ trunk/widgets/Redline/classes/markupmanager.php	2013-03-08 09:54:46 UTC (rev 2655)
@@ -526,7 +526,7 @@
     function UploadMarkup()
     {
         $locale = "en";
-        if (array_key_exists($this->args, "LOCALE"))
+        if (array_key_exists("LOCALE", $this->args))
             $locale = $this->args["LOCALE"];
         $uploadFileParts = pathinfo($_FILES["UPLOADFILE"]["name"]);
         $fdoProvider = $this->GetProviderFromExtension($uploadFileParts["extension"]);
@@ -547,8 +547,17 @@
         $markupLayerResId = new MgResourceIdentifier($this->GetResourceIdPrefix() . $baseName . ".LayerDefinition");
         $markupFsId = new MgResourceIdentifier($this->GetResourceIdPrefix() . $baseName . '.FeatureSource');
 
+        //Set up feature source document
         $dataName = $baseName . "." . $ext;
-        $fsXml = sprintf(file_get_contents("templates/markupfeaturesource.xml"), $dataName);
+        $fileParam = "File";
+        if (strcmp($fdoProvider, "OSGeo.SHP") == 0) {
+            $fileParam = "DefaultFileLocation";
+        }
+        $extraXml = "";
+        if (strcmp($fdoProvider, "OSGeo.SDF") == 0) { //Need to set ReadOnly = false for SDF
+            $extraXml = "<Parameter><Name>ReadOnly</Name><Value>FALSE</Value></Parameter>";
+        }
+        $fsXml = sprintf(file_get_contents("templates/markupfeaturesource.xml"), $fdoProvider, $fileParam, $dataName, $extraXml);
         $bs2 = new MgByteSource($fsXml, strlen($fsXml));
         $resourceService->SetResource($markupFsId, $bs2->GetReader(), null);
         $resourceService->SetResourceData($markupFsId, $dataName, "File", $bs->GetReader());
@@ -560,6 +569,7 @@
         $klass = $classes->GetItem(0);
         $geomProp = $klass->GetDefaultGeometryPropertyName();
         $clsProps = $klass->GetProperties();
+        $className = $schema->GetName().":".$klass->GetName();
         $geomTypes = -1;
         if ($clsProps->IndexOf($geomProp) >= 0) {
             $geom = $clsProps->GetItem($geomProp);
@@ -601,7 +611,7 @@
         $this->args["LABELBACKCOLOR"] = DefaultStyle::LABEL_BACK_COLOR;
         $this->args["LABELBACKSTYLE"] = DefaultStyle::LABEL_BACK_STYLE;
 
-        $markupLayerDefinition = $this->CreateMarkupLayerDefinitionContent($markupFsId->ToString());
+        $markupLayerDefinition = $this->CreateMarkupLayerDefinitionContent($markupFsId->ToString(), $className);
 
         $layerBs = new MgByteSource($markupLayerDefinition, strlen($markupLayerDefinition));
         //Save to new resource or overwrite existing

Modified: trunk/widgets/Redline/templates/markupfeaturesource.xml
===================================================================
--- trunk/widgets/Redline/templates/markupfeaturesource.xml	2013-03-08 09:32:42 UTC (rev 2654)
+++ trunk/widgets/Redline/templates/markupfeaturesource.xml	2013-03-08 09:54:46 UTC (rev 2655)
@@ -1,12 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <FeatureSource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="FeatureSource-1.0.0.xsd">
-  <Provider>OSGeo.SDF</Provider>
+  <Provider>%s</Provider>
   <Parameter>
-    <Name>File</Name>
+    <Name>%s</Name>
     <Value>%%MG_DATA_FILE_PATH%%%s</Value>
   </Parameter>
-  <Parameter>
-    <Name>ReadOnly</Name>
-    <Value>FALSE</Value>
-  </Parameter>
+  %s
 </FeatureSource>
\ No newline at end of file



More information about the fusion-commits mailing list