File.php

00001 <?php
00002 /*
00003  * Copyright (C) 2003-2004 Polytechnique.org
00004  * http://opensource.polytechnique.org/
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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     if (is_array($props))
00051     {
00052       foreach (array_keys($props) as $key) 
00053       {
00054         $this->props[$key] = $props[$key];
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&amp;dir=$dir&amp;target=$file";
00084     $edit = "edit?dir=$dir&amp;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&amp;file=$file"));
00114       array_push($filebar, array( __("HTML editor"), ($afile == "compose") ? "" : "compose?dir=$dir&amp;file=$file"));
00115     }
00116     array_push($filebar, array( __("file revisions"), "files?action=revs&amp;dir=$dir&amp;target=$file"));
00117     
00118     return $filebar;
00119   }
00120   
00121 }
00122  
00123 ?>

Generated on Fri Jan 11 01:20:08 2008 for Diogenes by  doxygen 1.5.1