Added:
/media/bookmarks/css/bookmarks.css
/media/bookmarks/js/bookmarks.js
Modified:
/lingcod/bookmarks/templates/bookmarks/form.html
/lingcod/common/templates/common/map.html
/media/common/js/layout/menu_items.js
/media/css_includes.xml
/media/js_includes.xml
=======================================
--- /dev/null
+++ /media/bookmarks/css/bookmarks.css Wed Oct 19 10:53:27 2011
@@ -0,0 +1,3 @@
+#bookmark-close-container {position:relative; top: -12px; left: 10px;}
+#bookmark-feature-img {padding: 6px;}
+#bookmark-menu-img {padding: 6px; padding-top:10px;}
=======================================
--- /dev/null
+++ /media/bookmarks/js/bookmarks.js Wed Oct 19 10:53:27 2011
@@ -0,0 +1,122 @@
+function setupBookmarkFeatureUI() {
+ $('#bookmark-close').click(function(){
+ $('.cancel_button').click();
+ $('#bookmark-close').hide();
+ return false;
+ });
+
+ $('#bookmark-menu-link').click( function(e) {
+ e.preventDefault();
+ var url = "/features/bookmark/form/";
+ var panelOpts = {
+ loading_msg: 'Loading Bookmark Form',
+ showClose: true
+ };
+ var panel = lingcod.editors[0].panel;
+
+
+ function setupForm(form, options){
+ options = options || {};
+ var el = panel.getEl();
+ el.find('.close').hide();
+ el.find('input[type=submit]').hide();
+ var manipulator;
+
+ opts = {
+ // Forcing submission of content thru iframe all the time
+ iframe: true,
+ beforeSubmit: function(a,b,c) {
+ panel.spin('Please wait while we save your bookmark.');
+ $(that).trigger('saving', ["Saving changes"]);
+ return true;
+ },
+ success: function(text, status, req, formel){
+ $(that).trigger('doneSaving');
+ if(text.match('<form') || text.match('<FORM')){ // for
ie8
+ // Validation error
+ // Set default panel options. panel is an instance
var
+ var panelOpts = {
+ loading_msg: 'Loading form',
+ // loading_msg: 'Loading ' + action.title,
+ // ^^^ action.title was causing js error and
stalling the app
+ // when a form was returned with validation
errors
+ showClose: true
+ };
+ panelOpts['showCloseButton'] = false;
+ panelOpts['success'] = function(){
+ lingcod.setupForm = function(){
+ alert('error:setupForm called after
clearing?');
+ };
+ }
+ // set a setupForm function that can be called by
content
+ // of the panel
+ lingcod.setupForm = function(form){
+ setupForm(form);
+ }
+ panel.close();
+ panel.stopSpinning();
+ panel.showText(text, panelOpts);
+ }else{
+ panel.close();
+ panel.stopSpinning();
+ var info = jQuery.parseJSON(text);
+ if(info['status'] != 200 && info['status'] != 201){
+ tree.refresh();
+ alert('There was an error saving your
feature.');
+ }else{
+ $(lingcod.editors[0]).trigger('edit', [text,
status, req, this]);
+ }
+ }
+ }
+ };
+ var a = $(form).attr('action');
+ if(typeof a !== 'undefined') {
+ if(a[a.length - 1] !== '/'){
+ // For the benefit of IE
+ $(form).attr('action', a + '/');
+ }
+ }
+ $(form).ajaxForm(opts);
+
+ el.find('.submit_button').click(function(){
+ $('#bookmark-close').hide();
+ form.trigger('submit');
+ });
+ el.find('.cancel_button').click(function(){
+ $('#bookmark-close').hide();
+ panel.close();
+ if(options.cancel){
+ options.cancel();
+ }
+ });
+ var tabs = el.find('.tabs');
+ tabs.bind('tabsshow', function(e){
+ var div = $(this).parent().parent().parent();
+ // scroll to 1, then 0 for the benefit of dumb firefox
+ div.scrollTop(1);
+ div.scrollTop(0);
+ });
+ tabs.tabs('select', '#PanelAttributes');
+ tabs.tabs('disable', 0);
+ tabs.find('> .ui-tabs-nav').hide();
+ if(tabs && tabs.length && $('.errorlist').length){
+ tabs.tabs('select', '#PanelAttributes');
+ }
+ panel.show();
+ if($('#PanelAttributes').length){
+
$('#PanelAttributes').parent().parent().parent().parent().scrollTop(1).scrollTop(0);
+ }
+
+ $(that).trigger('form_shown', [panel, null]);
+ };
+ ///////////////////////////END setupForm///////////////////////
+
+ // bind the setupForm function that can be called by content of
the panel
+ lingcod.setupForm = function(form){
+ setupForm(form);
+ }
+ lingcod.menu_items.closeAll();
+ $('.panelMask').hide();
+ panel.showUrl(url, panelOpts);
+ });
+}
=======================================
--- /lingcod/bookmarks/templates/bookmarks/form.html Wed Sep 7 12:14:05
2011
+++ /lingcod/bookmarks/templates/bookmarks/form.html Wed Oct 19 10:53:27
2011
@@ -58,6 +58,8 @@
};
$('#fshow_toggle_details').click(ftog);
$('#fhide_toggle_details').click(ftog);
+
+ $('#bookmark-close').show();
});
</script>
=======================================
--- /lingcod/common/templates/common/map.html Tue Oct 18 16:37:33 2011
+++ /lingcod/common/templates/common/map.html Wed Oct 19 10:53:27 2011
@@ -71,128 +71,9 @@
$(document).ready(function(){
lingcod.init(options);
{% block js_ready %}{% endblock %}
-
{% if user.is_authenticated and bookmarks_as_feature %}
- $('#bookmark-close').click(function(){
- $('.cancel_button').click();
- return false;
- });
-
- $('#bookmark-menu-link').click( function(e) {
- $('#bookmark-close').show();
- e.preventDefault();
- var url = "/features/bookmark/form/";
- var panelOpts = {
- loading_msg: 'Loading Bookmark Form',
- showClose: true
- };
- var panel = lingcod.editors[0].panel;
-
-
- function setupForm(form, options){
- options = options || {};
- var el = panel.getEl();
- el.find('.close').hide();
- el.find('input[type=submit]').hide();
- var manipulator;
-
- opts = {
- // Forcing submission of content thru iframe all
the time
- iframe: true,
- beforeSubmit: function(a,b,c) {
- panel.spin('Please wait while we save your
bookmark.');
- $(that).trigger('saving', ["Saving changes"]);
- return true;
- },
- success: function(text, status, req, formel){
- $(that).trigger('doneSaving');
- if(text.match('<form') ||
text.match('<FORM')){ // for ie8
- // Validation error
- // Set default panel options. panel is an
instance var
- var panelOpts = {
- loading_msg: 'Loading form',
- // loading_msg: 'Loading ' +
action.title,
- // ^^^ action.title was causing js
error and stalling the app
- // when a form was returned with
validation errors
- showClose: true
- };
- panelOpts['showCloseButton'] = false;
- panelOpts['success'] = function(){
- lingcod.setupForm = function(){
- alert('error:setupForm called
after clearing?');
- };
- }
- // set a setupForm function that can be
called by content
- // of the panel
- lingcod.setupForm = function(form){
- setupForm(form);
- }
- panel.close();
- panel.stopSpinning();
- panel.showText(text, panelOpts);
- }else{
- panel.close();
- panel.stopSpinning();
- var info = jQuery.parseJSON(text);
- if(info['status'] != 200 &&
info['status'] != 201){
- tree.refresh();
- alert('There was an error saving your
feature.');
- }else{
- $(lingcod.editors[0]).trigger('edit',
[text, status, req, this]);
- }
- }
- }
- };
- var a = $(form).attr('action');
- if(typeof a !== 'undefined') {
- if(a[a.length - 1] !== '/'){
- // For the benefit of IE
- $(form).attr('action', a + '/');
- }
- }
- $(form).ajaxForm(opts);
-
- el.find('.submit_button').click(function(){
- $('#bookmark-close').hide();
- form.trigger('submit');
- });
- el.find('.cancel_button').click(function(){
- $('#bookmark-close').hide();
- panel.close();
- if(options.cancel){
- options.cancel();
- }
- });
- var tabs = el.find('.tabs');
- tabs.bind('tabsshow', function(e){
- var div = $(this).parent().parent().parent();
- // scroll to 1, then 0 for the benefit of dumb
firefox
- div.scrollTop(1);
- div.scrollTop(0);
- });
- tabs.tabs('select', '#PanelAttributes');
- tabs.tabs('disable', 0);
- tabs.find('> .ui-tabs-nav').hide();
- if(tabs && tabs.length && $('.errorlist').length){
- tabs.tabs('select', '#PanelAttributes');
- }
- panel.show();
- if($('#PanelAttributes').length){
-
$('#PanelAttributes').parent().parent().parent().parent().scrollTop(1).scrollTop(0);
- }
-
- $(that).trigger('form_shown', [panel, null]);
- };
- ///////////////////////////END
setupForm///////////////////////
-
- // bind the setupForm function that can be called by
content of the panel
- lingcod.setupForm = function(form){
- setupForm(form);
- }
- panel.showUrl(url, panelOpts);
- });
+ setupBookmarkFeatureUI();
{% endif %}
-
{% if camera and publicstate %}
$(lingcod).bind('geReady', function() {
var camera =
ge.getView().copyAsCamera(ge.ALTITUDE_RELATIVE_TO_GROUND);
@@ -250,26 +131,30 @@
{% block menu_icons %}
<ul class="menu_items" id="header_buttons">
<li class="divider"><img
src="{{MEDIA_URL}}/common/images/header_divider.gif" height="32" width="2"
/></li>
+
{% if user.is_authenticated and bookmarks_as_feature %}
<li>
<span>
<a id="bookmark-menu-link" title="Bookmark"
href="#Bookmark">
- <img
src="{{MEDIA_URL}}bookmarks/images/bookmark-menu.png" style="padding: 6px;"
width="32" height="32" />
+ <img
src="{{MEDIA_URL}}bookmarks/images/bookmark-menu.png"
id="bookmark-feature-img" width="32" height="32" />
</a>
</span>
- <div style="position:relative; top: -12px; left: 10px;">
- <a id="bookmark-close" style="display:none;" href="#"><img
src="{{MEDIA_URL}}common/images/tool_window_pointer.png" width="23"
height="36" /></a>
+ <div id="bookmark-close-container">
+ <a id="bookmark-close" style="display:none;" href="#">
+ <img
src="{{MEDIA_URL}}common/images/tool_window_pointer.png" width="23"
height="36" />
+ </a>
</div>
</li>
{% else %}
<li id="bookmarks_menuitem" class="item">
<span>
<a title="Bookmark" href="#Bookmark">
- <img
src="{{MEDIA_URL}}bookmarks/images/bookmark-menu.png" style="padding: 6px;
padding-top:10px;" width="32" height="32" />
+ <img
src="{{MEDIA_URL}}bookmarks/images/bookmark-menu.png"
id="bookmark-menu-img" width="32" height="32" />
</a>
</span>
</li>
{% endif %}
+
<li class="divider"><img
src="{{MEDIA_URL}}/common/images/header_divider.gif" height="32" width="2"
/></li>
<li id="layers_menu" class="item">
<span>
=======================================
--- /media/common/js/layout/menu_items.js Tue Oct 18 16:37:33 2011
+++ /media/common/js/layout/menu_items.js Wed Oct 19 10:53:27 2011
@@ -60,6 +60,7 @@
});
}
// lingcod.unmaskSidebar();
+ $("#bookmark-close").click();
}
that.closeAll = closeAll;
=======================================
--- /media/css_includes.xml Wed Apr 20 14:10:48 2011
+++ /media/css_includes.xml Wed Oct 19 10:53:27 2011
@@ -21,4 +21,5 @@
<file path="common/css/table.css" />
<file path="geographic_report/css/geographic_report.css" />
<file path="common/css/jquery-widgets.css" />
+ <file path="bookmarks/css/bookmarks.css" />
</stylesheets>
=======================================
--- /media/js_includes.xml Fri Sep 2 16:37:53 2011
+++ /media/js_includes.xml Wed Oct 19 10:53:27 2011
@@ -45,4 +45,5 @@
<file path="features/features.js" />
<file path="features/js/workspace.js" />
<file path="features/js/kmlEditor.js" />
+ <file path="bookmarks/js/bookmarks.js" />
</javascripts>