Changeset 526


Ignore:
Timestamp:
Apr 21, 2013, 10:23:56 PM (12 years ago)
Author:
chronos
Message:
  • Upraveno: Tabulka HyperLink přejmenována na obecnější název Action. Odkazy na názvy ikony přepracovány na samostatnou tabulku.
  • Upraveno: Funkce týkající se fronty mailů odděleny do samostatného souboru.
Location:
trunk
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/System.php

    r525 r526  
    11<?php
     2
     3include_once(dirname(__FILE__).'/EmailQueue.php');
    24
    35class System
     
    1315  var $PathItems;
    1416  var $RootURLFolder;
     17  var $EmailQueue;
    1518
    1619  function __construct()
     
    2124    $this->Database = new Database();
    2225    $this->FormManager = new FormManager($this->Database);
     26    $this->EmailQueue = new EmailQueue($this);
    2327  } 
    2428 
     
    7983  }
    8084 
    81   function AddEmailToQueue($To, $Subject, $Content, $From, $AttachmentFileId = '')
    82   {
    83     $Values = array('To' => $To,
    84       'Subject' => $Subject, 'Content' => $Content, 'Time' => 'NOW()',
    85       'From' => $From);
    86     if($AttachmentFileId != '') $Values['AttachmentFile'] = $AttachmentFileId;
    87     $this->Database->insert('EmailQueue', $Values);
    88   }
    89  
    90   function ProcessEmailQueue()
    91   {
    92     $Output = '';
    93     $DbResult = $this->Database->select('EmailQueue', '*', 'Archive=0');
    94     while($DbRow = $DbResult->fetch_assoc())
    95     {     
    96       $Mail = new Mail();
    97       $Mail->AddToCombined($DbRow['To']);
    98       $Mail->Subject = $DbRow['Subject'];
    99       $Mail->From = $DbRow['From'];
    100       $Mail->AddBody(strip_tags($DbRow['Content']), 'text/plain');
    101       $Mail->AddBody($DbRow['Content'], 'text/html');
    102       if($DbRow['AttachmentFile'] != '')
    103       {
    104         $DbResult2 = $this->Database->select('File', '*', 'Id='.$DbRow['AttachmentFile']);
    105         while($File = $DbResult2->fetch_assoc())
    106           $Mail->AttachFile($this->Config['Web']['FileRootFolder'].$File['DrivePath'], $File['MimeType']);
    107       }
    108       $Mail->Send();
    109       $this->Database->update('EmailQueue', 'Id='.$DbRow['Id'], array('Archive' => 1));
    110       $this->ModuleManager->Modules['Log']->NewRecord('System', 'SendEmail', $DbRow['Id']);
    111       $Output .= 'To: '.$DbRow['To'].'  Subject: '.$DbRow['Subject'].'<br />';
    112     }   
    113     return($Output);
    114   }
    115  
    11685  function HumanDate($Time)
    11786  {
  • trunk/Common/Version.php

    r524 r526  
    11<?php
    22
    3 $Revision = 524; // Subversion revision
    4 $DatabaseRevision = 517; // SQL structure revision
    5 $ReleaseTime = '2013-04-20';
     3$Revision = 526; // Subversion revision
     4$DatabaseRevision = 526; // SQL structure revision
     5$ReleaseTime = '2013-04-21';
    66
    77?>
  • trunk/Modules/Finance/Manage.php

    r524 r526  
    593593       
    594594      $Content .= '<br />Tento email je generován automaticky. V případě zjištění nesrovnalostí napište zpět.';
    595       $this->System->AddEmailToQueue($User['Name'].' <'.$User['Email'].'>', $Title, $Content,
     595      $this->System->EmailQueue->AddItem($User['Name'].' <'.$User['Email'].'>', $Title, $Content,
    596596         $Config['Web']['Admin'].' <'.$Config['Web']['AdminEmail'].'>');
    597597      $Output = '';
  • trunk/Modules/Network/Administration.php

    r525 r526  
    2727        $Form = new Form('Email');
    2828        $Form->LoadValuesFromForm();
    29         $Result = $this->System->AddEmailToQueue($Form->Values['Address'],
     29        $Result = $this->System->EmailQueue->AddItem($Form->Values['Address'],
    3030          $Form->Values['Subject'], $Form->Values['Content'],
    3131          $this->System->Config['Web']['Admin'].' <'.$this->System->Config['Web']['AdminEmail'].'>');
     
    3434      if($_GET['Action'] == 'ProcessEmailQueue')
    3535      {
    36         $Output = $this->System->ProcessEmailQueue();
     36        $Output = $this->System->EmailQueue->Process();
    3737        $Output = $this->SystemMessage('Zpracování fronty emailů', 'Nové emaily byly odeslány').$Output;
    3838      }
  • trunk/Modules/Portal/Portal.php

    r524 r526  
    88  var $ShortTitle = 'Rozcestník';
    99 
    10   function ShowLinks($HyperlinkGroup)
     10  function ShowActions($ActionGroup)
    1111  {
    1212    $Output = '';
    13     $DbResult = $this->Database->query('SELECT * FROM `Hyperlink` WHERE (`Group`='.$HyperlinkGroup['Id'].') AND (`Enable` = 1)');
    14     while($HyperLink = $DbResult->fetch_assoc())
    15     {
    16       if($HyperLink['IconFile'] == '') $HyperLink['IconFile'] = 'clear.png';
    17         if(substr($HyperLink['URL'], 0, 4) != 'http') $HyperLink['URL'] = $this->System->Config['Web']['RootFolder'].$HyperLink['URL'];
    18         if(($HyperLink['PermissionModule'] == '') or (($HyperLink['PermissionModule'] != '') and $this->System->User->User->CheckPermission($HyperLink['PermissionModule'], $HyperLink['PermissionOperation'])))       
    19         $Output .= '<img alt="'.$HyperLink['Name'].'" src="images/favicons/'.$HyperLink['IconFile'].'" width="16" height="16" /> <a href="'.$HyperLink['URL'].'">'.$HyperLink['Name'].'</a><br />';
    20     }
    21     return($this->Panel($HyperlinkGroup['Name'], $Output));
     13    $DbResult = $this->Database->query('SELECT *, `ActionIcon`.`Name` AS `Icon` FROM `Action` LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '.
     14      'WHERE (`Group`='.$ActionGroup['Id'].') AND (`Enable` = 1)');
     15    while($Action = $DbResult->fetch_assoc())
     16    {
     17      if($Action['Icon'] == '') $Action['Icon'] = 'clear.png';
     18        if(substr($Action['URL'], 0, 4) != 'http') $Action['URL'] = $this->System->Link($Action['URL']);
     19        if(($Action['PermissionModule'] == '') or (($Action['PermissionModule'] != '') and $this->System->User->User->CheckPermission($Action['PermissionModule'], $Action['PermissionOperation'])))       
     20        $Output .= '<img alt="'.$Action['Title'].'" src="images/favicons/'.$Action['Icon'].'" width="16" height="16" /> <a href="'.$Action['URL'].'">'.$Action['Title'].'</a><br />';
     21    }
     22    return($this->Panel($ActionGroup['Name'], $Output));
    2223  }
    2324
     
    305306    }
    306307
    307     $DbResult = $this->Database->query('SELECT * FROM `HyperlinkGroup`');
     308    $DbResult = $this->Database->query('SELECT * FROM `ActionGroup`');
    308309    while($DbRow = $DbResult->fetch_assoc())
    309       $HyperlinkGroups[$DbRow['Id']] = $DbRow;
     310      $ActionGroups[$DbRow['Id']] = $DbRow;
    310311
    311312    // Show pannels
     
    322323      while($Panel = $DbResult2->fetch_assoc())
    323324      {
    324         if($Panel['Module'] == 'HyperlinkGroup') $Output .= $this->ShowLinks($HyperlinkGroups[$Panel['Parameters']]);
     325        if($Panel['Module'] == 'ActionGroup') $Output .= $this->ShowActions($ActionGroups[$Panel['Parameters']]);
    325326        else if($Panel['Module'] == 'OnlineHostList') $Output .= $this->Panel('Online počítače', $this->OnlineHostList());
    326327        else if($Panel['Module'] == 'UserOptions')
  • trunk/ToDo.txt

    r517 r526  
    2424  * Ruční filtrování a vyhledávání v tabulkách
    2525  * Předvolené sestavy filtrů, řazení, pořadí sloupců
    26 - Zprovoznit obsluhu stránek přes virtuální URL
     26  * Inicializace a aktualizace struktury databáze přímo z modulů 
    2727- Udělat fond IP adres, zobrazit jejich užití, umožnit automatické přiřazení volných
    2828- Vytvořit třídy pro práci s Mikrotik RouterOS API
     
    3535======
    3636
     37- Zprovoznit obsluhu stránek přes virtuální URL
    3738- IS modul pro obecné datové manipulace s tabulkami
    3839- Vedení skladu a produktových karet
  • trunk/admin/Updates.php

    r517 r526  
    239239}
    240240
     241function UpdateTo526($Manager)
     242{
     243  $Manager->Execute("ALTER TABLE `Hyperlink` CHANGE `Name` `Title` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL");
     244  $Manager->Execute("ALTER TABLE `Hyperlink` ADD `Name` VARCHAR( 255 ) NOT NULL AFTER `Id`");
     245  //$Manager->Execute("ALTER TABLE `Hyperlink` ADD UNIQUE ( `Name` )");
     246  $Manager->Execute("ALTER TABLE `Hyperlink` ADD `Type` INT NOT NULL AFTER `Title` , ADD INDEX ( `Type` )");
     247  $Manager->Execute("RENAME TABLE `Hyperlink` TO `Action` ;");
     248  $Manager->Execute("RENAME TABLE `HyperlinkGroup` TO `ActionGroup` ;");
     249  $Manager->Execute("CREATE TABLE IF NOT EXISTS `ActionType` (
     250      `Id` int(11) NOT NULL AUTO_INCREMENT,
     251      `Name` varchar(255) NOT NULL,
     252      PRIMARY KEY (`Id`)
     253  ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
     254 
     255  INSERT INTO `ActionType` (`Id`, `Name`) VALUES
     256  (1, 'Odkaz'),
     257  (2, 'Obrázek');");
     258  $Manager->Execute("UPDATE `Action` SET `Type` = 1;");
     259  $Manager->Execute("ALTER TABLE `Action` ADD FOREIGN KEY ( `Type` ) REFERENCES `ActionType` (".
     260    "`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;");
     261  $Manager->Execute("UPDATE `Panel` SET `Module` = 'ActionGroup' WHERE `Module` = 'HyperlinkGroup'");
     262  $Manager->Execute("CREATE TABLE IF NOT EXISTS `ActionIcon` (
     263  `Id` int(11) NOT NULL AUTO_INCREMENT,
     264  `Name` varchar(255) NOT NULL,
     265  PRIMARY KEY (`Id`)
     266) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
     267  $Manager->Execute("INSERT INTO `ActionIcon` (SELECT NULL AS `Id`, `IconFile` AS `Name` FROM `Action` WHERE `IconFile` != '' GROUP BY `IconFile`)");
     268  $Manager->Execute("UPDATE `Action` SET `IconFile` = (SELECT `Id` FROM `ActionIcon` WHERE `ActionIcon`.`Name` = `Action`.`IconFile`) ");
     269  $Manager->Execute("ALTER TABLE `Action` CHANGE `IconFile` `Icon` INT NULL ");
     270  $Manager->Execute("UPDATE `Action` SET `Icon` = NULL WHERE `Icon` = 0");
     271  $Manager->Execute("ALTER TABLE `Action` ADD INDEX ( `Icon` ) ");
     272  $Manager->Execute("ALTER TABLE `Action` ADD FOREIGN KEY ( `Icon` ) REFERENCES `ActionIcon` (`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;");
     273  $Manager->Execute("INSERT INTO `ISMenuItem` (`Id` ,`Name` ,`Parent` ,`Table` ,`IconName`) ".
     274    "VALUES (NULL , 'Akce', '23', 'Action', '');");
     275}
    241276
    242277$Updates = array(
     
    253288  507 => array('Revision' => 515, 'Function' => 'UpdateTo515'),
    254289  515 => array('Revision' => 517, 'Function' => 'UpdateTo517'),
     290  517 => array('Revision' => 526, 'Function' => 'UpdateTo526'),
    255291);
    256292
  • trunk/form_classes.php

    r517 r526  
    1919{
    2020  $FormManager->Classes = array(
     21  'Action' => array(
     22    'Title' => 'Akce',
     23    'Table' => 'Action',
     24    'Items' => array(
     25      'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
     26      'Title' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
     27      'URL' => array('Type' => 'Hyperlink', 'Caption' => 'Odkaz', 'Default' => ''),
     28      'Icon' => array('Type' => 'TActionIcon', 'Caption' => 'Ikony', 'Default' => ''),
     29      'Type' => array('Type' => 'TActionType', 'Caption' => 'Typ', 'Default' => ''),
     30      'Group' => array('Type' => 'TActionGroup', 'Caption' => 'Skupina', 'Default' => ''),
     31      'PermissionModule' => array('Type' => 'String', 'Caption' => 'Modul oprávnění', 'Default' => ''),
     32      'PermissionOperation' => array('Type' => 'String', 'Caption' => 'Operace oprávnění', 'Default' => ''),
     33      'Enable' => array('Type' => 'Boolean', 'Caption' => 'Povolení', 'Default' => ''),
     34    ),
     35  ),
     36  'ActionIcon' => array(
     37    'Title' => 'Ikony akcí',
     38    'Table' => 'ActionIcon',
     39    'Items' => array(
     40      'Name' => array('Type' => 'String', 'Caption' => 'Název souboru', 'Default' => ''),
     41    ),
     42  ),
     43  'ActionGroup' => array(
     44    'Title' => 'Skupiny akcí',
     45    'Table' => 'ActionGroup',
     46    'Items' => array(
     47      'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
     48    ),
     49  ),
     50  'ActionType' => array(
     51    'Title' => 'Typy akcí',
     52    'Table' => 'ActionType',
     53    'Items' => array(
     54      'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
     55    ),
     56  ),
    2157  'FinanceBank' => array(
    2258    'Title' => 'Banky',
     
    10991135    'Filter' => '1',
    11001136  ),
     1137  'TActionIcon' => array(
     1138    'Type' => 'Reference',
     1139    'Table' => 'ActionIcon',
     1140    'Id' => 'Id',
     1141    'Name' => 'Name',
     1142    'Filter' => '1',
     1143  ),
     1144  'TActionType' => array(
     1145    'Type' => 'Reference',
     1146    'Table' => 'ActionType',
     1147    'Id' => 'Id',
     1148    'Name' => 'Name',
     1149    'Filter' => '1',
     1150  ),
     1151  'TActionGroup' => array(
     1152    'Type' => 'Reference',
     1153    'Table' => 'ActionGroup',
     1154    'Id' => 'Id',
     1155    'Name' => 'Name',
     1156    'Filter' => '1',
     1157  ),
    11011158  'TDirectory' => array(
    11021159    'Type' => 'Reference',
Note: See TracChangeset for help on using the changeset viewer.