[Libreoffice-commits] dev-tools.git: help3/xhpeditor

Olivier Hallot (via logerrit) logerrit at kemper.freedesktop.org
Mon Dec 2 14:26:56 UTC 2019


 help3/xhpeditor/ed_transform.xsl |   66 ---------------------------------------
 help3/xhpeditor/index.php        |   35 ++++++++++++--------
 2 files changed, 21 insertions(+), 80 deletions(-)

New commits:
commit 584c6ec7aeb7d02db9e7bf6b6e1d4cc57a474a47
Author:     Olivier Hallot <olivier.hallot at libreoffice.org>
AuthorDate: Mon Dec 2 10:12:08 2019 -0300
Commit:     Olivier Hallot <olivier.hallot at libreoffice.org>
CommitDate: Mon Dec 2 15:26:38 2019 +0100

    Move editor to php (2) (WIP)
    
    - Cut useless xsl
    - login in php file
    - wip
    
    Change-Id: Idc449cd5ecd5f6a5207475d12041b3ece9d3c71d
    Reviewed-on: https://gerrit.libreoffice.org/84222
    Reviewed-by: Olivier Hallot <olivier.hallot at libreoffice.org>
    Tested-by: Olivier Hallot <olivier.hallot at libreoffice.org>

diff --git a/help3/xhpeditor/ed_transform.xsl b/help3/xhpeditor/ed_transform.xsl
index f96a43d..1e5b09d 100644
--- a/help3/xhpeditor/ed_transform.xsl
+++ b/help3/xhpeditor/ed_transform.xsl
@@ -116,39 +116,9 @@
 
 <!-- Create the document skeleton -->
 <xsl:template match="/">
-    <xsl:variable name="htmlpage"><xsl:value-of select="concat(substring-before($filename,'.xhp'),'.html')"/></xsl:variable>
-    <xsl:variable name="titleL10N">
-        <xsl:call-template name="brand"><xsl:with-param name="string"><xsl:value-of select="$title"/></xsl:with-param></xsl:call-template>
-    </xsl:variable>
-    <xsl:variable name="install">
-        <xsl:call-template name="tokenize">
-            <xsl:with-param name="str" select="$filename"/>
-        </xsl:call-template>
-    </xsl:variable>
-    <xsl:variable name="logoprodversion">
-        <xsl:choose>
-            <xsl:when test="$productversion='latest'"><xsl:value-of select="''"/></xsl:when>
-            <xsl:otherwise><xsl:value-of select="$productversion"/></xsl:otherwise>
-        </xsl:choose>
-    </xsl:variable>
-<html lang="{$lang}">
-    <head>
-        <base href="{$install}"/>
-        <meta name="viewport" content="width=device-width,initial-scale=1"/>
-    </head>
-    <body itemscope="true" itemtype="http://schema.org/TechArticle">
     <div id="DisplayArea" itemprop="articleBody">
         <xsl:apply-templates select="/helpdocument/body"/>
-
         <footer>
-            <xsl:if test="$online">
-                <div class="donation">
-                    <p><a href="https://www.libreoffice.org/donate/?pk_campaign=help" target ="_blank">
-                        <xsl:value-of select="$ui_donate"/>
-                    </a></p>
-                </div>
-                <p><a href="https://www.libreoffice.org/imprint" target="_blank">Impressum (Legal Info)</a> | <a href="https://www.libreoffice.org/privacy" target="_blank">Privacy Policy</a> | <a href="https://www.documentfoundation.org/statutes.pdf" target="_blank">Statutes (non-binding English translation)</a> - <a href="https://www.documentfoundation.org/satzung.pdf" target="_blank">Satzung (binding German version)</a> | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the <a href="https://www.libreoffice.org/download/license/" target="_blank">Mozilla Public License v2.0</a>. “LibreOffice” and “The Document Foundation” are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our <a href="https://wiki.documentfoundation.org/TradeMark_Poli
 cy" target="_blank">trademark policy</a>. LibreOffice was based on OpenOffice.org.</p>
-            </xsl:if>
             <div id="DEBUG" class="debug">
                 <h3 class="bug">Help content debug info:</h3>
                 <p>This page is: <a href="https://opengrok.libreoffice.org/xref/help/source{$filename}" target="_blank"><xsl:value-of select="$filename"/></a></p>
@@ -159,42 +129,6 @@
             </div>
         </footer>
     </div>
-<!--    <xsl:choose>
-        <xsl:when test="$online">
-            <script type="text/javascript">
-                <![CDATA[
-                var module = getParameterByName("DbPAR");
-                var system = getParameterByName("System");
-                var helpID = getParameterByName("HID");
-                fixURL(module,system);
-                var dbg = getParameterByName("Debug");
-                if (dbg == null){dbg=0}
-                document.getElementById("DEBUG").style.display = (dbg == 0) ? "none":"block";
-                document.getElementById("bm_module").innerHTML ="Module is: "+module;
-                document.getElementById("bm_system").innerHTML ="System is: "+system;
-                document.getElementById("bm_HID").innerHTML ="HID is: "+helpID;
-                ]]>
-            </script>
-        </xsl:when>
-        <xsl:otherwise>
-            <script type="text/javascript">
-                <![CDATA[
-                var module = getParameterByName("DbPAR");
-                var helpID = getParameterByName("HID");
-                var system = getSystem();
-                fixURL(module,system);
-                var dbg = getParameterByName("Debug");
-                if (dbg == null){dbg=0}
-                document.getElementById("DEBUG").style.display = (dbg == 0) ? "none":"block";
-                document.getElementById("bm_module").innerHTML ="Module is: "+module;
-                document.getElementById("bm_system").innerHTML ="System is: "+system;
-                document.getElementById("bm_HID").innerHTML ="HID is: "+helpID;
-                ]]>
-            </script>
-        </xsl:otherwise>
-    </xsl:choose>-->
-    </body>
-</html>
 </xsl:template>
 
 <!-- AHELP -->
diff --git a/help3/xhpeditor/index.php b/help3/xhpeditor/index.php
index a57e4b2..ced9ca7 100644
--- a/help3/xhpeditor/index.php
+++ b/help3/xhpeditor/index.php
@@ -7,7 +7,7 @@
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 -->
 <?php 
-$xhp = $_POST["olivier"];
+$xhp = $_POST["xhpdoc"];
 ?>
 <html>
 <head>
@@ -34,9 +34,10 @@ $xhp = $_POST["olivier"];
 <body style="font-family:sans-serif;">
 <div class="leftside">
     <h2>LibreOffice Documentation XHP Editor</h2>
-    <form id="mytextarea" class="form_area" action="xhpeditor/index.php" method="post">
-        <textarea id="xhpeditor" name="olivier" form="mytextarea"><?php echo $xhp; ?></textarea></br>
-        <input type="submit" value="Render page"/>
+    <form id="CMtextarea" class="form_area" action="index.php" method="post">
+        <textarea id="xhpeditor" name="xhpdoc" form="CMtextarea"><?php echo $xhp; ?></textarea></br>
+        <input type="submit" name="render_page" value="Render page"/>
+        <input type="submit" name="get_patch" value="Generate patch"/>
     </form>
     <br />
     <div class="snip_heading">
@@ -115,18 +116,24 @@ $xhp = $_POST["olivier"];
     </div>
 </div>
 <div class="rightside">
-    <h2>Rendered page</h2> 
-    <div id="renderedpage">
     <?php 
-    $xml = new DOMDocument();
-    $xml->loadXML($xhp);
-    $xsl = new DOMDocument; 
-    $xsl->load('ed_transform.xsl'); 
-    $proc = new XSLTProcessor(); 
-    $proc->importStyleSheet($xsl); 
-    echo $proc->transformToXML($xml);
+        $xhp = $_POST["xhpdoc"];
+        if (isset($_POST["render_page"])) {
+            echo '<h2>Rendered page</h2><div id="renderedpage">';
+            $xml = new DOMDocument();
+            $xml->loadXML($xhp);
+            $xsl = new DOMDocument;
+            $xsl->load('ed_transform.xsl');
+            $proc = new XSLTProcessor();
+            $proc->importStyleSheet($xsl);
+            echo $proc->transformToXml($xml);
+            echo'</div>';
+        } else if(isset($_POST["get_patch"])) {
+            echo '<h2>Patch</h2><div id="patchpage"><textarea>';
+            print $xhp;
+            echo '</textarea></div>';
+        }else {}
     ?>
-    </div>
 </div>
 </body>
 </html>


More information about the Libreoffice-commits mailing list