[kupu-checkins] r35491 - in kupu/trunk/kupu: . common default plone plone/kupu_plone_layer

duncan at codespeak.net duncan at codespeak.net
Fri Dec 8 16:41:53 CET 2006


Author: duncan
Date: Fri Dec  8 16:41:49 2006
New Revision: 35491

Modified:
   kupu/trunk/kupu/common/kupubasetools.js
   kupu/trunk/kupu/default/colorchooser.kupu
   kupu/trunk/kupu/dist-plone.kupu
   kupu/trunk/kupu/plone/helpers.py
   kupu/trunk/kupu/plone/include.kupu
   kupu/trunk/kupu/plone/kupu_plone_layer/kupu_wysiwyg_support.html
   kupu/trunk/kupu/plone/kupu_plone_layer/kupuplone.css.dtml
   kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneinit.js
   kupu/trunk/kupu/plone/plonelibrarytool.py
   kupu/trunk/kupu/plone/spellchecker.kupu
   kupu/trunk/kupu/plone/toolbar.kupu
   kupu/trunk/kupu/plone/zmi_toolbar.pt
Log:
Enabled the color chooser tool in Plone kupu. Ick, but at least it is disabled by default still.
Fixed the icon for the spellchecker.kupu

Modified: kupu/trunk/kupu/common/kupubasetools.js
==============================================================================
--- kupu/trunk/kupu/common/kupubasetools.js	(original)
+++ kupu/trunk/kupu/common/kupubasetools.js	Fri Dec  8 16:41:49 2006
@@ -839,15 +839,13 @@
     this.initialize = function(editor) {
         /* attach the event handlers */
         this.editor = editor;
-        
+        if (!(this.fgcolorbutton && this.hlcolorbutton && this.ccwindow)) return;
         this.createColorchooser(this.ccwindow);
 
         addEventHandler(this.fgcolorbutton, "click", this.openFgColorChooser, this);
         addEventHandler(this.hlcolorbutton, "click", this.openHlColorChooser, this);
         addEventHandler(this.ccwindow, "click", this.chooseColor, this);
-
         this.hide();
-
         this.editor.logMessage(_('Colorchooser tool initialized'));
     };
 
@@ -876,7 +874,12 @@
         /* event handler for choosing the color */
         var target = _SARISSA_IS_MOZ ? event.target : event.srcElement;
         var cell = this.editor.getNearestParentOfType(target, 'td');
-        this.editor.execCommand(this.command, cell.getAttribute('bgColor'));
+        var ed = this.editor;
+        var doc = ed.getDocument();
+        ed.execCommand('styleWithCSS', true);
+        doc.execCommand(this.command, cell.bgColor);
+        ed.execCommand('styleWithCSS', false);
+        // this.editor.execCommand(this.command, cell.bgColor);
         this.hide();
     
         this.editor.logMessage(_('Color chosen'));
@@ -889,7 +892,6 @@
 
     this.hide = function() {
         /* hide the colorchooser */
-        this.command = null;
         this.ccwindow.style.display = "none";
     };
 

Modified: kupu/trunk/kupu/default/colorchooser.kupu
==============================================================================
--- kupu/trunk/kupu/default/colorchooser.kupu	(original)
+++ kupu/trunk/kupu/default/colorchooser.kupu	Fri Dec  8 16:41:49 2006
@@ -10,7 +10,7 @@
   <kupu:id>$Id$</kupu:id>
 
   <kupu:part name="colorchooser">
-    <table id="kupu-colorchooser" cellpadding="0" cellspacing="0"
+    <table id="kupu-colorchooser" class="kupu-colorchooser" cellpadding="0" cellspacing="0"
            style="position: fixed; border-style: solid; border-color: black; border-width: 1px;">
     </table>
   </kupu:part>

Modified: kupu/trunk/kupu/dist-plone.kupu
==============================================================================
--- kupu/trunk/kupu/dist-plone.kupu	(original)
+++ kupu/trunk/kupu/dist-plone.kupu	Fri Dec  8 16:41:49 2006
@@ -22,6 +22,5 @@
   <!-- Plone does not want to use certain features -->
   <kupu:disable-feature name="toolboxes" />
   <kupu:disable-feature name="save" />
-  <kupu:disable-feature name="colorchooser" />
 
 </kupu:dist>

Modified: kupu/trunk/kupu/plone/helpers.py
==============================================================================
--- kupu/trunk/kupu/plone/helpers.py	(original)
+++ kupu/trunk/kupu/plone/helpers.py	Fri Dec  8 16:41:49 2006
@@ -15,6 +15,9 @@
     ('bg-subsuper', 'Subscript/Superscript group', True, None),
     ('subscript-button', 'Subscript button', True, 'kupu-subscript'),
     ('superscript-button', 'Superscript button', True, 'kupu-superscript'),
+    ('bg-colorchooser', 'Colour chooser group', False, None),
+    ('forecolor-button', 'Psychedelic foreground', False, 'kupu-forecolor'),
+    ('hilitecolor-button', 'Psychedelic background', False, 'kupu-hilitecolor'),
     ('bg-justify', 'Justify group', True, None),
     ('justifyleft-button', 'Justify left button', True, 'kupu-justifyleft'),
     ('justifycenter-button', 'Justify center button', True, 'kupu-justifycenter'),
@@ -38,7 +41,7 @@
     ('bg-undo', 'Undo group', True, None),
     ('undo-button', 'Undo button', True, 'kupu-undo'),
     ('redo-button', 'Redo button', True, 'kupu-redo'),
-    ('spellchecker', 'Spellchecker', False, ''),
+    ('spellchecker', 'Spellchecker', False, 'kupu-spellchecker'),
     ('source', 'Source', True, 'kupu-source'),
     ('styles', 'Styles pulldown', True, None),
     ('ulstyles', 'Unordered list style pulldown', True, None),
@@ -50,7 +53,7 @@
 class ButtonFilter:
     """Helper class to control visibility of buttons.
     Works from both a whitelist and a blacklist in the widget.
-    XXX Add expressions to the configlet so that a button may be hidden conditionally.
+    The configlet also provides a master list of visibilities
     """
     __allow_access_to_unprotected_subobjects__ = 1
 
@@ -63,7 +66,9 @@
         self.visible_buttons = tool.getToolbarFilters(context, field)
 
     def isButtonAllowed(self, name):
-        visible = self.visible_buttons.get(name, True)
+        visible = self.visible_buttons.get(name, None)
+        if visible is None:
+            visible = FILTERDICT.get(name, True)
         if self.allow_buttons is not None:
             return visible and name in self.allow_buttons
         if self.filter_buttons is not None:
@@ -75,4 +80,5 @@
         if name[0]=='_':
             raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__.__name__, name))
         allowed = self.isButtonAllowed(name)
+        #print name, "->", allowed
         return allowed

Modified: kupu/trunk/kupu/plone/include.kupu
==============================================================================
--- kupu/trunk/kupu/plone/include.kupu	(original)
+++ kupu/trunk/kupu/plone/include.kupu	Fri Dec  8 16:41:49 2006
@@ -14,6 +14,8 @@
   <xi:include href="drawers.kupu" />
   <xi:include href="beforeunload.kupu" />
   <xi:include href="sourceedit.kupu" />
+  <xi:include href="colorchooser.kupu" />
+  <xi:include href="spellchecker.kupu" />
   <xi:include href="wysiwyg_support.kupu" />
 
 </kupu:include>

Modified: kupu/trunk/kupu/plone/kupu_plone_layer/kupu_wysiwyg_support.html
==============================================================================
--- kupu/trunk/kupu/plone/kupu_plone_layer/kupu_wysiwyg_support.html	(original)
+++ kupu/trunk/kupu/plone/kupu_plone_layer/kupu_wysiwyg_support.html	Fri Dec  8 16:41:49 2006
@@ -22,10 +22,10 @@
     <!--$Id: head.kupu 34332 2006-11-07 14:50:40Z duncan $-->
     <!--$Id: xmlconfig.kupu 35367 2006-12-06 09:06:21Z duncan $-->
     <!--$Id: body.kupu 34311 2006-11-07 11:18:23Z duncan $-->
-    <!--$Id: toolbar.kupu 25717 2006-04-12 10:33:01Z fschulze $-->
-    <!--$Id: drawers.kupu 21175 2005-12-15 14:25:08Z duncan $-->
+    <!--$Id: toolbar.kupu 35477 2006-12-08 13:20:38Z duncan $-->
+    <!--$Id: drawers.kupu 35477 2006-12-08 13:20:38Z duncan $-->
     <!--$Id: beforeunload.kupu 14546 2005-07-12 14:35:55Z duncan $-->
-    <!--$Id: sourceedit.kupu 14546 2005-07-12 14:35:55Z duncan $-->
+    <!--$Id: sourceedit.kupu 35477 2006-12-08 13:20:38Z duncan $-->
     <!--$Id: wysiwyg_support.kupu 27722 2006-05-26 11:10:05Z duncan $-->
     
 
@@ -136,6 +136,11 @@
       <button type="button" class="kupu-superscript" id="kupu-superscript-button" title="Superscript: Access key (Alt or Ctrl) + +" tal:condition="filter/superscript-button" i18n:attributes="title" accesskey="+">&#160;</button>
     </span>
   
+    <span class="kupu-tb-buttongroup" tal:condition="filter/bg-colorchooser">
+      <button type="button" class="kupu-forecolor" id="kupu-forecolor-button" tal:condition="filter/forecolor-button" title="text color: alt-f" i18n:attributes="title" accesskey="f">&#160;</button>
+      <button type="button" class="kupu-hilitecolor" id="kupu-hilitecolor-button" tal:condition="filter/hilitecolor-button" title="background color: alt-h" i18n:attributes="title" accesskey="h">&#160;</button>
+    </span>
+  
     <span class="kupu-tb-buttongroup" id="kupu-bg-justify" tal:condition="filter/bg-justify">
       <button type="button" class="kupu-justifyleft" id="kupu-justifyleft-button" tal:condition="filter/justifyleft-button" title="Left justify: Access key (Alt or Ctrl) + L" i18n:attributes="title" accesskey="l">&#160;</button>
       <button type="button" class="kupu-justifycenter" tal:condition="filter/justifycenter-button" id="kupu-justifycenter-button" title="Center justify: Access key (Alt or Ctrl) + C" i18n:attributes="title" accesskey="c">&#160;</button>
@@ -176,7 +181,7 @@
       <button type="button" class="kupu-redo" tal:condition="filter/redo-button" id="kupu-redo-button" title="Redo: Access key (Alt or Ctrl) + Y" i18n:attributes="title" accesskey="y">&#160;</button>
     </span>
   
-    <span class="kupu-tb-buttongroup kupu-spellchecker-span" id="kupu-spellchecker">
+    <span class="kupu-tb-buttongroup kupu-spellchecker-span" id="kupu-spellchecker" tal:condition="filter/spellchecker">
       <button type="button" class="kupu-spellchecker" id="kupu-spellchecker-button" title="Check spelling" i18n:attributes="title">&#160;</button>
     </span>
   
@@ -184,7 +189,7 @@
       <button type="button" class="kupu-source" id="kupu-source-button" title="Switch between visual editor and HTML view" i18n:attributes="title toggle_source_view;" accesskey="h">&#160;</button>
     </span>
   
-    <select class="kupu-tb-styles" tal:condition="filter/styles" tal:define="styles python:tool.getStyleList(field);">
+    <select class="kupu-tb-styles" tal:condition="filter/styles" tal:define="field field|nothing;styles python:tool.getStyleList(field);">
       <option value="p" i18n:translate="">Normal</option>
       <tal:block condition="styles" repeat="style styles">
         <option i18n:translate="" tal:attributes="value style/value" tal:content="style/content"/>
@@ -414,6 +419,9 @@
   
   
     </div>
+  
+    <table id="kupu-colorchooser" class="kupu-colorchooser" cellpadding="0" cellspacing="0" style="position: fixed; border-style: solid; border-color: black; border-width: 1px;">
+    </table>
   <script type="text/javascript">var focuscount = 0;</script>
     <div>
     <iframe class="kupu-editor-iframe" frameborder="0" src="emptypage" onfocus="this.contentWindow.focus();" tal:define="base python:here.kupu_library_tool.getBaseUrl(here, True);                     base kupu_base_override|base;" tal:attributes="src string:${base}/emptypage;                         tabindex tabindex/next|nothing;">

Modified: kupu/trunk/kupu/plone/kupu_plone_layer/kupuplone.css.dtml
==============================================================================
--- kupu/trunk/kupu/plone/kupu_plone_layer/kupuplone.css.dtml	(original)
+++ kupu/trunk/kupu/plone/kupu_plone_layer/kupuplone.css.dtml	Fri Dec  8 16:41:49 2006
@@ -142,7 +142,8 @@
 .kupu-bold,
 .kupu-bold-pressed {background-image: url("&dtml-portal_url;/plonekupuimages/bold.gif");}
 
-.kupu-forecolor {background-image: url("&dtml-portal_url;/plonekupuimages/text-color.gif");}
+.kupu-forecolor {background-image: url("&dtml-portal_url;/kupuimages/text-color.png");}
+.kupu-hilitecolor {background-image: url("&dtml-portal_url;/kupuimages/background-color.png");}
 .kupu-inthyperlink {background-image: url("&dtml-portal_url;/plonekupuimages/hyperlink.gif");}
 .kupu-inthyperlink-pressed {
   border-color: &dtml-buttonshadow; &dtml-buttonhighlight; &dtml-buttonhighlight; &dtml-buttonshadow;;
@@ -196,7 +197,7 @@
 .kupu-undo {background-image: url("&dtml-portal_url;/plonekupuimages/undo.gif");}
 .kupu-removelink {background-image: url("&dtml-portal_url;/plonekupuimages/delete_icon.gif");}
 .kupu-removeimage {background-image: url("&dtml-portal_url;/plonekupuimages/delete_icon.gif");}
-.kupu-spellchecker { display:none; }
+.kupu-spellchecker {background-image: url("&dtml-portal_url;/kupuimages/text-check.png");}
 
 .kupu-zoom {background-image: url("&dtml-portal_url;/plonekupuimages/fullscreenexpand_icon.gif");}
 .kupu-zoom-pressed {background-image: url("&dtml-portal_url;/plonekupuimages/fullscreencollapse_icon.gif");}

Modified: kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneinit.js
==============================================================================
--- kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneinit.js	(original)
+++ kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneinit.js	Fri Dec  8 16:41:49 2006
@@ -89,6 +89,11 @@
                                                 'kupu-superscript-pressed');
     kupu.registerTool('superscriptbutton', superscriptbutton);
 
+    var colorchoosertool = new ColorchooserTool(prefix+'button.kupu-forecolor',
+        prefix+'button.kupu-hilitecolor',
+        prefix+'table.kupu-colorchooser');
+    kupu.registerTool('colorchooser', colorchoosertool);
+
     var justifyleftbutton = new KupuButton(prefix+'button.kupu-justifyleft',
                                            execCommand('justifyleft'));
     kupu.registerTool('justifyleftbutton', justifyleftbutton);
@@ -163,8 +168,8 @@
         kupu.registerTool('spellchecker', spellchecker);
     } else {
         // hide the button when not available
-        var spellchecker_tool = document.getElementById('kupu-spellchecker');
-        spellchecker_tool.style.display = 'none';
+        var sc = getFromSelector(prefix+'span.kupu-spellchecker-span');
+        if (sc) sc.style.display = 'none';
     }
 
     // Use the generic beforeUnload handler if we have it:

Modified: kupu/trunk/kupu/plone/plonelibrarytool.py
==============================================================================
--- kupu/trunk/kupu/plone/plonelibrarytool.py	(original)
+++ kupu/trunk/kupu/plone/plonelibrarytool.py	Fri Dec  8 16:41:49 2006
@@ -213,7 +213,8 @@
             return expr != '' or visible != DEFAULTS.get(id, False)
             
         cleaned = [ f for f in filters if nonstandard(f) ]
-        self._setToolbarFilters(filters)
+        print cleaned
+        self._setToolbarFilters(cleaned)
         if REQUEST:
             REQUEST.RESPONSE.redirect(self.absolute_url() + '/zmi_toolbar')
 

Modified: kupu/trunk/kupu/plone/spellchecker.kupu
==============================================================================
--- kupu/trunk/kupu/plone/spellchecker.kupu	(original)
+++ kupu/trunk/kupu/plone/spellchecker.kupu	Fri Dec  8 16:41:49 2006
@@ -1,14 +1,12 @@
 <?xml version="1.0" ?>
 <kupu:feature
     name="spellchecker"
-    implementation="default"
+    implementation="plone"
     xmlns="http://www.w3.org/1999/xhtml"
     xmlns:kupu="http://kupu.oscom.org/namespaces/dist"
     xmlns:i18n="http://xml.zope.org/namespaces/i18n"
-    i18n:domain="kupu"
+    xmlns:tal="http://xml.zope.org/namespaces/tal"
     >
-  <kupu:id>$Id: sourceedit.kupu 9779 2005-03-15 11:34:47Z duncan $</kupu:id>
-
   <kupu:part name="buttons">
     <span class="kupu-tb-buttongroup kupu-spellchecker-span"
         id="kupu-spellchecker" tal:condition="filter/spellchecker">

Modified: kupu/trunk/kupu/plone/toolbar.kupu
==============================================================================
--- kupu/trunk/kupu/plone/toolbar.kupu	(original)
+++ kupu/trunk/kupu/plone/toolbar.kupu	Fri Dec  8 16:41:49 2006
@@ -133,7 +133,8 @@
   <kupu:part name="select-styles">
     <select class="kupu-tb-styles"
             tal:condition="filter/styles"
-            tal:define="styles python:tool.getStyleList(field);">
+            
+            tal:define="field field|nothing;styles python:tool.getStyleList(field);">
       <option value="p" i18n:translate="">Normal</option>
       <tal:block condition="styles" repeat="style styles">
         <option i18n:translate=""

Modified: kupu/trunk/kupu/plone/zmi_toolbar.pt
==============================================================================
--- kupu/trunk/kupu/plone/zmi_toolbar.pt	(original)
+++ kupu/trunk/kupu/plone/zmi_toolbar.pt	Fri Dec  8 16:41:49 2006
@@ -45,7 +45,7 @@
               <th>Expression</th>
             </thead>
             <tbody class="kupu-tb-buttons">
-              <tr tal:repeat="opt context/getFilterOptions">
+              <tr tal:repeat="opt context/getFilterOptions" style="height:28px">
                 <td><button tal:condition="opt/classname" disabled
                   tal:attributes="class opt/classname">&#160;</button>
                 </td>


More information about the kupu-checkins mailing list