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
00032 class admin extends WebObject
00033 {
00034 function on_update_search_index($event_args)
00035 {
00036
00037 set_time_limit(0);
00038
00039
00040 $book_id = WebApp::getSVar('docbook->book_id');
00041 $lng = WebApp::getSVar('docbook->lng');
00042
00043
00044 $title = T_("Updating Search Indexes");
00045 print "<html><title>$title</title><body><h3>$title</h3><xmp>\n";
00046 flush();
00047
00048
00049 $data_owner = DATA_OWNER;
00050 passthru("sudo -u $data_owner search/make_index.sh 2>&1");
00051
00052
00053 print "\n</xmp></body></html>";
00054
00055
00056 exit;
00057 }
00058
00059 function on_update_downloadables($event_args)
00060 {
00061
00062 set_time_limit(0);
00063
00064
00065 $book_id = WebApp::getSVar('docbook->book_id');
00066 $lng = WebApp::getSVar('docbook->lng');
00067
00068
00069 $title = T_("Generating Downloadables For v_book_lng");
00070 $title = str_replace('v_book_lng', "'$book_id/$lng'", $title);
00071 print "<html><title>$title</title><body><h3>$title</h3><xmp>\n";
00072 flush();
00073
00074
00075 $data_owner = DATA_OWNER;
00076 $update_downloads_sh = 'content/downloads/update_downloads.sh';
00077 passthru("sudo -u $data_owner $update_downloads_sh $book_id $lng 2>&1");
00078
00079
00080 print "\n</xmp></body></html>";
00081
00082
00083 exit;
00084 }
00085
00086 function on_update_booklist($event_args)
00087 {
00088 shell("content/book_list.sh");
00089 }
00090
00091 function onRender()
00092 {
00093 $this->add_rs_modified_nodes();
00094 }
00095
00097 function add_rs_modified_nodes()
00098 {
00099 $rs = new EditableRS('modified_nodes');
00100
00101 $book_id = WebApp::getSVar('docbook->book_id');
00102 $lng = WebApp::getSVar('docbook->lng');
00103 $filename = WS_BOOKS."$book_id/$lng/modified_nodes.txt";
00104
00105 if (file_exists($filename))
00106 {
00107 $arr_modified_nodes = file($filename);
00108 for ($i=0; $i < sizeof($arr_modified_nodes); $i++)
00109 {
00110 $node_path = $arr_modified_nodes[$i];
00111 $node_path = trim($node_path);
00112 $node_title = $this->get_title($book_id, $lng, $node_path);
00113 $rec = compact('node_path', 'node_title');
00114 $rs->addRec($rec);
00115 }
00116 }
00117
00118 global $webPage;
00119 $webPage->addRecordset($rs);
00120 }
00121
00122 function get_title($book_id, $lng, $node_path)
00123 {
00124 $cache_path = WS_CACHE."$book_id/$lng/";
00125 $navigation_file = $cache_path.$node_path."navigation.txt";
00126 $line = shell("grep full_title $navigation_file");
00127 $arr = split('=', chop($line), 2);
00128 $title = $arr[1];
00129 if ($title=='') $title = 'Table Of Contents';
00130 return $title;
00131 }
00132 }
00133 ?>