changeset 541:d141b2a723cf

fix missing gui editor link bug (added 'name' attr handling), some debug code imported from: moin--main--1.5--patch-545
author Thomas Waldmann <tw@waldmann-edv.de>
date Sun, 09 Apr 2006 12:05:08 +0000
parents f9af485c696c
children 2f495a1be4c7
files ChangeLog MoinMoin/wikiutil.py wiki/htdocs/common/js/common.js
diffstat 3 files changed, 34 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Apr 09 11:30:52 2006 +0000
+++ b/ChangeLog	Sun Apr 09 12:05:08 2006 +0000
@@ -2,6 +2,20 @@
 # arch-tag: automatic-ChangeLog--arch@arch.thinkmo.de--2003-archives/moin--main--1.5
 #
 
+2006-04-09 13:05:08 GMT	Thomas Waldmann <tw@waldmann-edv.de>	patch-545
+
+    Summary:
+      fix missing gui editor link bug (added 'name' attr handling), some debug code
+    Revision:
+      moin--main--1.5--patch-545
+
+    fix missing gui editor link bug (added 'name' attr handling), some debug code
+    
+
+    modified files:
+     ChangeLog MoinMoin/wikiutil.py wiki/htdocs/common/js/common.js
+
+
 2006-04-09 12:30:52 GMT	Thomas Waldmann <tw@waldmann-edv.de>	patch-544
 
     Summary:
--- a/MoinMoin/wikiutil.py	Sun Apr 09 11:30:52 2006 +0000
+++ b/MoinMoin/wikiutil.py	Sun Apr 09 12:05:08 2006 +0000
@@ -1094,6 +1094,7 @@
     else:
         css_class = None
     id = kw.get('id', None)
+    name = kw.get('name', None)
     if text is None:
         text = params # default
     if formatter:
@@ -1111,6 +1112,8 @@
         attrs += ' class="%s"' % css_class
     if id:
         attrs += ' id="%s"' % id
+    if name:
+        attrs += ' name="%s"' % name
     result = '<a%s href="%s/%s">' % (attrs, request.getScriptname(), params)
     if on:
         return result
--- a/wiki/htdocs/common/js/common.js	Sun Apr 09 11:30:52 2006 +0000
+++ b/wiki/htdocs/common/js/common.js	Sun Apr 09 12:05:08 2006 +0000
@@ -4,6 +4,7 @@
 
 // use this instead of assigning to window.onload directly:
 function addLoadEvent(func) {
+  // alert("addLoadEvent " + func)
   var oldonload = window.onload;
   if (typeof window.onload != 'function') {
     window.onload = func;
@@ -41,13 +42,16 @@
 
 function update_edit_links() {
     // Update editlink according if if the browser is compatible
-    if (can_use_gui_editor() == false) return;
-
+    if (can_use_gui_editor() == false){
+        //alert("update_edit_links: can't use gui editor");
+        return;
+    }
     var editlinks = document.getElementsByName("editlink");
     for (i = 0; i < editlinks.length; i++) {
         var link = editlinks[i];
         href = link.href.replace('editor=textonly','editor=guipossible');
         link.href = href;
+        //alert("update_edit_links: modified to guipossible");
     }
 }
 
@@ -56,9 +60,15 @@
     // Add gui editor link after the text editor link
     
     // If the variable is not set or browser is not compatible, exit
-    try {gui_editor_link_href} catch (e) {return}
-    if (can_use_gui_editor() == false) return;
-    
+    try {gui_editor_link_href}
+    catch (e) {
+        //alert("add_gui_editor_links: gui_editor_link_href not here");
+        return
+    }
+    if (can_use_gui_editor() == false){
+        //alert("add_gui_editor_links: can't use gui_editor");
+        return;
+    }
     var all = document.getElementsByName('texteditlink');
     for (i = 0; i < all.length; i++) {
         var textEditorLink = all[i];
@@ -73,9 +83,10 @@
         var editbar = textEditorLink.parentNode.parentNode
         var nextListItem = textEditorLink.parentNode.nextSibling;
         editbar.insertBefore(listItem, nextListItem);
+        //alert("add_gui_editor_links: added gui editor link");
     }
 }
-  
+ 
 
 function show_switch2gui() {
     // Show switch to gui editor link if the browser is compatible