[fusion-commits] r2503 - in trunk: text widgets widgets/Redline
widgets/Redline/classes widgets/widgetinfo
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Tue Jan 3 23:57:38 EST 2012
Author: jng
Date: 2012-01-03 20:57:38 -0800 (Tue, 03 Jan 2012)
New Revision: 2503
Modified:
trunk/text/en
trunk/widgets/Redline.js
trunk/widgets/Redline/classes/markupmanager.php
trunk/widgets/Redline/markupmain.php
trunk/widgets/Redline/newmarkup.php
trunk/widgets/widgetinfo/redline.xml
Log:
#508: Improve redline widget usability (part 2): Add a new widget extension property (AutogenerateLayerNames) which indicates whether to prompt the user for a redline layer name, or to autogenerate one. Default is true (don't prompt, auto-generate the name)
Modified: trunk/text/en
===================================================================
--- trunk/text/en 2012-01-03 17:15:24 UTC (rev 2502)
+++ trunk/text/en 2012-01-04 04:57:38 UTC (rev 2503)
@@ -293,13 +293,13 @@
# Redline Editing
REDLINEEDIT = Edit Redline
-REDLINEEDITDEFAULTHELP = To begin select the type of markup to digitize.
+REDLINEEDITDEFAULTHELP = To begin select the type of redline to digitize.
REDLINEEDITPOINTHELP = Click the map to specify the location of the point.
REDLINEEDITLINEHELP = Click and drag on the map to specify the start and end points of the line.
REDLINEEDITLINESTRINGHELP = Click the map to define each point of the line, Double Click on the final point to end.
REDLINEEDITRECTANGLEHELP = Click on the map to specify the first corner and drag the mouse to define the rectangle.
REDLINEEDITPOLYGONHELP = Click the map to define each point of the polygon, Double Click on the final point to end.
-REDLINEPROMPTLABEL = Enter a label for the markup item
+REDLINEPROMPTLABEL = Enter a label for the redline item
REDLINEADD = Add Redline
REDLINEDIGITIZE = Digitize Redline
REDLINEOBJECTPOINT = Point
Modified: trunk/widgets/Redline/classes/markupmanager.php
===================================================================
--- trunk/widgets/Redline/classes/markupmanager.php 2012-01-03 17:15:24 UTC (rev 2502)
+++ trunk/widgets/Redline/classes/markupmanager.php 2012-01-04 04:57:38 UTC (rev 2503)
@@ -310,7 +310,7 @@
function CreateMarkup()
{
- $markupName = "RedlineLayer";
+ $markupName = $this->args["MARKUPNAME"];
$this->UniqueMarkupName($markupName);
$resourceService = $this->site->CreateService(MgServiceType::ResourceService);
Modified: trunk/widgets/Redline/markupmain.php
===================================================================
--- trunk/widgets/Redline/markupmain.php 2012-01-03 17:15:24 UTC (rev 2502)
+++ trunk/widgets/Redline/markupmain.php 2012-01-04 04:57:38 UTC (rev 2503)
@@ -76,6 +76,7 @@
$uploadLocal = GetLocalizedString('REDLINEUPLOADSDF', $locale );
$editStyleLocal = GetLocalizedString('REDLINEEDITSTYLE', $locale );
$redlineCreateFailureLocal = GetLocalizedString('REDLINECREATEFAILURE', $locale );
+ $redlineLayerNameLocal = GetLocalizedString('REDLINENAME', $locale);
}
catch (MgException $mge)
{
@@ -117,14 +118,28 @@
var markupForm = document.getElementById("markupForm");
if (cmd == CMD_NEW) {
- Fusion.ajaxRequest("widgets/redline/newmarkup.php", {
- onSuccess: OpenLayers.Function.bind(OnMarkupCreated, this),
- onFailure: OpenLayers.Function.bind(OnMarkupCreateFailure, this),
- parameters: {
- SESSION: session,
- MAPNAME: mapName
- }
- });
+ var widget = Fusion.getWidgetsByType("Redline")[0];
+ if (widget.autogenerateLayerNames) {
+ Fusion.ajaxRequest("widgets/redline/newmarkup.php", {
+ onSuccess: OpenLayers.Function.bind(OnMarkupCreated, this),
+ onFailure: OpenLayers.Function.bind(OnMarkupCreateFailure, this),
+ parameters: {
+ SESSION: session,
+ MAPNAME: mapName
+ }
+ });
+ } else {
+ var name = prompt("<?= $redlineLayerNameLocal ?>");
+ Fusion.ajaxRequest("widgets/redline/newmarkup.php", {
+ onSuccess: OpenLayers.Function.bind(OnMarkupCreated, this),
+ onFailure: OpenLayers.Function.bind(OnMarkupCreateFailure, this),
+ parameters: {
+ SESSION: session,
+ MAPNAME: mapName,
+ NEWLAYERNAME: name
+ }
+ });
+ }
} else {
if (cmd == CMD_EDIT) {
markupForm.action = "editmarkup.php";
Modified: trunk/widgets/Redline/newmarkup.php
===================================================================
--- trunk/widgets/Redline/newmarkup.php 2012-01-03 17:15:24 UTC (rev 2502)
+++ trunk/widgets/Redline/newmarkup.php 2012-01-04 04:57:38 UTC (rev 2503)
@@ -32,7 +32,7 @@
$responseJson = null;
try
{
- $args["MARKUPNAME"] = "MarkupLayer";
+ $args["MARKUPNAME"] = array_key_exists("NEWLAYERNAME", $args) ? $args["NEWLAYERNAME"] : "RedlineLayer";
$args["MARKERCOLOR"] = DefaultStyle::MARKER_COLOR;
$args["MARKERTYPE"] = DefaultStyle::MARKER_TYPE;
Modified: trunk/widgets/Redline.js
===================================================================
--- trunk/widgets/Redline.js 2012-01-03 17:15:24 UTC (rev 2502)
+++ trunk/widgets/Redline.js 2012-01-04 04:57:38 UTC (rev 2503)
@@ -48,12 +48,18 @@
// Indicates whether to prompt for text labels on recorded redlines
promptForRedlineLabels: false,
+ // Indicates whether to autogenerate redline layer names or to prompt the user for one.
+ autogenerateLayerNames: true,
+
initializeWidget: function(widgetTag) {
var json = widgetTag.extension;
this.mapWidget = Fusion.getWidgetById('Map');
if (json.PromptForRedlineLabels)
this.promptForRedlineLabels = (json.PromptForRedlineLabels[0] == "true");
+
+ if (json.AutogenerateLayerNames)
+ this.autogenerateLayerNames = (json.AutogenerateLayerNames[0] == "true");
// register Redline specific events
this.registerEventID(Fusion.Event.REDLINE_FEATURE_ADDED);
Modified: trunk/widgets/widgetinfo/redline.xml
===================================================================
--- trunk/widgets/widgetinfo/redline.xml 2012-01-03 17:15:24 UTC (rev 2502)
+++ trunk/widgets/widgetinfo/redline.xml 2012-01-04 04:57:38 UTC (rev 2503)
@@ -25,4 +25,12 @@
<DefaultValue>false</DefaultValue>
<IsMandatory>false</IsMandatory>
</Parameter>
+ <Parameter>
+ <Name>AutogenerateLayerNames</Name>
+ <Description>Indicates whether to prompt the auto-generate redline layer names when creating a new redline layer or to prompt the user. Default is true (don't prompt)</Description>
+ <Type>boolean</Type>
+ <Label>AutogenerateLayerNames</Label>
+ <DefaultValue>true</DefaultValue>
+ <IsMandatory>false</IsMandatory>
+ </Parameter>
</WidgetInfo>
More information about the fusion-commits
mailing list