Changeset 430
- Timestamp:
- Oct 11, 2012, 7:16:33 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Types/Color.php
r428 r430 9 9 function OnView($Item) 10 10 { 11 $Output = '<span style="background-color: '.$Item['Value'].'"> </span>';11 $Output = '<span style="background-color: #'.$Item['Value'].'"> </span>'; 12 12 return($Output); 13 13 } -
trunk/Common/Types/OneToMany.php
r428 r430 10 10 if($Item['Value'] != '') 11 11 { 12 $DbResult = $this->System->Database->query('SELECT '.$Type['Parameters']['Name'].' AS `Name` FROM `'.$Type['Parameters']['Table'].'` WHERE `'.$Type['Parameters']['Id'].'`='.$Item['Value']); 12 $DbResult = $this->System->Database->query('SELECT '.$Type['Parameters']['Name']. 13 ' AS `Name` FROM `'.$Type['Parameters']['Table'].'` WHERE `'. 14 $Type['Parameters']['Id'].'`='.$Item['Value']); 13 15 $DbRow = $DbResult->fetch_assoc(); 14 $Output = '<a href="'.$this->System->Navigation->MakeLink($Type['Parameters']['Table'], 'View', array('Id' => $Item['Value'])).'">'.$DbRow['Name'].'</a>'; 16 $Output = '<a href="?t='.$Type['Parameters']['Table'].'&a='. 17 'view'.'&id='.$Item['Value'].'">'.$DbRow['Name'].'</a>'; 15 18 } else $Output = ''; 16 19 return($Output); -
trunk/Common/Types/Type.php
r428 r430 72 72 73 73 $Type['Name'] = $Name; 74 $Type['Parameters'] = array_merge($Type['Parameters'], $Parameters); 74 if(array_key_exists('Parameters', $Type)) 75 $Type['Parameters'] = array_merge($Type['Parameters'], $Parameters); 76 else $Type['Parameters'] = $Parameters; 75 77 $this->TypeDefinitionList[$Name] = $Type; 76 78 } -
trunk/form_classes.php
r429 r430 7 7 'Items' => array( 8 8 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 9 'Type' => array('Type' => 'TNetworkDeviceType', 'Caption' => 'Typ', 'Default' => '0'), 10 'Member' => array('Type' => 'TMember', 'Caption' => 'Zákazník', 'Default' => '0'), 11 'Location' => array('Type' => 'TMember', 'Caption' => 'Umístění', 'Default' => '0'), 9 12 'Used' => array('Type' => 'Boolean', 'Caption' => 'Použito', 'Default' => '1'), 10 13 'Online' => array('Type' => 'Boolean', 'Caption' => 'Běží', 'Default' => '0'), 11 14 'LastOnline' => array('Type' => 'DateTime', 'Caption' => 'Naposledy běželo', 'Default' => ''), 12 15 'PermanentOnline' => array('Type' => 'Boolean', 'Caption' => 'Běží stále', 'Default' => '0'), 13 'Member' => array('Type' => 'TMember', 'Caption' => 'Zákazník', 'Default' => '0'), 14 'Location' => array('Type' => 'TMember', 'Caption' => 'Umístění', 'Default' => '0'), 16 ), 17 ), 18 'NetworkDeviceType' => array( 19 'Title' => 'Typ síťového zařízení', 20 'Table' => 'NetworkDeviceType', 21 'Items' => array( 22 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 23 'ShowOnline' => array('Type' => 'Boolean', 'Caption' => 'Ukázat online', 'Default' => '0'), 24 'IconName' => array('Type' => 'String', 'Caption' => 'Jméno ikony', 'Default' => '0'), 25 ), 26 ), 27 'NetworkInterface' => array( 28 'Title' => 'Síťové rozhraní', 29 'Table' => 'NetworkInterface', 30 'Items' => array( 31 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 32 'Type' => array('Type' => 'TNetworkInterfaceType', 'Caption' => 'Typ', 'Default' => '0'), 33 'MAC' => array('Type' => 'String', 'Caption' => 'Fyzická adresa (MAC)', 'Default' => ''), 34 'LocalIP' => array('Type' => 'String', 'Caption' => 'IPv4', 'Default' => ''), 35 'IPv6' => array('Type' => 'String', 'Caption' => 'IPv6', 'Default' => ''), 36 'ExternalIP' => array('Type' => 'String', 'Caption' => 'Veřejná IPv4', 'Default' => '0'), 37 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Zařízení', 'Default' => ''), 38 'Online' => array('Type' => 'Boolean', 'Caption' => 'Běží', 'Default' => '0'), 39 'LastOnline' => array('Type' => 'DateTime', 'Caption' => 'Naposledy běželo', 'Default' => ''), 40 ), 41 ), 42 'NetworkInterfaceType' => array( 43 'Title' => 'Typ síťového rozhraní', 44 'Table' => 'NetworkInterfaceType', 45 'Items' => array( 46 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 47 'MaxSpeed' => array('Type' => 'Integer', 'Caption' => 'Max. rychlost', 'Default' => '0'), 48 'FullDuplex' => array('Type' => 'Boolean', 'Caption' => 'Plně duplexní', 'Default' => '0'), 49 'Color' => array('Type' => 'Color', 'Caption' => 'Barva', 'Default' => '0'), 15 50 ), 16 51 ), … … 131 166 'Table' => 'Product', 132 167 'Items' => array( 133 ' name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),134 ' price' => array('Type' => 'Float', 'Caption' => 'Cena', 'Default' => 0),135 ' count' => array('Type' => 'Integer', 'Caption' => 'Počet', 'Default' => 1),136 ' date' => array('Type' => 'Time', 'Caption' => 'Datum zakoupení', 'Default' => 'Now'),137 ' segment' => array('Type' => 'TNetworkSegment', 'Caption' => 'Segment sítě', 'Default' => 0),138 ' date' => array('Type' => 'Time', 'Caption' => 'Datum zakoupení', 'Default' => 'Now'),139 ' used' => array('Type' => 'TNetworkDeviceState', 'Caption' => 'Stav', 'Default' => 0),140 ' consumption' => array('Type' => 'Integer', 'Caption' => 'Spotřeba', 'Default' => 0),141 ' user' => array('Type' => 'TFinanceSubject', 'Caption' => 'Subjekt', 'Default' => 0),142 ' info' => array('Type' => 'String', 'Caption' => 'Poznámky', 'Default' => ''),143 ' shop' => array('Type' => 'String', 'Caption' => 'Obchod', 'Default' => ''),144 ' device_id' => array('Type' => 'String', 'Caption' => 'Sériové číslo', 'Default' => ''),168 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''), 169 'Price' => array('Type' => 'Float', 'Caption' => 'Cena', 'Default' => 0), 170 'Count' => array('Type' => 'Integer', 'Caption' => 'Počet', 'Default' => 1), 171 'Date' => array('Type' => 'Time', 'Caption' => 'Datum zakoupení', 'Default' => 'Now'), 172 'Segment' => array('Type' => 'TNetworkSegment', 'Caption' => 'Segment sítě', 'Default' => 0), 173 'Date' => array('Type' => 'Time', 'Caption' => 'Datum zakoupení', 'Default' => 'Now'), 174 'Used' => array('Type' => 'TNetworkDeviceState', 'Caption' => 'Stav', 'Default' => 0), 175 'Consumption' => array('Type' => 'Integer', 'Caption' => 'Spotřeba', 'Default' => 0), 176 'User' => array('Type' => 'TFinanceSubject', 'Caption' => 'Subjekt', 'Default' => 0), 177 'Info' => array('Type' => 'String', 'Caption' => 'Poznámky', 'Default' => ''), 178 'Shop' => array('Type' => 'String', 'Caption' => 'Obchod', 'Default' => ''), 179 'DeviceId' => array('Type' => 'String', 'Caption' => 'Sériové číslo', 'Default' => ''), 145 180 ), 146 181 ), … … 227 262 'TNetworkDevice' => array( 228 263 'Type' => 'Reference', 229 'Table' => 'Product', 230 'Id' => 'id', 231 'Name' => 'name', 264 'Table' => 'NetworkDevice', 265 'Id' => 'Id', 266 'Name' => 'Name', 267 'Filter' => '1', 268 ), 269 'TNetworkDeviceType' => array( 270 'Type' => 'Reference', 271 'Table' => 'NetworkDeviceType', 272 'Id' => 'Id', 273 'Name' => 'Name', 232 274 'Filter' => '1', 233 275 ), … … 235 277 'Type' => 'Reference', 236 278 'Table' => 'NetworkInterface', 279 'Id' => 'Id', 280 'Name' => 'Name', 281 'Filter' => '1', 282 ), 283 'TNetworkInterfaceType' => array( 284 'Type' => 'Reference', 285 'Table' => 'NetworkInterfaceType', 237 286 'Id' => 'Id', 238 287 'Name' => 'Name', … … 262 311 ); 263 312 313 264 314 ?> -
trunk/forms.php
r426 r430 60 60 break; 61 61 case 'Time': 62 if($this->Values[$Index] == 'Now') $this->Values[$Index] = date('G:i:s'); 63 $Edit = '<input style="width: 98%;" type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'" />'; 64 break; 65 case 'Date': 62 66 if($this->Values[$Index] == 'Now') $this->Values[$Index] = date('j.n.Y'); 67 $Edit = '<input style="width: 98%;" type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'" />'; 68 break; 69 case 'DateTime': 70 if($this->Values[$Index] == 'Now') $this->Values[$Index] = date('j.n.Y G:i:s'); 63 71 $Edit = '<input style="width: 98%;" type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'" />'; 64 72 break; -
trunk/global.php
r428 r430 93 93 { 94 94 var $Modules = array(); 95 95 /** @var Type */ 96 var $Type; 97 98 function __construct() 99 { 100 parent::__construct(); 101 $this->Type = new Type($this); 102 } 103 96 104 function ModulePresent($Name) 97 105 { … … 229 237 $System->AddModule(new Finance()); 230 238 $System->Modules['Finance']->LoadMonthParameters(0); 231 232 $Type = new Type($System);233 239 } 234 240 -
trunk/index.php
r427 r430 87 87 if($this->System->Modules['User']->CheckPermission('Network', 'Administration')) 88 88 $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/network/administration.php">Správa sítě</a><br />'; 89 if($this->System->Modules['User']->CheckPermission('IS', 'Manage')) 90 $Output .= '<a href="'.$this->System->Link('/is/').'">Správa dat</a><br />'; 89 91 return($Output); 90 92 } -
trunk/is/index.php
r429 r430 14 14 global $FormClasses; 15 15 16 //if(!$this->System->Modules['User']->CheckPermission('IS', 'Manage'))17 //return('Nemáte oprávnění');16 if(!$this->System->Modules['User']->CheckPermission('IS', 'Manage')) 17 return('Nemáte oprávnění'); 18 18 19 19 $DbResult = $this->Database->select('ISMenuItem', '*'); … … 24 24 25 25 $Output = '<table style="width: 100%"><tr><td style="width: 20%; vertical-align: top;">'; 26 $Output .= $this->ShowMenuItem('');26 $Output .= '<strong>Nabídka:</strong><br/>'.$this->ShowMenuItem(''); 27 27 $Output .= '</td><td style="width: 80%; vertical-align: top;">'; 28 if(array_key_exists('t', $_GET)) 28 29 if(array_key_exists('t', $_GET)) $_SESSION['Table'] = $_GET['t']; 30 if(array_key_exists('a', $_GET)) $_SESSION['Action'] = $_GET['a']; 31 if(array_key_exists('id', $_GET)) $_SESSION['Id'] = $_GET['id']; 32 33 if($_SESSION['Action'] == 'list') 29 34 { 30 $DbResult = $this->Database->select('ISMenuItem', '*', 'Id='.$_GET['t'] * 1); 31 $MenuItem = $DbResult->fetch_assoc(); 32 $Output .= $this->ShowTable($FormClasses[$MenuItem['Table']]); 35 if(array_key_exists('Table', $_SESSION)) 36 $Output .= $this->ShowTable($FormClasses[$_SESSION['Table']]); 37 } else 38 if($_SESSION['Action'] == 'edit') 39 { 40 $Form = new Form($_SESSION['Table']); 41 $Form->LoadValuesFromDatabase($_SESSION['Id']); 42 $Form->OnSubmit = '?a=view'; 43 $Output .= $Form->ShowEditForm(); 44 } else 45 if($_SESSION['Action'] == 'view') 46 { 47 48 } else 49 if($_SESSION['Action'] == 'delete') 50 { 51 33 52 } 34 53 $Output .= '</td></tr></table>'; … … 50 69 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 51 70 $TableColumns[] = array('Name' => $ItemIndex, 'Title' => $FormItem['Caption']); 71 $TableColumns[] = array('Name' => '', 'Title' => 'Akce'); 52 72 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 53 73 $Output .= $Order['Output']; 54 74 55 75 $Query = 'SELECT * FROM `'.$FormClass['Table'].'` '.$Order['SQL'].$PageList['SQLLimit']; 56 76 57 77 $DbResult = $this->Database->query($Query); 58 78 while($Row = $DbResult->fetch_assoc()) … … 63 83 //$Output .= '<td>'.$Row[$ItemIndex].'</td>'; 64 84 if(array_key_exists($FormItem['Type'], $FormTypes)) 65 $Output .= '<td>'.$Type->ExecuteTypeEvent('OneToMany', 'OnView', 85 { 86 if(!array_key_exists($FormItem['Type'], $this->System->Type->TypeDefinitionList)) 87 $this->System->Type->RegisterType($FormItem['Type'], '', 88 $FormTypes[$FormItem['Type']]); 89 $Output .= '<td>'.$this->System->Type->ExecuteTypeEvent('OneToMany', 'OnView', 66 90 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 67 'Type' => array('Parameters' => array($FormTypes[$FormItem['Type']]))).'</td>';68 else $Output .= '<td>'.$Type->ExecuteTypeEvent($FormItem['Type'], 'OnView',91 'Type' => $FormItem['Type'])).'</td>'; 92 } else $Output .= '<td>'.$this->System->Type->ExecuteTypeEvent($FormItem['Type'], 'OnView', 69 93 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex)).'</td>'; 70 94 } 95 $Output .= '<td><a href="?a=view&id='.$Row['Id'].'"><img alt="Ukázat" title="Ukázat" src="'. 96 $this->System->Link('/images/view.png').'"/></a>'. 97 '<a href="?a=edit&id='.$Row['Id'].'"><img alt="Upravit" title="Upravit" src="'. 98 $this->System->Link('/images/edit.png').'"/></a>'. 99 '<a href="?a=delete&id='.$Row['Id'].'"><img alt="Smazat" title="Smazat" src="'. 100 $this->System->Link('/images/delete.png').'"/></a></td>'; 71 101 $Output .= '</tr>'; 72 102 } 73 103 $Output .= '</table>'; 74 104 $Output .= $PageList['Output']; 105 $Output .= '<br/><div style="text-align: center;"><a href="?a=add"><img alt="Přidat" title="Přidat" src="'. 106 $this->System->Link('/images/add.png').'"/></a></div>'; 75 107 return($Output); 76 108 } … … 78 110 function ShowMenuItem($Parent) 79 111 { 80 $Output = '<ul >';112 $Output = '<ul style="list-style: none; margin-left:1em; padding-left:0em;">'; 81 113 foreach($this->MenuItems as $MenuItem) 82 114 if($MenuItem['Parent'] == $Parent) 83 115 { 84 116 $LinkTitle = $MenuItem['Name']; 85 if($MenuItem['Table'] != '') $LinkTitle = MakeLink('?t='.$MenuItem[' Id'], $LinkTitle);117 if($MenuItem['Table'] != '') $LinkTitle = MakeLink('?t='.$MenuItem['Table'].'&a=list', $LinkTitle); 86 118 $Output .= '<li>'.$LinkTitle.'</li>'; 87 119 $Output .= $this->ShowMenuItem($MenuItem['Id']);
Note:
See TracChangeset
for help on using the changeset viewer.