Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/exe/webui
diff options
context:
space:
mode:
authorr3m0 <r3m0@38b22f21-9aea-0310-abfc-843a9883df58>2008-07-28 00:59:53 (GMT)
committer r3m0 <r3m0@38b22f21-9aea-0310-abfc-843a9883df58>2008-07-28 00:59:53 (GMT)
commit1575a14993103112575a38b7acc3564c293c12f5 (patch)
treece20db944d110234eff2a7ccdd04743307914f43 /exe/webui
parent143dde07f52b48f093821787e87e49d99407a7ef (diff)
Add Preference to disable internal linking (& not generate exe_tmp_anchor tags)
git-svn-id: https://exe.svn.sourceforge.net/svnroot/exe/trunk@3556 38b22f21-9aea-0310-abfc-843a9883df58
Diffstat (limited to 'exe/webui')
-rw-r--r--exe/webui/common.py12
-rw-r--r--exe/webui/preferencespage.py15
2 files changed, 23 insertions, 4 deletions
diff --git a/exe/webui/common.py b/exe/webui/common.py
index 941bccc..0324d32 100644
--- a/exe/webui/common.py
+++ b/exe/webui/common.py
@@ -25,6 +25,8 @@ This module is for the common HTML used in all webpages.
import logging
from nevow import tags as T
from nevow.flat import flatten
+from exe import globals as G
+
lastId = 0
@@ -126,7 +128,10 @@ def richTextArea(name, value="", width="100%", height=100, package=None):
# for ALL anchors available in the entire doc!
# (otherwise TinyMCE will only see those anchors within this field)
if package is not None and hasattr(package, 'anchor_fields') \
- and package.anchor_fields is not None:
+ and package.anchor_fields is not None \
+ and G.application.config.internalAnchors!="disable_all" :
+ # only add internal anchors for
+ # config.internalAnchors = "enable_all" or "disable_autotop"
log.debug(u"richTextArea adding exe_tmp_anchor tags for user anchors.")
for anchor_field in package.anchor_fields:
anchor_field_path = anchor_field.GetFullNodePath()
@@ -135,7 +140,10 @@ def richTextArea(name, value="", width="100%", height=100, package=None):
html += u'<exe_tmp_anchor title="%s" name="%s"></exe_tmp_anchor>'\
% (full_anchor_name, full_anchor_name)
# and below the user-defined anchors, also show "auto_top" anchors for ALL:
- if package is not None and package.root is not None:
+ if package is not None and package.root is not None \
+ and G.application.config.internalAnchors=="enable_all" :
+ # only add auto_top anchors for
+ # config.internalAnchors = "enable_all"
log.debug(u"richTextArea adding exe_tmp_anchor auto_top for ALL nodes.")
node_anchors = True
if node_anchors:
diff --git a/exe/webui/preferencespage.py b/exe/webui/preferencespage.py
index fac2d3d..83ca172 100644
--- a/exe/webui/preferencespage.py
+++ b/exe/webui/preferencespage.py
@@ -76,8 +76,9 @@ class PreferencesPage(RenderableResource):
html += u'@import url(/style/base.css);\n'
html += u"@import url(/style/standardwhite/content.css);</style>\n"
html += u'''<script language="javascript" type="text/javascript">
- function setLocale(l) {
+ function setLocaleAndAnchors(l,anchors) {
opener.nevow_clientToServerEvent('setLocale', this, '', l)
+ opener.nevow_clientToServerEvent('setInternalAnchors', this, '', anchors)
window.close()
}
</script>'''
@@ -97,11 +98,21 @@ class PreferencesPage(RenderableResource):
options = self.localeNames,
selection = self.config.locale)
+ internal_anchor_options = [(_(u"Enable All Internal Linking"), "enable_all"),
+ (_(u"Disable Auto-Top Internal Linking"), "disable_autotop"),
+ (_(u"Disable All Internal Linking"), "disable_all")]
+ html += common.formField('select', this_package, _(u"Internal Linking (for Web Site Exports only)"),
+ 'internalAnchors',
+ '', # TODO: Instructions
+ options = internal_anchor_options,
+ selection = self.config.internalAnchors)
+
html += u"<div id=\"editorButtons\"> \n"
html += u"<br/>"
html += common.button("ok", _("OK"), enabled=True,
_class="button",
- onClick="setLocale(document.forms.contentForm.locale.value)")
+ onClick="setLocaleAndAnchors(document.forms.contentForm.locale.value,"
+ "document.forms.contentForm.internalAnchors.value)")
html += common.button("cancel", _("Cancel"), enabled=True,
_class="button", onClick="window.close()")
html += u"</div>\n"