X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fadmin%2Fedit.php;fp=include%2Fadmin%2Fedit.php;h=a0991073b0d0ab391f7282d0c83d532f0dea17fa;hb=6855525e48fad5de270500a5445c4f4ff85d8bda;hp=0000000000000000000000000000000000000000;hpb=e69709aa8ee6108a1197e46b45367ba8dab55a52;p=diogenes.git diff --git a/include/admin/edit.php b/include/admin/edit.php new file mode 100644 index 0000000..a099107 --- /dev/null +++ b/include/admin/edit.php @@ -0,0 +1,56 @@ +barrel; +$bpage = Diogenes_Barrel_Page::fromDb($bbarrel, $dir); +$bfile = new Diogenes_Barrel_File($bpage, $file); + +// rcs handle +$rcs = $page->getRcs(); + +// file location & url +$mydir = $bbarrel->spool->spoolPath($dir); +$myfile = $bbarrel->spool->spoolPath($dir,$file); + +// process requested action +$action = isset($_REQUEST["action"]) ? $_REQUEST["action"] : ""; +switch($action) +{ +case "update": + // update the current file with form contents + if (isset($_REQUEST['file_content'])) { + $page->info(__("Commiting changes to file") . " $file"); + $message = empty($_REQUEST['message']) ? "updated using editor" : stripslashes($_REQUEST['message']); + $rcs->commit($dir,$file,stripslashes($_REQUEST['file_content']),$message); + } + + break; +} + +$rev = array_shift($tmparr = $rcs->logParse($dir,$file)); + +$page->assign('greeting', __("File editor")." - ". $bpage->getLocation($file). " - {$rev['rev']}"); +$page->assign('post',$page->script_self()); +$page->assign('dir',$dir); +$page->assign('file',$file); +$page->assign('source',__("File source")); +$page->assign('msg_log',__("log message")); +$page->assign('file_content',htmlspecialchars(file_get_contents($myfile), ENT_NOQUOTES)); +$page->assign('submit',__("Submit")); + +// top toolbar +$page->toolbar(__("Page"), $bpage->make_toolbar()); +$page->toolbar(__("File"), $bfile->make_toolbar(true)); +$page->display('admin-edit.tpl'); +?>