Changeset 527


Ignore:
Timestamp:
Apr 21, 2013, 11:24:56 PM (12 years ago)
Author:
chronos
Message:
  • Upraveno: Tabulka ISMenuItem přepracována na obecnější MenuItem odkazující se na Menu. Nově položky nabídky jsou vázány přímo na akce tabulku Action.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Version.php

    r526 r527  
    11<?php
    22
    3 $Revision = 526; // Subversion revision
    4 $DatabaseRevision = 526; // SQL structure revision
     3$Revision = 527; // Subversion revision
     4$DatabaseRevision = 527; // SQL structure revision
    55$ReleaseTime = '2013-04-21';
    66
  • trunk/Modules/IS/IS.php

    r524 r527  
    1515      return('Nemáte oprávnění');
    1616
    17     $DbResult = $this->Database->select('ISMenuItem', '*', '1 ORDER BY Parent,Name');
     17    $DbResult = $this->Database->query('SELECT `MenuItem`.`Id`, `MenuItem`.`Name`, `MenuItem`.`Parent`, `Action`.`URL` AS `URL`, `ActionIcon`.`Name` AS `IconName`  FROM `MenuItem` '.
     18      'LEFT JOIN `Action` ON `Action`.`Id` = `MenuItem`.`Action` '.
     19      'LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '.
     20      'ORDER BY `MenuItem`.`Parent`,`MenuItem`.`Name`');
    1821    while($DbRow = $DbResult->fetch_assoc())
    1922    {
     
    260263    {
    261264      $LinkTitle = $MenuItem['Name'];
    262       if($MenuItem['Table'] != '') $LinkTitle = MakeLink('?t='.$MenuItem['Table'].'&amp;a=list', $LinkTitle);
     265      if($MenuItem['URL'] != '')
     266      {
     267        if(substr($MenuItem['URL'], 0, 4) != 'http') $MenuItem['URL'] = $this->System->Link($MenuItem['URL']);
     268        $LinkTitle = MakeLink($MenuItem['URL'], $LinkTitle);
     269      }
    263270      if($MenuItem['IconName'] != '') $Image = '<img src="../images/favicons/'.$MenuItem['IconName'].'"/>&nbsp;';
    264271        else $Image = '';
  • trunk/admin/Updates.php

    r526 r527  
    275275}
    276276
     277function UpdateTo527($Manager)
     278{
     279  $Manager->Execute("RENAME TABLE `ISMenuItem` TO `MenuItem` ;");
     280  $Manager->Execute("CREATE TABLE IF NOT EXISTS `Menu` (
     281  `Id` int(11) NOT NULL AUTO_INCREMENT,
     282  `Name` varchar(255) NOT NULL,
     283  PRIMARY KEY (`Id`)
     284) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
     285  $Manager->Execute("INSERT INTO `Menu` (`Id` ,`Name`)VALUES (NULL , 'IS');");
     286  $Manager->Execute("ALTER TABLE `MenuItem` ADD `Menu` INT NOT NULL , ADD INDEX ( `Menu` )");
     287  $Manager->Execute("UPDATE `MenuItem` SET `Menu` = 1");
     288  $Manager->Execute("ALTER TABLE `MenuItem` ADD FOREIGN KEY ( `Menu` ) REFERENCES `Menu` (".
     289    "`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;");
     290  $Manager->Execute("ALTER TABLE `Action` CHANGE `Group` `Group` INT( 11 ) NULL ");
     291  $Manager->Execute("INSERT INTO `Action` (SELECT NULL AS `Id`, '' AS `Name`, `Name` AS `Title`, 1 AS `Type`, CONCAT('/is/?t=', `Table`, '&a=list') AS `URL`, NULL AS `Group`, NULL AS `Icon`, NULL AS `PermisionModule`,  NULL AS `PermissionOperation`, 1 AS `Enable` FROM `MenuItem` WHERE `Parent` IS NOT NULL)");
     292  $Manager->Execute("ALTER TABLE `MenuItem` DROP `IconName`");
     293  $Manager->Execute("UPDATE `MenuItem` SET `Table` = (SELECT `Id` FROM `Action` WHERE `Action`.`URL` = CONCAT('/is/?t=', `MenuItem`.`Table`, '&a=list')) WHERE `MenuItem`.`Table` != ''");
     294  $Manager->Execute("ALTER TABLE `MenuItem` CHANGE `Table` `Action` INT NULL");
     295  $Manager->Execute("UPDATE `MenuItem` SET `Action` = NULL WHERE `Action` = 0");
     296  $Manager->Execute("ALTER TABLE `MenuItem` ADD INDEX ( `Action` ) ");
     297  $Manager->Execute("ALTER TABLE `MenuItem` ADD FOREIGN KEY ( `Action` ) REFERENCES `Action` (`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;");
     298  $Manager->Execute("INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,`Group` ,`Icon` ,`PermissionModule` ,`PermissionOperation` ,`Enable`)".
     299    "VALUES (NULL , '', 'Nabídky', '1', '/is/?t=Menu&a=list', NULL , NULL , '', '', '1');");
     300  $ActionId = $Manager->Database->insert_id;
     301  $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     302    "VALUES (NULL , 'Nabídky', '23', '".$ActionId."', '1');"); 
     303 
     304}
     305
    277306$Updates = array(
    278307  491 => array('Revision' => 493, 'Function' => 'UpdateTo493'),
     
    289318  515 => array('Revision' => 517, 'Function' => 'UpdateTo517'),
    290319  517 => array('Revision' => 526, 'Function' => 'UpdateTo526'),
     320  526 => array('Revision' => 527, 'Function' => 'UpdateTo527'),
    291321);
    292322
  • trunk/form_classes.php

    r526 r527  
    1919{
    2020  $FormManager->Classes = array(
     21  'MenuItem' => array(
     22    'Title' => 'Položky nabídky',
     23    'Table' => 'MenuItem',
     24    'Items' => array(
     25      'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
     26      'Parent' => array('Type' => 'TMenuItem', 'Caption' => 'Rodič', 'Default' => '', 'Null' => true),
     27      'Action' => array('Type' => 'TAction', 'Caption' => 'Akce', 'Default' => ''),
     28      'Menu' => array('Type' => 'TMenu', 'Caption' => 'Nabídka', 'Default' => ''),
     29      'Items' => array('Type' => 'TMenuItemListParent', 'Caption' => 'Položky'),
     30    ),
     31  ),
     32  'Menu' => array(
     33    'Title' => 'Nabídky',
     34    'Table' => 'Menu',
     35    'Items' => array(
     36      'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
     37      'Items' => array('Type' => 'TMenuItemListMenu', 'Caption' => 'Položky'),
     38    ),
     39  ),
    2140  'Action' => array(
    2241    'Title' => 'Akce',
    2342    'Table' => 'Action',
    2443    'Items' => array(
    25       'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
     44      //'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
    2645      'Title' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
    2746      'URL' => array('Type' => 'Hyperlink', 'Caption' => 'Odkaz', 'Default' => ''),
    28       'Icon' => array('Type' => 'TActionIcon', 'Caption' => 'Ikony', 'Default' => ''),
     47      'Icon' => array('Type' => 'TActionIcon', 'Caption' => 'Ikony', 'Default' => '', 'Null' => true),
    2948      'Type' => array('Type' => 'TActionType', 'Caption' => 'Typ', 'Default' => ''),
    30       'Group' => array('Type' => 'TActionGroup', 'Caption' => 'Skupina', 'Default' => ''),
     49      'Group' => array('Type' => 'TActionGroup', 'Caption' => 'Skupina', 'Default' => '', 'Null' => true),
    3150      'PermissionModule' => array('Type' => 'String', 'Caption' => 'Modul oprávnění', 'Default' => ''),
    3251      'PermissionOperation' => array('Type' => 'String', 'Caption' => 'Operace oprávnění', 'Default' => ''),
     
    3958    'Items' => array(
    4059      'Name' => array('Type' => 'String', 'Caption' => 'Název souboru', 'Default' => ''),
     60      'Items' => array('Type' => 'TActionListIcon', 'Caption' => 'Položky', 'Default' => ''),
    4161    ),
    4262  ),
     
    4666    'Items' => array(
    4767      'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
     68      'Items' => array('Type' => 'TActionListGroup', 'Caption' => 'Položky', 'Default' => ''),
    4869    ),
    4970  ),
     
    5374    'Items' => array(
    5475      'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
     76      'Items' => array('Type' => 'TActionListType', 'Caption' => 'Položky', 'Default' => ''),
    5577    ),
    5678  ),
     
    11351157    'Filter' => '1',
    11361158  ),
     1159  'TAction' => array(
     1160    'Type' => 'Reference',
     1161    'Table' => 'Action',
     1162    'Id' => 'Id',
     1163    'Name' => 'Title',
     1164    'Filter' => '1',
     1165  ),
    11371166  'TActionIcon' => array(
    11381167    'Type' => 'Reference',
     
    12121241    'Filter' => '1',
    12131242  ),
     1243  'TMenuItem' => array(
     1244    'Type' => 'Reference',
     1245    'Table' => 'MenuItem',
     1246    'Id' => 'Id',
     1247    'Name' => 'Name',
     1248    'Filter' => '1',
     1249  ),
     1250  'TMenu' => array(
     1251    'Type' => 'Reference',
     1252    'Table' => 'Menu',
     1253    'Id' => 'Id',
     1254    'Name' => 'Name',
     1255    'Filter' => '1',
     1256  ),
    12141257  'TFinanceInvoice' => array(
    12151258    'Type' => 'Reference',
     
    13711414    'Id' => 'Id',
    13721415    'Ref' => 'Subject',
     1416    'Filter' => '1',
     1417  ),
     1418  'TMenuItemListMenu' => array(
     1419    'Type' => 'ManyToOne',
     1420    'Table' => 'MenuItem',
     1421    'Id' => 'Id',
     1422    'Ref' => 'Menu',
     1423    'Filter' => '1',
     1424  ),
     1425  'TMenuItemListParent' => array(
     1426    'Type' => 'ManyToOne',
     1427    'Table' => 'MenuItem',
     1428    'Id' => 'Id',
     1429    'Ref' => 'Parent',
     1430    'Filter' => '1',
     1431  ),
     1432  'TActionListGroup' => array(
     1433    'Type' => 'ManyToOne',
     1434    'Table' => 'Action',
     1435    'Id' => 'Id',
     1436    'Ref' => 'Group',
     1437    'Filter' => '1',
     1438  ),
     1439  'TActionListIcon' => array(
     1440    'Type' => 'ManyToOne',
     1441    'Table' => 'Action',
     1442    'Id' => 'Id',
     1443    'Ref' => 'Icon',
     1444    'Filter' => '1',
     1445  ),
     1446  'TActionListType' => array(
     1447    'Type' => 'ManyToOne',
     1448    'Table' => 'Action',
     1449    'Id' => 'Id',
     1450    'Ref' => 'Type',
    13731451    'Filter' => '1',
    13741452  ),
Note: See TracChangeset for help on using the changeset viewer.