diff options
author | Olivier Hallot <olivier.hallot@libreoffice.org> | 2017-06-04 20:32:35 -0300 |
---|---|---|
committer | Olivier Hallot <olivier.hallot@edx.srv.br> | 2017-06-05 01:35:21 +0200 |
commit | fadaa62d1dd4757a355adb68f58b0a77b5e854b5 (patch) | |
tree | 96a41f64dd901ae6f9a0d589ee956dd0e970eeb9 /source | |
parent | ac24ea0b5c1d2b453b83cbc8f93e99b6955416a7 (diff) |
More work on help pages in browsers
Now works offline with file://
Change-Id: I03e061078f128e46810472fc484495aff684e3f4
Reviewed-on: https://gerrit.libreoffice.org/38396
Reviewed-by: Olivier Hallot <olivier.hallot@edx.srv.br>
Tested-by: Olivier Hallot <olivier.hallot@edx.srv.br>
Diffstat (limited to 'source')
-rw-r--r-- | source/default.css | 54 | ||||
-rwxr-xr-x | source/get_bookmark.sh | 98 | ||||
-rw-r--r-- | source/get_bookmark.xsl | 3 | ||||
-rw-r--r-- | source/help.js | 10 | ||||
-rw-r--r-- | source/online_transform.xsl | 103 |
5 files changed, 108 insertions, 160 deletions
diff --git a/source/default.css b/source/default.css index ee9396f957..f13f61f75a 100644 --- a/source/default.css +++ b/source/default.css @@ -93,7 +93,7 @@ h4, h5, h6 { } .avis { - background-color: #FFCCFF; + background-color: #EEEEEE; } .relatedtopics { @@ -184,7 +184,7 @@ h4, h5, h6 { bottom: 5px; right: 5px; left: 30%; - top: 15%; + top: 10%; overflow: auto; border: solid 1px; padding: 10px; @@ -196,7 +196,7 @@ h4, h5, h6 { left: 5px; overflow: auto; right: 70%; - top: 15%; + top: 10%; border-top: solid 1px; border-left: solid 1px; border-bottom: solid 1px; @@ -204,24 +204,18 @@ h4, h5, h6 { } #TopRight { - border-top: solid 1px; - border-left: solid 1px; - border-right: solid 1px; position: fixed; - right: 5px; - top: 5px; - left: 50%; - bottom: 85%; + right: 0px; + top: 0px; + left: 70%; + bottom: 90%; } #TopLeft { - border-top: solid 1px; - border-left: solid 1px; - border-right: solid 1px; - left: 5px; + left: 0px; position: fixed; - top: 5px; - bottom: 85%; + top: 0px; + bottom: 90%; } #NavigationHistory { @@ -250,5 +244,31 @@ h4, h5, h6 { } .embedded { - border-right: 10px solid red; } +// Top menu navidation +nav { + background-color: #333; + margin: 0; + overflow: hidden; +} +nav ul{ + margin: 0; + padding: 0; +} +nav ul li { + /* This allow us to arrange list items in a row, without using float */ + display: inline-block; + list-style-type: none; +} + +/* Create a style for the first level items */ +nav > ul > li > a { + color: #FFFFFF; + background-color:#18A303; + display: block; + line-height: 2em; + padding: 0.5em 0.5em; + text-decoration: none; +} + + diff --git a/source/get_bookmark.sh b/source/get_bookmark.sh index 4aa4e44d04..8c8849269e 100755 --- a/source/get_bookmark.sh +++ b/source/get_bookmark.sh @@ -8,95 +8,39 @@ outdir=$1 -stub1='<ul class="indexlink">' -stub2='</ul>' -ffile=$outdir'bookmark_CALC.html' +ffile=$outdir'bookmarks.js' +rm -f $ffile ffile2=temp.html -param='--stringparam app CALC' -rm -f $ffile $ffile2 -find text/scalc -type f -name "*.xhp" -exec xsltproc $param get_bookmark.xsl {} + >> $ffile2 -echo $stub1 > $ffile -awk 'NF' $ffile2 >> $ffile -sort -k3b -t\> -s -o $ffile $ffile -echo $stub2 >> $ffile - -ffile=$outdir'bookmark_WRITER.html' -rm -f $ffile $ffile2 -touch $ffile2 -param='--stringparam app WRITER' -find text/swriter -type f -name "*.xhp" -exec xsltproc $param get_bookmark.xsl {} + >> $ffile2 -echo $stub1 > $ffile -awk 'NF' $ffile2 >> $ffile -sort -k3b -t\> -s -o $ffile $ffile -echo $stub2 >> $ffile +stub2=\' -ffile=$outdir'bookmark_DRAW.html' -rm -f $ffile $ffile2 -touch $ffile2 -param='--stringparam app DRAW' -find text/sdraw -type f -name "*.xhp" -exec xsltproc $param get_bookmark.xsl {} + >> $ffile2 -echo $stub1 > $ffile -awk 'NF' $ffile2 >> $ffile -sort -k3b -t\> -s -o $ffile $ffile -echo $stub2 >> $ffile - -ffile=$outdir'bookmark_IMPRESS.html' -rm -f $ffile $ffile2 -touch $ffile2 -param='--stringparam app IMPRESS' -find text/simpress -type f -name "*.xhp" -exec xsltproc $param get_bookmark.xsl {} + >> $ffile2 -echo $stub1 > $ffile +for i in CALC CHART WRITER DRAW IMPRESS MATH BASIC +do +stub1='document.getElementById("bookmark'$i'").innerHTML='\'\\ +sfind=`echo 'text/s'$i | tr '[:upper:]' '[:lower:]'` +param='--stringparam app '$i +rm -f $ffile2 +find $sfind -type f -name "*.xhp" -exec xsltproc $param get_bookmark.xsl {} + >> $ffile2 +echo $stub1 >> $ffile +sort -k3b -t\> -s -o $ffile2 $ffile2 awk 'NF' $ffile2 >> $ffile -sort -k3b -t\> -s -o $ffile $ffile echo $stub2 >> $ffile +done -ffile=$outdir'bookmark_SHARED.html' -rm -f $ffile $ffile2 -touch $ffile2 +stub1='document.getElementById("bookmarkSHARED").innerHTML='\'\\ +rm -f $ffile2 param='--stringparam app SHARED' find text/shared -type f -name "*.xhp" -exec xsltproc $param get_bookmark.xsl {} + >> $ffile2 -echo $stub1 > $ffile +echo $stub1 >> $ffile +sort -k3b -t\> -s -o $ffile2 $ffile2 awk 'NF' $ffile2 >> $ffile -sort -k3b -t\> -s -o $ffile $ffile echo $stub2 >> $ffile -ffile=$outdir'bookmark_CHART.html' -rm -f $ffile $ffile2 -touch $ffile2 -param='--stringparam app CHART' -find text/schart -type f -name "*.xhp" -exec xsltproc $param get_bookmark.xsl {} + >> $ffile2 -echo $stub1 > $ffile -awk 'NF' $ffile2 >> $ffile -sort -k3b -t\> -s -o $ffile $ffile -echo $stub2 >> $ffile - -ffile=$outdir'bookmark_MATH.html' -rm -f $ffile $ffile2 -touch $ffile2 -param='--stringparam app MATH' -find text/smath -type f -name "*.xhp" -exec xsltproc $param get_bookmark.xsl {} + >> $ffile2 -echo $stub1 > $ffile -awk 'NF' $ffile2 >> $ffile -sort -k3b -t\> -s -o $ffile $ffile -echo $stub2 >> $ffile - -ffile=$outdir'bookmark_BASIC.html' -rm -f $ffile $ffile2 -touch $ffile2 -param='--stringparam app BASIC' -find text/sbasic -type f -name "*.xhp" -exec xsltproc $param get_bookmark.xsl {} + >> $ffile2 -echo $stub1 > $ffile -awk 'NF' $ffile2 >> $ffile -sort -k3b -t\> -s -o $ffile $ffile -echo $stub2 >> $ffile - -ffile=$outdir'bookmark_BASE.html' -rm -f $ffile $ffile2 -touch $ffile2 +stub1='document.getElementById("bookmarkBASE").innerHTML='\'\\ +rm -f $ffile2 param='--stringparam app BASE' find text/shared/explorer/database -type f -name "*.xhp" -exec xsltproc $param get_bookmark.xsl {} + >> $ffile2 -echo $stub1 > $ffile +echo $stub1 >> $ffile +sort -k3b -t\> -s -o $ffile2 $ffile2 awk 'NF' $ffile2 >> $ffile -sort -k3b -t\> -s -o $ffile $ffile echo $stub2 >> $ffile rm -f $ffile2 diff --git a/source/get_bookmark.xsl b/source/get_bookmark.xsl index e13d1b333e..b09b038cdc 100644 --- a/source/get_bookmark.xsl +++ b/source/get_bookmark.xsl @@ -53,13 +53,12 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:for-each select="//bookmark[@branch='index']"> <xsl:variable name="hrefhtml" select="substring-before($filename,'xhp')"/> <xsl:variable name="href" select="concat($hrefhtml,'html?DbPAR=',$app,'#',@id)"/> - <xsl:for-each select="bookmark_value"> <li><a href="{$href}" target="_top"> <xsl:call-template name="brand"><xsl:with-param name="string"> <xsl:value-of select="."/> </xsl:with-param></xsl:call-template> - </a></li><xsl:text>
</xsl:text> + </a></li><xsl:text>\
</xsl:text> </xsl:for-each> </xsl:for-each> </xsl:template> diff --git a/source/help.js b/source/help.js index dba3baf217..b138839e59 100644 --- a/source/help.js +++ b/source/help.js @@ -8,9 +8,10 @@ */ function setModule(module){ -var itemspan = document.getElementsByTagName("span"); +if (module == null){module="SHARED"} -if (module == null){module="DEFAPP"} +document.getElementById("bookmark"+module).hidden=false; +var itemspan = document.getElementsByTagName("span"); var n = itemspan.length; for (var i = 0; i < n; i++){ if (itemspan[i].getAttribute("value") == module){ @@ -54,11 +55,6 @@ function fixURL(module, system){ } } -function displayBookmark(module){ - if (module==null){module='WRITER'} - $("#BottomLeft").load('bookmark_'+module+'.html'); -} - function getParameterByName(name, url) { if (!url) { url = window.location.href; diff --git a/source/online_transform.xsl b/source/online_transform.xsl index f79bfa659d..3e02576fa9 100644 --- a/source/online_transform.xsl +++ b/source/online_transform.xsl @@ -104,9 +104,6 @@ <xsl:variable name="note_img" select="concat($img_url_prefix,'helpimg/note.png')"/> <xsl:variable name="tip_img" select="concat($img_url_prefix,'helpimg/tip.png')"/> <xsl:variable name="warning_img" select="concat($img_url_prefix,'helpimg/warning.png')"/> -<!--<xsl:variable name="note_img" select="concat($img_url_prefix,$lang,'res/helpimg/note.png')"/> -<xsl:variable name="tip_img" select="concat($img_url_prefix,'res/helpimg/tip.png')"/> -<xsl:variable name="warning_img" select="concat($img_url_prefix,'res/helpimg/warning.png')"/>--> <!-- ############# @@ -116,31 +113,45 @@ <!-- Create the document skeleton --> <xsl:template match="/"> - <!--<xsl:variable name="csslink" select="concat($urlpre,'/',$urlpost)"/>--> <xsl:variable name="csslink" select="concat($urlpre,'default.css')"/> <xsl:variable name="bookmarkref" select="concat('bookmark_',$appl,'.html')"/> <html> <head> - <!--<base href="file:///home/olivier/tmp/help/source/h/"/>--> +<!-- <base href="file:///home/tdf/git/core/helpcontent2/source/html/"/> --> <base href="/"/> - <title><xsl:value-of select="$title"/></title> + <title><xsl:call-template name="brand"><xsl:with-param name="string"> + <xsl:value-of select="$title"/> + </xsl:with-param></xsl:call-template></title> <link href="{$csslink}" rel="Stylesheet" type="text/css" /> <script type="text/javascript" src="jquery-3.1.1.min.js"></script> <script type="text/javascript" src="help.js"></script> + <meta http-equiv="Content-type" content="text/html; charset=utf-8"/> </head> <body lang="{$lang}"> - <div id="DisplayArea"> + <div id="BottomLeft"> + <p>Search: <input type="text" id="search-bar"/></p> + <ul id="bookmarkCALC" hidden="true" class="indexlink"></ul> + <ul id="bookmarkCHART" hidden="true" class="indexlink"></ul> + <ul id="bookmarkWRITER" hidden="true" class="indexlink"></ul> + <ul id="bookmarkDRAW" hidden="true" class="indexlink"></ul> + <ul id="bookmarkIMPRESS" hidden="true" class="indexlink"></ul> + <ul id="bookmarkMATH" hidden="true" class="indexlink"></ul> + <ul id="bookmarkBASE" hidden="true" class="indexlink"></ul> + <ul id="bookmarkSHARED" hidden="true" class="indexlink"></ul> + <ul id="bookmarkBASIC" hidden="true" class="indexlink"></ul> + </div> + <div id="DisplayArea"> <xsl:apply-templates select="/helpdocument/body"/> <div class="debug"> - <h3>Help content debug info:</h3> - <p class="bug">This page is: <xsl:value-of select="$filename"/></p> + <h3 class="bug">Help content debug info:</h3> + <p>This page is: <xsl:value-of select="$filename"/></p> <p>Title is: <xsl:value-of select="$title"/></p> <p id="bm_module"></p> <p id="bm_system"></p> </div> </div> - <div id="BottomLeft"></div> + <div id="TopRight"> <script type="text/javascript"> <![CDATA[ @@ -158,37 +169,35 @@ <xsl:text disable-output-escaping="yes"><gcse:search></gcse:search></xsl:text> </div> <div id="TopLeft"> - <table> - <tr> - <td class="topmenu"><a href="text/scalc/main0000.html?DbPAR=CALC">Calc</a></td> - <td class="topmenu"><a href="text/swriter/main0000.html?DbPAR=WRITER">Writer</a></td> - <td class="topmenu"><a href="text/simpress/main0000.html?DbPAR=IMPRESS">Impress</a></td> - <td class="topmenu"><a href="text/sdraw/main0000.html?DbPAR=DRAW">Draw</a></td> - <td class="topmenu"><a href="text/schart/main0000.html?DbPAR=CHART">Chart</a></td> - <td class="topmenu"><a href="text/sbasic/shared/main0601.html?DbPAR=BASIC">Basic</a></td> - <td class="topmenu"><a href="text/smath/main0000.html?DbPAR=MATH">Math</a></td> - <td class="topmenu"><a href="text/shared/explorer/database/main.html?DbPAR=BASE">Base</a></td> - <td class="topmenu"><a href="text/shared/guide/main.html?DbPAR=SHARED">Guide</a></td> - </tr> - </table> - <p>Search: <input type="text" id="search-bar"/></p> + <nav id="TopMenu"> + <ul> + <li><a href="text/scalc/main0000.html?DbPAR=CALC">Calc</a></li> + <li><a href="text/swriter/main0000.html?DbPAR=WRITER">Writer</a></li> + <li><a href="text/simpress/main0000.html?DbPAR=IMPRESS">Impress</a></li> + <li><a href="text/sdraw/main0000.html?DbPAR=DRAW">Draw</a></li> + <li><a href="text/schart/main0000.html?DbPAR=CHART">Chart</a></li> + <li><a href="text/sbasic/shared/main0601.html?DbPAR=BASIC">Basic</a></li> + <li><a href="text/smath/main0000.html?DbPAR=MATH">Math</a></li> + <li><a href="text/shared/explorer/database/main.html?DbPAR=BASE">Base</a></li> + <li><a href="text/shared/guide/main.html?DbPAR=SHARED">Guide</a></li> + </ul> + </nav> </div> <script type="text/javascript"> <![CDATA[ -if (window.location.href.indexOf('?')) { +if (window.location.href.indexOf('?') == -1) { +window.open('text/shared/main0108.html?System=DEFSYS&DbPAR=WRITER&System=WIN','_self'); +} var module = getParameterByName("DbPAR"); -displayBookmark(module); setModule(module); var system = getParameterByName("System"); setSystem(system); +fixURL(module,system); document.getElementById("bm_module").innerHTML ="Module is: "+module; document.getElementById("bm_system").innerHTML ="System is: "+system; -fixURL(module,system); -} else { -window.open('text/shared/main0108.html?System=DEFSYS&DbPAR=WRITER','_self'); -} ]]> </script> + <script type="text/javascript" src="bookmarks.js"/> </body> </html> </xsl:template> @@ -688,7 +697,6 @@ window.open('text/shared/main0108.html?System=DEFSYS&DbPAR=WRITER','_self'); <xsl:variable name="href"><xsl:value-of select="concat($linkprefix,substring-before(@href, 'xhp'),'html',$linkpostfix)"/></xsl:variable> <a href="{$href}"><xsl:apply-templates /></a> - <!-- <span class="hotlink" onclick="javascript:displayResult('{$href}')"><xsl:apply-templates /></span>--> </xsl:otherwise> </xsl:choose> </xsl:template> @@ -749,7 +757,6 @@ window.open('text/shared/main0108.html?System=DEFSYS&DbPAR=WRITER','_self'); <xsl:param name="embedded" /> <xsl:choose> <xsl:when test="parent::switch[@select='sys'] or parent::switchinline[@select='sys']"> - <!--<xsl:if test="@select = $System">--> <xsl:choose> <xsl:when test="$embedded = 'yes'"> <span hidden="true" itemprop="system" value="{@select}"><xsl:apply-templates mode="embedded"/></span> @@ -758,10 +765,8 @@ window.open('text/shared/main0108.html?System=DEFSYS&DbPAR=WRITER','_self'); <span hidden="true" itemprop="system" value="{@select}"><xsl:apply-templates /></span> </xsl:otherwise> </xsl:choose> - <!--</xsl:if>--> </xsl:when> <xsl:when test="parent::switch[@select='appl'] or parent::switchinline[@select='appl']"> - <!--<xsl:if test="@select = $appl">--> <xsl:choose> <xsl:when test="$embedded = 'yes'"> <span hidden="true" itemprop="appl" value="{@select}"><xsl:apply-templates mode="embedded"/></span> @@ -770,10 +775,8 @@ window.open('text/shared/main0108.html?System=DEFSYS&DbPAR=WRITER','_self'); <span hidden="true" itemprop="appl" value="{@select}"><xsl:apply-templates /></span> </xsl:otherwise> </xsl:choose> - <!--</xsl:if>--> </xsl:when> <xsl:when test="parent::switch[@select='distrib'] or parent::switchinline[@select='distrib']"> - <!--<xsl:if test="@select = $distrib">--> <xsl:choose> <xsl:when test="$embedded = 'yes'"> <span hidden="true" itemprop="distrib" value="{@select}"><xsl:apply-templates mode="embedded"/></span> @@ -782,7 +785,6 @@ window.open('text/shared/main0108.html?System=DEFSYS&DbPAR=WRITER','_self'); <span hidden="true" itemprop="distrib" value="{@select}"><xsl:apply-templates /></span> </xsl:otherwise> </xsl:choose> - <!--</xsl:if>--> </xsl:when> </xsl:choose> </xsl:template> @@ -807,10 +809,10 @@ window.open('text/shared/main0108.html?System=DEFSYS&DbPAR=WRITER','_self'); <xsl:if test="not(../child::case[@select=$appl]) and not(../child::caseinline[@select=$appl])"> <xsl:choose> <xsl:when test="$embedded = 'yes'"> - <span hidden="true" itemprop="appl" value="DEFAPP"><xsl:apply-templates mode="embedded"/></span> + <span hidden="true" itemprop="appl" value="SHARED"><xsl:apply-templates mode="embedded"/></span> </xsl:when> <xsl:otherwise> - <span hidden="true" itemprop="appl" value="DEFAPP"><xsl:apply-templates /></span> + <span hidden="true" itemprop="appl" value="SHARED"><xsl:apply-templates /></span> </xsl:otherwise> </xsl:choose> </xsl:if> @@ -950,7 +952,6 @@ window.open('text/shared/main0108.html?System=DEFSYS&DbPAR=WRITER','_self'); </xsl:variable> <xsl:choose> - <xsl:when test="count(descendant::tablecell)=1"> <table border="0" class="onecell" cellpadding="0" cellspacing="0"> <xsl:apply-templates /> @@ -958,32 +959,29 @@ window.open('text/shared/main0108.html?System=DEFSYS&DbPAR=WRITER','_self'); </xsl:when> <xsl:when test="descendant::tablecell[1]/descendant::image"> - - - <table border="0" class="icontable" cellpadding="5" cellspacing="0"> + <table border="0" class="icontable" cellpadding="5" cellspacing="0"> <xsl:apply-templates mode="icontable"/> - </table> + </table> </xsl:when> <xsl:when test="@class='wide'"> <table border="1" class="{@class}" cellpadding="0" cellspacing="0" width="100%" > <xsl:apply-templates /> - </table> + </table> </xsl:when> <xsl:when test="not(@class='')"> <table border="1" class="{@class}" cellpadding="0" cellspacing="0" > <xsl:apply-templates /> - </table> + </table> </xsl:when> <xsl:otherwise> <table border="1" class="border" cellpadding="0" cellspacing="0" > <xsl:apply-templates /> - </table> + </table> </xsl:otherwise> </xsl:choose> - <br/> </xsl:template> @@ -991,16 +989,9 @@ window.open('text/shared/main0108.html?System=DEFSYS&DbPAR=WRITER','_self'); <div class="embedded"> <xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable> <xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable> - <!--<xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive,substring-before(@href,'#'),$urlpost,$dbpostfix)"/></xsl:variable>--> - <!--<xsl:variable name="href"><xsl:value-of select="concat($urlpre,substring-before(@href,'#'),$urlpost,$dbpostfix)"/></xsl:variable>--> <xsl:variable name="href"><xsl:value-of select="concat($urlpre,substring-before(@href,'#'))"/></xsl:variable> <xsl:variable name="anc"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable> <xsl:variable name="docum" select="document($href)"/> -<!-- <p>Archive: <xsl:value-of select="$archive"/></p> - <p>dbPostfix: <xsl:value-of select="$dbpostfix"/></p> - <p>href: <xsl:value-of select="$href"/></p> - <p>anchor: <xsl:value-of select="$anc"/></p> - <p>document: <xsl:value-of select="$docum"/></p>--> <xsl:call-template name="insertembed"> <xsl:with-param name="doc" select="$docum" /> @@ -1014,8 +1005,6 @@ window.open('text/shared/main0108.html?System=DEFSYS&DbPAR=WRITER','_self'); <xsl:if test="not(@href='text/shared/00/00000004.xhp#wie')"> <!-- special treatment if howtoget links --> <xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable> <xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable> - <!--<xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive,substring-before(@href,'#'),$urlpost,$dbpostfix)"/></xsl:variable>--> - <!--<xsl:variable name="href"><xsl:value-of select="concat($urlpre,substring-before(@href,'#'),$urlpost,$dbpostfix)"/></xsl:variable>--> <xsl:variable name="href"><xsl:value-of select="concat($urlpre,substring-before(@href,'#'))"/></xsl:variable> <xsl:variable name="anchor"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable> <xsl:variable name="doc" select="document($href)"/> |