<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.toodlepip.co.uk/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0" xml:base="http://www.toodlepip.co.uk/drupal">
  <channel>
    <title>Rummaging Around with Drupal</title>
    <link>http://www.toodlepip.co.uk/drupal</link>
    <description />
    <language>en</language>
          <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.toodlepip.co.uk/toodlepipdrupal" /><feedburner:info uri="toodlepipdrupal" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
    <title>Using Iframes With Drupal's WYSIWYG Module And TinyMCE</title>
    <link>http://feeds.toodlepip.co.uk/~r/toodlepipdrupal/~3/ScZgrrOTryY/using-iframes-drupals-wysiwyg-module-and-tinymce</link>
    <description>&lt;p&gt;&lt;a href="/blog/2009/12/using-iframes-drupals-wysiwyg-module-and-tinymce"&gt;&lt;img src="http://www.toodlepip.co.uk/files-toodlepip.co.uk/images/google-maps.jpg" alt="Google Maps by aburt" style="border: 0pt none ; float: right;" width="317" height="383"&gt;&lt;/a&gt;Impatient? Skip the pre-amble and &lt;a href="#solution"&gt;go straight to the solution&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Despite it's considerable, Drupal has become the main tool used for &lt;a href="http://www.toodlepip.co.uk"&gt;this blog&lt;/a&gt; and &lt;a href="http://chinwag.com" target="_blank" title="Chinwag"&gt;at work&lt;/a&gt;. Despite the power under the hood, it sill lags behind Wordpress for user experience. &lt;/p&gt;&lt;p&gt;In previous versions, Drupal editor was fiddly to set up with lots of niggles that made life awkward, especially for occassional bloggers used to the friendly Wordpress interface.&lt;/p&gt;&lt;p&gt;Fortunately, the new &lt;a href="http://drupal.org/project/wysiwyg" target="_blank" title="Drupal Wysiwyg Module"&gt;Wysiwyg module&lt;/a&gt; dramatically changes this picture providing Drupal users access to a wide range of editors (FCKeditor 2.6, TinyMCE 3, TinyMCE 2, Whizzywig 55, YUI editor
2.7 amongst others). Add in some rather nifty picture handling using &lt;a href="http://drupal.org/project/imce" target="_blank" title="Drupal IMCE module"&gt;IMCE&lt;/a&gt; and suddenly Drupal as a blogging platform doesn't feel like Wordpress' poor relation.&lt;/p&gt;&lt;p&gt;However, there are still niggles. One that's been driving me nuts for the last few weeks has been the problem with adding Google Maps to blog posts, or any other type of page edited with TinyMCE (the flavour of editor we've decided to use at &lt;a href="http://chinwag.com" target="_blank" title="Chinwag"&gt;Chinwag&lt;/a&gt;).&lt;/p&gt;&lt;p&gt;What about the brilliant &lt;a href="http://drupal.org/project/gmap" target="_blank" title="Drupal Google Map (GMAP) Module"&gt;Google Maps (GMAP) module&lt;/a&gt;, I hear you cry? Good point, well made. It does have a very handy input filter to defined Google Maps using a macro.&lt;/p&gt;&lt;p&gt;But for something more fancy including, say a list of locations that need to be added to a map, like this one created using &lt;a href="http://chinwag.com/digitalmission/LASF09#audioboo" target="_blank" title="Digital Mission to LA &amp;amp; San Francisco - Audioboo Map"&gt;Audioboo on the Digital Mission to LA &amp;amp; San Francisco&lt;/a&gt;. Or what about other widgets using iframes to show themselves on your pages.&lt;/p&gt;&lt;p&gt;Try copying/pasting iframe code into a blog post, then enable TinyMCE and, hey presto, your code is gone. Not very useful. TinyMCE, quite rightly, strips out the iframe code, because, and I can't stress this enough, &lt;strong&gt;it's a potentially huge security hole&lt;/strong&gt;.&lt;/p&gt;&lt;h2&gt;&lt;a name="solution"&gt;&lt;/a&gt;The Solution&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Caveat: This opens a potential security hole on your site. Only enable to the smallest number of privileged users on your site. Under no circumstances enable this for Anonymous users, or you are asking for trouble. You have been warned!&lt;br&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;The plugin infrastructure provided by TinyMCE is easily accessible using the Wyisywyg module's hooks. This gives a neat solution without having to tinker either with any core files and also allows to add other extensions, if you're comfortable coding.&lt;/p&gt;&lt;p&gt;Ideally, someone in the future will turn this into a fully-featured module that allows further customisation without coding. It's clearly an issues that's &lt;a href="http://drupal.org/node/544032" target="_blank"&gt;annoying a few users&lt;/a&gt;. &lt;/p&gt;&lt;p&gt;The solution (props to &lt;a href="http://drupal.org/user/208732" target="_blank" title="Jonathan Hedstrom"&gt;Jonathan Hedstrom&lt;/a&gt;) uses the Wysiwyg's hook_wysiwyg_plugin() and TinyMCE's extended_valid_elements plugin to persuade TinyMCE to stop stripping out the iframe tags. The hook passes an array to TinyMCE that creates a TinyMCE plugin, that can be enabled on the editors profile page.&lt;/p&gt;&lt;p&gt;This code has been tested with:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://drupal.org/project/drupal" target="_blank" title="Drupal"&gt;Drupal&lt;/a&gt; 6.15 (and works with at least 3 previous releases)&lt;/li&gt;&lt;li&gt;&lt;a href="http://drupal.org/project/wysiwyg" target="_blank" title="Drupal Wysiwyg Module"&gt;Wysiwyg&lt;/a&gt; 6.x-2.x-dev (and last 3 release versions)&lt;/li&gt;&lt;li&gt;&lt;a href="http://tinymce.moxiecode.com/" target="_blank"&gt;TinyMCE&lt;/a&gt; 3.2.5&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;and is dependent on the following modules being installed and configured:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Wysiwyg&lt;/li&gt;&lt;li&gt;TinyMCE library installe&lt;/li&gt;&lt;li&gt;TinyMCE profile enabled&lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;Installation&lt;/h2&gt;&lt;p&gt;The code used is listed below and there's also a download, which you can install as a stand-alone module. It &lt;em&gt;shouldn't&lt;/em&gt; break anything else, but use at your own risk. There's two options:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.toodlepip.co.uk/files-toodlepip.co.uk/tinymce_extended.zip" target="_blank"&gt;Download and install the module&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Copy/paste the code below into a module of your choice&lt;/li&gt;&lt;/ul&gt;&lt;pre&gt;function &lt;em&gt;yourmodulename&lt;/em&gt;_wysiwyg_plugin($editor, $version) {&lt;br&gt;&amp;nbsp; switch($editor) {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 'tinymce':&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return array(&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'iframe' =&amp;gt; array(&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'extensions' =&amp;gt; array('iframe' =&amp;gt; t('Iframe Fix')),&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'extended_valid_elements' =&amp;gt;&lt;br&gt;            array('iframe[src|width|height|frameborder|scrolling]'),&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'load' =&amp;gt; FALSE,&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'internal' =&amp;gt; TRUE,&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ),&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; );&lt;br&gt;&amp;nbsp; }&lt;br&gt;}&lt;/pre&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Assuming you've downloaded the module, here's the instructions to get it up and running (this'll all sound very familiar if you're used to installing Drupal modules):&lt;/p&gt;&lt;p&gt;1) Copy the tinymce_extended folder to the modules folder in your installation.&lt;/p&gt;&lt;p&gt;2) Enable the module using Administer -&amp;gt; Site building -&amp;gt; Modules&amp;nbsp; (/admin/build/modules).&lt;/p&gt;&lt;p&gt;3) Enable the function in wysiwyg's TinyMCE profile. Go to Administer -&amp;gt; Site Configuration -&amp;gt; Wysiwyg and click 'Edit' for the TinyMCE profile that you want to access &amp;lt;iframe&amp;gt; tags. Expand the 'Buttons and plugins' option and tick the option for 'Iframe Fix', which should be near the bottom.&lt;/p&gt;&lt;p&gt;4) If your site has heavy caching, it might be worth clearing the cache, to make sure it's all working. Go to Administer -&amp;gt; Site Configuration -&amp;gt; Performance and click on the 'Clear cached data' button near the bottom of the page.&lt;/p&gt;&lt;h2&gt;Security&lt;/h2&gt;&lt;p&gt;Use this module (of a fix if you're using the code directly) with care. Iframes can be a security blackhole, so only expose this option to user's that need it. &lt;/p&gt;&lt;p&gt;I'd suggest creating a specific TinyMCE profile using the Wysiwyg module that is purely for admins and enable the iFrame fix plugin for this module &lt;em&gt;only&lt;/em&gt;. That should limit your exposure, but please note, you're using this at your own risk!&lt;/p&gt;&lt;p&gt;Picture courtesy of &lt;a href="http://www.flickr.com/photos/aburt/244778461/" target="_blank"&gt;aburt&lt;/a&gt;. Some rights reserved.&lt;/p&gt;&lt;div class="field field-type-content-taxonomy field-field-classification"&gt;
    &lt;div class="field-items"&gt;
            &lt;div class="field-item odd"&gt;
                    &lt;a href="/category/drupal"&gt;drupal&lt;/a&gt;        &lt;/div&gt;
        &lt;/div&gt;
&lt;/div&gt;
&lt;div class="field field-type-content-taxonomy field-field-tags-auto"&gt;
    &lt;div class="field-items"&gt;
            &lt;div class="field-item odd"&gt;
                    &lt;a href="/tags/drupal"&gt;drupal&lt;/a&gt;        &lt;/div&gt;
              &lt;div class="field-item even"&gt;
                    &lt;a href="/tags/tinymce"&gt;tinymce&lt;/a&gt;        &lt;/div&gt;
              &lt;div class="field-item odd"&gt;
                    &lt;a href="/tags/wysiwyg"&gt;wysiwyg&lt;/a&gt;        &lt;/div&gt;
              &lt;div class="field-item even"&gt;
                    &lt;a href="/tags/iframe"&gt;iframe&lt;/a&gt;        &lt;/div&gt;
              &lt;div class="field-item odd"&gt;
                    &lt;a href="/tags/solution"&gt;solution&lt;/a&gt;        &lt;/div&gt;
        &lt;/div&gt;
&lt;/div&gt;
&lt;table id="attachments" class="sticky-enabled"&gt;
 &lt;thead&gt;&lt;tr&gt;&lt;th&gt;Attachment&lt;/th&gt;&lt;th&gt;Size&lt;/th&gt; &lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
 &lt;tr class="odd"&gt;&lt;td&gt;&lt;a href="http://www.toodlepip.co.uk/files-toodlepip.co.uk/tinymce_extended.zip"&gt;tinymce_extended.zip&lt;/a&gt;&lt;/td&gt;&lt;td&gt;2.47 KB&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;img src="http://feeds.feedburner.com/~r/toodlepipdrupal/~4/ScZgrrOTryY" height="1" width="1"/&gt;</description>
     <comments>http://www.toodlepip.co.uk/blog/2009/12/using-iframes-drupals-wysiwyg-module-and-tinymce#comments</comments>
 <category domain="http://www.toodlepip.co.uk/tags/drupal">drupal</category>
 <category domain="http://www.toodlepip.co.uk/tags/iframe">iframe</category>
 <category domain="http://www.toodlepip.co.uk/tags/solution">solution</category>
 <category domain="http://www.toodlepip.co.uk/tags/tinymce">tinymce</category>
 <category domain="http://www.toodlepip.co.uk/tags/wysiwyg">wysiwyg</category>
 <category domain="http://www.toodlepip.co.uk/category/drupal">drupal</category>
 <enclosure url="http://www.toodlepip.co.uk/files-toodlepip.co.uk/tinymce_extended.zip" length="2533" type="application/zip" />
 <pubDate>Sun, 20 Dec 2009 15:21:54 +0000</pubDate>
 <dc:creator>Sam Michel</dc:creator>
 <guid isPermaLink="false">89 at http://www.toodlepip.co.uk</guid>
  <feedburner:origLink>http://www.toodlepip.co.uk/blog/2009/12/using-iframes-drupals-wysiwyg-module-and-tinymce</feedburner:origLink></item>
  <item>
    <title>Nasty Drupal and IE Error - Operation Aborted</title>
    <link>http://feeds.toodlepip.co.uk/~r/toodlepipdrupal/~3/UffWT89kIkQ/nasty-drupal-and-ie-error-operation-aborted</link>
    <description>&lt;!--extended--&gt;
&lt;p&gt;
Ooo, this is a fiddly little so-and-so. Finished putting together all the blocks for the site, all ready to get on with the work that I'm supposed to be doing only to discover that Internet Explorer is throwing an absolutely fit. Tried loading the page in a bunch of different IE versions to discover the same thing.
&lt;/p&gt;
&lt;blockquote class="code"&gt;
	Internet Explorer cannot open the Internet site.
	&lt;br /&gt;
	Operation aborted.
&lt;/blockquote&gt;
&lt;p&gt;
Trying to navigate to another page results in another error, something like:
&lt;/p&gt;
&lt;blockquote class="code"&gt;
	Internet Explorer is trying to load this page. Are you sure you want to navigate away?
&lt;/blockquote&gt;
&lt;p&gt;
Turns out, it's an IE-specifc error relating to Javascript. After a bit of trial and error, removing and adding back in various widgets, it turns out the one I'm using to display the latest Twitter action is the offender. The fix is to add:
&lt;/p&gt;
&lt;blockquote class="code"&gt;
	defer=&amp;quot;defer&amp;quot;
&lt;/blockquote&gt;
&lt;p&gt;
into the Javascript call, so it becomes:
&lt;/p&gt;
&lt;blockquote class="code"&gt;
	&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://twitter.com/javascripts/blogger.js&amp;quot; defer=&amp;quot;defer&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
	&amp;lt;script text=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://twitter.com/...&amp;quot;  defer=&amp;quot;defer&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
&lt;/blockquote&gt;
&lt;div class="field field-type-content-taxonomy field-field-classification"&gt;
    &lt;div class="field-items"&gt;
            &lt;div class="field-item odd"&gt;
                    &lt;a href="/category/miscellany"&gt;miscellany&lt;/a&gt;        &lt;/div&gt;
        &lt;/div&gt;
&lt;/div&gt;
&lt;div class="field field-type-content-taxonomy field-field-tags-auto"&gt;
    &lt;div class="field-items"&gt;
            &lt;div class="field-item odd"&gt;
                    &lt;a href="/tags/drupal"&gt;drupal&lt;/a&gt;        &lt;/div&gt;
              &lt;div class="field-item even"&gt;
                    &lt;a href="/tags/internet-explorer"&gt;internet explorer&lt;/a&gt;        &lt;/div&gt;
        &lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/toodlepipdrupal/~4/UffWT89kIkQ" height="1" width="1"/&gt;</description>
     <comments>http://www.toodlepip.co.uk/blog/2008/01/nasty-drupal-and-ie-error-operation-aborted#comments</comments>
 <category domain="http://www.toodlepip.co.uk/tags/drupal">drupal</category>
 <category domain="http://www.toodlepip.co.uk/tags/internet-explorer">internet explorer</category>
 <category domain="http://www.toodlepip.co.uk/category/drupal">drupal</category>
 <category domain="http://www.toodlepip.co.uk/category/miscellany">miscellany</category>
 <pubDate>Sun, 06 Jan 2008 19:46:00 +0000</pubDate>
 <dc:creator>Sam Michel</dc:creator>
 <guid isPermaLink="false">10 at http://www.toodlepip.co.uk</guid>
  <feedburner:origLink>http://www.toodlepip.co.uk/blog/2008/01/nasty-drupal-and-ie-error-operation-aborted</feedburner:origLink></item>
  </channel>
</rss>
