FolderAction Klassenreferenz

Klassendiagramm für FolderAction:

Inheritance graph
base refererrect $classObjectAction.html 33,5 140,125

Aufstellung aller Elemente

Öffentliche Methoden

 FolderAction ()
 createnew ()
 createnewfolder ()
 createnewfile ()
 createnewlink ()
 createnewpage ()
 saveprop ()
 delete ()
 changesequence ()
 edit ()
 multiple ()
 reorder ()
 settop ()
 setbottom ()
 create ()
 createfolder ()
 maxFileSize ()
 createfile ()
 stringToBytes ($val)
 createlink ()
 createpage ()
 show ()
 select ()
 order ()
 prop ()
 remove ()
 pub ()
 pubnow ()
 checkMenu ($name)

Öffentliche Attribute

 $defaultSubAction = 'show'
 $folder


Ausführliche Beschreibung

Definiert in Zeile 189 der Datei FolderAction.class.php.


Dokumentation der Elementfunktionen

FolderAction::changesequence (  ) 

Definiert in Zeile 532 der Datei FolderAction.class.php.

Benutzt Action::addNotice(), Action::callSubAction() und Action::getRequestVar().

00533      {
00534           $ids = $this->folder->getObjectIds();
00535           $seq = 0;
00536           foreach( $ids as $id )
00537           {
00538                $seq++; // Sequenz um 1 erhoehen
00539                
00540                // Die beiden Ordner vertauschen
00541                if   ( $id == $this->getRequestVar('objectid1') )
00542                     $id = $this->getRequestVar('objectid2');
00543                elseif ( $id == $this->getRequestVar('objectid2') )
00544                     $id = $this->getRequestVar('objectid1');
00545                     
00546                $o = new Object( $id );
00547                $o->setOrderId( $seq );
00548      
00549                unset( $o ); // Selfmade Garbage Collection :-)
00550           }
00551           
00552           $this->addNotice($this->folder->getType(),$this->folder->name,'SEQUENCE_CHANGED','ok');
00553           $this->folder->setTimestamp();
00554 
00555           // Ordner anzeigen
00556           $this->callSubAction('order');
00557           
00558      }

FolderAction::checkMenu ( name  ) 

Ermittelt, ob der Men�punkt aktiv ist. Ob ein Men�punkt als aktiv angezeigt werden soll, steht meist erst zur Laufzeit fest.
Diese Methode kann von den Unterklassen �berschrieben werden. Falls diese Methode nicht �berschrieben wird, sind alle Men�punkte aktiv.

Parameter:
String $name Logischer Name des Men�punktes
Rückgabe:
boolean TRUE, wenn Men�punkt aktiv ist.

Erneute Implementation von Action.

Definiert in Zeile 1304 der Datei FolderAction.class.php.

01305      {
01306           switch( $name)
01307           {
01308                case 'createfolder':
01309                     return $this->folder->hasRight(ACL_CREATE_FOLDER) && count($this->folder->parentObjectIds(true,true)) < MAX_FOLDER_DEPTH;
01310 
01311                case 'createfile':
01312                     return $this->folder->hasRight(ACL_CREATE_FILE);
01313 
01314                case 'createlink':
01315                     return $this->folder->hasRight(ACL_CREATE_LINK);
01316 
01317                case 'createpage':
01318                     return $this->folder->hasRight(ACL_CREATE_PAGE);
01319 
01320                case 'remove':
01321                     return count($this->folder->getObjectIds()) == 0;
01322 
01323                default:
01324                     return true;
01325           }
01326      }

FolderAction::create (  ) 

Definiert in Zeile 917 der Datei FolderAction.class.php.

Benutzt Action::addNotice(), Template::getAll(), maxFileSize() und Action::setTemplateVar().

00918      {
00919           // Maximale Dateigroesse.
00920           $maxSizeBytes = $this->maxFileSize();
00921           $this->setTemplateVar('max_size' ,($maxSizeBytes/1024).' KB' );
00922           $this->setTemplateVar('maxlength',$maxSizeBytes );
00923           
00924           $all_templates = Template::getAll();
00925           $this->setTemplateVar('templates' ,$all_templates );
00926           
00927           if   ( count($all_templates) == 0 )
00928                $this->addNotice('folder',$this->folder->name,'NO_TEMPLATES_AVAILABLE',OR_NOTICE_WARN);
00929           
00930           $this->setTemplateVar('objectid'  ,$this->folder->objectid );
00931      }

FolderAction::createfile (  ) 

Hochladen einer Datei.

Definiert in Zeile 979 der Datei FolderAction.class.php.

Benutzt maxFileSize() und Action::setTemplateVar().

00980      {
00981           // Maximale Dateigroesse.
00982           $maxSizeBytes = $this->maxFileSize();
00983           $this->setTemplateVar('max_size' ,($maxSizeBytes/1024).' KB' );
00984           $this->setTemplateVar('maxlength',$maxSizeBytes );
00985           
00986           $this->setTemplateVar('objectid',$this->folder->objectid );
00987      }

FolderAction::createfolder (  ) 

Definiert in Zeile 935 der Datei FolderAction.class.php.

Benutzt Action::setTemplateVar().

00936      {
00937           $this->setTemplateVar('objectid'  ,$this->folder->objectid );
00938      }

FolderAction::createlink (  ) 

Definiert in Zeile 1020 der Datei FolderAction.class.php.

Benutzt Action::setTemplateVar().

01021      {
01022           $this->setTemplateVar('objectid'  ,$this->folder->objectid );
01023      }

FolderAction::createnew (  ) 

Neues Objekt anlegen.
Dies kann ein(e) Verzeichnis, Seite, Verkn�pfung oder Datei sein.

Definiert in Zeile 217 der Datei FolderAction.class.php.

Benutzt $conf, Action::addNotice(), Action::addValidationError(), Action::callSubAction() und Action::getRequestVar().

00218      {
00219           global $conf;
00220           $type = $this->getRequestVar('type'       );
00221           
00222           switch( $type )
00223           {
00224                case 'folder':
00225                     $name = $this->getRequestVar('folder_name');
00226 
00227                     if   ( !empty($name) )
00228                     {
00229                          $f = new Folder();
00230                          $f->name     = $name;
00231                          $f->parentid = $this->folder->objectid; 
00232                          $f->add();
00233                          $this->folder->setTimestamp();
00234                          $this->addNotice('folder',$f->name,'ADDED','ok');
00235                     }
00236                     else
00237                     {
00238                          $this->addValidationError('folder_name');
00239                          $this->callSubAction('create');
00240                     }
00241                     break;
00242 
00243                case 'file':
00244                     $upload = new Upload();
00245 
00246                     if   ( !$upload->isValid() )
00247                     {
00248                          $this->addValidationError('file','COMMON_VALIDATION_ERROR',array(),$upload->error);
00249                          $this->callSubAction('createfile');
00250                          return;
00251                     }
00252                     // Pr�fen der maximal erlaubten Dateigr��e.
00253                     elseif    ( $upload->size > $this->maxFileSize() )
00254                     {
00255                          // Maximale Dateigr��e ist �berschritten
00256                          $this->addValidationError('file','MAX_FILE_SIZE_EXCEEDED');
00257                          $this->callSubAction('createfile');
00258                          return;
00259                     }
00260                     elseif( $upload->size > 0 )
00261                     {
00262                          $file   = new File();
00263                          $file->desc      = '';
00264                          $file->filename  = $upload->filename;
00265                          $file->name      = $upload->filename;
00266                          $file->extension = $upload->extension;       
00267                          $file->size      = $upload->size;
00268                          $file->parentid  = $this->folder->objectid;
00269                
00270                          $file->value     = $upload->value;
00271                
00272                          $file->add(); // Datei hinzufuegen
00273                          $this->folder->setTimestamp();
00274                          $this->addNotice('file',$file->name,'ADDED','ok');
00275                     }
00276                     
00277                     break;
00278 
00279                case 'page':
00280 
00281                     $name = $this->getRequestVar('page_name');
00282                     if   ( !empty($name) )
00283                     {
00284                          $page = new Page();
00285                          $page->name       = $name;
00286                          $page->templateid = $this->getRequestVar('page_templateid');
00287                          $page->parentid   = $this->folder->objectid;
00288                          $page->add();
00289                          $this->folder->setTimestamp();
00290           
00291                          $this->addNotice('page',$page->name,'ADDED','ok');
00292                     }
00293                     else
00294                     {
00295                          $this->addValidationError('page_name');
00296                          $this->callSubAction('create');
00297                     }
00298                     break;
00299                     
00300                case 'link':
00301 
00302                     $name = $this->getRequestVar('link_name');
00303                     if   ( !empty($name) )
00304                     {
00305                          $link = new Link();
00306                          $link->name           = $name;
00307                          $link->parentid       = $this->folder->objectid;
00308           
00309                          $link->isLinkToObject = false;
00310                          $link->url            = $name;
00311           
00312                          $link->add();
00313                          $this->folder->setTimestamp();
00314 
00315                          $this->addNotice('link',$link->name,'ADDED','ok');
00316                     }
00317                     else
00318                     {
00319                          $this->addValidationError('link_name');
00320                          $this->callSubAction('create');
00321                     }
00322                     
00323                     break;
00324                     
00325                default:
00326                     $this->addValidationError('type');
00327                     $this->callSubAction('create');
00328                     
00329           }
00330                               
00331      }    

FolderAction::createnewfile (  ) 

Definiert in Zeile 364 der Datei FolderAction.class.php.

Benutzt Action::addNotice(), Action::addValidationError(), Action::callSubAction(), Action::getRequestVar(), Action::hasRequestVar() und Action::setTemplateVar().

00365      {
00366           $type        = $this->getRequestVar('type'       );
00367           $name        = $this->getRequestVar('name'       );
00368           $filename    = $this->getRequestVar('filename'   );
00369           $description = $this->getRequestVar('description');
00370           
00371           $file   = new File();
00372           
00373           if   ( $this->hasRequestVar('url') )
00374           {
00375                $url = $this->getRequestVar('url');
00376                $http = new Http();
00377                $http->setUrl( $url );
00378           
00379                $ok = $http->request();
00380                
00381                if   ( !$ok )
00382                {
00383                     $this->addValidationError('url','COMMON_VALIDATION_ERROR',array(),$http->error);
00384                     $this->callSubAction('createfile');
00385                     return;
00386                }
00387                
00388                $file->desc      = $description;
00389                $file->filename  = basename($url);
00390                $file->name      = !empty($name)?$name:basename($url);
00391                $file->size      = strlen($http->body);
00392                $file->value     = $http->body;
00393                $file->parentid  = $this->folder->objectid;
00394           }
00395           else
00396           {
00397                $upload = new Upload();
00398                
00399                if   ( !$upload->isValid() )
00400                {
00401                     $this->addValidationError('file','COMMON_VALIDATION_ERROR',array(),$upload->error);
00402                     $this->callSubAction('createfile');
00403                     return;
00404                }
00405      
00406                $file->desc      = $description;
00407                $file->filename  = $upload->filename;
00408                $file->name      = !empty($name)?$name:$upload->filename;
00409                $file->extension = $upload->extension;       
00410                $file->size      = $upload->size;
00411                $file->parentid  = $this->folder->objectid;
00412      
00413                $file->value     = $upload->value;
00414           }
00415 
00416           $file->add(); // Datei hinzufuegen
00417           $this->addNotice('file',$file->name,'ADDED','ok');
00418 
00419           $this->folder->setTimestamp();
00420 
00421           $this->setTemplateVar('tree_refresh',true);
00422      }    

FolderAction::createnewfolder (  ) 

Definiert in Zeile 335 der Datei FolderAction.class.php.

Benutzt Action::addNotice(), Action::addValidationError(), Action::callSubAction() und Action::getRequestVar().

00336      {
00337           $type        = $this->getRequestVar('type'       );
00338           $name        = $this->getRequestVar('name'       );
00339           $filename    = $this->getRequestVar('filename'   );
00340           $description = $this->getRequestVar('description');
00341           
00342           if   ( !empty($name) )
00343           {
00344                $f = new Folder();
00345                $f->name     = $name;
00346                $f->filename = $name;
00347                $f->desc     = $description;
00348                $f->parentid = $this->folder->objectid; 
00349 
00350                $f->add();
00351                $this->addNotice('folder',$f->name,'ADDED','ok');
00352           }
00353           else
00354           {
00355                $this->addValidationError('name');
00356                $this->callSubAction('createfolder');
00357           }
00358           
00359           $this->folder->setTimestamp();
00360      }    

FolderAction::createnewlink (  ) 

Definiert in Zeile 426 der Datei FolderAction.class.php.

Benutzt Action::addNotice(), Action::addValidationError(), Action::callSubAction() und Action::getRequestVar().

00427      {
00428           $type        = $this->getRequestVar('type'       );
00429           $name        = $this->getRequestVar('name'       );
00430           $filename    = $this->getRequestVar('filename'   );
00431           $description = $this->getRequestVar('description');
00432           
00433           if   ( !empty($name) )
00434           {
00435                $link = new Link();
00436                $link->name           = $name;
00437                $link->desc           = $description;
00438                $link->parentid       = $this->folder->objectid;
00439 
00440                $link->isLinkToObject = false;
00441                $link->url            = $this->getRequestVar('name');
00442 
00443                $this->addNotice('link',$link->name,'ADDED','ok');
00444 
00445                $link->add();
00446           }
00447           else
00448           {
00449                $this->addValidationError('name');
00450                $this->callSubAction('createlink');
00451                return;
00452           }
00453           
00454           $this->folder->setTimestamp();
00455      }    

FolderAction::createnewpage (  ) 

Definiert in Zeile 459 der Datei FolderAction.class.php.

Benutzt Action::addNotice(), Action::addValidationError(), Action::callSubAction() und Action::getRequestVar().

00460      {
00461           $type        = $this->getRequestVar('type'       );
00462           $name        = $this->getRequestVar('name'       );
00463           $filename    = $this->getRequestVar('filename'   );
00464           $description = $this->getRequestVar('description');
00465           
00466           if   ( $this->getRequestVar('name') != '' )
00467           {
00468                $page = new Page();
00469                $page->name       = $name;
00470                $page->desc       = $description;
00471                $page->filename   = $filename;
00472                $page->templateid = $this->getRequestVar('templateid');
00473                $page->parentid   = $this->folder->objectid;
00474 
00475                $this->addNotice('page',$page->name,'ADDED','ok');
00476                $page->add();
00477           }
00478           else
00479           {
00480                $this->addValidationError('name');
00481                $this->callSubAction('createpage');
00482                return;
00483           }
00484           
00485           $this->folder->setTimestamp();
00486      }    

FolderAction::createpage (  ) 

Definiert in Zeile 1026 der Datei FolderAction.class.php.

Benutzt Action::addNotice(), Template::getAll() und Action::setTemplateVar().

01027      {
01028           $all_templates = Template::getAll();
01029           $this->setTemplateVar('templates' ,$all_templates          );
01030           $this->setTemplateVar('objectid'  ,$this->folder->objectid );
01031 
01032           if   ( count($all_templates) == 0 )
01033                $this->addNotice('folder',$this->folder->name,'NO_TEMPLATES_AVAILABLE',OR_NOTICE_WARN);
01034      }

FolderAction::delete (  ) 

Abspeichern der Ordner-Eigenschaften. Ist der Schalter "delete" gesetzt, wird der Ordner stattdessen gel?scht.

Definiert in Zeile 520 der Datei FolderAction.class.php.

Benutzt Action::addNotice(), Action::getRequestVar() und lang().

00521      {
00522           if   ( $this->getRequestVar('delete') != '' )
00523           {
00524                // Ordner l?schen
00525                $this->folder->delete();
00526                $this->addNotice($this->folder->getType(),$this->folder->name,lang('DELETED'),'ok');
00527           }
00528      }

FolderAction::edit (  ) 

Verschieben/Kopieren/Loeschen/Verknuepfen von mehreren Dateien in diesem Ordner.

Es werden alle ausgew�hlten Dateien nochmal angezeigt. Abh�ngig von der ausgew�hlten Aktion wird eine weitere Auswahl ben�tigt.

Definiert in Zeile 567 der Datei FolderAction.class.php.

Benutzt Action::getRequestVar(), Action::hasRequestVar() und Action::setTemplateVar().

00568      {
00569           $type = $this->getRequestVar('type'); // Typ der Aktion, z.B "copy" oder "move"
00570           
00571           switch( $type )
00572           {
00573                case 'move':
00574                case 'copy':
00575                case 'link':
00576                     // Liste von m�glichen Zielordnern anzeigen
00577      
00578                     $otherfolder = array();
00579                     foreach( $this->folder->getAllFolders() as $id )
00580                     {
00581                          $f = new Folder( $id );
00582                          
00583                          // Beim Verkn�pfen muss im Zielordner die Berechtigung zum Erstellen
00584                          // von Verkn�pfungen vorhanden sein.
00585                          //
00586                          // Beim Verschieben und Kopieren muss im Zielordner die Berechtigung
00587                          // zum Erstellen von Ordner, Dateien oder Seiten vorhanden sein.
00588                          if   ( ( $type=='link' && $f->hasRight( ACL_CREATE_LINK ) ) || 
00589                                 ( ( $type=='move' || $type == 'copy' ) && 
00590                                   ( $f->hasRight(ACL_CREATE_FOLDER) || $f->hasRight(ACL_CREATE_FILE) || $f->hasRight(ACL_CREATE_PAGE) ) ) )
00591                               // Zielordner hinzuf�gen
00592                               $otherfolder[$id] = FILE_SEP.implode( FILE_SEP,$f->parentObjectNames(false,true) );
00593                     }
00594                     
00595                     // Zielordner-Liste alphabetisch sortieren
00596                     asort( $otherfolder );
00597                               
00598                     $this->setTemplateVar('folder',$otherfolder);
00599                     
00600                     break;
00601                     
00602                case 'archive':
00603                     $this->setTemplateVar('ask_filename','');
00604                     break;
00605 
00606                case 'delete':
00607                     $this->setTemplateVar('ask_commit','');
00608                     break;
00609                     
00610                default:
00611                     exit("trouble");
00612                     
00613           } // switch
00614           
00615           $ids        = $this->folder->getObjectIds();
00616           $objectList = array();
00617 
00618           foreach( $ids as $id )
00619           {
00620                // Nur, wenn Objekt ausgewaehlt wurde
00621                if   ( !$this->hasRequestVar('obj'.$id) )
00622                     continue;
00623 
00624                $o = new Object( $id );
00625                $o->load();
00626                
00627                // F�r die gew�nschte Aktion m�ssen pro Objekt die entsprechenden Rechte
00628                // vorhanden sein.
00629                if   ( $type == 'copy'   && $o->hasRight( ACL_READ   ) ||
00630                       $type == 'move'   && $o->hasRight( ACL_DELETE ) ||
00631                       $type == 'link'   && $o->hasRight( ACL_READ   ) ||
00632                       $type == 'delete' && $o->hasRight( ACL_DELETE )    )
00633                     $objectList[ $id ] = $o->getProperties();
00634           }
00635           
00636           $this->setTemplateVar('type'  ,$type       );
00637           $this->setTemplateVar('objectlist',$objectList );
00638           
00639           // Komma-separierte Liste von ausgew�hlten Objekt-Ids erzeugen 
00640           $this->setTemplateVar('ids',join(array_keys($objectList),',') );
00641      }

FolderAction::FolderAction (  ) 

Definiert in Zeile 194 der Datei FolderAction.class.php.

Benutzt Session::getObject(), Action::getRequestId(), Action::lastModified() und Session::setObject().

00195      {
00196           if   ( $this->getRequestId() != 0  )
00197           {
00198                $this->folder = new Folder( $this->getRequestId() );
00199                $this->folder->load();
00200                Session::setObject( $this->folder );
00201           }
00202           else
00203           {
00204                $this->folder = Session::getObject();
00205           }
00206           
00207           // Datum letzte Aenderung an Browser uebertragen
00208           $this->lastModified( $this->folder->lastchangeDate );
00209      }

FolderAction::maxFileSize (  ) 

Ermittelt die maximale Gr��e einer hochzuladenden Datei.
Der Wert wird aus der PHP- und OpenRat-Konfiguration ermittelt.

Rückgabe:
Integer maximale Dateigroesse in Bytes

Definiert in Zeile 948 der Datei FolderAction.class.php.

Benutzt $conf und stringToBytes().

Wird benutzt von create() und createfile().

00949      {
00950           global $conf;
00951           
00952           // When querying memory size values:
00953           // Many ini memory size values, such as upload_max_filesize,
00954           // are stored in the php.ini file in shorthand notation.
00955           // ini_get() will return the exact string stored in the php.ini file
00956           // and NOT its integer equivalent.
00957           $sizes = array(10*1024*1024*1024); // Init with 10GB enough? :)
00958           
00959           foreach( array('upload_max_filesize','post_max_size','memory_limit') as $var )
00960           {
00961                $v = $this->stringToBytes(ini_get($var));
00962                
00963                if   ($v > 0 )
00964                     $sizes[] = $v;
00965           }
00966           
00967           $confMaxSize = intval($conf['content']['file']['max_file_size'])*1024; 
00968           if   ( $confMaxSize > 0 )
00969                $sizes[] = $confMaxSize;
00970           
00971           return min($sizes);
00972      }

FolderAction::multiple (  ) 

Verschieben/Kopieren/Loeschen/Verknuepfen von mehreren Dateien in diesem Ordner

Definiert in Zeile 648 der Datei FolderAction.class.php.

Benutzt Action::addNotice(), Action::callSubAction(), Action::getRequestVar(), Action::hasRequestVar(), lang() und Http::serverError().

00649      {
00650           $type           = $this->getRequestVar('type');
00651           $ids            = explode(',',$this->getRequestVar('ids'));
00652           $targetObjectId = $this->getRequestVar('targetobjectid');
00653 
00654           foreach( $ids as $id )
00655           {
00656                $o = new Object( $id );
00657                $o->load();
00658 
00659                switch( $type )
00660                {
00661                     case 'move':
00662                          if   ( $o->isFolder )
00663                          {
00664                               $f = new Folder( $id );
00665                               $allsubfolders = $f->getAllSubFolderIds();
00666                               
00667                               // Wenn
00668                               // - Das Zielverzeichnis sich nicht in einem Unterverzeichnis des zu verschiebenen Ordners liegt
00669                               // und
00670                               // - Das Zielverzeichnis nicht der zu verschiebene Ordner ist
00671                               // dann verschieben
00672                               if   ( !in_array($targetObjectId,$allsubfolders) && $id != $targetObjectId )
00673                               {
00674                                    $this->addNotice($o->getType(),$o->name,'MOVED','ok');
00675                                    //$o->setParentId( $targetObjectId );
00676                               }
00677                               else
00678                               {
00679                                    $this->addNotice($o->getType(),$o->name,'ERROR','error');
00680                               }
00681                          }
00682                          else
00683                          {
00684                               $o->setParentId( $targetObjectId );
00685                               $this->addNotice($o->getType(),$o->name,'MOVED','ok');
00686                          }
00687                          break;
00688      
00689                     case 'copy':
00690                          switch( $o->getType() )
00691                          {
00692                               case 'folder':
00693                                    // Ordner zur Zeit nicht kopieren
00694                                    // Funktion waere zu verwirrend
00695                                    $this->addNotice($o->getType(),$o->name,'CANNOT_COPY_FOLDER','error');
00696                                    break;
00697                               
00698                               case 'file':
00699                                    $f = new File( $id );
00700                                    $f->load();
00701                                    $f->filename = '';
00702                                    $f->name     = lang('GLOBAL_COPY_OF').' '.$f->name;
00703                                    $f->parentid = $targetObjectId;
00704                                    $f->add();
00705                                    $f->copyValueFromFile( $id );
00706                                    $this->addNotice($o->getType(),$o->name,'COPIED','ok');
00707                                    break;
00708                               
00709                               case 'page':
00710                                    $p = new Page( $id );
00711                                    $p->load();
00712                                    $p->filename = '';
00713                                    $p->name     = lang('GLOBAL_COPY_OF').' '.$p->name;
00714                                    $p->parentid = $targetObjectId;
00715                                    $p->add();
00716                                    $p->copyValuesFromPage( $id );
00717                                    $this->addNotice($o->getType(),$o->name,'COPIED','ok');
00718                                    break;
00719                               
00720                               case 'link':
00721                                    $l = new Link( $id );
00722                                    $l->load();
00723                                    $l->filename = '';
00724                                    $l->name     = lang('GLOBAL_COPY_OF').' '.$l->name;
00725                                    $l->parentid = $targetObjectId;
00726                                    $l->add();
00727                                    $this->addNotice($o->getType(),$o->name,'COPIED','ok');
00728                                    break;
00729                               
00730                               default:
00731                                    die('fatal: what type to delete?');
00732                          }
00733                          $notices[] = lang('COPIED');
00734                          break;
00735      
00736                     case 'link':
00737 
00738                          if   ( $o->isFile  ||
00739                                 $o->isPage  )  // Nur Seiten oder Dateien sind verknuepfbar
00740                          {
00741                               $link = new Link();
00742                               $link->parentid       = $targetObjectId;
00743                     
00744                               $link->linkedObjectId = $id;
00745                               $link->isLinkToObject = true;
00746                               $link->name           = lang('GLOBAL_LINK_TO').' '.$o->name;
00747                               $link->add();
00748                               $this->addNotice($o->getType(),$o->name,'LINKED','ok');
00749                          }
00750                          else
00751                          {
00752                               $this->addNotice($o->getType(),$o->name,'ERROR','error');
00753                          }
00754                          break;
00755      
00756                     case 'delete':
00757 
00758                          if   ( $this->hasRequestVar('commit') ) 
00759                          {
00760                               switch( $o->getType() )
00761                               {
00762                                    case 'folder':
00763                                         $f = new Folder( $id );
00764                                         $f->deleteAll();
00765                                         break;
00766                                    
00767                                    case 'file':
00768                                         $f = new File( $id );
00769                                         $f->delete();
00770                                         break;
00771                                    
00772                                    case 'page':
00773                                         $p = new Page( $id );
00774                                         $p->load();
00775                                         $p->delete();
00776                                         break;
00777                                    
00778                                    case 'link':
00779                                         $l = new Link( $id );
00780                                         $l->delete();
00781                                         break;
00782                                    
00783                                    default:
00784                                         Http::serverError('Internal Error while deleting: What type to delete?');
00785                               }
00786                               $this->addNotice($o->getType(),$o->name,'DELETED',OR_NOTICE_OK);
00787                          }
00788                          else
00789                          {
00790                               $this->addNotice($o->getType(),$o->name,'NOTHING_DONE',OR_NOTICE_WARN);
00791                          }
00792                          
00793                          break;
00794 
00795                     default:
00796                          $this->addNotice($o->getType(),$o->name,'ERROR','error');
00797                }
00798 
00799           }
00800 
00801           $this->folder->setTimestamp();
00802           
00803           // Ordner anzeigen
00804           $this->callSubAction('show');
00805      }

FolderAction::order (  ) 

Definiert in Zeile 1181 der Datei FolderAction.class.php.

Benutzt lang(), Text::maxLaenge(), Action::setTemplateVar() und Html::url().

01182      {
01183           global $conf_php;
01184 
01185           $list = array();
01186           $last_objectid = 0;
01187 
01188           // Schleife ueber alle Objekte in diesem Ordner
01189           foreach( $this->folder->getObjects() as $o )
01190           {
01191                $id = $o->objectid;
01192 
01193                if   ( $o->hasRight(ACL_READ) )
01194                {
01195                     $list[$id]['name']     = Text::maxLaenge( 30,$o->name     );
01196                     $list[$id]['filename'] = Text::maxLaenge( 20,$o->filename );
01197                     $list[$id]['desc']     = Text::maxLaenge( 30,$o->desc     );
01198                     if   ( $list[$id]['desc'] == '' )
01199                          $list[$id]['desc'] = lang('GLOBAL_NO_DESCRIPTION_AVAILABLE');
01200                     $list[$id]['desc'] = 'ID '.$id.' - '.$list[$id]['desc']; 
01201 
01202                     $list[$id]['type'] = $o->getType();
01203                     
01204                     $list[$id]['icon'] = $o->getType();
01205 
01206                     if   ( $o->getType() == 'file' )
01207                     {
01208                          $file = new File( $id );
01209                          $file->load();
01210                          $list[$id]['desc'] .= ' - '.intval($file->size/1000).'kB';
01211 
01212                          if   ( $file->isImage() )
01213                               $list[$id]['icon'] = 'image';
01214                     }
01215 
01216                     $list[$id]['url' ] = Html::url('main',$o->getType(),$id);
01217                     $list[$id]['date'] = $o->lastchangeDate;
01218                     $list[$id]['user'] = $o->lastchangeUser;
01219 
01220                     if   ( $last_objectid != 0 && $o->hasRight(ACL_WRITE) )
01221                     {
01222                          $list[$id           ]['upurl'    ] = Html::url('folder','changesequence',0,array(
01223                                                                               'objectid1'=>$id,
01224                                                                               'objectid2'=>$last_objectid));
01225                          $list[$last_objectid]['downurl'  ] = $list[$id]['upurl'];
01226                          $list[$last_objectid]['bottomurl'] = Html::url('folder','setbottom',0,array(
01227                                                                               'objectid1'=>$last_objectid));
01228                          $list[$id           ]['topurl'   ] = Html::url('folder','settop',0,array(
01229                                                                               'objectid1'=>$id));
01230                     }
01231 
01232                     $last_objectid = $id;
01233                }
01234           }
01235 
01236           $this->setTemplateVar('flip_url'             ,Html::url('folder','reorder',0,array('type'=>'flip'      )) );
01237           $this->setTemplateVar('orderbyname_url'      ,Html::url('folder','reorder',0,array('type'=>'name'      )) );
01238           $this->setTemplateVar('orderbytype_url'      ,Html::url('folder','reorder',0,array('type'=>'type'      )) );
01239           $this->setTemplateVar('orderbylastchange_url',Html::url('folder','reorder',0,array('type'=>'lastchange')) );
01240           $this->setTemplateVar('object'      ,$list            );
01241           $this->setTemplateVar('act_objectid',$this->folder->id);
01242      }

FolderAction::prop (  ) 

Definiert in Zeile 1246 der Datei FolderAction.class.php.

Benutzt Action::setTemplateVar() und Action::setTemplateVars().

01247      {
01248           $this->setTemplateVars( $this->folder->getProperties() );
01249           $this->setTemplateVar( 'full_filename',$this->folder->full_filename() );
01250      }

FolderAction::pub (  ) 

Definiert in Zeile 1259 der Datei FolderAction.class.php.

Benutzt Action::setTemplateVar().

01260      {
01261           // Schalter nur anzeigen, wenn sinnvoll
01262           $this->setTemplateVar('files'  ,count($this->folder->getFiles()) > 0 );
01263           $this->setTemplateVar('pages'  ,count($this->folder->getPages()) > 0 );
01264           $this->setTemplateVar('subdirs',count($this->folder->getSubFolderIds()) > 0 );
01265           $this->setTemplateVar('clean'  ,$this->folder->isRoot );
01266           
01267 //        $this->addNotice('folder',$this->folder->name,'MUCH_TIME',OR_NOTICE_WARN);
01268      }

FolderAction::pubnow (  ) 

Definiert in Zeile 1271 der Datei FolderAction.class.php.

Benutzt Action::addNotice() und Action::hasRequestVar().

01272      {
01273           if   ( !$this->folder->hasRight( ACL_PUBLISH ) )
01274                die('no rights for publish');
01275 
01276           $subdirs = ( $this->hasRequestVar('subdirs') );
01277           $pages   = ( $this->hasRequestVar('pages'  ) );
01278           $files   = ( $this->hasRequestVar('files'  ) );
01279 
01280           $publish = new Publish();
01281           
01282           $this->folder->publish = &$publish;
01283           $this->folder->publish( $pages,$files,$subdirs );
01284           $this->folder->publish->close();
01285 
01286           $list = array();
01287           foreach( $publish->publishedObjects as $o )
01288                $list[] = $o['full_filename'];
01289           
01290           if   ( !$publish->ok )
01291                $this->addNotice('folder',$this->folder->name,'PUBLISHED_ERROR',OR_NOTICE_ERROR,array(),$publish->log);
01292           else
01293                $this->addNotice('folder',$this->folder->name,'PUBLISHED',OR_NOTICE_OK,array(),$list);
01294                     
01295           // Wenn gewuenscht, das Zielverzeichnis aufraeumen
01296           if   ( $this->hasRequestVar('clean')      )
01297                $publish->clean();
01298 
01299           $this->callSubaction( 'pub' );
01300      }

FolderAction::remove (  ) 

Definiert in Zeile 1253 der Datei FolderAction.class.php.

Benutzt Action::setTemplateVars().

01254      {
01255           $this->setTemplateVars( $this->folder->getProperties() );
01256      }

FolderAction::reorder (  ) 

Definiert in Zeile 809 der Datei FolderAction.class.php.

Benutzt Action::addNotice(), Action::callSubAction(), Action::getRequestVar() und Http::sendStatus().

00810      {
00811           $type = $this->getRequestVar('type');
00812           
00813           switch( $type )
00814           {
00815                case 'type':
00816                     $ids = $this->folder->getObjectIdsByType();
00817                     break;
00818 
00819                case 'name':
00820                     $ids = $this->folder->getObjectIdsByName();
00821                     break;
00822 
00823                case 'lastchange':
00824                     $ids = $this->folder->getObjectIdsByLastChange();
00825                     break;
00826 
00827                case 'flip':
00828                     $ids = $this->folder->getObjectIds();
00829                     $ids = array_reverse( $ids ); // Reihenfolge drehen
00830                     
00831                     break;
00832 
00833                default:
00834                     Http::sendStatus(400,'Bad request','Unknown reordertype: '.$type );
00835           }
00836 
00837           // Und jetzt die neu ermittelte Reihenfolge speichern
00838           $seq = 0;
00839           foreach( $ids as $id )
00840           {
00841                $seq++; // Sequenz um 1 erhoehen
00842                
00843                $o = new Object( $id );
00844                $o->setOrderId( $seq );
00845      
00846                unset( $o );
00847           }
00848           $this->addNotice($this->folder->getType(),$this->folder->name,'SEQUENCE_CHANGED','ok');
00849 
00850           $this->folder->setTimestamp();
00851           
00852           // Ordner anzeigen
00853           $this->callSubAction('order');
00854      }

FolderAction::saveprop (  ) 

Abspeichern der Ordner-Eigenschaften. Ist der Schalter "delete" gesetzt, wird der Ordner stattdessen gel?scht.

Definiert in Zeile 494 der Datei FolderAction.class.php.

Benutzt Action::addNotice(), Action::addValidationError(), Action::callSubAction() und Action::getRequestVar().

00495      {
00496           // Ordnereigenschaften speichern
00497           if   ( $this->getRequestVar('name') != '' )
00498                $this->folder->name     = $this->getRequestVar('name'    );
00499           elseif ($this->getRequestVar('filename') != '' )
00500                $this->folder->name     = $this->getRequestVar('filename');
00501           else
00502           {
00503                $this->addValidationError('name');
00504                $this->addValidationError('filename');
00505                $this->callSubAction('prop');
00506                return;
00507           }
00508           
00509           $this->folder->filename = $this->getRequestVar('filename'   );
00510           $this->folder->desc     = $this->getRequestVar('description');
00511           $this->folder->save();
00512           $this->addNotice($this->folder->getType(),$this->folder->name,'PROP_SAVED','ok');
00513      }

FolderAction::select (  ) 

Definiert in Zeile 1097 der Datei FolderAction.class.php.

Benutzt lang(), Text::maxLaenge(), Action::setTemplateVar() und Html::url().

01098      {
01099           global $conf_php;
01100 
01101           $this->setTemplateVar('writable',$this->folder->hasRight(ACL_WRITE) );
01102           
01103           $list = array();
01104 
01105           // Schleife ueber alle Objekte in diesem Ordner
01106           foreach( $this->folder->getObjects() as $o )
01107           {
01108                $id = $o->objectid;
01109 
01110                if   ( $o->hasRight(ACL_READ) )
01111                {
01112                     $list[$id]['id']     = 'obj'.$id;
01113                     $list[$id]['name']     = Text::maxLaenge( 30,$o->name     );
01114                     $list[$id]['filename'] = Text::maxLaenge( 20,$o->filename );
01115                     $list[$id]['desc']     = Text::maxLaenge( 30,$o->desc     );
01116                     if   ( $list[$id]['desc'] == '' )
01117                          $list[$id]['desc'] = lang('GLOBAL_NO_DESCRIPTION_AVAILABLE');
01118                     $list[$id]['desc'] = 'ID '.$id.' - '.$list[$id]['desc']; 
01119 
01120                     $list[$id]['type'] = $o->getType();
01121                     
01122                     $list[$id]['icon'] = $o->getType();
01123 
01124                     if   ( $o->getType() == 'file' )
01125                     {
01126                          $file = new File( $id );
01127                          $file->load();
01128                          $list[$id]['desc'] .= ' - '.intval($file->size/1000).'kB';
01129 
01130                          if   ( substr($file->mimeType(),0,6) == 'image/' )
01131                               $list[$id]['icon'] = 'image';
01132 //                       if   ( substr($file->mimeType(),0,5) == 'text/' )
01133 //                            $list[$id]['icon'] = 'text';
01134                     }
01135 
01136                     $list[$id]['url' ] = Html::url('main',$o->getType(),$id);
01137                     $list[$id]['date'] = date( lang('DATE_FORMAT'),$o->lastchangeDate );
01138                     $list[$id]['user'] = $o->lastchangeUser;
01139                }
01140           }
01141 
01142           if   ( $this->folder->hasRight(ACL_WRITE) )
01143           {
01144                // Alle anderen Ordner ermitteln
01145                $otherfolder = array();
01146                foreach( $this->folder->getAllFolders() as $id )
01147                {
01148                     $f = new Folder( $id );
01149                     if   ( $f->hasRight( ACL_WRITE ) )
01150                          $otherfolder[$id] = FILE_SEP.implode( FILE_SEP,$f->parentObjectNames(false,true) );
01151                }
01152                asort( $otherfolder );
01153      
01154                $this->setTemplateVar('folder',$otherfolder);
01155      
01156                // URLs zum Umsortieren der Eintraege
01157                $this->setTemplateVar('order_url'      ,Html::url('folder','order',$this->folder->id) );
01158           }    
01159 
01160           $actionList = array();
01161           $actionList[] = array('type'=>'copy');
01162           $actionList[] = array('type'=>'link');
01163 
01164           if   ( $this->folder->hasRight(ACL_WRITE) )
01165           {
01166                $actionList[] = array('type'=>'move');
01167                $actionList[] = array('type'=>'delete');
01168           }
01169           
01170           $this->setTemplateVar('actionlist',$actionList );
01171 
01172           $this->setTemplateVar('object'      ,$list            );
01173           $this->setTemplateVar('act_objectid',$this->folder->id);
01174      }

FolderAction::setbottom (  ) 

Definiert in Zeile 886 der Datei FolderAction.class.php.

Benutzt Action::addNotice(), Action::callSubAction() und Action::getRequestVar().

00887      {
00888           $ids = $this->folder->getObjectIds();
00889           $seq = 0;
00890 
00891           foreach( $ids as $id )
00892           {
00893                if   ( $id != $this->getRequestVar('objectid1') )
00894                {
00895                     $seq++; // Sequenz um 1 erhoehen
00896 
00897                     $o = new Object( $id );
00898                     $o->setOrderId( $seq );
00899      
00900                     unset( $o ); // Selfmade Garbage Collection :-)
00901                }
00902           }
00903 
00904           $seq++; // Sequenz um 1 erhoehen
00905           $o = new Object( $this->getRequestVar('objectid1') );
00906           $o->setOrderId( $seq );
00907 
00908           $this->addNotice($this->folder->getType(),$this->folder->name,'SEQUENCE_CHANGED','ok');
00909           $this->folder->setTimestamp();
00910           
00911           // Ordner anzeigen
00912           $this->callSubAction('order');
00913           
00914      }

FolderAction::settop (  ) 

Definiert in Zeile 857 der Datei FolderAction.class.php.

Benutzt Action::addNotice(), Action::callSubAction() und Action::getRequestVar().

00858      {
00859           $o = new Object( $this->getRequestVar('objectid1') );
00860           $o->setOrderId( 1 );
00861 
00862           $ids = $this->folder->getObjectIds();
00863           $seq = 1;
00864 
00865           foreach( $ids as $id )
00866           {
00867                if   ( $id != $this->getRequestVar('objectid1') )
00868                {
00869                     $seq++; // Sequenz um 1 erhoehen
00870 
00871                     $o = new Object( $id );
00872                     $o->setOrderId( $seq );
00873      
00874                     unset( $o ); // Selfmade Garbage Collection :-)
00875                }
00876           }
00877 
00878           $this->addNotice($this->folder->getType(),$this->folder->name,'SEQUENCE_CHANGED','ok');
00879           $this->folder->setTimestamp();
00880           
00881           // Ordner anzeigen
00882           $this->callSubAction('order');
00883      }

FolderAction::show (  ) 

Anzeige aller Objekte in diesem Ordner.

Rückgabe:
unknown_type

Definiert in Zeile 1041 der Datei FolderAction.class.php.

Benutzt lang(), Text::maxLaenge(), Action::setTemplateVar() und Html::url().

01042      {
01043           global $conf_php;
01044 
01045           if   ( ! $this->folder->isRoot )
01046                $this->setTemplateVar('up_url',Html::url('main','folder',$this->folder->parentid));
01047 
01048           $this->setTemplateVar('writable',$this->folder->hasRight(ACL_WRITE) );
01049           
01050           $list = array();
01051 
01052           // Schleife ueber alle Objekte in diesem Ordner
01053           foreach( $this->folder->getObjects() as $o )
01054           {
01055                $id = $o->objectid;
01056 
01057                if   ( $o->hasRight(ACL_READ) )
01058                {
01059                     $list[$id]['name']     = Text::maxLaenge( 30,$o->name     );
01060                     $list[$id]['filename'] = Text::maxLaenge( 20,$o->filename );
01061                     $list[$id]['desc']     = Text::maxLaenge( 30,$o->desc     );
01062                     if   ( $list[$id]['desc'] == '' )
01063                          $list[$id]['desc'] = lang('GLOBAL_NO_DESCRIPTION_AVAILABLE');
01064                     $list[$id]['desc'] = $list[$id]['desc'].' - '.lang('GLOBAL_IMAGE').' '.$id; 
01065 
01066                     $list[$id]['type'] = $o->getType();
01067                     
01068                     $list[$id]['icon' ] = $o->getType();
01069                     $list[$id]['class'] = $o->getType();
01070                     $list[$id]['url' ] = Html::url('main',$o->getType(),$id);
01071                     
01072                     if   ( $o->getType() == 'file' )
01073                     {
01074                          $file = new File( $id );
01075                          $file->load();
01076                          $list[$id]['desc'] .= ' - '.intval($file->size/1000).'kB';
01077 
01078                          if   ( $file->isImage() )
01079                          {
01080                               $list[$id]['icon' ] = 'image';
01081                               $list[$id]['class'] = 'image';
01082                               //$list[$id]['url' ] = Html::url('file','show',$id) nur sinnvoll bei Lightbox-Anzeige
01083                          }
01084 //                       if   ( substr($file->mimeType(),0,5) == 'text/' )
01085 //                            $list[$id]['icon'] = 'text';
01086                     }
01087 
01088                     $list[$id]['date'] = $o->lastchangeDate;
01089                     $list[$id]['user'] = $o->lastchangeUser;
01090                }
01091           }
01092 
01093           $this->setTemplateVar('object'      ,$list            );
01094      }

FolderAction::stringToBytes ( val  ) 

Umwandlung von abgek�rzten Bytewerten ("Shorthand Notation") wie "4M" oder "500K" in eine ganzzahlige Byteanzahl.

Quelle: http://de.php.net/manual/de/function.ini-get.php

Parameter:
String Abgek�rzter Bytewert
Rückgabe:
Integer Byteanzahl

Definiert in Zeile 999 der Datei FolderAction.class.php.

Wird benutzt von maxFileSize().

01000      {
01001           $val  = trim($val);
01002           $last = strtolower($val{strlen($val)-1});
01003           // Achtung: Der Trick ist das "Fallthrough", kein "break" vorhanden!
01004           switch($last)
01005           {
01006                // The 'G' modifier is available since PHP 5.1.0
01007                case 'g':
01008                     $val *= 1024;
01009                case 'm':
01010                     $val *= 1024;
01011                case 'k':
01012                     $val *= 1024;
01013           }
01014           
01015           return intval($val);
01016      }


Dokumentation der Datenelemente

FolderAction::$defaultSubAction = 'show'

Definiert in Zeile 191 der Datei FolderAction.class.php.

FolderAction::$folder

Definiert in Zeile 192 der Datei FolderAction.class.php.


Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei:

Erzeugt am Thu May 14 00:55:49 2009 für OpenRat von  doxygen 1.5.8