00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00028 class help extends WebObject
00029 {
00031 function on_select($event_args)
00032 {
00033 $book_id = 'docbookwiki_guide';
00034
00035
00036 $arr_langs = $this->get_langs($book_id);
00037 $langs = implode(',', $arr_langs);
00038 $lng = $event_args['lng'];
00039 if ($lng=='') $lng = $arr_langs[0];
00040
00041
00042 $node_id = $event_args['topic'];
00043 $xsl = XSLT.'edit/get_node_path.xsl';
00044 $index_xml = BOOKS."$book_id/$lng/index.xml";
00045 $param_id = "--stringparam id '$node_id'";
00046 $node_path = shell("xsltproc $param_id $xsl $index_xml");
00047 if ($node_path=='') $node_path = './';
00048
00049
00050 WebApp::setSVar('docbook->book_id', $book_id);
00051 WebApp::setSVar('docbook->node_path', $node_path);
00052 WebApp::setSVar('docbook->languages', $langs);
00053 WebApp::setSVar('docbook->lng', $lng);
00054 WebApp::setSVar('docbook->mode', 'view');
00055
00056
00057 $book_title = $this->get_book_title($book_id, $lng);
00058 WebApp::setSVar('book_title', $book_title);
00059 }
00060
00061 function afterParse()
00062 {
00063
00064 WebApp::setSVar('webnotes->page_id', '');
00065
00066
00067 WebApp::addGlobalVar('hide_webapp_logo', 'true');
00068 }
00069
00074 function get_langs($book_id)
00075 {
00076 $book_path = BOOKS.$book_id.'/';
00077 if (!file_exists($book_path)) return array();
00078
00079 $langs = shell("ls $book_path");
00080 $arr_langs = explode("\n", chop($langs));
00081
00082 return $arr_langs;
00083 }
00084
00085 function get_book_title($book_id, $lng)
00086 {
00087 $book_list = CONTENT.'books/book_list';
00088 $title = shell("grep '^$book_id:$lng:' $book_list | cut -d: -f3");
00089 $title = trim($title);
00090 return $title;
00091 }
00092 }
00093 ?>