Skip to main content
Site identity, navigation, etc.
Log in
Username
Password
I forgot my password
CapsLock is on.
Log in
Stay in SSL mode
Navigation and related functionality and content
Related content
View template: modules/mod-map_edit_features.tpl
Edit CSS
Template listing
{if !empty($edit_features.field)} {tikimodule error=$module_params.error title=$tpl_module_title name="map_edit_features" flip=$module_params.flip decorations=$module_params.decorations nobox=$module_params.nobox notitle=$module_params.notitle} <form class="map-edit-features" method="post" action="{service controller=tracker action=insert_item}"> <div class="submit"> {ticket} <input type="hidden" name="trackerId" value="{$edit_features.trackerId|escape}"/> <input type="hidden" name="controller" value="tracker"/> <input type="hidden" name="action" value="insert_item"/> <input class="feature-content" id="{$edit_features.field.fieldId|escape}" type="hidden" name="forced~{$edit_features.field.permName|escape}"/> {foreach from=$edit_features.hiddenInput key=f item=v} <input id="{$f|escape}" type="hidden" name="forced~{$f|escape}" value="{$v|escape}"/> {/foreach} <input type="submit" class="btn btn-primary btn-sm" name="create" value="{tr}Create{/tr}"/> </div> </form> {jq} $(function () { var map, activeFeature, form = $('.map-edit-features').hide(); form .removeClass('map-edit-features') .on("submit", function () { if (! activeFeature) { return false; } var form = this; $.post($(form).attr('action'), $(form).serialize(), null, 'json') .done(function (data) { $(form).trigger('insert', [data]); }) .fail(function () { $(this).serviceDialog({ title: $(':submit', form).val(), data: $(form).serialize(), success: function () { $(form).trigger('insert', [{}]); }, close: function () { $(form).trigger('cancel'); } }); }) ; return false; }) .each(function () { map = $(this).closest('.tab, #appframe, body').find('.map-container').first()[0]; if (! map) { return; } $(this).show(); }); $(map).one('initialized', function () { var vlayer = map.vectors, toolbar, modify; function saveFeature() { var format = new OpenLayers.Format.GeoJSON; form.find('.feature-content').val(format.write(activeFeature)); } {{if $prefs.geo_openlayers_version eq 'ol2'}} vlayer.events.on({ featureadded: function (event) { var format = new OpenLayers.Format.GeoJSON; if (! event.feature.attributes.itemId && event.feature.attributes.intent !== 'marker') { if (activeFeature) { vlayer.removeFeatures([activeFeature]); activeFeature = null; } activeFeature = event.feature; saveFeature(); form.trigger("submit"); } }, featuremodified: function (event) { if (event.feature === activeFeature) { saveFeature(); } } }); {{if !empty($edit_features.standardControls)}} modify = new OpenLayers.Control.ModifyFeature(vlayer, { mode: OpenLayers.Control.ModifyFeature.DRAG | OpenLayers.Control.ModifyFeature.RESHAPE, }); toolbar = new OpenLayers.Control.EditingToolbar(vlayer); toolbar.addControls([modify]); map.modeManager.addMode({ name: 'Draw', controls: [ toolbar ] }); {{/if}} {{/if}} form.on('insert', function (e, data) { var form = this; $(map).trigger('changed'); map.vectors.removeFeatures([activeFeature]); activeFeature = null; {{if !empty($edit_features.editDetails)}} if (data.itemId) { $('<a>').attr('href', $.service('tracker', 'update_item')) .serviceDialog({ data: { trackerId: $(form.trackerId).val(), itemId: data.itemId }, success: function () { $(map).trigger('changed'); } }); } {{/if}} {{if !empty($edit_features.insertMode)}} map.modeManager.switchTo({{$edit_features.insertMode|json_encode}}); {{/if}} }); }); }); {/jq} {/tikimodule} {else} {remarksbox type=warning title="{tr}Module misconfigured{/tr}"} {tr}No acceptable field to store the feature was found in the specified tracker.{/tr} {/remarksbox} {/if}
Related content
Most Popular Tags
adze
american woods
axe
broadleaf
broadleaf aspen
broadleafs
community
conifers
dendrology
eco friendly
education
froe
glossary
green
green woodworking
hammer
hard wood
hard woods
hardwoods
hickory
history
how to
joinery
literature
machinery
material processing
media
merchants
mortise
people
plane
poplar
safety
shaker
shave
society
soft woods
spokeshave
sustainable
template
tenon
terminology
tools
wood
works