home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-cocoon-addon-1.4.9-installer.exe / news2edit.xslt < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  10.3 KB  |  193 lines

  1. <?xml version="1.0"?>
  2. <!--
  3.   Copyright 2002-2004 The Apache Software Foundation
  4.  
  5.   Licensed under the Apache License, Version 2.0 (the "License");
  6.   you may not use this file except in compliance with the License.
  7.   You may obtain a copy of the License at
  8.  
  9.       http://www.apache.org/licenses/LICENSE-2.0
  10.  
  11.   Unless required by applicable law or agreed to in writing, software
  12.   distributed under the License is distributed on an "AS IS" BASIS,
  13.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.   See the License for the specific language governing permissions and
  15.   limitations under the License.
  16. -->
  17.  
  18. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  19.                               xmlns:n="http://www.betaversion.org/linotype/news/1.0"
  20.                               xmlns="http://www.w3.org/1999/xhtml">
  21.  
  22.   <xsl:param name="home"/>
  23.   <xsl:param name="id"/>
  24.  
  25.   <xsl:template match="/">
  26.     <html>
  27.       <head>
  28.         <title><xsl:value-of select="n:news/n:title"/></title> 
  29.         <link rel="stylesheet" type="text/css" href="{$home}/styles/main.css"/>
  30.         <link rel="stylesheet" type="text/css" href="{$home}/styles/editor.css"/>
  31.         <script src="{$home}/scripts/utils.js" type="text/javascript">//</script>
  32.         <script src="{$home}/scripts/browser_dependent.js" type="text/javascript">//</script>
  33.         <script src="{$home}/scripts/schema.js" type="text/javascript">//</script>
  34.         <script src="{$home}/scripts/editor.js" type="text/javascript">//</script>
  35.         <script type="text/javascript"><![CDATA[
  36.  
  37.             function doAction(action) {
  38.                 var form = document.forms[0];
  39.  
  40.                 if (action == "delete") {
  41.                     var agree = confirm("Are you sure you want to delete this news?");
  42.                     if (!agree) return;
  43.                 } else if (action == "revert") {
  44.                     var content = document.getElementById("previous_innerHTML").firstChild.nodeValue;
  45.                     if (content != "") {
  46.                         var agree = confirm("Are you sure you want to restore content to the previous version?");
  47.                         if (agree) loadContent(content);
  48.                     }
  49.                     return;
  50.                 } else {
  51.                     if (!form.elements['date'].value || (action == "publish")) {
  52.                         form.elements['date'].value = getDate();
  53.                         form.elements['time'].value = getTime();
  54.                         form.elements['fulldate'].value = getFullDate();
  55.                         form.elements['isodate'].value = getISODate();
  56.                         alert("I am updating date");
  57.                     }
  58.                     form.elements['innerHTML'].value = getInnerHTML();
  59.                     form.elements['xml:content'].value = getContent();
  60.                 }
  61.  
  62.                 form.elements['action'].value = action;
  63.                 form.submit();
  64.             }
  65.             
  66.      ]]></script>
  67.         <noscript>
  68.           <h1>Dude, you won't go anywhere around here without Javascript enabled. ;-)</h1>
  69.         </noscript>
  70.       </head>
  71.  
  72.       <body onload="start(event)" onunload="stop(event)">
  73.         <!--form name="data" action="/request" method="POST" enctype="multipart/form-data"-->
  74.         <form name="data" action="{string('#{$continuation/id}')}.kont" method="POST" enctype="multipart/form-data">
  75.           <input type="hidden" name="action"/>
  76.           <input type="hidden" name="author" value="{string('#{userid}')}"/>
  77.           <input type="hidden" name="date" value="{n:news/@creation-date}"/>
  78.           <input type="hidden" name="time" value="{n:news/@creation-time}"/>
  79.           <input type="hidden" name="fulldate" value="{n:news/@creation-fulldate}"/>
  80.           <input type="hidden" name="isodate" value="{n:news/@creation-isodate}"/>
  81.           <input type="hidden" name="xml:content"/>
  82.           <input type="hidden" name="innerHTML"/>
  83.  
  84.           <div id="toolbar">
  85.             <table cellpadding="0" cellspacing="0">
  86.               <tr>
  87.                 <td><div class="imagebutton" id="bold"><img src="{$home}/images/icons/bold.gif" alt="Strong" title="Strong"/></div></td>
  88.                 <td><div class="imagebutton" id="italic"><img src="{$home}/images/icons/italic.gif" alt="Emphasis" title="Emphasis"/></div></td>
  89.                 <td><div class="imagebutton" id="strikethrough"><img src="{$home}/images/icons/strikethrough.gif" alt="Error" title="Error"/></div></td>
  90.                 <td><div class="spacer"/></td>
  91.                 <td><div class="imagebutton" id="removeformat"><img src="{$home}/images/icons/removeformat.gif" alt="Remove Format" title="Remove Format"/></div></td>
  92.                 <td><div class="spacer"/></td>
  93.                 <td><div class="imagebutton" id="undo"><img src="{$home}/images/icons/undo.gif" alt="Undo" title="Undo"/></div></td>
  94.                 <td><div class="imagebutton" id="redo"><img src="{$home}/images/icons/redo.gif" alt="Redo" title="Redo"/></div></td>
  95.                 <td><div class="spacer"/></td>
  96.                 <td><div class="imagebutton" id="createlink"><img src="{$home}/images/icons/link.gif" alt="Link Selection" title="Link Selection"/></div></td>
  97.                 <td><div class="imagebutton" id="unlink"><img src="{$home}/images/icons/unlink.gif" alt="Unlink Selection" title="Unlink Selection"/></div></td>
  98.                 <td><div class="spacer"/></td>
  99.                 <td><div class="imagebutton" id="insertimage"><img src="{$home}/images/icons/image.gif" alt="Add Image" title="Add Image"/></div></td>
  100.                 <td><div class="imagebutton" id="inserthorizontalrule"><img src="{$home}/images/icons/horizontalrule.gif" alt="Add Horizontal Rule" title="Add Horizontal Rule"/></div></td>
  101.                 <td><div class="spacer"/></td>
  102.                 <td><div class="imagebutton" id="block"><img src="{$home}/images/icons/block.gif" alt="Block" title="Block"/></div></td>
  103.                 <td><div class="imagebutton" id="unblock"><img src="{$home}/images/icons/unblock.gif" alt="UnBlock" title="UnBlock"/></div></td>
  104.                 <td><div class="spacer"/></td>
  105.                 <td><div class="imagebutton" id="insertorderedlist"><img src="{$home}/images/icons/orderedlist.gif" alt="Ordered List" title="Ordered List"/></div></td>
  106.                 <td><div class="imagebutton" id="insertunorderedlist"><img src="{$home}/images/icons/unorderedlist.gif" alt="Unordered List" title="Unordered List"/></div></td>
  107.                 <td><div class="spacer"/></td>
  108.                 <td><div class="imagebutton" id="outdent"><img src="{$home}/images/icons/outdent.gif" alt="Outdent" title="Outdent"/></div></td>
  109.                 <td><div class="imagebutton" id="indent"><img src="{$home}/images/icons/indent.gif" alt="Indent" title="Indent"/></div></td>
  110.                 <td width="100%" align="center" style="white-space: nowrap;">
  111.                   <span id="block_selector">
  112.                     <xsl:text>Block: </xsl:text>
  113.                     <select id="formatblock">
  114.                       <option value="p">Paragraph</option>
  115.                       <option value="h1">Heading 1</option>
  116.                       <option value="h2">Heading 2</option>
  117.                       <option value="h3">Heading 3</option>
  118.                       <option value="h4">Heading 4</option>
  119.                     </select>
  120.                   </span>
  121.                   <span id="class_selector">
  122.                     <xsl:text>Class: </xsl:text>
  123.                     <select id="alternatives">
  124.                       <option>whatever</option>
  125.                     </select>
  126.                   </span>
  127.                 </td>
  128.                 <!--td style="white-space: nowrap;">
  129.                   <input type="checkbox" name="online">
  130.                     <xsl:if test="n:news/@online='on'">
  131.                       <xsl:attribute name="checked">true</xsl:attribute>
  132.                     </xsl:if>
  133.                   </input>
  134.                   <label for="online">published</label>
  135.                 </td-->
  136.               </tr>
  137.             </table>
  138.           </div>
  139.  
  140.           <div id="navigation">
  141.            <a href="../../../../">linotype</a> » <a href="../../../">private</a> » <xsl:value-of select="$id"/> <span class="date">[<xsl:value-of select="n:news/@creation-date"/> ~ <xsl:value-of select="n:news/@creation-time"/>]</span>
  142.           </div>
  143.  
  144.           <xsl:apply-templates/>
  145.  
  146.           <div id="controls">
  147.             <!--Version: <select name="version">
  148.               <t:forEach select="{string('#{versions}')}" xmlns:t="http://apache.org/cocoon/templates/jx/1.0">
  149.                 <option>#{.}</option>
  150.               </t:forEach>
  151.             </select>
  152.             <input type="button" value="Restore" onclick="doAction('restore')"/--> 
  153.             <input type="button" value="Revert" onclick="doAction('revert')"/> 
  154.             <input type="button" value="Delete" onclick="doAction('delete')"/> 
  155.             <input type="button" value="Save" onclick="doAction('save')"/>
  156.             <input type="button" value="Finish" onclick="doAction('finish')"/>
  157.             <input type="button" value="Publish" onclick="doAction('publish')"/>
  158.             <!--input type="checkbox" name="update_date"/><label for="update_date">Update date</label-->
  159.           </div>
  160.           
  161.           <script type="text/javascript">
  162.             // NOTE(SM): This is a workaround to a bug in the intra-frame security restrictions
  163.             // of the latest IE6 versions, I know it's ugly as hell, but blame them not me!
  164.             // If you find a better way to make this work, please let me know.
  165.             if (IE) {
  166.                 document.getElementById("edit").contentWindow.document.designMode = "On";
  167.             }
  168.           </script>
  169.         </form>
  170.       </body>
  171.     </html>
  172.   </xsl:template>
  173.  
  174.   <xsl:template match="n:news">
  175.     <div id="page">
  176.       <div class="field">Title:<br/><input type="text" name="title" size="40" value="{n:title}"/></div>
  177.       <div id="image_inputs"/>
  178.       <div class="field">
  179.         <table cellpadding="0" cellspacing="0">
  180.           <tr>
  181.             <td align="left">Content:</td>
  182.             <td align="right" width="100%"><input type="checkbox" id="wysiwyg-checkbox" onclick="wysiwyg(!this.checked)"/>WYSIWYG</td>
  183.           </tr>
  184.         </table>
  185.         <iframe id="edit" src="content" width="100%" height="400px" scrolling="auto" frameborder="0">Get a modern browser</iframe>
  186.         <div id="editpath">...</div>
  187.       </div>
  188.       <div id="previous_innerHTML">#{innerHTML}</div>
  189.     </div>
  190.   </xsl:template>
  191.  
  192. </xsl:stylesheet>
  193.