00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00024 class Diogenes_Barrel_File
00025 {
00027 var $page;
00028
00030 var $props = array();
00031
00037 function Diogenes_Barrel_File(&$page, $file)
00038 {
00039 if (!is_object($page))
00040 {
00041 trigger_error("\$page is not an object!", E_USER_ERROR);
00042 }
00043
00044 $this->page =& $page;
00045 $this->props = array(
00046 'file' => $file
00047 );
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 }
00058
00059
00065 function delete(&$barrel, $dir)
00066 {
00067 global $globals;
00068
00069 }
00070
00071
00076 function make_actions($canedit)
00077 {
00078 global $globals;
00079
00080 $dir = $this->page->props['PID'];
00081 $file = $this->props['file'];
00082
00083 $rev = "files?action=revs&dir=$dir&target=$file";
00084 $edit = "edit?dir=$dir&file=$file";
00085 $del = "javascript:file_delete('$dir','$file');";
00086 $rename = "javascript:file_rename('$dir','$file');";
00087 $view = "../". $this->page->getLocation($file);
00088
00089 $actions = array();
00090 if ($view) array_push($actions, array(__("view"), $view, "view"));
00091 if ($edit && $canedit) array_push($actions, array(__("edit"), $edit, "edit"));
00092 if ($rev) array_push($actions, array(__("revisions"),$rev, "revisions"));
00093 if ($rename && $canedit) array_push($actions, array(__("rename"), $rename, "rename"));
00094 if ($del && $canedit) array_push($actions, array(__("delete"), $del, "delete"));
00095
00096 return $globals->icons->get_action_icons($actions);
00097 }
00098
00099
00104 function make_toolbar($canedit)
00105 {
00106 $dir = $this->page->props['PID'];
00107 $file = $this->props['file'];
00108 global $afile;
00109
00110 $filebar = array ();
00111 if ($canedit)
00112 {
00113 array_push($filebar, array( __("raw editor"), ($afile == "edit") ? "" : "edit?dir=$dir&file=$file"));
00114 array_push($filebar, array( __("HTML editor"), ($afile == "compose") ? "" : "compose?dir=$dir&file=$file"));
00115 }
00116 array_push($filebar, array( __("file revisions"), "files?action=revs&dir=$dir&target=$file"));
00117
00118 return $filebar;
00119 }
00120
00121 }
00122
00123 ?>