Changeset 404 for branches


Ignore:
Timestamp:
Jun 12, 2012, 6:41:12 PM (12 years ago)
Author:
chronos
Message:
  • Opraveno: Odinstalování nyní respektuje závislé moduly, které odinstaluje dříve než samotný modul.
  • Přidáno: Modul system obsahuje rozhraní pro zobrazení seznamu modulů.
Location:
branches/Modular
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/Modular/.htaccess

    r383 r404  
    1111RewriteCond  %{REQUEST_FILENAME}  !-f
    1212RewriteCond  %{REQUEST_FILENAME}  !-d
    13 RewriteRule   ^(.*)$ centrala/index.php?$1
    14 #RewriteRule   ^(.*)$ index.php?$1
     13#RewriteRule   ^(.*)$ centrala/index.php?$1
     14RewriteRule   ^(.*)$ dev/centrala/branches/Modular/index.php?$1
    1515
    1616# Pretty urls
  • branches/Modular/Common/Module.php

    r403 r404  
    3232    DebugLog('Installing module '.$this->Name.'...');
    3333    $this->Installed = true;
     34
     35    // Install dependencies first
    3436    foreach($this->Dependencies as $Dependency) 
    3537      $this->System->Modules[$Dependency]->Install();
     38
    3639    $this->LoadModels();
    3740    foreach($this->Models as $Index => $Module)
     
    4548  {
    4649    DebugLog('Uninstalling module '.$this->Name.'...');
     50    $this->Installed = false;
     51   
     52    // Remove dependent modules first
     53    foreach($this->System->Modules as $Module) 
     54      foreach($Module->Dependencies as $Dependency)
     55        if(($Dependency == $this->Name) and ($Module->Installed)) $this->System->Modules[$Module->Name]->UnInstall();
     56       
    4757    $this->LoadModels();
    4858    foreach(array_reverse($this->Models, true) as $Index => $Model)
     
    5161    }
    5262    $this->Database->query('UPDATE SystemModule SET Installed=0 WHERE Name="'.$this->Name.'"');
    53     $this->Installed = false;
    5463  }
    5564 
     
    115124    $this->LoadModules();
    116125    foreach($this->Modules as $Index => $Module)
     126    {
     127      //DebugLog('Init module '.$Module->Name);
    117128      $this->Modules[$Index]->Init();
     129    }
    118130  }
    119131 
     
    171183    $this->ReloadList();
    172184    $this->LoadModules(false);
    173     //$this->Modules['System']->Install();
    174     foreach($this->Modules as $Index => $Module)
     185    $this->Modules['System']->Install();
     186    /*foreach($this->Modules as $Index => $Module)
    175187    {     
    176188      $this->Modules[$Index]->Install();
    177     }
     189    }*/
    178190  }
    179191 
  • branches/Modular/Common/Page.php

    r386 r404  
    5555    <div id="Title">'.$Title.'</div>
    5656    <div class="Navigation"><span class="MenuItem"><strong>Navigace :: </strong> '.$Navigation.'</span><div class="MenuItem2">';
    57     if($this->System->Config['Web']['UserSupport'] == 1)
     57    if(array_key_exists('User', $this->System->Modules))
    5858    {
    5959      if($this->System->Modules['User']->Models['User']->User['Id'] == $this->System->Modules['User']->Models['User']->AnonymousUserId)
  • branches/Modular/Common/TableHeader.php

    r384 r404  
    9292      {
    9393        $this->QueryItems->Data['OrderDir'] = 1 - $OrderDir;
    94         $ArrowImage = '<img style="vertical-align: middle; border: 0px;" src="'.$this->System->RootFolder.'/Style/'.$this->System->Style.'/Images/'.$this->OrderArrowImage[$OrderDir].'" alt="order arrow">';
     94        $ArrowImage = '<img style="vertical-align: middle; border: 0px;" src="'.$this->System->RootFolder.'/style/'.$this->System->Style.'/images/'.$this->OrderArrowImage[$OrderDir].'" alt="order arrow">';
    9595      } else
    9696      {
  • branches/Modular/Common/ViewList.php

    r385 r404  
    131131  }   
    132132
     133  function AddItemBoolean($Name, $Title)
     134  {
     135    $this->Columns[$Name] = array('Name' => $Name, 'Title' => $Title,
     136      'Type' => ViewItemTypeBoolean, 'SQL' => $Name);
     137  }   
     138
    133139  function AddItemDateTime($Name, $Title)
    134140  {
  • branches/Modular/Modules/System/System.php

    r403 r404  
    11<?php
     2
     3class PageModules extends Page
     4{
     5  function __construct()
     6  {
     7    parent::__construct();
     8    $this->FullTitle = 'Správa modulů';
     9    $this->ShortTitle = 'Moduly';
     10  }
     11 
     12  function Show()
     13  {
     14    $View = new ViewModules($this->System);
     15    $View->LoadFromDatabase();
     16    return($View->Show());
     17  }
     18}
     19 
     20class ViewModules extends ViewList
     21{
     22  function __construct($System)
     23  {
     24    parent::__construct($System);
     25    $this->Name = 'SystemModule';
     26    $this->AddItemString('Name', 'Jméno');
     27    $this->AddItemString('Creator', 'Tvůrce');
     28    $this->AddItemString('Version', 'Verze');
     29    $this->AddItemString('License', 'Licence');
     30    $this->AddItemBoolean('Installed', 'Instalováno');
     31    $this->AddItemText('Description', 'Popis');
     32  }
     33}
    234
    335class SystemView extends Model
     
    3466}
    3567
     68class SystemModule extends Model
     69{
     70  function __construct($Database, $System)
     71  {
     72    parent::__construct($Database, $System);
     73    $this->Name = 'SystemModule';
     74    $this->AddPropertyString('Name');
     75    $this->AddPropertyString('Creator');
     76    $this->AddPropertyString('Version');
     77    $this->AddPropertyString('License');
     78    $this->AddPropertyBoolean('Installed');
     79    $this->AddPropertyText('Description');
     80  }
     81
     82  function Install()
     83  {
     84    // Do nothing, already installed by ModuleManager
     85  }
     86 
     87  function UnInstall()
     88  {
     89    // Do nothing, managed by ModuleManager
     90  } 
     91}
     92
    3693class ModuleSystem extends Module
    3794{
     
    44101    $this->License = 'GNU/GPL';
    45102    $this->Description = 'Base system module';
    46     $this->Dependencies = array('User');
    47     $this->SupportedModels = array('SystemView', 'SystemAction', 'SystemMenu');
     103    $this->Dependencies = array();
     104    $this->SupportedModels = array('SystemView', 'SystemAction', 'SystemMenu',
     105      'SystemModule');
    48106  }
    49107 
     
    60118  function Init()
    61119  {
     120    $this->System->Pages['modules'] = 'PageModules';
    62121  }
    63122}
Note: See TracChangeset for help on using the changeset viewer.