[phpwebapp-commits] CVS: web_app/boxes/docbook header.html,NONE,1.1 footer.html,NONE,1.1 docbook.txt
Brought to you by:
dashohoxha
From: Dashamir H. <das...@us...> - 2005-10-26 14:31:19
|
Update of /cvsroot/phpwebapp/web_app/boxes/docbook In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv766/boxes/docbook Added Files: header.html footer.html docbook.txt docbook.php docbook.js docbook.html docbook.css Log Message: The 'docbook' webbox is used just to display the cache (HTML) files of a DocBookWiki application. It is useful for including a docbook document in an application. --- NEW FILE: header.html --- <table class="navheader" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="node_title" valign="bottom"> {{this_full_title}} </td> <td align="right" valign="bottom" nowrap="nowrap"> <a href="javascript:set_node('{{prev_path}}')"><img border="0" src="{{./}}img/go-prev.png" alt='T_("Previous")' /></a> <a href="javascript:set_node('{{up_path}}')"><img border="0" src="{{./}}img/go-up.png" alt='T_("Up")' /></a> <a href="javascript:set_node('{{toc_path}}')"><img border="0" src="{{./}}img/go-home.png" alt='T_("Home")' /></a> <a href="javascript:set_node('{{next_path}}')"><img border="0" width="16" src="{{./}}img/go-next.png" alt='T_("Next")' /></a> </td> </tr> </table> --- NEW FILE: footer.html --- <table class="navfooter" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="middle" width="45%"> <a href="javascript:set_node('{{prev_path}}')"> <img border="0" src="{{./}}img/go-prev.png" alt="Previous" /> <span class="small_caps">{{prev_title}}</span> </a> </td> <td align="center" valign="top"> <a href="javascript:set_node('{{up_path}}')"> <img border="0" src="{{./}}img/go-up.png" alt="Up" /> </a> <a href="javascript:set_node('{{toc_path}}')"> <img border="0" src="{{./}}img/go-home.png" alt="Home" /> </a> </td> <td align="right" valign="middle" width="45%"> <a href="javascript:set_node('{{next_path}}')"> <span class="small_caps">{{next_title}}</span> <img border="0" src="{{./}}img/go-next.png" alt="Next" /> </a> </td> </tr> </table> --- NEW FILE: docbook.txt --- The 'docbook' webbox is used just to display the cache (HTML) files of a DocBookWiki application. It is useful for including a docbook document in an application. It can be included like this: <include src="{{DOCBOOK_PATH}}docbook.html" /> where DOCBOOK_PATH is defined by the framework itself. If you make a local copy of the webbox, then you have to use the right path. It has these state variables which can be initialized or changed by the application that includes it: docbook->cache_path -- the path of the HTML files (usually the directory 'contents/books/cache/' of the DocBookWiki docbook->book_id -- the id of the book docbook->node_path -- the path of the node to be displayed (default './') docbook->lng -- the language of the book (default 'en') The JS function set_node(node_path) can be used by the application to change the node that is currently displayed. If the constant WEBNOTES_ENABLE is defined as 'true', then webnotes will be appended at the end of each section (but first they must be installed and configured properly). This constant is set at the begining of 'docbook.php'. --- NEW FILE: docbook.php --- <?php /* This file is part of phpWebApp, which is a framework for building web application based on relational databases. Copyright 2001,2002,2003,2004 Dashamir Hoxha, das...@us... phpWebApp is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. phpWebApp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with phpWebApp; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** append webnotes at the end of each section */ define('WEBNOTES_ENABLE', 'true'); class docbook extends WebObject { function init() { $this->addSVar('cache_path', UNDEFINED); $this->addSVar('book_id', UNDEFINED); $this->addSVar('node_path', './'); $this->addSVar('lng', 'en'); } function on_set_node($event_args) { $node_path = $event_args['node_path']; $this->setSVar('node_path', $node_path); } function onParse() { $cache_path = $this->getSVar('cache_path'); $book_id = $this->getSVar('book_id'); $node_path = $this->getSVar('node_path'); $lng = $this->getSVar('lng'); //add the variables {{content_html}} and {{subnodes_html}} $book_path = $cache_path.$book_id.'/'.$lng.'/'; $content_html = $book_path.$node_path."content.html"; $subnodes_html = $book_path.$node_path."subnodes.html"; WebApp::addVars(compact('content_html', 'subnodes_html')); } function onRender() { //add navigation variables $node_path = $this->getSVar('node_path'); $vars = $this->get_arr_navigation($node_path); if ($vars['this_full_title']=='') $vars['this_full_title'] = T_("Table Of Contents"); WebApp::addVars($vars); WebApp::addVar('toc_path', './'); //set the page_id of the webnotes, in case that webnotes are used if (WEBNOTES_ENABLE=='true') { $book_id = $this->getSVar('book_id'); $node_path = $this->getSVar('node_path'); $lng = $this->getSVar('lng'); ereg('([^/]+)/$', $node_path, $regs); $node_id = $regs[1]; $page_id = "$book_id/$node_id/$lng"; WebApp::setSVar('webnotes->page_id', $page_id); } } /** * Reads from cache 'navigation.txt' for the current node and * returns an associative array with the template variables * this_path, next_path, prev_path, up_path, toc_path, * this_title, next_title, prev_title, up_title, toc_title. */ function get_arr_navigation() { $cache_path = $this->getSVar('cache_path'); $book_id = $this->getSVar('book_id'); $node_path = $this->getSVar('node_path'); $lng = $this->getSVar('lng'); $arr_navigation = array(); //get the navigation file $book_path = $cache_path.$book_id.'/'.$lng.'/'; $fname = $book_path.$node_path."navigation.txt"; if (!file_exists($fname)) { $arr_navigation['next_path'] = './'; $arr_navigation['prev_path'] = './'; $arr_navigation['up_path'] = './'; return $arr_navigation; } //open it $lines = file($fname); //parse it for ($i=0; $i < sizeof($lines); $i++) { $line = $lines[$i]; list($var_name,$var_value) = split('=', $line, 2); if ($var_name=='') continue; $arr_navigation[$var_name] = trim($var_value); } return $arr_navigation; } } ?> --- NEW FILE: docbook.js --- // -*-C-*- /* This file is part of phpWebApp, which is a framework for building web application based on relational databases. Copyright 2001,2002,2003,2004 Dashamir Hoxha, das...@us... phpWebApp is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. phpWebApp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with phpWebApp; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ function set_node(node_path) { SendEvent("docbook", "set_node", "node_path="+node_path); } --- NEW FILE: docbook.html --- <webbox id="docbook"> <div class="docbook"> <include src="{{./}}header.html" /> <hr /> <include src="{{content_html}}" /> <include src="{{subnodes_html}}" /> <hr /> <include src="{{./}}footer.html" /> <if condition="{{WEBNOTES_ENABLE}}"> <include src="{{WEBNOTES_PATH}}webnotes.html" /> </if> </div> </webbox> --- NEW FILE: docbook.css --- @import url(css/contents.css); @import url(css/bookinfo.css); @import url(css/list.css); @import url(css/link.css); @import url(css/media.css); @import url(css/figure.css); @import url(css/preformated.css); @import url(css/admonitions.css); @import url(css/key_gui.css); @import url(css/inline.css); @import url(css/footnotes.css); p, div, span, li, dt { font-family: sans-serif; font-size: 10pt; color: #000066; } p.para { font-family: sans-serif; font-size: 10pt; color: #000066; } .title { color: #aa0000; font-family: sans-serif; font-size: 12pt; text-align: center; } .navheader, .navfooter { width: 100%; } .node_title { color: #aa0000; font-family: sans-serif; font-size: 12pt; } .small_caps { vertical-align: top; font: small-caps 10px arial; color: #000099; } hr { background-color: #cccccc; margin: 0; height: 1px; border: none; } |