iframes and editing on Wiki Server
After a lot of poking around and breaking things, I thought I'd share with you how to add iframes to Wiki pages and Blog posts.
*Hurdle 1.) Wiki does not allow iframes by default.*
Answer 1.) You can allow different tags by creating an override file called "whitelist.plist" and placing it here (Scroll to the bottom for code):
/private/etc/wikid/whitelist.plist
*Hurdle 2.) Wiki does not have a way to edit the <HEAD> tag on any pages. We need to use JS in the HEAD to resize the iframe for maximum use of page space.*
Answer 2.) a.) Create a .js file called "iframe.js" (Scroll to the bottom for code). b.) Drop iframe.js into /usr/share/collaboration/javascript/. c.) Edit /usr/share/wikid/lib/apple_templates/default.xsl and place this line into the <head> section so that you can load your JS code:
<script src="/collaboration/javascript/iframe.js?v=WikiServerUI-190" type="text/javascript" charset="utf-8"></script>
d.) Restart the Web service from Server Admin
*Hurdle 3.) Adding your iframe to your Wiki or Blog post*
Answer 3.) Create a new page, go into code view and add the following code:
<iframe src="http://apple.com" onload="calcHeight();" height="1" width="820" scrolling="no" id="the_iframe" frameborder="0"></iframe>
Change the "src" to whatever you want.
Have fun guys! And let me know if this helps any of you out with customizing your Wiki.
*Code 1.) "whitelist.plist"*
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>protocols</key>
<array>
<string>file</string>
<string>afp</string>
<string>feed</string>
<string>feeds</string>
<string>fax</string>
<string>ftp</string>
<string>gopher</string>
<string>http</string>
<string>https</string>
<string>itms</string>
<string>itpc</string>
<string>ldap</string>
<string>mailto</string>
<string>news</string>
<string>nfs</string>
<string>nntp</string>
<string>rdar</string>
<string>rtsp</string>
<string>sip</string>
<string>sips</string>
<string>sftp</string>
<string>smb</string>
<string>ssh</string>
<string>svn</string>
<string>svn+ssh</string>
<string>tel</string>
<string>telnet</string>
<string>vnc</string>
<string>webcal</string>
<string>xmpp</string>
</array>
<key>styles</key>
<array>
<string>font-style</string>
<string>font-weight</string>
<string>text-decoration</string>
</array>
<key>tags</key>
<dict>
<key>iframe</key>
<array>
<string>id</string>
<string>src</string>
<string>onload</string>
<string>frameborder</string>
<string>height</string>
<string>width</string>
<string>scrolling</string>
</array>
<key> all</key>
<array>
<string>style</string>
<string>class</string>
<string>title</string>
</array>
<key>a</key>
<array>
<string>href</string>
<string>name</string>
<string>rel</string>
</array>
<key>blockquote</key>
<array>
<string>cite</string>
</array>
<key>body</key>
<array/>
<key>br</key>
<array/>
<key>caption</key>
<array/>
<key>dd</key>
<array/>
<key>div</key>
<array/>
<key>dl</key>
<array/>
<key>dt</key>
<array/>
<key>em</key>
<array/>
<key>h1</key>
<array/>
<key>h2</key>
<array/>
<key>h3</key>
<array/>
<key>h4</key>
<array/>
<key>h5</key>
<array/>
<key>h6</key>
<array/>
<key>html</key>
<array/>
<key>img</key>
<array>
<string>src</string>
<string>alt</string>
<string>name</string>
<string>width</string>
<string>height</string>
<string>longdesc</string>
</array>
<key>li</key>
<array/>
<key>node</key>
<array/>
<key>object</key>
<array>
<string>classid</string>
<string>width</string>
<string>height</string>
<string>codebase</string>
</array>
<key>ol</key>
<array/>
<key>p</key>
<array/>
<key>param</key>
<array>
<string>name</string>
<string>value</string>
</array>
<key>pre</key>
<array/>
<key>q</key>
<array>
<string>cite</string>
</array>
<key>span</key>
<array/>
<key>strong</key>
<array/>
<key>table</key>
<array/>
<key>tbody</key>
<array/>
<key>td</key>
<array>
<string>colspan</string>
<string>rowspan</string>
</array>
<key>tfoot</key>
<array/>
<key>th</key>
<array>
<string>colspan</string>
<string>rowspan</string>
</array>
<key>thead</key>
<array/>
<key>tr</key>
<array/>
<key>ul</key>
<array/>
</dict>
</dict>
</plist>
*Code 2.) "iframe.js"*
function calcHeight()
{
//find the height of the internal page
var the_height=
document.getElementById('the_iframe').contentWindow.
document.body.scrollHeight;
//change the height of the iframe
document.getElementById('the_iframe').height=
the_height;
}
*Hurdle 1.) Wiki does not allow iframes by default.*
Answer 1.) You can allow different tags by creating an override file called "whitelist.plist" and placing it here (Scroll to the bottom for code):
/private/etc/wikid/whitelist.plist
*Hurdle 2.) Wiki does not have a way to edit the <HEAD> tag on any pages. We need to use JS in the HEAD to resize the iframe for maximum use of page space.*
Answer 2.) a.) Create a .js file called "iframe.js" (Scroll to the bottom for code). b.) Drop iframe.js into /usr/share/collaboration/javascript/. c.) Edit /usr/share/wikid/lib/apple_templates/default.xsl and place this line into the <head> section so that you can load your JS code:
<script src="/collaboration/javascript/iframe.js?v=WikiServerUI-190" type="text/javascript" charset="utf-8"></script>
d.) Restart the Web service from Server Admin
*Hurdle 3.) Adding your iframe to your Wiki or Blog post*
Answer 3.) Create a new page, go into code view and add the following code:
<iframe src="http://apple.com" onload="calcHeight();" height="1" width="820" scrolling="no" id="the_iframe" frameborder="0"></iframe>
Change the "src" to whatever you want.
Have fun guys! And let me know if this helps any of you out with customizing your Wiki.
*Code 1.) "whitelist.plist"*
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>protocols</key>
<array>
<string>file</string>
<string>afp</string>
<string>feed</string>
<string>feeds</string>
<string>fax</string>
<string>ftp</string>
<string>gopher</string>
<string>http</string>
<string>https</string>
<string>itms</string>
<string>itpc</string>
<string>ldap</string>
<string>mailto</string>
<string>news</string>
<string>nfs</string>
<string>nntp</string>
<string>rdar</string>
<string>rtsp</string>
<string>sip</string>
<string>sips</string>
<string>sftp</string>
<string>smb</string>
<string>ssh</string>
<string>svn</string>
<string>svn+ssh</string>
<string>tel</string>
<string>telnet</string>
<string>vnc</string>
<string>webcal</string>
<string>xmpp</string>
</array>
<key>styles</key>
<array>
<string>font-style</string>
<string>font-weight</string>
<string>text-decoration</string>
</array>
<key>tags</key>
<dict>
<key>iframe</key>
<array>
<string>id</string>
<string>src</string>
<string>onload</string>
<string>frameborder</string>
<string>height</string>
<string>width</string>
<string>scrolling</string>
</array>
<key> all</key>
<array>
<string>style</string>
<string>class</string>
<string>title</string>
</array>
<key>a</key>
<array>
<string>href</string>
<string>name</string>
<string>rel</string>
</array>
<key>blockquote</key>
<array>
<string>cite</string>
</array>
<key>body</key>
<array/>
<key>br</key>
<array/>
<key>caption</key>
<array/>
<key>dd</key>
<array/>
<key>div</key>
<array/>
<key>dl</key>
<array/>
<key>dt</key>
<array/>
<key>em</key>
<array/>
<key>h1</key>
<array/>
<key>h2</key>
<array/>
<key>h3</key>
<array/>
<key>h4</key>
<array/>
<key>h5</key>
<array/>
<key>h6</key>
<array/>
<key>html</key>
<array/>
<key>img</key>
<array>
<string>src</string>
<string>alt</string>
<string>name</string>
<string>width</string>
<string>height</string>
<string>longdesc</string>
</array>
<key>li</key>
<array/>
<key>node</key>
<array/>
<key>object</key>
<array>
<string>classid</string>
<string>width</string>
<string>height</string>
<string>codebase</string>
</array>
<key>ol</key>
<array/>
<key>p</key>
<array/>
<key>param</key>
<array>
<string>name</string>
<string>value</string>
</array>
<key>pre</key>
<array/>
<key>q</key>
<array>
<string>cite</string>
</array>
<key>span</key>
<array/>
<key>strong</key>
<array/>
<key>table</key>
<array/>
<key>tbody</key>
<array/>
<key>td</key>
<array>
<string>colspan</string>
<string>rowspan</string>
</array>
<key>tfoot</key>
<array/>
<key>th</key>
<array>
<string>colspan</string>
<string>rowspan</string>
</array>
<key>thead</key>
<array/>
<key>tr</key>
<array/>
<key>ul</key>
<array/>
</dict>
</dict>
</plist>
*Code 2.) "iframe.js"*
function calcHeight()
{
//find the height of the internal page
var the_height=
document.getElementById('the_iframe').contentWindow.
document.body.scrollHeight;
//change the height of the iframe
document.getElementById('the_iframe').height=
the_height;
}
XServe, Mac OS X (10.6.2)