Ignore:
Timestamp:
Mar 10, 2013, 8:15:46 PM (12 years ago)
Author:
chronos
Message:
  • Přidáno: FormManager pro objektové řešení zrušení vazeb na třídu System. FormManager nyní obsluhuje existující formulářové typy a třídy formulářů.
  • Přidáno: Formulářový typ FileContent zajistí načtení obsahu souboru. Typ File pak zajistí i uložení do databáze a přiřazení Id do tabulky File.
  • Odstraněno: Adresář docs obsahoval staré dokumenty. Ty musí být přesunuty do adresáře files a registrovány do databáze.
  • Upraveno: Třídy Database nyní bude hlásit chyby přes výjimky PHP.
Location:
trunk/Common/Form
Files:
2 added
1 deleted
5 edited
2 copied
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Common/Form/Types/Base.php

    r484 r501  
    33class TypeBase
    44{
    5   var $System;
     5  var $FormManager;
     6  var $Database;
    67  var $DatabaseCompareOperators = array();
    78  var $Hidden;
    89
    9   function __construct($System)
     10  function __construct($FormManager)
    1011  {
    11     $this->System = &$System;
     12    $this->FormManager = &$FormManager;
     13    $this->Database = &$FormManager->Database;
    1214    $this->Hidden = false;
    1315  }
  • trunk/Common/Form/Types/Enumeration.php

    r498 r501  
    77  function OnView($Item)
    88  {
    9     $Type = $this->System->Type->GetTypeDefinition($Item['Type']);
     9    $Type = $this->FormManager->Type->GetTypeDefinition($Item['Type']);
    1010    if(array_key_exists($Item['Value'], $Type['Parameters']['States']))
    1111      $Output = $Type['Parameters']['States'][$Item['Value']];
     
    1616  function OnEdit($Item)
    1717  {
    18     $Type = $this->System->Type->GetTypeDefinition($Item['Type']);
     18    $Type = $this->FormManager->Type->GetTypeDefinition($Item['Type']);
    1919    $Output = '<select name="'.$Item['Name'].'">';
    2020      if(array_key_exists('Null', $Item) and $Item['Null'])
  • trunk/Common/Form/Types/Hidden.php

    r484 r501  
    55class TypeHidden extends TypeBase
    66{
    7   function __construct($System)
     7  function __construct($FormManager)
    88  {
    9     parent::__construct($System);
     9    parent::__construct($FormManager);
    1010    $this->Hidden = true;
    1111  }
  • trunk/Common/Form/Types/OneToMany.php

    r483 r501  
    2525  {
    2626    $Output = '<select name="'.$Item['Name'].'">';
    27     $Type = $this->System->Type->TypeDefinitionList[$Item['Type']];
     27    $Type = $this->FormManager->Type->TypeDefinitionList[$Item['Type']];
    2828    if(array_key_exists('Condition', $Type['Parameters'])) $Where = ' WHERE '.$Type['Parameters']['Condition'];
    2929      else $Where = '';
     
    3535    if(array_key_exists('View', $Type['Parameters'])) $Table = $Type['Parameters']['View'];
    3636      else $Table = $Type['Parameters']['Table'];
    37     $DbResult = $this->System->Database->query('SELECT '.$Type['Parameters']['Name'].' AS `Name`,'.$Type['Parameters']['Id'].' AS `Id` FROM '.$Table.''.$Where.' ORDER BY `Name`');
     37    $DbResult = $this->Database->query('SELECT '.$Type['Parameters']['Name'].' AS `Name`,'.$Type['Parameters']['Id'].' AS `Id` FROM '.$Table.''.$Where.' ORDER BY `Name`');
    3838    while($DbRow = $DbResult->fetch_assoc())
    3939    {
  • trunk/Common/Form/Types/RandomHash.php

    r484 r501  
    55class TypeRandomHash extends TypeBase
    66{
    7   function __construct($System)
     7  function __construct($FormManager)
    88  {
    9     parent::__construct($System);
     9    parent::__construct($FormManager);
    1010    $this->Hidden = true;
    1111  }
  • trunk/Common/Form/Types/Type.php

    r500 r501  
    1616include(dirname(__FILE__).'/Hyperlink.php');
    1717include(dirname(__FILE__).'/Hidden.php');
    18 include(dirname(__FILE__).'/File/File.php');
     18include(dirname(__FILE__).'/File.php');
     19include(dirname(__FILE__).'/FileContent.php');
    1920include(dirname(__FILE__).'/GPS.php');
    2021include(dirname(__FILE__).'/IPv4Address.php');
     
    2425class Type
    2526{
    26   var $System;
     27  var $FormManager;
    2728  var $TypeDefinitionList;
    2829  var $Values;
    2930
    30   function __construct($System)
     31  function __construct($FormManager)
    3132  {
    32     $this->System = $System;
     33    $this->FormManager = &$FormManager;
    3334    $this->TypeDefinitionList = array
    3435    (
     
    5253      'Color' => array('Name' => 'Color', 'Class' => 'Color', 'ParentType' => '', 'Parameters' => array()),
    5354      'RandomHash' => array('Name' => 'RandomHash', 'Class' => 'RandomHash', 'ParentType' => '', 'Parameters' => array()),
     55      'FileContent' => array('Name' => 'FileContent', 'Class' => 'FileContent', 'ParentType' => '', 'Parameters' => array()),
    5456    );
    5557  }
     
    6163      $Type = $this->TypeDefinitionList[$TypeName];
    6264      $TypeClass = 'Type'.$Type['Class'];
    63       $TypeObject = new $TypeClass($this->System);
     65      $TypeObject = new $TypeClass($this->FormManager);
    6466      if(is_callable(array($TypeObject, $Event))) return($TypeObject->$Event($Parameters));
    6567        else return($TypeName.'->'.$Event.'('.serialize($Parameters).')');
     
    7375      $Type = $this->TypeDefinitionList[$TypeName];
    7476      $TypeClass = 'Type'.$Type['Class'];
    75       $TypeObject = new $TypeClass($this->System);
     77      $TypeObject = new $TypeClass($this->FormManager);
    7678      return($TypeObject->Hidden);
    7779    } else return(false);
     
    9294  }
    9395
     96  function UnregisterType($Name)
     97  {
     98    unset($this->TypeDefinitionList[$Name]);
     99    // TODO: remove dependent types
     100  }
     101 
    94102  function GetTypeDefinition($TypeName)
    95103  {
Note: See TracChangeset for help on using the changeset viewer.