Changeset 597


Ignore:
Timestamp:
Nov 22, 2013, 10:37:47 PM (11 years ago)
Author:
chronos
Message:
  • Přidáno: Akce zobrazovat přes sjednocenou funkci ShowAction.
  • Přidáno: Chybějící tabulka Model pro seznam modelů.
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/System.php

    r595 r597  
    113113  }
    114114 
     115  function ShowAction($Id)
     116  {
     117        $Output = '';
     118    $DbResult = $this->Database->query('SELECT *, `ActionIcon`.`Name` AS `Icon` FROM `Action` '.
     119      'LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '.
     120      'WHERE (`Action`.`Id`='.$Id.')');
     121    if($DbResult->num_rows > 0)
     122    {
     123      $Action = $DbResult->fetch_assoc();
     124      if($Action['Icon'] == '') $Action['Icon'] = 'clear.png';
     125      if(substr($Action['URL'], 0, 4) != 'http') $Action['URL'] = $this->Link($Action['URL']);
     126      if($this->User->CheckPermission('System', 'Read', 'Item', $Id))
     127        $Output .= '<img alt="'.$Action['Title'].'" src="'.$this->Link('/images/favicons/'.$Action['Icon']).
     128        '" width="16" height="16" /> <a href="'.$Action['URL'].'">'.$Action['Title'].'</a>';
     129    }
     130    return($Output);
     131  }
     132
    115133  function Run()
    116134  {
  • trunk/Application/Version.php

    r596 r597  
    11<?php
    22
    3 $Revision = 596; // Subversion revision
    4 $DatabaseRevision = 591; // SQL structure revision
     3$Revision = 597; // Subversion revision
     4$DatabaseRevision = 597; // SQL structure revision
    55$ReleaseTime = '2013-11-20';
  • trunk/Common/AppModule.php

    r594 r597  
    296296  function LoadState()
    297297  {
     298        $ConfigModules = array();
    298299    include($this->FileName);
    299300    foreach($ConfigModules as $Mod)
     
    327328  }
    328329 
    329   function UnregisterModule($Module)
     330  function UnregisterModule(AppModule $Module)
    330331  {
    331332    unset($this->Modules[array_search($Module, $this->Modules)]);
  • trunk/Common/Setup/Updates.php

    r596 r597  
    449449}
    450450
     451function UpdateTo597($Manager)
     452{
     453  $Manager->Execute('CREATE TABLE IF NOT EXISTS `Model` (
     454  `Id` int(11) NOT NULL AUTO_INCREMENT,
     455  `Name` varchar(255) NOT NULL,
     456  `Module` int(11) NOT NULL,
     457  PRIMARY KEY (`Id`),
     458  KEY `Module` (`Module`)
     459) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
     460
     461  $Manager->Execute('ALTER TABLE `Model`
     462  ADD CONSTRAINT `Model_ibfk_1` FOREIGN KEY (`Module`) REFERENCES `Module` (`Id`);');
     463}
     464
    451465class Updates
    452466{
     
    454468  {
    455469    return(array(
    456   491 => array('Revision' => 493, 'Function' => 'UpdateTo493'),
    457   493 => array('Revision' => 494, 'Function' => 'UpdateTo494'),
    458   494 => array('Revision' => 495, 'Function' => 'UpdateTo495'),
    459   495 => array('Revision' => 497, 'Function' => 'UpdateTo497'),
    460   497 => array('Revision' => 498, 'Function' => 'UpdateTo498'),
    461   498 => array('Revision' => 499, 'Function' => 'UpdateTo499'),
    462   499 => array('Revision' => 500, 'Function' => 'UpdateTo500'),
    463   500 => array('Revision' => 502, 'Function' => 'UpdateTo502'),
    464   502 => array('Revision' => 505, 'Function' => 'UpdateTo505'),
    465   505 => array('Revision' => 507, 'Function' => 'UpdateTo507'),
    466   507 => array('Revision' => 515, 'Function' => 'UpdateTo515'),
    467   515 => array('Revision' => 517, 'Function' => 'UpdateTo517'),
    468   517 => array('Revision' => 526, 'Function' => 'UpdateTo526'),
    469   526 => array('Revision' => 527, 'Function' => 'UpdateTo527'),
    470   527 => array('Revision' => 535, 'Function' => 'UpdateTo535'),
    471   535 => array('Revision' => 549, 'Function' => 'UpdateTo549'),
    472   549 => array('Revision' => 550, 'Function' => 'UpdateTo550'),
    473   550 => array('Revision' => 551, 'Function' => 'UpdateTo551'),
    474   551 => array('Revision' => 565, 'Function' => 'UpdateTo565'),
    475   565 => array('Revision' => 571, 'Function' => 'UpdateTo571'),
    476   571 => array('Revision' => 574, 'Function' => 'UpdateTo574'),
    477   574 => array('Revision' => 584, 'Function' => 'UpdateTo584'),
    478   584 => array('Revision' => 591, 'Function' => 'UpdateTo591'),
    479 ));
     470      491 => array('Revision' => 493, 'Function' => 'UpdateTo493'),
     471      493 => array('Revision' => 494, 'Function' => 'UpdateTo494'),
     472      494 => array('Revision' => 495, 'Function' => 'UpdateTo495'),
     473      495 => array('Revision' => 497, 'Function' => 'UpdateTo497'),
     474      497 => array('Revision' => 498, 'Function' => 'UpdateTo498'),
     475      498 => array('Revision' => 499, 'Function' => 'UpdateTo499'),
     476      499 => array('Revision' => 500, 'Function' => 'UpdateTo500'),
     477      500 => array('Revision' => 502, 'Function' => 'UpdateTo502'),
     478      502 => array('Revision' => 505, 'Function' => 'UpdateTo505'),
     479      505 => array('Revision' => 507, 'Function' => 'UpdateTo507'),
     480      507 => array('Revision' => 515, 'Function' => 'UpdateTo515'),
     481      515 => array('Revision' => 517, 'Function' => 'UpdateTo517'),
     482      517 => array('Revision' => 526, 'Function' => 'UpdateTo526'),
     483      526 => array('Revision' => 527, 'Function' => 'UpdateTo527'),
     484      527 => array('Revision' => 535, 'Function' => 'UpdateTo535'),
     485      535 => array('Revision' => 549, 'Function' => 'UpdateTo549'),
     486      549 => array('Revision' => 550, 'Function' => 'UpdateTo550'),
     487      550 => array('Revision' => 551, 'Function' => 'UpdateTo551'),
     488      551 => array('Revision' => 565, 'Function' => 'UpdateTo565'),
     489      565 => array('Revision' => 571, 'Function' => 'UpdateTo571'),
     490      571 => array('Revision' => 574, 'Function' => 'UpdateTo574'),
     491      574 => array('Revision' => 584, 'Function' => 'UpdateTo584'),
     492      584 => array('Revision' => 591, 'Function' => 'UpdateTo591'),
     493      591 => array('Revision' => 597, 'Function' => 'UpdateTo597'),
     494    ));
    480495  }
    481496}
  • trunk/Modules/IS/IS.php

    r586 r597  
    484484        $LinkTitle = MakeLink($MenuItem['URL'], $LinkTitle);
    485485      }
    486       if($MenuItem['IconName'] != '') $Image = '<img src="../images/favicons/'.$MenuItem['IconName'].'"/>&nbsp;';
    487         else $Image = '<img src="../images/favicons/blank.png"/>&nbsp;';
    488       $Output .= '<li>'.$Image.$LinkTitle.'</li>';
     486      if($MenuItem['IconName'] != '') $Image = '<img src="'.$this->System->Link('/images/favicons/'.$MenuItem['IconName']).'"/>&nbsp;';
     487        else $Image = '<img src="'.$this->System->Link('/images/favicons/blank.png').'"/>&nbsp;';
     488      if(!$this->System->User->CheckPermission($this->TableToModule($Table), 'Write'))       
     489        $Output .= '<li>'.$Image.$LinkTitle.'</li>';
    489490      $Output .= $this->ShowMenuItem($MenuItem['Id']);
    490491    }
     
    495496  function TableToModule($Table)
    496497  {
    497     $DbResult = $this->Database->query('SELECT (SELECT Name FROM Module WHERE Module.Id=Model.Module) AS Name FROM Model WHERE Name="'.$Table.'"');
     498    $DbResult = $this->Database->query('SELECT (SELECT `Name` FROM `Module` '.
     499      'WHERE `Module`.`Id`=`Model`.`Module`) AS `Name` FROM `Model` WHERE `Name`="'.$Table.'"');
    498500    if($DbResult->num_rows == 1)
    499501    {
  • trunk/Modules/Portal/Portal.php

    r586 r597  
    103103  function ShowActions($ActionGroup)
    104104  {
    105     $Output = '';
    106     $DbResult = $this->Database->query('SELECT *, `ActionIcon`.`Name` AS `Icon` FROM `Action` '.
    107       'LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '.
    108       'WHERE (`Group`='.$ActionGroup['Id'].') AND (`Enable` = 1)');
     105    $Output = '';   
     106    $DbResult = $this->Database->query('SELECT `Id` FROM `Action` '.     
     107      'WHERE (`Action`.`Group`='.$ActionGroup['Id'].') AND (`Action`.`Enable` = 1)');
    109108    while($Action = $DbResult->fetch_assoc())
    110109    {
    111       if($Action['Icon'] == '') $Action['Icon'] = 'clear.png';
    112         if(substr($Action['URL'], 0, 4) != 'http') $Action['URL'] = $this->System->Link($Action['URL']);
    113         if($Action['PermissionOperation'] != '')
    114         {
    115           $DbResult2 = $this->Database->query('SELECT * FROM PermissionOperation'.
    116             ' LEFT JOIN Module ON Module.Id=PermissionOperation.Module'.
    117             ' WHERE Id='.$Action['PermissionOperation']);
    118           $DbRow2 = $DbResult2->fetch_assoc();
    119           if($this->System->User->User->CheckPermission($DbRow2['Module'], $DbRow2['Operation']))
    120             $Allowed = true; else $Allowed = false;       
    121         } else $Allowed = true;
    122         if($Allowed)
    123           $Output .= '<img alt="'.$Action['Title'].'" src="images/favicons/'.$Action['Icon'].'" width="16" height="16" /> <a href="'.$Action['URL'].'">'.$Action['Title'].'</a><br />';
     110        $Output .= $this->System->ShowAction($Action['Id']);
    124111    }
    125112    return($this->Panel($ActionGroup['Name'], $Output));
Note: See TracChangeset for help on using the changeset viewer.