<D <M <Y
M> D>

2008-04-29T01:38:52 tinymce patch for newsbruiser:

This patch hopefully works on the new newsbruiser release 2.6.2. It lets us use the excellent TinyMCE editor widget to write blog posts. Along with this patch, you have to actually put tinymce such that it shows up at /resources/tiny_mce/tiny_mce.js.

(Coming soon: another newsbruiser patch and accompanying tools that let us send picture posts from our cell phones.)

 

Index: nb/CoreCGIs.py
===================================================================
RCS file: /cvs/newsbruiser/nb/CoreCGIs.py,v
retrieving revision 1.100
diff -u -r1.100 CoreCGIs.py
--- nb/CoreCGIs.py 27 Apr 2008 11:52:33 -0000 1.100
+++ nb/CoreCGIs.py 29 Apr 2008 08:16:41 -0000
@@ -271,7 +267,7 @@
self.printDisplaySnippets('aboveEntryText')
print '<table><tr><td valign="top">'
self.textArea(self.notebook.getEntryBoxLength(), 70,
- const.ENTRY_CGI_KEY)
+ const.ENTRY_CGI_KEY, html=True)
self.printDisplaySnippets('rightOfEntryText')

if showHelp:
@@ -819,7 +815,7 @@
print '<table><tr><td valign="top">'

self.textArea(self.notebook.getEntryBoxLength(), 70,
- const.ENTRY_CGI_KEY, entry.text)
+ const.ENTRY_CGI_KEY, entry.text, html=True)
self.printDisplaySnippets('rightOfEntryText')
if names:
print '</td><td valign="top">'
Index: nb/lib/LOMP.py
===================================================================
RCS file: /cvs/newsbruiser/nb/lib/LOMP.py,v
retrieving revision 1.16
diff -u -r1.16 LOMP.py
--- nb/lib/LOMP.py 5 Dec 2004 20:20:51 -0000 1.16
+++ nb/lib/LOMP.py 29 Apr 2008 08:16:59 -0000
@@ -183,9 +183,41 @@
maxlength = ''
print '<input type="text" name="%s" value="%s" size="%s"%s />' % (name, cgi.escape(str(value), 1), size, maxlength)

- def textArea(self, rows, cols, name, content=''):
- "Prints a standard multiline text box."
- print '<p><textarea wrap="virtual" rows="%s" cols="%s" name="%s">%s</textarea></p>' % (rows, cols, name, cgi.escape(str(content)))
+ def textArea(self, rows, cols, name, content='', html=False):
+ """Prints a standard multiline text box.
+
+ drewp adds html mode using tinymce
+ """
+ escContent = cgi.escape(str(content))
+ if html:
+ # it would be cool to grab recent images and put them in
+ # the external_image_list
+ # see http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/external_image_list_url
+
+ # the way i include this js probably only works if there's
+ # one html textarea on the page
+ print """
+<script type="text/javascript" src="/resources/tiny_mce/tiny_mce.js"></script>
+<script type="text/javascript">
+ tinyMCE.init({
+ mode : "exact",
+ elements : "elm1",
+ theme : "advanced",
+ table_inline_editing : true,
+ plugins : "table,emotions,style",
+ theme_advanced_blockformats : "p,pre,div,h1,h2,h3,h4,h5,h6,blockquote,dt,dd,code,samp",
+ theme_advanced_toolbar_location : "top",
+ theme_advanced_statusbar_location : "bottom",
+ theme_advanced_resizing : true,
+ theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,outdent,indent,blockquote,|,formatselect,fontselect,fontsizeselect",
+ theme_advanced_buttons2 : "undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,styleprops",
+ theme_advanced_buttons3 : "tablecontrols"
+ });
+</script>
+
+ <p><textarea id="elm1" name="%(name)s" rows="20" cols="60">%(escContent)s</textarea></p>""" % vars()
+ return
+ print '<p><textarea wrap="virtual" rows="%s" cols="%s" name="%s">%s</textarea></p>' % (rows, cols, name, escContent)

def listBox(self, boxName, names, values, defaults=None, size=1,
allowMultiple=0):

2008-04-29T21:52:08 Timelapse Capture of Google's Predicted Traffic Conditions:

seen here


[Main]

Unless otherwise noted, all content licensed by Drew Perttula
under a Creative Commons License.