diff --git a/Gemfile b/Gemfile index 6da92d5..f50b288 100644 --- a/Gemfile +++ b/Gemfile @@ -28,8 +28,3 @@ group :development do gem 'rb-fsevent' end -group :vagrant do - gem 'vagrant', '~> 1.0.3' - gem 'zayin' -end - diff --git a/Gemfile.lock b/Gemfile.lock index e0302f7..014ade4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,7 +4,6 @@ GEM activesupport (3.2.12) i18n (~> 0.6) multi_json (~> 1.0) - archive-tar-minitar (0.5.2) builder (3.2.0) capybara (2.0.3) mime-types (>= 1.16) @@ -45,7 +44,6 @@ GEM em-websocket (0.5.0) eventmachine (>= 0.12.9) http_parser.rb (~> 0.5.3) - erubis (2.7.0) eventmachine (1.0.3) execjs (1.4.0) multi_json (~> 1.0) @@ -103,7 +101,6 @@ GEM em-dir-watcher (>= 0.1) em-websocket (>= 0.3.5) json (>= 1.5.3) - log4r (1.1.10) lumberjack (1.0.3) mechanize (2.6.0) domain_name (~> 0.5, >= 0.5.1) @@ -119,9 +116,6 @@ GEM multi_xml (0.5.3) net-http-digest_auth (1.3) net-http-persistent (2.8) - net-scp (1.0.4) - net-ssh (>= 1.99.1) - net-ssh (2.2.2) nokogiri (1.5.9) ntlm-http (0.1.1) peach (0.5.1) @@ -150,21 +144,10 @@ GEM unf (0.1.1) unf_ext unf_ext (0.0.6) - vagrant (1.0.7) - archive-tar-minitar (= 0.5.2) - childprocess (~> 0.3.1) - erubis (~> 2.7.0) - i18n (~> 0.6.0) - json (>= 1.5.1, < 1.8.0) - log4r (~> 1.1.9) - net-scp (~> 1.0.4) - net-ssh (~> 2.2.2) webrobots (0.1.1) websocket (1.0.7) xpath (1.0.0) nokogiri (~> 1.3) - zayin (0.2.0) - rake (~> 0.8) PLATFORMS ruby @@ -192,5 +175,3 @@ DEPENDENCIES rspec-expectations sass selenium-webdriver - vagrant (~> 1.0.3) - zayin diff --git a/NeatlineFeaturesPlugin.php b/NeatlineFeaturesPlugin.php index 15b474e..6926a4f 100644 --- a/NeatlineFeaturesPlugin.php +++ b/NeatlineFeaturesPlugin.php @@ -187,7 +187,7 @@ public function hookAdminHead($args) // We are also outputting the script tags to load OpenLayers here. $this->_queueJsUri( - "http://maps.google.com/maps/api/js?v=3.8&sensor=false" + "//maps.google.com/maps/api/js?v=3.8&sensor=false" ); queue_js_file('libraries/openlayers/OpenLayers.min'); queue_js_file('libraries/tile.stamen'); @@ -223,7 +223,7 @@ public function hookPublicHead() // We are also outputting the script tags to load OpenLayers here. $this->_queueJsUri( - "http://maps.google.com/maps/api/js?v=3.8&sensor=false" + "//maps.google.com/maps/api/js?v=3.8&sensor=false" ); queue_js_file('libraries/openlayers/OpenLayers.min'); queue_js_file('libraries/tile.stamen'); diff --git a/Rakefile b/Rakefile index 7395153..8da9cd1 100644 --- a/Rakefile +++ b/Rakefile @@ -146,7 +146,7 @@ task :update_pot do pot_duplicates = Tempfile.new("-duplicates.pot") pot_duplicates.close - files.pmap do |filename| + files.each do |filename| sh %{xgettext -L php --from-code=utf-8 -k__ --flag=__:1:pass-php-format --omit-header -F -o #{pot_temp.path} #{filename}} end diff --git a/features/data/db-dump.sql.gz b/features/data/db-dump.sql.gz index 8d91df2..733ef24 100644 Binary files a/features/data/db-dump.sql.gz and b/features/data/db-dump.sql.gz differ diff --git a/languages/de_DE.mo b/languages/de_DE.mo index 1b855ac..e7303d1 100644 Binary files a/languages/de_DE.mo and b/languages/de_DE.mo differ diff --git a/languages/de_DE.po b/languages/de_DE.po index 577695b..a3a8622 100644 --- a/languages/de_DE.po +++ b/languages/de_DE.po @@ -1,20 +1,20 @@ # Translation for the Neatline Time plugin for Omeka. # # Translators: -# , 2012. +# Martin Liebeskind , 2012 msgid "" msgstr "" "Project-Id-Version: Neatline\n" -"Report-Msgid-Bugs-To: http://github.com/scholarslab/\n" +"Report-Msgid-Bugs-To: http://github.com/scholarslab/NeatlineFeatures/issues\n" "POT-Creation-Date: 2012-06-25 10:00-0500\n" -"PO-Revision-Date: 2012-08-24 19:46+0000\n" +"PO-Revision-Date: 2013-11-20 13:30+0000\n" "Last-Translator: Martin Liebeskind \n" "Language-Team: German (Germany) (http://www.transifex.com/projects/p/neatline/language/de_DE/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: de_DE\n" -"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" #: views/shared/coverage.php:28 msgid "Use Map" diff --git a/languages/en_US.mo b/languages/en_US.mo index eb52ead..891183b 100644 Binary files a/languages/en_US.mo and b/languages/en_US.mo differ diff --git a/languages/en_US.po b/languages/en_US.po index a539d91..596e1de 100644 --- a/languages/en_US.po +++ b/languages/en_US.po @@ -4,11 +4,11 @@ msgid "" msgstr "" "Project-Id-Version: Neatline\n" -"Report-Msgid-Bugs-To: http://github.com/scholarslab/\n" +"Report-Msgid-Bugs-To: http://github.com/scholarslab/NeatlineFeatures/issues\n" "POT-Creation-Date: 2012-06-25 10:00-0500\n" -"PO-Revision-Date: 2012-06-25 15:51+0000\n" +"PO-Revision-Date: 2013-11-20 13:30+0000\n" "Last-Translator: Jeremy Boggs \n" -"Language-Team: LANGUAGE \n" +"Language-Team: English (United States) (http://www.transifex.com/projects/p/neatline/language/en_US/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/languages/es.mo b/languages/es.mo index ea0ee1b..69cf00d 100644 Binary files a/languages/es.mo and b/languages/es.mo differ diff --git a/languages/es.po b/languages/es.po index 54a11bf..74da3f3 100644 --- a/languages/es.po +++ b/languages/es.po @@ -4,16 +4,16 @@ msgid "" msgstr "" "Project-Id-Version: Neatline\n" -"Report-Msgid-Bugs-To: http://github.com/scholarslab/\n" +"Report-Msgid-Bugs-To: http://github.com/scholarslab/NeatlineFeatures/issues\n" "POT-Creation-Date: 2012-06-25 10:00-0500\n" -"PO-Revision-Date: 2012-07-12 14:17+0000\n" +"PO-Revision-Date: 2013-11-20 13:30+0000\n" "Last-Translator: Jeremy Boggs \n" "Language-Team: Spanish (http://www.transifex.com/projects/p/neatline/language/es/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: es\n" -"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" #: views/shared/coverage.php:28 msgid "Use Map" diff --git a/languages/fi_FI.mo b/languages/fi_FI.mo index 1e3104c..53c7048 100644 Binary files a/languages/fi_FI.mo and b/languages/fi_FI.mo differ diff --git a/languages/fi_FI.po b/languages/fi_FI.po index ebff40f..22b5154 100644 --- a/languages/fi_FI.po +++ b/languages/fi_FI.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Neatline\n" -"Report-Msgid-Bugs-To: http://github.com/scholarslab/\n" +"Report-Msgid-Bugs-To: http://github.com/scholarslab/NeatlineFeatures/issues\n" "POT-Creation-Date: 2012-06-25 10:00-0500\n" "PO-Revision-Date: 2012-06-25 15:51+0000\n" "Last-Translator: FULL NAME \n" diff --git a/languages/fr.mo b/languages/fr.mo index 49a5185..eb2e967 100644 Binary files a/languages/fr.mo and b/languages/fr.mo differ diff --git a/languages/fr.po b/languages/fr.po index 4431b76..bc835c8 100644 --- a/languages/fr.po +++ b/languages/fr.po @@ -1,20 +1,20 @@ # Translation for the Neatline Time plugin for Omeka. # # Translators: -# , 2012. +# katinalynn , 2012 msgid "" msgstr "" "Project-Id-Version: Neatline\n" -"Report-Msgid-Bugs-To: http://github.com/scholarslab/\n" +"Report-Msgid-Bugs-To: http://github.com/scholarslab/NeatlineFeatures/issues\n" "POT-Creation-Date: 2012-06-25 10:00-0500\n" -"PO-Revision-Date: 2012-08-01 14:35+0000\n" +"PO-Revision-Date: 2013-11-20 13:30+0000\n" "Last-Translator: katinalynn \n" "Language-Team: French (http://www.transifex.com/projects/p/neatline/language/fr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: fr\n" -"Plural-Forms: nplurals=2; plural=(n > 1)\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" #: views/shared/coverage.php:28 msgid "Use Map" diff --git a/languages/it_IT.mo b/languages/it_IT.mo index 78981db..7be7290 100644 Binary files a/languages/it_IT.mo and b/languages/it_IT.mo differ diff --git a/languages/it_IT.po b/languages/it_IT.po index 4900ebc..e78bd20 100644 --- a/languages/it_IT.po +++ b/languages/it_IT.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Neatline\n" -"Report-Msgid-Bugs-To: http://github.com/scholarslab/\n" +"Report-Msgid-Bugs-To: http://github.com/scholarslab/NeatlineFeatures/issues\n" "POT-Creation-Date: 2012-06-25 10:00-0500\n" "PO-Revision-Date: 2012-06-25 15:51+0000\n" "Last-Translator: FULL NAME \n" diff --git a/languages/nl_BE.mo b/languages/nl_BE.mo index 7e208d7..8750733 100644 Binary files a/languages/nl_BE.mo and b/languages/nl_BE.mo differ diff --git a/languages/nl_BE.po b/languages/nl_BE.po index 6ca650f..f5fdab9 100644 --- a/languages/nl_BE.po +++ b/languages/nl_BE.po @@ -5,9 +5,9 @@ msgid "" msgstr "" "Project-Id-Version: Neatline\n" -"Report-Msgid-Bugs-To: http://github.com/scholarslab/\n" +"Report-Msgid-Bugs-To: http://github.com/scholarslab/NeatlineFeatures/issues\n" "POT-Creation-Date: 2012-06-25 10:00-0500\n" -"PO-Revision-Date: 2013-06-23 16:28+0000\n" +"PO-Revision-Date: 2013-11-20 13:30+0000\n" "Last-Translator: Sam Alloing \n" "Language-Team: Dutch (Belgium) (http://www.transifex.com/projects/p/neatline/language/nl_BE/)\n" "MIME-Version: 1.0\n" diff --git a/languages/pt_BR.mo b/languages/pt_BR.mo index 090d23a..12098c8 100644 Binary files a/languages/pt_BR.mo and b/languages/pt_BR.mo differ diff --git a/languages/pt_BR.po b/languages/pt_BR.po index 5600864..ebc30dc 100644 --- a/languages/pt_BR.po +++ b/languages/pt_BR.po @@ -1,14 +1,14 @@ # Translation for the Neatline Time plugin for Omeka. # # Translators: -# tamiel, 2014 +# Tel, 2014 msgid "" msgstr "" "Project-Id-Version: Neatline\n" "Report-Msgid-Bugs-To: http://github.com/scholarslab/NeatlineFeatures/issues\n" "POT-Creation-Date: 2012-06-25 10:00-0500\n" "PO-Revision-Date: 2014-01-09 17:43+0000\n" -"Last-Translator: tamiel\n" +"Last-Translator: Tel\n" "Language-Team: Portuguese (Brazil) (http://www.transifex.com/projects/p/neatline/language/pt_BR/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff --git a/languages/ru.mo b/languages/ru.mo index cf6558c..7e35e24 100644 Binary files a/languages/ru.mo and b/languages/ru.mo differ diff --git a/languages/ru.po b/languages/ru.po index fe576e0..b97e69d 100644 --- a/languages/ru.po +++ b/languages/ru.po @@ -1,20 +1,20 @@ # Translation for the Neatline Time plugin for Omeka. # # Translators: -# , 2012. +# Oguljan , 2012 msgid "" msgstr "" "Project-Id-Version: Neatline\n" -"Report-Msgid-Bugs-To: http://github.com/scholarslab/\n" +"Report-Msgid-Bugs-To: http://github.com/scholarslab/NeatlineFeatures/issues\n" "POT-Creation-Date: 2012-06-25 10:00-0500\n" -"PO-Revision-Date: 2012-08-24 17:15+0000\n" +"PO-Revision-Date: 2013-11-20 13:30+0000\n" "Last-Translator: Oguljan \n" "Language-Team: Russian (http://www.transifex.com/projects/p/neatline/language/ru/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: ru\n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #: views/shared/coverage.php:28 msgid "Use Map" diff --git a/models/Table/Table_NeatlineFeature.php b/models/Table/Table_NeatlineFeature.php index b333efb..cc640ee 100644 --- a/models/Table/Table_NeatlineFeature.php +++ b/models/Table/Table_NeatlineFeature.php @@ -365,7 +365,7 @@ private function _param($params, $key, $default=null) { $value = $default; try { - if (array_key_exists($key, $params)) { + if (array_key_exists($key, $params) && !empty($params[$key])) { $value = $params[$key]; } } catch (Exception $e) { diff --git a/package.json b/package.json index 3fd1005..7f4563a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name" : "neatlinefeatures", - "version" : "2.0.2", + "version" : "2.0.3", "dependencies" : { "inireader" : "~0.2.4", "iniparser" : "~1.0.5", diff --git a/plugin.ini b/plugin.ini index ef83f98..58cb1e3 100644 --- a/plugin.ini +++ b/plugin.ini @@ -8,7 +8,7 @@ author="Scholars' Lab" description="Allows administrators to draw things on maps and associate them with an Omeka item." link="https://github.com/scholarslab/NeatlineFeatures" support_link="https://github.com/scholarslab/NeatlineFeatures/issues" -version="2.0.2" +version="2.0.3" tags="geospatial" omeka_minimum_version="2.0" omeka_tested_up_to="2.0" diff --git a/version b/version index f93ea0c..6acdb44 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.0.2 \ No newline at end of file +2.0.3 \ No newline at end of file diff --git a/views/shared/javascripts/featureswidget.js b/views/shared/javascripts/featureswidget.js index f87c1c4..004743a 100644 --- a/views/shared/javascripts/featureswidget.js +++ b/views/shared/javascripts/featureswidget.js @@ -1,10 +1,10 @@ -// Generated by CoffeeScript 1.7.1 +// Generated by CoffeeScript 1.6.3 (function() { var __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; (function($) { - var BaseWidget, EditWidget, ViewWidget, derefid, poll, stripFirstLine, to_s; + var BaseWidget, EditWidget, ViewWidget, derefid, poll, stripFirstLine, to_s, _ref, _ref1; derefid = function(id) { if (id[0] === '#') { return id.slice(1, id.length); @@ -93,7 +93,8 @@ __extends(ViewWidget, _super); function ViewWidget() { - return ViewWidget.__super__.constructor.apply(this, arguments); + _ref = ViewWidget.__super__.constructor.apply(this, arguments); + return _ref; } ViewWidget.prototype.init = function() { @@ -135,7 +136,8 @@ __extends(EditWidget, _super); function EditWidget() { - return EditWidget.__super__.constructor.apply(this, arguments); + _ref1 = EditWidget.__super__.constructor.apply(this, arguments); + return _ref1; } EditWidget.prototype.init = function() { @@ -193,16 +195,13 @@ }; EditWidget.prototype.captureEditor = function() { - this.fields.mapon.change((function(_this) { - return function() { - return _this._onUseMap(); - }; - })(this)); - return this.fields.html.change((function(_this) { - return function() { - return _this._updateTinyEvents(); - }; - })(this)); + var _this = this; + this.fields.mapon.change(function() { + return _this._onUseMap(); + }); + return this.fields.html.change(function() { + return _this._updateTinyEvents(); + }); }; EditWidget.prototype.populate = function(values) { @@ -225,20 +224,17 @@ }; EditWidget.prototype.wire = function() { - var updateFields; - updateFields = (function(_this) { - return function() { - return _this.updateFields(_this.fields.free.val()); - }; - })(this); + var updateFields, + _this = this; + updateFields = function() { + return _this.updateFields(_this.fields.free.val()); + }; this.fields.free.change(updateFields); - this.map.bind('featureadded.nlfeatures', updateFields).bind('update.nlfeatures', updateFields).bind('delete.nlfeatures', updateFields).bind('refresh.nlfeatures', updateFields).bind('saveview.nlfeatures', (function(_this) { - return function() { - _this.map.nlfeatures('saveViewport'); - _this.updateFields(); - return _this.flash('View Saved...'); - }; - })(this)); + this.map.bind('featureadded.nlfeatures', updateFields).bind('update.nlfeatures', updateFields).bind('delete.nlfeatures', updateFields).bind('refresh.nlfeatures', updateFields).bind('saveview.nlfeatures', function() { + _this.map.nlfeatures('saveViewport'); + _this.updateFields(); + return _this.flash('View Saved...'); + }); return this.map.nlfeatures('getMap').events.on({ changebaselayer: updateFields }); @@ -253,25 +249,23 @@ }; EditWidget.prototype.showMap = function() { - var tools; + var tools, + _this = this; tools = this.fields.map.children('button'); - return tools.hide('normal', (function(_this) { - return function() { - return _this.fields.map_container.slideDown('normal', function() { - return tools.fadeIn(); - }); - }; - })(this)); + return tools.hide('normal', function() { + return _this.fields.map_container.slideDown('normal', function() { + return tools.fadeIn(); + }); + }); }; EditWidget.prototype.hideMap = function() { - var tools; + var tools, + _this = this; tools = this.fields.map.children('button'); - return tools.fadeOut('normal', (function(_this) { - return function() { - return _this.fields.map_container.slideUp(); - }; - })(this)); + return tools.fadeOut('normal', function() { + return _this.fields.map_container.slideUp(); + }); }; EditWidget.prototype._onUseMap = function() { @@ -284,25 +278,22 @@ }; EditWidget.prototype._updateTinyEvents = function() { - var freeId; + var freeId, + _this = this; if (this.usesHtml()) { freeId = this.fields.free.attr('id'); return poll(function() { return tinymce.get(freeId) != null; - }, (function(_this) { - return function() { - _this.fields.free.unbind('change'); - return tinymce.get(freeId).onChange.add(function() { - return _this.updateFields(); - }); - }; - })(this)); - } else { - return this.fields.free.change((function(_this) { - return function() { + }, function() { + _this.fields.free.unbind('change'); + return tinymce.get(freeId).onChange.add(function() { return _this.updateFields(); - }; - })(this)); + }); + }); + } else { + return this.fields.free.change(function() { + return _this.updateFields(); + }); } }; @@ -332,16 +323,15 @@ }; EditWidget.prototype.flash = function(msg, delay) { + var _this = this; if (delay == null) { delay = 5000; } - return this.fields.flash.html(msg).fadeIn('slow', (function(_this) { - return function() { - return setTimeout(function() { - return _this.fields.flash.fadeOut('slow'); - }, delay); - }; - })(this)); + return this.fields.flash.html(msg).fadeIn('slow', function() { + return setTimeout(function() { + return _this.fields.flash.fadeOut('slow'); + }, delay); + }); }; return EditWidget; @@ -388,11 +378,11 @@ } id_prefix = deref(id_prefix); parts = (function() { - var _i, _len, _ref, _results; - _ref = id_prefix.split('-'); + var _i, _len, _ref2, _results; + _ref2 = id_prefix.split('-'); _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - p = _ref[_i]; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + p = _ref2[_i]; if (p.length > 0) { _results.push(p); } @@ -422,4 +412,6 @@ }).call(this); -//# sourceMappingURL=featureswidget.map +/* +//@ sourceMappingURL=featureswidget.map +*/ diff --git a/views/shared/javascripts/neatline-features-2.0.2-min.js b/views/shared/javascripts/neatline-features-2.0.3-min.js similarity index 67% rename from views/shared/javascripts/neatline-features-2.0.2-min.js rename to views/shared/javascripts/neatline-features-2.0.3-min.js index 2ad4146..f6f701f 100644 --- a/views/shared/javascripts/neatline-features-2.0.2-min.js +++ b/views/shared/javascripts/neatline-features-2.0.3-min.js @@ -1 +1 @@ -!function(t,e){t.widget("nlfeatures.nlfeatures",{options:{markup:{toolbar_class:"olControlEditingToolbar",id_prefix:"nlf-"},animation:{fade_duration:500},styles:{default_opacity:.4,default_color:"#ffb80e",select_point_radius:10,select_stroke_color:"#ea3a3a",point_graphic:{normal:e,selected:e}},map:{boundingBox:"90,0,-90,360",center:e,zoom:e,epsg:e,wmsAddress:e,raw_update:e},mode:null,json:null,zoom:null,center:null},_create:function(){this._instantiateOpenLayers(),this._currentVectorLayers=[],this._currentEditItem=null,this._currentEditLayer=null,this.clickedFeature=null,this.idToLayer={},this.requestData=null,"undefined"!=typeof this.options.json&&null!==this.options.json?(this.loadLocalData([this.options.json]),this.setViewport(),"edit"===this.options.mode&&this.editJson(this.options.json,!0)):this.loadData()},_instantiateOpenLayers:function(){OpenLayers.IMAGE_RELOAD_ATTEMTPS=3,OpenLayers.Util.onImageLoadErrorColor="transparent",OpenLayers.ImgPath="http://js.mapbox.com/theme/dark/";var t,n,i=!0;OpenLayers.IMAGE_RELOAD_ATTEMPTS=5,OpenLayers.DOTS_PER_INCH=25.4/.28,format=i?"image/png8":"image/png",this.options.map.boundingBox===e?t=new OpenLayers.Bounds:(n=this.options.map.boundingBox.split(","),t=new OpenLayers.Bounds(parseFloat(n[0]),parseFloat(n[1]),parseFloat(n[2]),parseFloat(n[3])));var o=this.options.map.epsg!==e?this.options.map.epsg[0]:"EPSG:4326",s=[new OpenLayers.Control.Attribution,new OpenLayers.Control.Navigation,new OpenLayers.Control.PanZoomBar];"edit"===this.options.mode&&(s=s.concat([new OpenLayers.Control.MousePosition,new OpenLayers.Control.LayerSwitcher]));var r={controls:s,maxExtent:t,maxResolution:"auto",projection:o,units:"m"};if(this.map=new OpenLayers.Map(this.element.attr("id"),r),this.options.map.wmsAddress!==e?this.baseLayer=new OpenLayers.Layer.WMS(this.options.name,this.options.map.wmsAddress,{LAYERS:this.options.map.layers,STYLES:"",format:"image/jpeg",tiled:!i,tilesOrigin:this.map.maxExtent.left+","+this.map.maxExtent.bottom},{buffer:0,displayOutsideMaxExtent:!0,isBaseLayer:!0}):(this.baseLayers=this._getBaseLayers(),this.baseLayer=this.baseLayers[this.options.base_layer]!==e?this.baseLayers[this.options.base_layer]:this.baseLayers.osm),this.map.addLayers([this.baseLayers.osm,this.baseLayers.gphy,this.baseLayers.gmap,this.baseLayers.ghyb,this.baseLayers.gsat]),this.baseLayers.swc!==e&&this.map.addLayers([this.baseLayers.stn,this.baseLayers.str,this.baseLayers.swc]),this.map.setBaseLayer(this.baseLayer),this.exists(this.options.default_map_bounds)&&(n=this.options.default_map_bounds.split(","),t=new OpenLayers.Bounds(parseFloat(n[0]),parseFloat(n[1]),parseFloat(n[2]),parseFloat(n[3]))),this.options.map.center!==e){var a=this.options.map.zoom===e?3:this.options.map.zoom,l=new OpenLayers.LonLat(this.options.map.center[0],this.options.map.center[1]);this.map.setCenter(l,a)}else this.map.zoomToExtent(t)},getMap:function(){return this.map},_getBaseLayers:function(){var t={};if(t.gphy=new OpenLayers.Layer.Google("Google Physical",{type:google.maps.MapTypeId.TERRAIN}),t.gmap=new OpenLayers.Layer.Google("Google Streets",{numZoomLevels:20}),t.ghyb=new OpenLayers.Layer.Google("Google Hybrid",{type:google.maps.MapTypeId.HYBRID,numZoomLevels:20}),t.gsat=new OpenLayers.Layer.Google("Google Satellite",{type:google.maps.MapTypeId.SATELLITE,numZoomLevels:22}),t.osm=new OpenLayers.Layer.OSM,OpenLayers.Layer.Stamen!==e){var n='Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA.';t.swc=new OpenLayers.Layer.Stamen("Stamen Watercolor",{provider:"watercolor",attribution:n,tileOptions:{crossOriginKeyword:null}}),t.stn=new OpenLayers.Layer.Stamen("Stamen Toner",{provider:"toner",attribution:n,tileOptions:{crossOriginKeyword:null}}),t.str=new OpenLayers.Layer.Stamen("Stamen Terrain",{provider:"terrain",attribution:n,tileOptions:{crossOriginKeyword:null}})}return t},loadData:function(){var n=this;this._resetData(),this.exists(this.requestData)&&this.requestData.abort(),this.options.dataSources!==e&&this.options.dataSources.maps!==e&&(this.requestData=t.ajax({url:this.options.dataSources.map,dataType:"json",success:function(t){n._buildVectorLayers(t),n._addClickControls(),n.exists(n._currentEditItem)&&n.editJson(n._currentEditItem,!0)}}))},loadLocalData:function(t){this._resetData(),this._buildVectorLayers(t),"edit"===this.options.mode&&this._addClickControls()},_resetData:function(){var e=this;this._removeControls(),t.each(this._currentVectorLayers,function(t,n){e.map.removeLayer(n),n.destroy()}),this._currentVectorLayers=[],this.idToLayer={}},_buildVectorLayers:function(n){var i=this,o=!1;this.idToLayer={},this.layerToId={},t.each(n,function(n,s){var r=s.id,a=""!==s.color?s.color:i.options.styles.default_color,l=i._getStyleMap(a),u=new OpenLayers.Layer.Vector(s.title,{styleMap:l});if(null!==s.geo&&s.geo!==e){var d=new OpenLayers.Format.KML,p=d.read(s.geo);if(0===p.length){var c=new OpenLayers.Format.WKT;t.each(s.geo.split("|"),function(t,n){if(c.read(n)!==e){var i=new OpenLayers.Geometry.fromWKT(n),o=new OpenLayers.Feature.Vector(i);p.push(o)}}),o=p.length>0}p.length>0&&u.addFeatures(p)}u.setMap(i.map),i.idToLayer[r]=u,i.layerToId[u.id]=r,i._currentVectorLayers.push(u),i.map.addLayer(u)}),o&&setTimeout(function(){i.element.trigger("refresh.nlfeatures")},250)},selectFeature:function(t){this.isFocusLocked()||(this.modifyFeatures.selectFeature(t),this.clickControl.highlight(t),this.listenToFeature(t),this.clickedFeature=t,this.element.trigger("select.nlfeatures",t))},getFeatureElement:function(e){var n;return n=("#"+e.geometry.id).replace(/\./g,"\\."),t(n)},listenToFeature:function(t){var e,n,i;e=t.id,n=this,i=this.getFeatureElement(t),i.on({mousedown:function(){n.lockFocus(t)},mouseup:function(){n.unlockFocus(t)}})},unlistenToFeature:function(t,n){var i;i=this,(null===n||n===e)&&(n=this.getFeatureElement(t)),n.off("mouseup").off("mousedown")},deselectFeature:function(t,n){(null===t||t===e)&&(t=this.clickedFeature),(!this.isFocusLocked(t)||n)&&(this.clickControl.unhighlight(t),this.modifyFeatures.unselectFeature(t),this.unlistenToFeature(t),this.resetModifyFeatures(),t.nlfeatures&&(t.nlfeatures.focusLocked=!1),t===this.clickedFeature&&(this.clickedFeature=null),this.element.trigger("deselect.nlfeatures",t))},lockFocus:function(t){(null===t||t===e)&&(t=this.clickedFeature),null!==t&&t!==e&&(null===t.nlfeatures||t.nlfeatures===e?t.nlfeatures={focusLocked:!0}:t.nlfeatures.focusLocked=!0)},unlockFocus:function(t){(null===t||t===e)&&(t=this.clickedFeature),null!==t&&t!==e&&null!==t.nlfeatures&&t.nlfeatures!==e&&(t.nlfeatures.focusLocked=!1)},isFocusLocked:function(t){return(null===t||t===e)&&(t=this.clickedFeature),null!==t&&t!==e&&null!==t.nlfeatures&&t.nlfeatures!==e&&t.nlfeatures.focusLocked},_addClickControls:function(){var t=this;this._removeControls(),this.clickControl=new OpenLayers.Control.SelectFeature(this._currentVectorLayers,{hover:!0,highlightOnly:!0,overFeature:function(n){(null===n.geometry.parent||n.geometry.parent===e)&&(t.modifyFeatures!==e&&null!==t.clickedFeature&&t.clickedFeature!==e&&n.id!==t.clickedFeature.id&&t.deselectFeature(),t.modifyFeatures===e||null!==t.clickedFeature&&t.clickedFeature!==e&&n.id===t.clickedFeature.id||t.selectFeature(n))},outFeature:function(){return!1}}),this.map.addControl(this.clickControl),this.clickControl.activate(),this.map.events.register("click",this.map,function(){null!==t.clickedFeature&&t.clickedFeature!==e&&t.deselectFeature(t.clickedFeature,!0)})},_removeControls:function(){this.modifyFeatures!==e&&(this.map.removeControl(this.modifyFeatures),this.modifyFeatures.destroy(),delete this.modifyFeatures),this.editToolbar!==e&&(this.map.removeControl(this.editToolbar),this.editToolbar.destroy(),delete this.editToolbar),this.clickControl!==e&&(this.map.removeControl(this.clickControl),this.clickControl.destroy(),delete this.clickControl),this.highlightControl!==e&&(this.map.removeControl(this.highlightControl),this.highlightControl.destroy(),delete this.highlightControl)},edit:function(t,e){var n={id:t.attr("recordid"),name:t.find("span.item-title-text").text()};this.editJson(n,e)},editJson:function(n,i){var o=this;this.highlightControl!==e&&this.highlightControl.deactivate();var s=n.id;if(this._currentEditLayer=this.idToLayer[s],this._currentEditId=s,this._currentEditItem=n,!this._currentEditLayer){var r=n.name;this._currentEditLayer=new OpenLayers.Layer.Vector(r),this.map.addLayer(this._currentEditLayer),this._currentEditLayer.setMap(this.map),this._currentVectorLayers.push(this._currentEditLayer),this.idToLayer[s]=this._currentEditLayer,this.layerToId[this._currentEditLayer.id]=s}var a=[new OpenLayers.Control.Navigation,new OpenLayers.Control.DrawFeature(this._currentEditLayer,OpenLayers.Handler.Path,{displayClass:"olControlDrawFeaturePath",featureAdded:function(){o.element.trigger("featureadded.nlfeatures")}}),new OpenLayers.Control.DrawFeature(this._currentEditLayer,OpenLayers.Handler.Point,{displayClass:"olControlDrawFeaturePoint",featureAdded:function(){o.element.trigger("featureadded.nlfeatures")}}),new OpenLayers.Control.DrawFeature(this._currentEditLayer,OpenLayers.Handler.Polygon,{displayClass:"olControlDrawFeaturePolygon",featureAdded:function(){o.element.trigger("featureadded.nlfeatures")}})];this.modifyFeatures=new OpenLayers.Control.ModifyFeature(this._currentEditLayer,{onModification:function(){o.element.trigger("featureadded.nlfeatures")},standalone:!0}),this.editToolbar=new OpenLayers.Control.Panel({defaultControl:a[0],displayClass:this.options.markup.toolbar_class}),this.editToolbar.addControls(a),this.map.addControl(this.editToolbar),this.map.addControl(this.modifyFeatures),this.modifyFeatures.activate(),this.element.editfeatures({markup:{id_prefix:this.options.markup.id_prefix}}),this.element.bind({"update.nlfeatures":function(t,e){o.modifyFeatures.mode=OpenLayers.Control.ModifyFeature.RESHAPE,e.rotate&&(o.modifyFeatures.mode|=OpenLayers.Control.ModifyFeature.ROTATE),e.scale&&(o.modifyFeatures.mode|=OpenLayers.Control.ModifyFeature.RESIZE),e.drag&&(o.modifyFeatures.mode|=OpenLayers.Control.ModifyFeature.DRAG),(e.drag||e.rotate)&&(o.modifyFeatures.mode&=-OpenLayers.Control.ModifyFeature.RESHAPE);var n=o.modifyFeatures.feature;o.exists(n)&&(o.modifyFeatures.unselectFeature(n),o.modifyFeatures.selectFeature(n))},"lockfocus.nlfeatures":function(){o.lockFocus()},"unlockfocus.nlfeatures":function(){o.unlockFocus()},"delete.nlfeatures":function(){if(o.modifyFeatures.feature){var t=o.modifyFeatures.feature;o.clickedFeature=null,o.modifyFeatures.unselectFeature(t),o._currentEditLayer.destroyFeatures([t])}}}),i?t("."+this.options.markup.toolbar_class).css("opacity",1):(this.element.editfeatures("showButtons",i),t("."+this.options.markup.toolbar_class).animate({opacity:1},this.options.animation.fade_duration)),this.options.map.raw_update!==e&&(this.options.map.raw_update,this.element.bind({"featureadded.nlfeatures":function(){o.updateRaw()},"update.nlfeatures":function(){o.updateRaw()},"delete.nlfeatures":function(){o.updateRaw()}}));var l=!1;t.each(this._currentEditLayer.features,function(t,e){e==o.clickedFeature&&(l=!0)}),l&&this.modifyFeatures.selectFeature(this.clickedFeature)},resetModifyFeatures:function(){this.modifyFeatures.mode=OpenLayers.Control.ModifyFeature.RESHAPE},editJsonItem:function(t){this.loadLocalData([t]),this.setViewport(),this.editJson(t,!0)},setViewport:function(){this.viewportOptionsValid()?this._setViewportFromOptions():this._setViewportFromData()},viewportOptionsValid:function(){var t=!0;return t=t&&null!==this.options.zoom&&this.options.zoom,t=t&&this.options.zoom>0,t=t&&null!==this.options.center&&this.options.center!==e,t=t&&null!==this.options.center.lon&&this.options.center.lon!==e,t=t&&null!==this.options.center.lat&&this.options.center.lat!==e,t=t&&!isNaN(parseFloat(this.options.center.lon)),t=t&&!isNaN(parseFloat(this.options.center.lat))},_setViewportFromOptions:function(){var t,n,i=this.options.zoom,o=this.options.center,s=new OpenLayers.LonLat(o.lon,o.lat);null!==o.srs&&o.srs!==e&&(n=new OpenLayers.Projection(o.srs),t=this.map.getProjectionObject(),s=s.transform(n,t)),this.map.setCenter(s,i,!1,!1)},_setViewportFromData:function(){var t,e,n,i,o,s,r,a,l,u;for(t=this,l=new OpenLayers.Bounds,e=0,i=this._currentVectorLayers.length,n=0;i>n;n++)for(o=this._currentVectorLayers[n],r=o.features.length,s=0;r>s;s++)e++,a=o.features[s].geometry,l.extend(a.getBounds());0===e?(u=new OpenLayers.Control.Geolocate({bind:!0,watch:!1}),u.events.on({locationfailed:function(){t.map.setCenter(new OpenLayers.LonLat(-8738850.21367,4584105.47978),3,!1,!1)}}),this.map.addControl(u),this.map.zoomTo(3),u.activate()):this.map.zoomToExtent(l,!1)},updateRaw:function(){var t=this.options.map.raw_update;if(this.exists(t)){var e=this.getWktForSave();e=e.replace(/\|/g,"|\n"),t.val(e)}},endEditWithoutSave:function(e,n){var i=t("."+this.options.markup.toolbar_class).clone();this.modifyFeatures.unselectFeature(this.clickedFeature),this.map.removeControl(this.modifyFeatures),this.map.removeControl(this.editToolbar),n||(this.element.editfeatures("hideButtons"),this.element.append(i),i.animate({opacity:0},this.options.animation.fade_duration,function(){i.remove()})),this._addClickControls(),0===this._currentEditLayer.features.length&&(this.map.removeLayer(this._currentEditLayer),this._currentVectorLayers.remove(this._currentEditLayer),delete this.idToLayer[e],delete this.layerToId[this._currentEditLayer.id],this._currentEditLayer=null),this._currentEditItem=null},getBaseLayerCode:function(){var t,e,n,i,o,s;for(s=this.map.baseLayer.name,n=null,i=["osm","gphy","gmap","ghyb","gsat","swc","stn","str"],o=0,e=i.length;e>o;o++)if(t=i[o],s===this.baseLayers[t].name){n=t;break}return n},getWktForSave:function(){var t=[];return this._getFeatures(function(e,n){t.push(n.geometry.toString())}),t.join("|")},getKml:function(){var t=new OpenLayers.Format.KML,e=[];return this._getFeatures(function(t,n){e.push(n)}),t.write(e)},_getFeatures:function(e){var n=this.exists(this.clickedFeature);n&&this.modifyFeatures.unselectFeature(this.clickedFeature),t.each(this._currentEditLayer.features,e),n&&this.modifyFeatures.selectFeature(this.clickedFeature)},getExtentForSave:function(){return this.map.getExtent().toString()},getZoomForSave:function(){return this.map.getZoom()},zoomToItemVectors:function(t){var e=this.idToLayer[t];this.exists(e)&&e.features.length>0&&this.map.zoomToExtent(e.getDataExtent())},_getStyleMap:function(t){return new OpenLayers.StyleMap({"default":new OpenLayers.Style({fillColor:t,fillOpacity:this.options.styles.default_opacity,strokeColor:t,strokeWidth:1,pointRadius:10}),select:new OpenLayers.Style({fillColor:t,fillOpacity:this.options.styles.default_opacity,strokeColor:this.options.styles.select_stroke_color,strokeWidth:2,pointRadius:10})})},setItemColor:function(t){this._currentEditLayer.styleMap=this._getStyleMap(t),this._currentEditLayer.redraw()},getCenterLonLat:function(){var t=new OpenLayers.Projection("EPSG:4326"),e=this.map.getProjectionObject();return this.map.getCenter().transform(e,t)},setCenterLonLat:function(t,e){var n=new OpenLayers.LonLat(t,e),i=new OpenLayers.Projection("EPSG:4326"),o=this.map.getProjectionObject();return this.map.panTo(n.transform(i,o))},setZoom:function(t){return this.map.zoomTo(t)},hasPoint:function(){return this.hasFeature("OpenLayers.Geometry.Point")},hasLine:function(){return this.hasFeature("OpenLayers.Geometry.LineString")},hasPolygon:function(){return this.hasFeature("OpenLayers.Geometry.Polygon")},hasFeature:function(e){return result=!1,t.each(this._currentVectorLayers,function(n,i){t.each(i.features,function(t,n){result=result||n.geometry.CLASS_NAME==e})}),result},exists:function(t){return"undefined"!=typeof t&&null!==t},getSavedZoom:function(){return this.options.zoom},getSavedCenter:function(){return this.options.center},saveViewport:function(){var t=this.map.getCenter(),e=this.map.getZoom();this.options.zoom=e,this.options.center={lon:t.lon,lat:t.lat}}})}(jQuery),function(t){t.widget("nlfeatures.editfeatures",{options:{markup:{geo_edit_class:"geo-edit",id_prefix:"nlf-"},animation:{fade_duration:500}},_createEditButton:function(e,n,i){var o=n.split(" ",1)[0];return t('")},_create:function(){var t=this,e=this.options.markup.id_prefix;"#"==e.charAt(0)&&(e=e.substr(1)),this.scaleButton=this._createEditButton(e,"scale-button radio-button sel-button","Scale"),this.rotateButton=this._createEditButton(e,"rotate-button radio-button sel-button","Rotate"),this.dragButton=this._createEditButton(e,"drag-button radio-button sel-button","Drag"),this.deleteButton=this._createEditButton(e,"delete-button sel-button","Delete"),this.viewportButton=this._createEditButton(e,"viewport-button","Save View"),this.element.append(this.dragButton),this.element.append(this.rotateButton),this.element.append(this.scaleButton),this.element.append(this.deleteButton),this.element.append(this.viewportButton),this.radioButtons=this.element.children("button.radio-button"),this.selectionButtons=this.element.children("button.sel-button"),this.radioButtons.data("activated",!1),this.disableAll(),this.element.bind({"select.nlfeatures":function(){t.enableAll()},"deselect.nlfeatures":function(){t.disableAll()}}),this.dragButton.bind({mousedown:function(){t.toggleButton(t.dragButton),t.triggerUpdateEvent()},click:function(t){t.preventDefault()}}),this.scaleButton.bind({mousedown:function(){t.toggleButton(t.scaleButton),t.triggerUpdateEvent()},click:function(t){t.preventDefault()}}),this.rotateButton.bind({mousedown:function(){t.toggleButton(t.rotateButton),t.triggerUpdateEvent()},click:function(t){t.preventDefault()}}),this.deleteButton.bind({mousedown:function(){t.element.trigger("delete.nlfeatures")},click:function(t){t.preventDefault()}}),this.viewportButton.bind({mousedown:function(){t.element.trigger("saveview.nlfeatures")},click:function(t){t.preventDefault()}})},showButtons:function(){this.element.children("button").css({display:"block !important",opacity:0}).stop().animate({opacity:1},this.options.animation.fade_duration),this.deactivateAllButtons()},hideButtons:function(){var t=this.element.children("button");t.stop().animate({opacity:0},this.options.markup.fade_duration,function(){t.css("display","none !important")})},deactivateAllButtons:function(){this.radioButtons.removeClass("primary").data("activated",!1)},disableAll:function(){this.selectionButtons.removeClass("primary").addClass("disabled"),this.selectionButtons.each(function(){this.disabled=!0})},enableAll:function(){this.selectionButtons.removeClass("disabled"),this.selectionButtons.each(function(){this.disabled=!1})},activateButton:function(t){this.deactivateAllButtons(),t.addClass("primary").data("activated",!0),this.element.trigger("lockfocus.nlfeatures")},deactivateButton:function(t){t.removeClass("primary").data("activated",!1),this.element.trigger("unlockfocus.nlfeatures")},toggleButton:function(t){t.data("activated")?this.deactivateButton(t):this.activateButton(t)},triggerUpdateEvent:function(){this.element.trigger("update.nlfeatures",[{drag:this.dragButton.data("activated"),rotate:this.rotateButton.data("activated"),scale:this.scaleButton.data("activated")}])}})}(jQuery),function(){var t={}.hasOwnProperty,e=function(e,n){function i(){this.constructor=e}for(var o in n)t.call(n,o)&&(e[o]=n[o]);return i.prototype=n.prototype,e.prototype=new i,e.__super__=n.prototype,e};!function(t){var n,i,o,s,r,a,l;return s=function(t){return"#"===t[0]?t.slice(1,t.length):t},l=function(t){return null!=t?t.toString():""},r=function(t,e,n,i){var o,s,r;return null==n&&(n=null),null==i&&(i=100),o=0,s=null!=n&&0!==n?function(){return t()||o>=n}:t,r=function(){return s()?e():(o++,setTimeout(r,i))},setTimeout(r,i)},a=function(t){return null!=t?t.substr(t.indexOf("\n")+1):""},n=function(){function e(t){this.widget=t}return e.prototype.$=function(e){return t(e,this.parent)},e.prototype.value=function(){return this.widget.options.values},e.prototype.initMap=function(){var e,n,i,o,s,r,a,l;return this.map=this.fields.map,n=this.value(),i={title:"Coverage",name:"Coverage",id:this.widget.element.attr("id"),geo:null!=(s=null!=n?n.geo:void 0)?s:""},o={mode:this.widget.options.mode,json:i,markup:{id_prefix:this.widget.options.id_prefix}},o.zoom=null!=(r=null!=n?n.zoom:void 0)?r:null,o.center=null!=(a=null!=n?n.center:void 0)?a:null,o.base_layer=null!=(l=null!=n?n.base_layer:void 0)?l:null,e=t.extend(!0,{},this.widget.options.map_options,this.widget.options.values,o),this.map.nlfeatures(e),this.map},e}(),o=function(n){function i(){return i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.init=function(){return this.build(),this.initMap(),this.populate()},i.prototype.build=function(){var e,n,i,o;return e=t(this.widget.element),i=s(this.widget.options.id_prefix),o=t("
"),n=t("
"),e.addClass("nlfeatures").append(o).append(n),this.fields={map:t("#"+i+"map"),free:t("#"+i+"free")},e},i.prototype.populate=function(){var t,e;return t=this.widget.options.values.text,e=a(t),""===e?(this.fields.free.detach(),delete this.fields.free):this.fields.free.html(e)},i}(n),i=function(n){function i(){return i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.init=function(){return this.build(),this.initMap(),this.captureEditor(),this.populate(),this.wire()},i.prototype._buildMap=function(e,n){return t(e).addClass("nlfeatures").addClass("nlfeatures-edit").before('
\n
\n
\n
\n
\n
")},i.prototype._buildInputs=function(e,n,i){return t(e).after("\n\n\n\n\n\n')},i.prototype._buildUseMap=function(e,n,i,o){return t(".use-html",e.parent().parent()).after('')},i.prototype._populateFields=function(e,n){var i;return i=e.parent(),this.fields={map_container:i.find(".map-container"),map:t("#"+n+"map"),map_tools:i.find(".nlfeatures-map-tools"),mapon:t("#"+n+"mapon"),text:t("#"+n+"text"),free:t("#"+n+"free"),html:t("#"+n+"html"),geo:t("#"+n+"geo"),zoom:t("#"+n+"zoom"),center_lon:t("#"+n+"center_lon"),center_lat:t("#"+n+"center_lat"),base_layer:t("#"+n+"base_layer"),flash:i.find(".nlflash")}},i.prototype.build=function(){var e,n,i,o,r;return e=t(this.widget.element),n=s(this.widget.options.id_prefix),i=this.widget.options.name_prefix,o=this.widget.options.labels.html,r=this.widget.options.labels.map,this._buildMap(e,n),this._buildInputs(e,n,i),this._buildUseMap(e,n,i,r),this._populateFields(e,n),this},i.prototype.captureEditor=function(){return this.fields.mapon.change(function(t){return function(){return t._onUseMap()}}(this)),this.fields.html.change(function(t){return function(){return t._updateTinyEvents()}}(this))},i.prototype.populate=function(t){return null==t&&(t=this.widget.options.values),null!=t?(this.fields.html.prop("checked",+t.is_html),this.fields.mapon.prop("checked",+t.is_map),this.fields.geo.val(l(t.geo)),this.fields.zoom.val(l(t.zoom)),null!=t.center&&(this.fields.center_lon.val(l(t.center.lon)),this.fields.center_lat.val(l(t.center.lat))),this.fields.base_layer.val(l(t.base_layer)),this.fields.text.val(l(t.text)),this.fields.free.val(a(t.text))):void 0},i.prototype.wire=function(){var t;return t=function(t){return function(){return t.updateFields(t.fields.free.val())}}(this),this.fields.free.change(t),this.map.bind("featureadded.nlfeatures",t).bind("update.nlfeatures",t).bind("delete.nlfeatures",t).bind("refresh.nlfeatures",t).bind("saveview.nlfeatures",function(t){return function(){return t.map.nlfeatures("saveViewport"),t.updateFields(),t.flash("View Saved...")}}(this)),this.map.nlfeatures("getMap").events.on({changebaselayer:t})},i.prototype.usesHtml=function(){return this.fields.html.prop("checked")},i.prototype.usesMap=function(){return this.fields.mapon.prop("checked")},i.prototype.showMap=function(){var t;return t=this.fields.map.children("button"),t.hide("normal",function(e){return function(){return e.fields.map_container.slideDown("normal",function(){return t.fadeIn()})}}(this))},i.prototype.hideMap=function(){var t;return t=this.fields.map.children("button"),t.fadeOut("normal",function(t){return function(){return t.fields.map_container.slideUp()}}(this))},i.prototype._onUseMap=function(){return this.usesMap()?this.showMap():this.hideMap(),this.updateFields()},i.prototype._updateTinyEvents=function(){var t;return this.usesHtml()?(t=this.fields.free.attr("id"),r(function(){return null!=tinymce.get(t)},function(e){return function(){return e.fields.free.unbind("change"),tinymce.get(t).onChange.add(function(){return e.updateFields()})}}(this))):this.fields.free.change(function(t){return function(){return t.updateFields()}}(this))},i.prototype.updateFields=function(){var t,e,n,i,o;return n=this.map.nlfeatures("getWktForSave"),this.fields.geo.val(n),o=this.map.nlfeatures("getSavedZoom"),null!=o&&this.fields.zoom.val(o),e=this.map.nlfeatures("getSavedCenter"),null!=e&&(this.fields.center_lon.val(e.lon),this.fields.center_lat.val(e.lat)),t=this.map.nlfeatures("getBaseLayerCode"),null!=t&&this.fields.base_layer.val(t),i=this.usesHtml()?tinymce.get(this.fields.free.attr("id")).getContent():this.fields.free.val(),this.fields.text.val(""+n+"|"+o+"|"+(null!=e?e.lon:void 0)+"|"+(null!=e?e.lat:void 0)+"|"+t+"\n"+i)},i.prototype.flash=function(t,e){return null==e&&(e=5e3),this.fields.flash.html(t).fadeIn("slow",function(t){return function(){return setTimeout(function(){return t.fields.flash.fadeOut("slow")},e)}}(this))},i}(n),t.widget("nlfeatures.featurewidget",{options:{mode:"view",id_prefix:null,name_prefix:null,labels:{html:"Use HTML",map:"Use Map"},map_options:{},values:{geo:null,zoom:null,center:null,text:null,is_html:null,is_map:null}},_create:function(){var t,e,n;return t=this.element.attr("id"),null==(e=this.options).id_prefix&&(e.id_prefix="#"+t.substring(0,t.length-"widget".length)),null==(n=this.options).name_prefix&&(n.name_prefix=this._idPrefixToNamePrefix()),this.mode="edit"===this.options.mode?new i(this):new o(this),this.mode.init(),this.options.values.is_map?void 0:this.mode.hideMap()},_idPrefixToNamePrefix:function(t){var e,n,i,o;return null==t&&(t=this.options.id_prefix),t=deref(t),o=function(){var e,n,o,s;for(o=t.split("-"),s=[],e=0,n=o.length;n>e;e++)i=o[e],i.length>0&&s.push(i);return s}(),e=o.shift(),n=function(){var t,e,n;for(n=[],t=0,e=o.length;e>t;t++)i=o[t],n.push("["+i+"]");return n}(),""+e+n.join("")},destroy:function(){return t.Widget.prototype.destroy.call(this)},_setOptions:function(){return t.Widget.prototype._setOption.apply(this,arguments)}})}(jQuery)}.call(this); \ No newline at end of file +!function(t,e){t.widget("nlfeatures.nlfeatures",{options:{markup:{toolbar_class:"olControlEditingToolbar",id_prefix:"nlf-"},animation:{fade_duration:500},styles:{default_opacity:.4,default_color:"#ffb80e",select_point_radius:10,select_stroke_color:"#ea3a3a",point_graphic:{normal:e,selected:e}},map:{boundingBox:"90,0,-90,360",center:e,zoom:e,epsg:e,wmsAddress:e,raw_update:e},mode:null,json:null,zoom:null,center:null},_create:function(){this._instantiateOpenLayers(),this._currentVectorLayers=[],this._currentEditItem=null,this._currentEditLayer=null,this.clickedFeature=null,this.idToLayer={},this.requestData=null,"undefined"!=typeof this.options.json&&null!==this.options.json?(this.loadLocalData([this.options.json]),this.setViewport(),"edit"===this.options.mode&&this.editJson(this.options.json,!0)):this.loadData()},_instantiateOpenLayers:function(){OpenLayers.IMAGE_RELOAD_ATTEMTPS=3,OpenLayers.Util.onImageLoadErrorColor="transparent",OpenLayers.ImgPath="http://js.mapbox.com/theme/dark/";var t,n,i=!0;OpenLayers.IMAGE_RELOAD_ATTEMPTS=5,OpenLayers.DOTS_PER_INCH=25.4/.28,format=i?"image/png8":"image/png",this.options.map.boundingBox===e?t=new OpenLayers.Bounds:(n=this.options.map.boundingBox.split(","),t=new OpenLayers.Bounds(parseFloat(n[0]),parseFloat(n[1]),parseFloat(n[2]),parseFloat(n[3])));var o=this.options.map.epsg!==e?this.options.map.epsg[0]:"EPSG:4326",s=[new OpenLayers.Control.Attribution,new OpenLayers.Control.Navigation,new OpenLayers.Control.PanZoomBar];"edit"===this.options.mode&&(s=s.concat([new OpenLayers.Control.MousePosition,new OpenLayers.Control.LayerSwitcher]));var a={controls:s,maxExtent:t,maxResolution:"auto",projection:o,units:"m"};if(this.map=new OpenLayers.Map(this.element.attr("id"),a),this.options.map.wmsAddress!==e?this.baseLayer=new OpenLayers.Layer.WMS(this.options.name,this.options.map.wmsAddress,{LAYERS:this.options.map.layers,STYLES:"",format:"image/jpeg",tiled:!i,tilesOrigin:this.map.maxExtent.left+","+this.map.maxExtent.bottom},{buffer:0,displayOutsideMaxExtent:!0,isBaseLayer:!0}):(this.baseLayers=this._getBaseLayers(),this.baseLayer=this.baseLayers[this.options.base_layer]!==e?this.baseLayers[this.options.base_layer]:this.baseLayers.osm),this.map.addLayers([this.baseLayers.osm,this.baseLayers.gphy,this.baseLayers.gmap,this.baseLayers.ghyb,this.baseLayers.gsat]),this.baseLayers.swc!==e&&this.map.addLayers([this.baseLayers.stn,this.baseLayers.str,this.baseLayers.swc]),this.map.setBaseLayer(this.baseLayer),this.exists(this.options.default_map_bounds)&&(n=this.options.default_map_bounds.split(","),t=new OpenLayers.Bounds(parseFloat(n[0]),parseFloat(n[1]),parseFloat(n[2]),parseFloat(n[3]))),this.options.map.center!==e){var r=this.options.map.zoom===e?3:this.options.map.zoom,l=new OpenLayers.LonLat(this.options.map.center[0],this.options.map.center[1]);this.map.setCenter(l,r)}else this.map.zoomToExtent(t)},getMap:function(){return this.map},_getBaseLayers:function(){var t={};if(t.gphy=new OpenLayers.Layer.Google("Google Physical",{type:google.maps.MapTypeId.TERRAIN}),t.gmap=new OpenLayers.Layer.Google("Google Streets",{numZoomLevels:20}),t.ghyb=new OpenLayers.Layer.Google("Google Hybrid",{type:google.maps.MapTypeId.HYBRID,numZoomLevels:20}),t.gsat=new OpenLayers.Layer.Google("Google Satellite",{type:google.maps.MapTypeId.SATELLITE,numZoomLevels:22}),t.osm=new OpenLayers.Layer.OSM,OpenLayers.Layer.Stamen!==e){var n='Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA.';t.swc=new OpenLayers.Layer.Stamen("Stamen Watercolor",{provider:"watercolor",attribution:n,tileOptions:{crossOriginKeyword:null}}),t.stn=new OpenLayers.Layer.Stamen("Stamen Toner",{provider:"toner",attribution:n,tileOptions:{crossOriginKeyword:null}}),t.str=new OpenLayers.Layer.Stamen("Stamen Terrain",{provider:"terrain",attribution:n,tileOptions:{crossOriginKeyword:null}})}return t},loadData:function(){var n=this;this._resetData(),this.exists(this.requestData)&&this.requestData.abort(),this.options.dataSources!==e&&this.options.dataSources.maps!==e&&(this.requestData=t.ajax({url:this.options.dataSources.map,dataType:"json",success:function(t){n._buildVectorLayers(t),n._addClickControls(),n.exists(n._currentEditItem)&&n.editJson(n._currentEditItem,!0)}}))},loadLocalData:function(t){this._resetData(),this._buildVectorLayers(t),"edit"===this.options.mode&&this._addClickControls()},_resetData:function(){var e=this;this._removeControls(),t.each(this._currentVectorLayers,function(t,n){e.map.removeLayer(n),n.destroy()}),this._currentVectorLayers=[],this.idToLayer={}},_buildVectorLayers:function(n){var i=this,o=!1;this.idToLayer={},this.layerToId={},t.each(n,function(n,s){var a=s.id,r=""!==s.color?s.color:i.options.styles.default_color,l=i._getStyleMap(r),u=new OpenLayers.Layer.Vector(s.title,{styleMap:l});if(null!==s.geo&&s.geo!==e){var d=new OpenLayers.Format.KML,p=d.read(s.geo);if(0===p.length){var h=new OpenLayers.Format.WKT;t.each(s.geo.split("|"),function(t,n){if(h.read(n)!==e){var i=new OpenLayers.Geometry.fromWKT(n),o=new OpenLayers.Feature.Vector(i);p.push(o)}}),o=p.length>0}p.length>0&&u.addFeatures(p)}u.setMap(i.map),i.idToLayer[a]=u,i.layerToId[u.id]=a,i._currentVectorLayers.push(u),i.map.addLayer(u)}),o&&setTimeout(function(){i.element.trigger("refresh.nlfeatures")},250)},selectFeature:function(t){this.isFocusLocked()||(this.modifyFeatures.selectFeature(t),this.clickControl.highlight(t),this.listenToFeature(t),this.clickedFeature=t,this.element.trigger("select.nlfeatures",t))},getFeatureElement:function(e){var n;return n=("#"+e.geometry.id).replace(/\./g,"\\."),t(n)},listenToFeature:function(t){var e,n,i;e=t.id,n=this,i=this.getFeatureElement(t),i.on({mousedown:function(){n.lockFocus(t)},mouseup:function(){n.unlockFocus(t)}})},unlistenToFeature:function(t,n){var i;i=this,(null===n||n===e)&&(n=this.getFeatureElement(t)),n.off("mouseup").off("mousedown")},deselectFeature:function(t,n){(null===t||t===e)&&(t=this.clickedFeature),(!this.isFocusLocked(t)||n)&&(this.clickControl.unhighlight(t),this.modifyFeatures.unselectFeature(t),this.unlistenToFeature(t),this.resetModifyFeatures(),t.nlfeatures&&(t.nlfeatures.focusLocked=!1),t===this.clickedFeature&&(this.clickedFeature=null),this.element.trigger("deselect.nlfeatures",t))},lockFocus:function(t){(null===t||t===e)&&(t=this.clickedFeature),null!==t&&t!==e&&(null===t.nlfeatures||t.nlfeatures===e?t.nlfeatures={focusLocked:!0}:t.nlfeatures.focusLocked=!0)},unlockFocus:function(t){(null===t||t===e)&&(t=this.clickedFeature),null!==t&&t!==e&&null!==t.nlfeatures&&t.nlfeatures!==e&&(t.nlfeatures.focusLocked=!1)},isFocusLocked:function(t){return(null===t||t===e)&&(t=this.clickedFeature),null!==t&&t!==e&&null!==t.nlfeatures&&t.nlfeatures!==e&&t.nlfeatures.focusLocked},_addClickControls:function(){var t=this;this._removeControls(),this.clickControl=new OpenLayers.Control.SelectFeature(this._currentVectorLayers,{hover:!0,highlightOnly:!0,overFeature:function(n){(null===n.geometry.parent||n.geometry.parent===e)&&(t.modifyFeatures!==e&&null!==t.clickedFeature&&t.clickedFeature!==e&&n.id!==t.clickedFeature.id&&t.deselectFeature(),t.modifyFeatures===e||null!==t.clickedFeature&&t.clickedFeature!==e&&n.id===t.clickedFeature.id||t.selectFeature(n))},outFeature:function(){return!1}}),this.map.addControl(this.clickControl),this.clickControl.activate(),this.map.events.register("click",this.map,function(){null!==t.clickedFeature&&t.clickedFeature!==e&&t.deselectFeature(t.clickedFeature,!0)})},_removeControls:function(){this.modifyFeatures!==e&&(this.map.removeControl(this.modifyFeatures),this.modifyFeatures.destroy(),delete this.modifyFeatures),this.editToolbar!==e&&(this.map.removeControl(this.editToolbar),this.editToolbar.destroy(),delete this.editToolbar),this.clickControl!==e&&(this.map.removeControl(this.clickControl),this.clickControl.destroy(),delete this.clickControl),this.highlightControl!==e&&(this.map.removeControl(this.highlightControl),this.highlightControl.destroy(),delete this.highlightControl)},edit:function(t,e){var n={id:t.attr("recordid"),name:t.find("span.item-title-text").text()};this.editJson(n,e)},editJson:function(n,i){var o=this;this.highlightControl!==e&&this.highlightControl.deactivate();var s=n.id;if(this._currentEditLayer=this.idToLayer[s],this._currentEditId=s,this._currentEditItem=n,!this._currentEditLayer){var a=n.name;this._currentEditLayer=new OpenLayers.Layer.Vector(a),this.map.addLayer(this._currentEditLayer),this._currentEditLayer.setMap(this.map),this._currentVectorLayers.push(this._currentEditLayer),this.idToLayer[s]=this._currentEditLayer,this.layerToId[this._currentEditLayer.id]=s}var r=[new OpenLayers.Control.Navigation,new OpenLayers.Control.DrawFeature(this._currentEditLayer,OpenLayers.Handler.Path,{displayClass:"olControlDrawFeaturePath",featureAdded:function(){o.element.trigger("featureadded.nlfeatures")}}),new OpenLayers.Control.DrawFeature(this._currentEditLayer,OpenLayers.Handler.Point,{displayClass:"olControlDrawFeaturePoint",featureAdded:function(){o.element.trigger("featureadded.nlfeatures")}}),new OpenLayers.Control.DrawFeature(this._currentEditLayer,OpenLayers.Handler.Polygon,{displayClass:"olControlDrawFeaturePolygon",featureAdded:function(){o.element.trigger("featureadded.nlfeatures")}})];this.modifyFeatures=new OpenLayers.Control.ModifyFeature(this._currentEditLayer,{onModification:function(){o.element.trigger("featureadded.nlfeatures")},standalone:!0}),this.editToolbar=new OpenLayers.Control.Panel({defaultControl:r[0],displayClass:this.options.markup.toolbar_class}),this.editToolbar.addControls(r),this.map.addControl(this.editToolbar),this.map.addControl(this.modifyFeatures),this.modifyFeatures.activate(),this.element.editfeatures({markup:{id_prefix:this.options.markup.id_prefix}}),this.element.bind({"update.nlfeatures":function(t,e){o.modifyFeatures.mode=OpenLayers.Control.ModifyFeature.RESHAPE,e.rotate&&(o.modifyFeatures.mode|=OpenLayers.Control.ModifyFeature.ROTATE),e.scale&&(o.modifyFeatures.mode|=OpenLayers.Control.ModifyFeature.RESIZE),e.drag&&(o.modifyFeatures.mode|=OpenLayers.Control.ModifyFeature.DRAG),(e.drag||e.rotate)&&(o.modifyFeatures.mode&=-OpenLayers.Control.ModifyFeature.RESHAPE);var n=o.modifyFeatures.feature;o.exists(n)&&(o.modifyFeatures.unselectFeature(n),o.modifyFeatures.selectFeature(n))},"lockfocus.nlfeatures":function(){o.lockFocus()},"unlockfocus.nlfeatures":function(){o.unlockFocus()},"delete.nlfeatures":function(){if(o.modifyFeatures.feature){var t=o.modifyFeatures.feature;o.clickedFeature=null,o.modifyFeatures.unselectFeature(t),o._currentEditLayer.destroyFeatures([t])}}}),i?t("."+this.options.markup.toolbar_class).css("opacity",1):(this.element.editfeatures("showButtons",i),t("."+this.options.markup.toolbar_class).animate({opacity:1},this.options.animation.fade_duration)),this.options.map.raw_update!==e&&(this.options.map.raw_update,this.element.bind({"featureadded.nlfeatures":function(){o.updateRaw()},"update.nlfeatures":function(){o.updateRaw()},"delete.nlfeatures":function(){o.updateRaw()}}));var l=!1;t.each(this._currentEditLayer.features,function(t,e){e==o.clickedFeature&&(l=!0)}),l&&this.modifyFeatures.selectFeature(this.clickedFeature)},resetModifyFeatures:function(){this.modifyFeatures.mode=OpenLayers.Control.ModifyFeature.RESHAPE},editJsonItem:function(t){this.loadLocalData([t]),this.setViewport(),this.editJson(t,!0)},setViewport:function(){this.viewportOptionsValid()?this._setViewportFromOptions():this._setViewportFromData()},viewportOptionsValid:function(){var t=!0;return t=t&&null!==this.options.zoom&&this.options.zoom,t=t&&this.options.zoom>0,t=t&&null!==this.options.center&&this.options.center!==e,t=t&&null!==this.options.center.lon&&this.options.center.lon!==e,t=t&&null!==this.options.center.lat&&this.options.center.lat!==e,t=t&&!isNaN(parseFloat(this.options.center.lon)),t=t&&!isNaN(parseFloat(this.options.center.lat))},_setViewportFromOptions:function(){var t,n,i=this.options.zoom,o=this.options.center,s=new OpenLayers.LonLat(o.lon,o.lat);null!==o.srs&&o.srs!==e&&(n=new OpenLayers.Projection(o.srs),t=this.map.getProjectionObject(),s=s.transform(n,t)),this.map.setCenter(s,i,!1,!1)},_setViewportFromData:function(){var t,e,n,i,o,s,a,r,l,u;for(t=this,l=new OpenLayers.Bounds,e=0,i=this._currentVectorLayers.length,n=0;i>n;n++)for(o=this._currentVectorLayers[n],a=o.features.length,s=0;a>s;s++)e++,r=o.features[s].geometry,l.extend(r.getBounds());0===e?(u=new OpenLayers.Control.Geolocate({bind:!0,watch:!1}),u.events.on({locationfailed:function(){t.map.setCenter(new OpenLayers.LonLat(-8738850.21367,4584105.47978),3,!1,!1)}}),this.map.addControl(u),this.map.zoomTo(3),u.activate()):this.map.zoomToExtent(l,!1)},updateRaw:function(){var t=this.options.map.raw_update;if(this.exists(t)){var e=this.getWktForSave();e=e.replace(/\|/g,"|\n"),t.val(e)}},endEditWithoutSave:function(e,n){var i=t("."+this.options.markup.toolbar_class).clone();this.modifyFeatures.unselectFeature(this.clickedFeature),this.map.removeControl(this.modifyFeatures),this.map.removeControl(this.editToolbar),n||(this.element.editfeatures("hideButtons"),this.element.append(i),i.animate({opacity:0},this.options.animation.fade_duration,function(){i.remove()})),this._addClickControls(),0===this._currentEditLayer.features.length&&(this.map.removeLayer(this._currentEditLayer),this._currentVectorLayers.remove(this._currentEditLayer),delete this.idToLayer[e],delete this.layerToId[this._currentEditLayer.id],this._currentEditLayer=null),this._currentEditItem=null},getBaseLayerCode:function(){var t,e,n,i,o,s;for(s=this.map.baseLayer.name,n=null,i=["osm","gphy","gmap","ghyb","gsat","swc","stn","str"],o=0,e=i.length;e>o;o++)if(t=i[o],s===this.baseLayers[t].name){n=t;break}return n},getWktForSave:function(){var t=[];return this._getFeatures(function(e,n){t.push(n.geometry.toString())}),t.join("|")},getKml:function(){var t=new OpenLayers.Format.KML,e=[];return this._getFeatures(function(t,n){e.push(n)}),t.write(e)},_getFeatures:function(e){var n=this.exists(this.clickedFeature);n&&this.modifyFeatures.unselectFeature(this.clickedFeature),t.each(this._currentEditLayer.features,e),n&&this.modifyFeatures.selectFeature(this.clickedFeature)},getExtentForSave:function(){return this.map.getExtent().toString()},getZoomForSave:function(){return this.map.getZoom()},zoomToItemVectors:function(t){var e=this.idToLayer[t];this.exists(e)&&e.features.length>0&&this.map.zoomToExtent(e.getDataExtent())},_getStyleMap:function(t){return new OpenLayers.StyleMap({"default":new OpenLayers.Style({fillColor:t,fillOpacity:this.options.styles.default_opacity,strokeColor:t,strokeWidth:1,pointRadius:10}),select:new OpenLayers.Style({fillColor:t,fillOpacity:this.options.styles.default_opacity,strokeColor:this.options.styles.select_stroke_color,strokeWidth:2,pointRadius:10})})},setItemColor:function(t){this._currentEditLayer.styleMap=this._getStyleMap(t),this._currentEditLayer.redraw()},getCenterLonLat:function(){var t=new OpenLayers.Projection("EPSG:4326"),e=this.map.getProjectionObject();return this.map.getCenter().transform(e,t)},setCenterLonLat:function(t,e){var n=new OpenLayers.LonLat(t,e),i=new OpenLayers.Projection("EPSG:4326"),o=this.map.getProjectionObject();return this.map.panTo(n.transform(i,o))},setZoom:function(t){return this.map.zoomTo(t)},hasPoint:function(){return this.hasFeature("OpenLayers.Geometry.Point")},hasLine:function(){return this.hasFeature("OpenLayers.Geometry.LineString")},hasPolygon:function(){return this.hasFeature("OpenLayers.Geometry.Polygon")},hasFeature:function(e){return result=!1,t.each(this._currentVectorLayers,function(n,i){t.each(i.features,function(t,n){result=result||n.geometry.CLASS_NAME==e})}),result},exists:function(t){return"undefined"!=typeof t&&null!==t},getSavedZoom:function(){return this.options.zoom},getSavedCenter:function(){return this.options.center},saveViewport:function(){var t=this.map.getCenter(),e=this.map.getZoom();this.options.zoom=e,this.options.center={lon:t.lon,lat:t.lat}}})}(jQuery),function(t){t.widget("nlfeatures.editfeatures",{options:{markup:{geo_edit_class:"geo-edit",id_prefix:"nlf-"},animation:{fade_duration:500}},_createEditButton:function(e,n,i){var o=n.split(" ",1)[0];return t('")},_create:function(){var t=this,e=this.options.markup.id_prefix;"#"==e.charAt(0)&&(e=e.substr(1)),this.scaleButton=this._createEditButton(e,"scale-button radio-button sel-button","Scale"),this.rotateButton=this._createEditButton(e,"rotate-button radio-button sel-button","Rotate"),this.dragButton=this._createEditButton(e,"drag-button radio-button sel-button","Drag"),this.deleteButton=this._createEditButton(e,"delete-button sel-button","Delete"),this.viewportButton=this._createEditButton(e,"viewport-button","Save View"),this.element.append(this.dragButton),this.element.append(this.rotateButton),this.element.append(this.scaleButton),this.element.append(this.deleteButton),this.element.append(this.viewportButton),this.radioButtons=this.element.children("button.radio-button"),this.selectionButtons=this.element.children("button.sel-button"),this.radioButtons.data("activated",!1),this.disableAll(),this.element.bind({"select.nlfeatures":function(){t.enableAll()},"deselect.nlfeatures":function(){t.disableAll()}}),this.dragButton.bind({mousedown:function(){t.toggleButton(t.dragButton),t.triggerUpdateEvent()},click:function(t){t.preventDefault()}}),this.scaleButton.bind({mousedown:function(){t.toggleButton(t.scaleButton),t.triggerUpdateEvent()},click:function(t){t.preventDefault()}}),this.rotateButton.bind({mousedown:function(){t.toggleButton(t.rotateButton),t.triggerUpdateEvent()},click:function(t){t.preventDefault()}}),this.deleteButton.bind({mousedown:function(){t.element.trigger("delete.nlfeatures")},click:function(t){t.preventDefault()}}),this.viewportButton.bind({mousedown:function(){t.element.trigger("saveview.nlfeatures")},click:function(t){t.preventDefault()}})},showButtons:function(){this.element.children("button").css({display:"block !important",opacity:0}).stop().animate({opacity:1},this.options.animation.fade_duration),this.deactivateAllButtons()},hideButtons:function(){var t=this.element.children("button");t.stop().animate({opacity:0},this.options.markup.fade_duration,function(){t.css("display","none !important")})},deactivateAllButtons:function(){this.radioButtons.removeClass("primary").data("activated",!1)},disableAll:function(){this.selectionButtons.removeClass("primary").addClass("disabled"),this.selectionButtons.each(function(){this.disabled=!0})},enableAll:function(){this.selectionButtons.removeClass("disabled"),this.selectionButtons.each(function(){this.disabled=!1})},activateButton:function(t){this.deactivateAllButtons(),t.addClass("primary").data("activated",!0),this.element.trigger("lockfocus.nlfeatures")},deactivateButton:function(t){t.removeClass("primary").data("activated",!1),this.element.trigger("unlockfocus.nlfeatures")},toggleButton:function(t){t.data("activated")?this.deactivateButton(t):this.activateButton(t)},triggerUpdateEvent:function(){this.element.trigger("update.nlfeatures",[{drag:this.dragButton.data("activated"),rotate:this.rotateButton.data("activated"),scale:this.scaleButton.data("activated")}])}})}(jQuery),function(){var t={}.hasOwnProperty,e=function(e,n){function i(){this.constructor=e}for(var o in n)t.call(n,o)&&(e[o]=n[o]);return i.prototype=n.prototype,e.prototype=new i,e.__super__=n.prototype,e};!function(t){var n,i,o,s,a,r,l,u,d;return s=function(t){return"#"===t[0]?t.slice(1,t.length):t},l=function(t){return null!=t?t.toString():""},a=function(t,e,n,i){var o,s,a;return null==n&&(n=null),null==i&&(i=100),o=0,s=null!=n&&0!==n?function(){return t()||o>=n}:t,a=function(){return s()?e():(o++,setTimeout(a,i))},setTimeout(a,i)},r=function(t){return null!=t?t.substr(t.indexOf("\n")+1):""},n=function(){function e(t){this.widget=t}return e.prototype.$=function(e){return t(e,this.parent)},e.prototype.value=function(){return this.widget.options.values},e.prototype.initMap=function(){var e,n,i,o,s,a,r,l;return this.map=this.fields.map,n=this.value(),i={title:"Coverage",name:"Coverage",id:this.widget.element.attr("id"),geo:null!=(s=null!=n?n.geo:void 0)?s:""},o={mode:this.widget.options.mode,json:i,markup:{id_prefix:this.widget.options.id_prefix}},o.zoom=null!=(a=null!=n?n.zoom:void 0)?a:null,o.center=null!=(r=null!=n?n.center:void 0)?r:null,o.base_layer=null!=(l=null!=n?n.base_layer:void 0)?l:null,e=t.extend(!0,{},this.widget.options.map_options,this.widget.options.values,o),this.map.nlfeatures(e),this.map},e}(),o=function(n){function i(){return u=i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.init=function(){return this.build(),this.initMap(),this.populate()},i.prototype.build=function(){var e,n,i,o;return e=t(this.widget.element),i=s(this.widget.options.id_prefix),o=t("
"),n=t("
"),e.addClass("nlfeatures").append(o).append(n),this.fields={map:t("#"+i+"map"),free:t("#"+i+"free")},e},i.prototype.populate=function(){var t,e;return t=this.widget.options.values.text,e=r(t),""===e?(this.fields.free.detach(),delete this.fields.free):this.fields.free.html(e)},i}(n),i=function(n){function i(){return d=i.__super__.constructor.apply(this,arguments)}return e(i,n),i.prototype.init=function(){return this.build(),this.initMap(),this.captureEditor(),this.populate(),this.wire()},i.prototype._buildMap=function(e,n){return t(e).addClass("nlfeatures").addClass("nlfeatures-edit").before('
\n
\n
\n
\n
\n
")},i.prototype._buildInputs=function(e,n,i){return t(e).after("\n\n\n\n\n\n')},i.prototype._buildUseMap=function(e,n,i,o){return t(".use-html",e.parent().parent()).after('')},i.prototype._populateFields=function(e,n){var i;return i=e.parent(),this.fields={map_container:i.find(".map-container"),map:t("#"+n+"map"),map_tools:i.find(".nlfeatures-map-tools"),mapon:t("#"+n+"mapon"),text:t("#"+n+"text"),free:t("#"+n+"free"),html:t("#"+n+"html"),geo:t("#"+n+"geo"),zoom:t("#"+n+"zoom"),center_lon:t("#"+n+"center_lon"),center_lat:t("#"+n+"center_lat"),base_layer:t("#"+n+"base_layer"),flash:i.find(".nlflash")}},i.prototype.build=function(){var e,n,i,o,a;return e=t(this.widget.element),n=s(this.widget.options.id_prefix),i=this.widget.options.name_prefix,o=this.widget.options.labels.html,a=this.widget.options.labels.map,this._buildMap(e,n),this._buildInputs(e,n,i),this._buildUseMap(e,n,i,a),this._populateFields(e,n),this},i.prototype.captureEditor=function(){var t=this;return this.fields.mapon.change(function(){return t._onUseMap()}),this.fields.html.change(function(){return t._updateTinyEvents()})},i.prototype.populate=function(t){return null==t&&(t=this.widget.options.values),null!=t?(this.fields.html.prop("checked",+t.is_html),this.fields.mapon.prop("checked",+t.is_map),this.fields.geo.val(l(t.geo)),this.fields.zoom.val(l(t.zoom)),null!=t.center&&(this.fields.center_lon.val(l(t.center.lon)),this.fields.center_lat.val(l(t.center.lat))),this.fields.base_layer.val(l(t.base_layer)),this.fields.text.val(l(t.text)),this.fields.free.val(r(t.text))):void 0},i.prototype.wire=function(){var t,e=this;return t=function(){return e.updateFields(e.fields.free.val())},this.fields.free.change(t),this.map.bind("featureadded.nlfeatures",t).bind("update.nlfeatures",t).bind("delete.nlfeatures",t).bind("refresh.nlfeatures",t).bind("saveview.nlfeatures",function(){return e.map.nlfeatures("saveViewport"),e.updateFields(),e.flash("View Saved...")}),this.map.nlfeatures("getMap").events.on({changebaselayer:t})},i.prototype.usesHtml=function(){return this.fields.html.prop("checked")},i.prototype.usesMap=function(){return this.fields.mapon.prop("checked")},i.prototype.showMap=function(){var t,e=this;return t=this.fields.map.children("button"),t.hide("normal",function(){return e.fields.map_container.slideDown("normal",function(){return t.fadeIn()})})},i.prototype.hideMap=function(){var t,e=this;return t=this.fields.map.children("button"),t.fadeOut("normal",function(){return e.fields.map_container.slideUp()})},i.prototype._onUseMap=function(){return this.usesMap()?this.showMap():this.hideMap(),this.updateFields()},i.prototype._updateTinyEvents=function(){var t,e=this;return this.usesHtml()?(t=this.fields.free.attr("id"),a(function(){return null!=tinymce.get(t)},function(){return e.fields.free.unbind("change"),tinymce.get(t).onChange.add(function(){return e.updateFields()})})):this.fields.free.change(function(){return e.updateFields()})},i.prototype.updateFields=function(){var t,e,n,i,o;return n=this.map.nlfeatures("getWktForSave"),this.fields.geo.val(n),o=this.map.nlfeatures("getSavedZoom"),null!=o&&this.fields.zoom.val(o),e=this.map.nlfeatures("getSavedCenter"),null!=e&&(this.fields.center_lon.val(e.lon),this.fields.center_lat.val(e.lat)),t=this.map.nlfeatures("getBaseLayerCode"),null!=t&&this.fields.base_layer.val(t),i=this.usesHtml()?tinymce.get(this.fields.free.attr("id")).getContent():this.fields.free.val(),this.fields.text.val(""+n+"|"+o+"|"+(null!=e?e.lon:void 0)+"|"+(null!=e?e.lat:void 0)+"|"+t+"\n"+i)},i.prototype.flash=function(t,e){var n=this;return null==e&&(e=5e3),this.fields.flash.html(t).fadeIn("slow",function(){return setTimeout(function(){return n.fields.flash.fadeOut("slow")},e)})},i}(n),t.widget("nlfeatures.featurewidget",{options:{mode:"view",id_prefix:null,name_prefix:null,labels:{html:"Use HTML",map:"Use Map"},map_options:{},values:{geo:null,zoom:null,center:null,text:null,is_html:null,is_map:null}},_create:function(){var t,e,n;return t=this.element.attr("id"),null==(e=this.options).id_prefix&&(e.id_prefix="#"+t.substring(0,t.length-"widget".length)),null==(n=this.options).name_prefix&&(n.name_prefix=this._idPrefixToNamePrefix()),this.mode="edit"===this.options.mode?new i(this):new o(this),this.mode.init(),this.options.values.is_map?void 0:this.mode.hideMap()},_idPrefixToNamePrefix:function(t){var e,n,i,o;return null==t&&(t=this.options.id_prefix),t=deref(t),o=function(){var e,n,o,s;for(o=t.split("-"),s=[],e=0,n=o.length;n>e;e++)i=o[e],i.length>0&&s.push(i);return s}(),e=o.shift(),n=function(){var t,e,n;for(n=[],t=0,e=o.length;e>t;t++)i=o[t],n.push("["+i+"]");return n}(),""+e+n.join("")},destroy:function(){return t.Widget.prototype.destroy.call(this)},_setOptions:function(){return t.Widget.prototype._setOption.apply(this,arguments)}})}(jQuery)}.call(this); \ No newline at end of file diff --git a/views/shared/javascripts/neatline-features-2.0.2.js b/views/shared/javascripts/neatline-features-2.0.3.js similarity index 96% rename from views/shared/javascripts/neatline-features-2.0.2.js rename to views/shared/javascripts/neatline-features-2.0.3.js index 653cbba..83c8092 100644 --- a/views/shared/javascripts/neatline-features-2.0.2.js +++ b/views/shared/javascripts/neatline-features-2.0.3.js @@ -1627,13 +1627,13 @@ -// Generated by CoffeeScript 1.7.1 +// Generated by CoffeeScript 1.6.3 (function() { var __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; (function($) { - var BaseWidget, EditWidget, ViewWidget, derefid, poll, stripFirstLine, to_s; + var BaseWidget, EditWidget, ViewWidget, derefid, poll, stripFirstLine, to_s, _ref, _ref1; derefid = function(id) { if (id[0] === '#') { return id.slice(1, id.length); @@ -1722,7 +1722,8 @@ __extends(ViewWidget, _super); function ViewWidget() { - return ViewWidget.__super__.constructor.apply(this, arguments); + _ref = ViewWidget.__super__.constructor.apply(this, arguments); + return _ref; } ViewWidget.prototype.init = function() { @@ -1764,7 +1765,8 @@ __extends(EditWidget, _super); function EditWidget() { - return EditWidget.__super__.constructor.apply(this, arguments); + _ref1 = EditWidget.__super__.constructor.apply(this, arguments); + return _ref1; } EditWidget.prototype.init = function() { @@ -1822,16 +1824,13 @@ }; EditWidget.prototype.captureEditor = function() { - this.fields.mapon.change((function(_this) { - return function() { - return _this._onUseMap(); - }; - })(this)); - return this.fields.html.change((function(_this) { - return function() { - return _this._updateTinyEvents(); - }; - })(this)); + var _this = this; + this.fields.mapon.change(function() { + return _this._onUseMap(); + }); + return this.fields.html.change(function() { + return _this._updateTinyEvents(); + }); }; EditWidget.prototype.populate = function(values) { @@ -1854,20 +1853,17 @@ }; EditWidget.prototype.wire = function() { - var updateFields; - updateFields = (function(_this) { - return function() { - return _this.updateFields(_this.fields.free.val()); - }; - })(this); + var updateFields, + _this = this; + updateFields = function() { + return _this.updateFields(_this.fields.free.val()); + }; this.fields.free.change(updateFields); - this.map.bind('featureadded.nlfeatures', updateFields).bind('update.nlfeatures', updateFields).bind('delete.nlfeatures', updateFields).bind('refresh.nlfeatures', updateFields).bind('saveview.nlfeatures', (function(_this) { - return function() { - _this.map.nlfeatures('saveViewport'); - _this.updateFields(); - return _this.flash('View Saved...'); - }; - })(this)); + this.map.bind('featureadded.nlfeatures', updateFields).bind('update.nlfeatures', updateFields).bind('delete.nlfeatures', updateFields).bind('refresh.nlfeatures', updateFields).bind('saveview.nlfeatures', function() { + _this.map.nlfeatures('saveViewport'); + _this.updateFields(); + return _this.flash('View Saved...'); + }); return this.map.nlfeatures('getMap').events.on({ changebaselayer: updateFields }); @@ -1882,25 +1878,23 @@ }; EditWidget.prototype.showMap = function() { - var tools; + var tools, + _this = this; tools = this.fields.map.children('button'); - return tools.hide('normal', (function(_this) { - return function() { - return _this.fields.map_container.slideDown('normal', function() { - return tools.fadeIn(); - }); - }; - })(this)); + return tools.hide('normal', function() { + return _this.fields.map_container.slideDown('normal', function() { + return tools.fadeIn(); + }); + }); }; EditWidget.prototype.hideMap = function() { - var tools; + var tools, + _this = this; tools = this.fields.map.children('button'); - return tools.fadeOut('normal', (function(_this) { - return function() { - return _this.fields.map_container.slideUp(); - }; - })(this)); + return tools.fadeOut('normal', function() { + return _this.fields.map_container.slideUp(); + }); }; EditWidget.prototype._onUseMap = function() { @@ -1913,25 +1907,22 @@ }; EditWidget.prototype._updateTinyEvents = function() { - var freeId; + var freeId, + _this = this; if (this.usesHtml()) { freeId = this.fields.free.attr('id'); return poll(function() { return tinymce.get(freeId) != null; - }, (function(_this) { - return function() { - _this.fields.free.unbind('change'); - return tinymce.get(freeId).onChange.add(function() { - return _this.updateFields(); - }); - }; - })(this)); - } else { - return this.fields.free.change((function(_this) { - return function() { + }, function() { + _this.fields.free.unbind('change'); + return tinymce.get(freeId).onChange.add(function() { return _this.updateFields(); - }; - })(this)); + }); + }); + } else { + return this.fields.free.change(function() { + return _this.updateFields(); + }); } }; @@ -1961,16 +1952,15 @@ }; EditWidget.prototype.flash = function(msg, delay) { + var _this = this; if (delay == null) { delay = 5000; } - return this.fields.flash.html(msg).fadeIn('slow', (function(_this) { - return function() { - return setTimeout(function() { - return _this.fields.flash.fadeOut('slow'); - }, delay); - }; - })(this)); + return this.fields.flash.html(msg).fadeIn('slow', function() { + return setTimeout(function() { + return _this.fields.flash.fadeOut('slow'); + }, delay); + }); }; return EditWidget; @@ -2017,11 +2007,11 @@ } id_prefix = deref(id_prefix); parts = (function() { - var _i, _len, _ref, _results; - _ref = id_prefix.split('-'); + var _i, _len, _ref2, _results; + _ref2 = id_prefix.split('-'); _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - p = _ref[_i]; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + p = _ref2[_i]; if (p.length > 0) { _results.push(p); } @@ -2051,4 +2041,6 @@ }).call(this); -//# sourceMappingURL=featureswidget.map +/* +//@ sourceMappingURL=featureswidget.map +*/