Changeset 8


Ignore:
Timestamp:
Sep 29, 2008, 2:35:42 PM (16 years ago)
Author:
george
Message:
  • Přidáno: Částečná podpora pro přihlašování uživatelů.
  • Přepracováno: Funkce pro generování formulářů podle dynamické definice namísto přímého generování podle databáze. Všechny formuláře nemají odpovídající strukturu v databázi.
Files:
9 added
1 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • base.php

    r6 r8  
    11<?php
    2 include('database.php');
    3 include('common.php');
    42
    53// Include type definitions
     
    1513include('types/Hyperlink.php');
    1614
    17 function ShowList($List, $Column = '', $ColumnValue = 0)
     15function ShowList($List, $Column = '', $ColumnValue = 0, $Title = '')
    1816{
    1917  global $Database, $Types, $Config;
    2018
    21   $Output = '<div>'.$List['Title'].'</div><table class="WideTable"><tr>';
     19  if($Title == '') $Output = '<div>'.$List['Title'].'</div>';
     20    else $Output = '<div>'.$Title.'</div>';
     21  $Output .= '<table class="WideTable"><tr>';
    2222  foreach($List['Items'] as $Item)
    2323  {
     
    5252  {
    5353    $OrderDirection = array('ASC', 'DESC');
    54     $Where .= ' ORDER BY `'.$_SESSION['OrderColumn'].'` '.$OrderDirection[$_SESSION['OrderDirection']];
    55   }
     54    $Order = 'ORDER BY `'.$_SESSION['OrderColumn'].'` '.$OrderDirection[$_SESSION['OrderDirection']];
     55  } else $Order = '';
    5656
    5757  if(array_key_exists('Page', $_GET)) $Page = $_GET['Page']; else $Page = 0;
     58  //$Where .= ' AND (ValidFromTime <= NOW()) AND ((ValidToTime >= NOW()) OR (ValidToTime IS NULL))';
     59  $Where .= ' '.$Order;
    5860  $DbResult = $Database->select($List['TableName'], 'COUNT(*)', $Where);
    5961  //echo($Database->LastQuery);
     
    7173        $ItemType = explode(':', $Item['Type']);
    7274        $Type = $Types[$ItemType[0]];
    73         if(count($ItemType) > 1) $Type['Parameter'] = $ItemType[1];
    74         if(is_callable($Type['CallbackView'])) $Value = $Type['CallbackView']($Type, $DbRow[$Index], $List['TableName'], $DbRow['Id']);
     75        $ItemDefinition = array('Name' => $Index, 'Value' => $DbRow[$Index], 'SourceTable' => $List['TableName'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']);
     76        if(is_callable($Type['CallbackView'])) $Value = $Type['CallbackView']($Type, $ItemDefinition);
    7577        else $Value = $Type['CallbackView'];
    76         $Value = str_replace('%value%', $DbRow[$Index], $Value);
    7778        $Output .= '<td>'.$Value.'</td>';
    7879      }
     
    101102      {
    102103        $Type = $Types[$ItemType[0]];
    103         if(count($ItemType) > 1) $Type['Parameter'] = $ItemType[1];
    104         if(is_callable($Type['CallbackEdit'])) $Value = $Type['CallbackEdit']($Type, $DbRow[$Index], $List['TableName'], $DbRow['Id']);
     104        $ItemDefinition = array('Name' => $Index, 'Value' => $DbRow[$Index], 'SourceTable' => $List['TableName'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']);
     105        if(is_callable($Type['CallbackEdit'])) $Value = $Type['CallbackEdit']($Type, $ItemDefinition);
    105106        else $Value = $Type['CallbackEdit'];
    106         $Value = str_replace('%value%', $DbRow[$Index], $Value);
    107         $Value = str_replace('%name%', $Index, $Value);
    108         if($Item['Required'] == 1) $Required = ' *'; else $Required = '';
     107        if($Item['Required'] == 1) $Required = '*'; else $Required = '';
    109108        $Output .= '<tr><td>'.$Item['TextBefore'].':'.$Required.'</td><td title="'.$Item['Help'].'">'.$Value.'</td></tr>';
    110109      }
     
    147146  global $Database, $Types;
    148147
    149   $Output = '<form action="?Action=AddItemFinish" method="post"><table class="WideTable">';
    150   $Output .= '<tr><th>Jméno položky</th><th>Hodnota</th></tr>';
     148  $DefinitionItems = array();
    151149  $AfterTableOutput = '';
    152150  foreach($List['Items'] as $Index => $Item)
     
    155153    if(($ItemType[0] != 'PointerOneToMany') and ($Item['Name'] != $Column))
    156154    {
    157       $Type = $Types[$ItemType[0]];
    158       if(count($ItemType) > 1) $Type['Parameter'] = $ItemType[1];
    159       if(is_callable($Type['CallbackEdit'])) $Value = $Type['CallbackEdit']($Type, $Type['InitValue'], $List['TableName'], 0);
    160       else $Value = $Type['CallbackEdit'];
    161       $Value = str_replace('%value%', $Type['InitValue'], $Value);
    162       $Value = str_replace('%name%', $Index, $Value);
    163       if($Item['Required'] == 1) $Required = ' *'; else $Required = '';
    164       $Output .= '<tr><td>'.$Item['TextBefore'].':'.$Required.'</td><td title="'.$Item['Help'].'">'.$Value.'</td></tr>';
     155      if($Item['Required'] == 1) $Required = '*'; else $Required = '';
     156      $DefinitionItems[] = array('Name' => $Index, 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'].$Required, 'Value' => '', 'SourceTable' => $List['TableName'], 'SourceItemId' => 0);
    165157    } else
    166158    if($Item['Name'] == $Column)
    167159    {
    168       $AfterTableOutput = '<input type="hidden" name="'.$Column.'" value="'.$ColumnValue.'" />';
    169     }
    170   }
    171   $Output .= '</table>'.$AfterTableOutput.'<input type="submit" value="Přidat"></form>';
     160      $DefinitionItems[] = array('Name' => $Column, 'Type' => 'String', 'Caption' => '', 'Value' => $ColumnValue);
     161    }
     162  }
     163  $Form = new Form();
     164  $Form->Definition = array
     165  (
     166    'Title' => 'Titulek',
     167    'SubmitBuffonText' => 'Přidat',
     168    'Items' => $DefinitionItems,
     169  );
     170  $Form->OnSubmit = '?Action=AddItemFinish';
     171  $Output .= $Form->ShowEditForm().$AfterTableOutput;
    172172  if(($Column != '') and ($ColumnValue != 0))
    173173  {
     
    216216      {
    217217        $Type = $Types[$ItemType[0]];
    218         if(count($ItemType) > 1) $Type['Parameter'] = $ItemType[1];
    219         if(is_callable($Type['CallbackView'])) $Value = $Type['CallbackView']($Type, $DbRow[$Index], $List['TableName'], $DbRow['Id']);
     218        $ItemDefinition = array('Name' => $Index, 'Value' => $DbRow[$Index], 'SourceTable' => $List['TableName'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']);
     219        if(is_callable($Type['CallbackView'])) $Value = $Type['CallbackView']($Type, $ItemDefinition);
    220220        else $Value = $Type['CallbackView'];
    221         $Value = str_replace('%value%', $DbRow[$Index], $Value);
    222221        $Output .= '<tr><td>'.$Item['TextBefore'].':</td><td title="'.$Item['Help'].'">'.$Value.'</td></tr>';
    223222      }
     
    241240      {
    242241        $SubList = $Lists[$ItemType[1]];
    243         $Output .= ShowList($SubList, $ItemType[2], $DbRow['Id']).'<br /><br />';
     242        $Output .= ShowList($SubList, $ItemType[2], $DbRow['Id'], $Item['TextBefore']).'<br /><br />';
    244243      }
    245244    }
  • index.php

    r5 r8  
    11<?php
    22
    3 include('config.php');
    4 session_start();
     3include_once('global.php');
    54include('base.php');
    6 $Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password'], $Config['Database']['Database']);
    7 $Database->Prefix = $Config['Database']['Prefix'];
    8 $Database->charset($Config['Database']['Charset']);
    95
    10 $Output = '<?xml version="1.0" encoding="utf-8"?>'."\n".
    11     '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'.
    12     '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'.
    13     '<head><link rel="stylesheet" href="style.css" type="text/css" media="all" />'.
    14     //'<script type="text/javascript" src="global.js"></script>'.
    15     '<title>IS</title>
    16     </head><body><table class="base"><tr><td class="menu">';
     6class IndexPage extends Page
     7{
     8  var $Dependencies = array('News');
     9  var $FullTitle = '';
     10  var $ShortTitle = '';
    1711
    18 LoadTypeDefinition();
    19 LoadListDefinition();
    20 $Output .= $Output;
    21 $Output .= TableList(1);
    22 $Output .= TableList(0);
    23 $Output .= '</td><td class="main">';
    24 $Output .= Output();
    25 $Output .= '</td></tr></table></body></html>';
    26 echo($Output);
    27 //echo(phpinfo());
     12  function Show()
     13  {
     14    $FormUserLogin = array(
     15      'Title' => 'Přihlášení',
     16      'SubmitBuffonText' => 'Přihlásit',
     17      'Items' => array(
     18        array('Name' => 'UserName', 'Type' => 'String', 'Caption' => 'Jméno', 'Value' => ''),
     19        array('Name' => 'Password', 'Type' => 'Password', 'Caption' => 'Heslo', 'Value' => ''),
     20      ),
     21    );
     22    $FormUserRegister = array
     23    (
     24      'Title' => 'Registrace uživatele',
     25      'Table' => 'User',
     26      'SubmitBuffonText' => 'Registrovat',
     27      'Items' => array(
     28        array('Name' => 'UserName', 'Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Value' => ''),
     29        array('Name' => 'Password', 'Type' => 'Password', 'Caption' => 'Heslo', 'Value' => ''),
     30        array('Name' => 'Password2', 'Type' => 'Password', 'Caption' => 'Potvrzení hesla', 'Value' => ''),
     31        array('Name' => 'Email', 'Type' => 'String', 'Caption' => 'E-mail', 'Value' => ''),
     32        array('NAme' => 'FirstName', 'Type' => 'String', 'Caption' => 'Křestní jméno', 'Value' => ''),
     33        array('Name' => 'SecondName', 'Type' => 'String', 'Caption' => 'Příjmení', 'Value' => ''),
     34      ),
     35    );
     36
     37    $Output = '<table class="base"><tr><td class="menu">';
     38    if(array_key_exists('Action', $_GET))
     39    {
     40      if($_GET['Action'] == 'Login')
     41      {
     42        $Output .= $this->SystemMessage('Přihlášení', $this->System->Modules['User']->Login($_POST['UserName'], $_POST['Password']));
     43      } else
     44      if($_GET['Action'] == 'Logout')
     45      {
     46        $Output .= $this->SystemMessage('Odhlášení', $this->System->Modules['User']->Logout());
     47      } else
     48      if($_GET['Action'] == 'UserRegister')
     49      {
     50        $Form = new Form();
     51        $Form->Definition = $FormUserRegister;
     52        $Form->OnSubmit = '?Action=UserRegisterSave';
     53        $Output .= $Form->ShowEditForm();
     54      } else
     55      if($_GET['Action'] == 'UserRegisterConfirm')
     56      {
     57          $Output .= $this->SystemMessage('Potvrzení registrace', $this->System->Modules['User']->RegisterConfirm($_GET['User'], $_GET['H']));
     58      } else
     59      if($_GET['Action'] == 'UserRegisterSave')
     60      {
     61        $Form = new Form();
     62        $Form->Definition = $FormUserRegister;
     63        $Form->LoadValuesFromForm();
     64        $Output .= $this->SystemMessage('Registrace', $this->System->Modules['User']->Register($Form->Values['Name'], $Form->Values['Password'], $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['FirstName'], $Form->Values['SecondName']));
     65      }
     66    }
     67    if($this->System->Modules['User']->User['Id'] == 0)
     68    {
     69      if(!array_key_exists('Action', $_GET))
     70      {
     71        $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=LoginForm">Přihlášení</a> <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserRegister">Registrace</a>';
     72        $Form = new Form();
     73        $Form->Definition = $FormUserLogin;
     74        $Form->OnSubmit = '?Action=Login';
     75        $Output .= $Form->ShowEditForm();
     76      }
     77    }
     78    else
     79    {
     80      $Output .= $this->System->Modules['User']->User['UserName'].' <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=Logout">Odhlásit</a>';
     81      $Output .= '<br /><br />';
     82      LoadTypeDefinition();
     83      LoadListDefinition();
     84      $Output .= TableList(1);
     85      $Output .= TableList(0);
     86      $Output .= '</td><td class="main">';
     87      $Output .= Output();
     88      $Output .= '</td></tr></table></body></html>';
     89    }
     90    return($Output);
     91  }
     92}
     93
     94$System->AddModule(new IndexPage());
     95$System->Modules['IndexPage']->GetOutput();
     96
    2897?>
  • sql/demo_database.sql

    r7 r8  
    11-- phpMyAdmin SQL Dump
    2 -- version 2.11.9
     2-- version 2.11.9.1
    33-- http://www.phpmyadmin.net
    44--
    55-- Počítač: localhost
    6 -- Vygenerováno: Úterý 16. září 2008, 09:16
     6-- Vygenerováno: Pondělí 29. září 2008, 14:31
    77-- Verze MySQL: 5.0.51
    88-- Verze PHP: 5.2.6
     
    3131  `Workgroup` varchar(255) collate utf8_czech_ci NOT NULL,
    3232  `WINS` varchar(255) collate utf8_czech_ci NOT NULL,
     33  `HostList` int(11) NOT NULL,
    3334  PRIMARY KEY  (`Id`)
    3435) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=5 ;
     
    3839--
    3940
    40 INSERT INTO `Area` (`Id`, `Name`, `NetworkIPAddress`, `IPAddressMask`, `DNSPrimary`, `DNSSecondary`, `DHCP`, `Domain`, `Workgroup`, `WINS`) VALUES
    41 (1, 'Bytovky dolní konec', '192.168.12.0', '255.255.255.0', '192.168.0.22', '46.33.1.2', '192.168.12.1', 'freenet.cz', 'FREENET', '192.168.0.23'),
    42 (2, 'Centrum Komořany', '192.168.10.0', '255.255.255.0', '192.168.0.22', '', '192.168.10.1', 'centrum.freenet.cz', 'CENTRUM', '192.168.0.23'),
    43 (3, 'Serverovna', '192.168.0.0', '255.255.255.0', '192.168.0.22', '44.55.22.34', '19ě.168.0.1', 'freenet.cz', 'FREENET', '192.168.0.23'),
    44 (4, 'Kůlna', '10.198.0.0', '255.255.0.0', '192.168.0.1', '129.168.0.22', '10.198.0.1', 'kulna.freenet.cz', 'KULNA', '192.168.0.23');
     41INSERT INTO `Area` (`Id`, `Name`, `NetworkIPAddress`, `IPAddressMask`, `DNSPrimary`, `DNSSecondary`, `DHCP`, `Domain`, `Workgroup`, `WINS`, `HostList`) VALUES
     42(1, 'Bytovky dolní konec', '192.168.12.0', '255.255.255.0', '192.168.0.22', '46.33.1.2', '192.168.12.1', 'freenet.cz', 'FREENET', '192.168.0.23', 0),
     43(2, 'Centrum Komořany', '192.168.10.0', '255.255.255.0', '192.168.0.22', '', '192.168.10.1', 'centrum.freenet.cz', 'CENTRUM', '192.168.0.23', 0),
     44(3, 'Serverovna', '192.168.0.0', '255.255.255.0', '192.168.0.22', '44.55.22.34', '19ě.168.0.1', 'freenet.cz', 'FREENET', '192.168.0.23', 0),
     45(4, 'Kůlna', '10.198.0.0', '255.255.0.0', '192.168.0.1', '129.168.0.22', '10.198.0.1', 'kulna.freenet.cz', 'KULNA', '192.168.0.23', 0);
    4546
    4647-- --------------------------------------------------------
     
    139140
    140141--
     142-- Struktura tabulky `History`
     143--
     144
     145CREATE TABLE IF NOT EXISTS `History` (
     146  `Id` int(11) NOT NULL auto_increment,
     147  `Author` int(11) NOT NULL,
     148  `TimeValidFrom` datetime NOT NULL,
     149  `TimeValidTo` datetime NOT NULL,
     150  `PermanentId` int(11) NOT NULL,
     151  `ListId` int(11) NOT NULL,
     152  `TimeCreation` datetime NOT NULL,
     153  PRIMARY KEY  (`Id`)
     154) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;
     155
     156--
     157-- Vypisuji data pro tabulku `History`
     158--
     159
     160
     161-- --------------------------------------------------------
     162
     163--
    141164-- Struktura tabulky `Host`
    142165--
     
    153176  `ParentHost` int(11) NOT NULL,
    154177  `Member` int(11) NOT NULL,
     178  `Area` int(11) NOT NULL,
    155179  PRIMARY KEY  (`Id`)
    156180) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=10 ;
     
    160184--
    161185
    162 INSERT INTO `Host` (`Id`, `DomainName`, `NetBIOSName`, `LocalIPAddress`, `PublicIPAddress`, `LastOnlineDate`, `Type`, `Interface`, `ParentHost`, `Member`) VALUES
    163 (1, 'george', 'GEORGE', '192.168.0.23', '', '0000-00-00', 1, 0, 4, 0),
    164 (2, 'stroj', 'STROJ', '192.168.1.44', '33.66.44.77', '0000-00-00', 5, 0, 0, 0),
    165 (3, 'telefon', 'TELEFON', '192.168.1.45', '', '0000-00-00', 2, 0, 0, 0),
    166 (4, 'router-inet', 'ROUTER-INET', '192.168.0.2', '77.33.55.12', '0000-00-00', 4, 0, 0, 0),
    167 (5, 'muhehe', 'MUHEHE', '192.168.0.4', '', '0000-00-00', 1, 0, 0, 0),
    168 (6, 'jonny', 'JONNY', '192.168.0.6', '', '0000-00-00', 1, 0, 0, 0),
    169 (7, 'laserovka-samsung', 'LASEROVKA-SAMSUNG', '192.168.12.4', '', '0000-00-00', 6, 0, 0, 0),
    170 (8, 'www', 'WWW', '192.168.0.7', '34.22.1.4', '0000-00-00', 5, 0, 0, 0),
    171 (9, 'peklo', 'PEKLO', '192.168.66.66', '', '0000-00-00', 7, 0, 4, 2);
     186INSERT INTO `Host` (`Id`, `DomainName`, `NetBIOSName`, `LocalIPAddress`, `PublicIPAddress`, `LastOnlineDate`, `Type`, `Interface`, `ParentHost`, `Member`, `Area`) VALUES
     187(1, 'george', 'GEORGE', '192.168.0.23', '', '0000-00-00', 1, 0, 4, 0, 0),
     188(2, 'stroj', 'STROJ', '192.168.1.44', '33.66.44.77', '0000-00-00', 5, 0, 0, 0, 0),
     189(3, 'telefon', 'TELEFON', '192.168.1.45', '', '0000-00-00', 2, 0, 4, 1, 2),
     190(4, 'router-inet', 'ROUTER-INET', '192.168.0.2', '77.33.55.12', '0000-00-00', 4, 0, 1, 1, 4),
     191(5, 'muhehe', 'MUHEHE', '192.168.0.4', '', '0000-00-00', 1, 0, 1, 1, 2),
     192(6, 'jonny', 'JONNY', '192.168.0.6', '', '0000-00-00', 1, 0, 1, 1, 1),
     193(7, 'laserovka-samsung', 'LASEROVKA-SAMSUNG', '192.168.12.4', '', '0000-00-00', 6, 0, 0, 0, 0),
     194(8, 'www', 'WWW', '192.168.0.7', '34.22.1.4', '0000-00-00', 5, 0, 0, 0, 0),
     195(9, 'peklo', 'PEKLO', '192.168.66.66', '', '0000-00-00', 7, 0, 4, 2, 0);
    172196
    173197-- --------------------------------------------------------
     
    214238  `HostList` int(11) NOT NULL,
    215239  `Tariff` int(11) NOT NULL,
     240  `UserList` int(11) NOT NULL,
     241  `ValidFromTime` datetime default NULL,
     242  `ValidToTime` datetime default NULL,
    216243  PRIMARY KEY  (`Id`)
    217244) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=7 ;
     
    221248--
    222249
    223 INSERT INTO `Member` (`Id`, `Subject`, `ResponsibleUser`, `MapPositionX`, `MapPositionY`, `FamilyMemberCount`, `MembershipDate`, `MemberState`, `HostList`, `Tariff`) VALUES
    224 (1, 2, 1, 123, 567, 3, '0000-00-00', 2, 0, 3),
    225 (2, 3, 6, 123, 123, 2, '0000-00-00', 2, 0, 4),
    226 (3, 7, 8, 0, 0, 0, '0000-00-00', 2, 0, 2),
    227 (4, 8, 11, 0, 0, 0, '0000-00-00', 2, 0, 3),
    228 (5, 10, 1, 32423, 21, 2, '0000-00-00', 1, 0, 3),
    229 (6, 12, 12, 12, 2, 1, '0000-00-00', 3, 0, 1);
     250INSERT INTO `Member` (`Id`, `Subject`, `ResponsibleUser`, `MapPositionX`, `MapPositionY`, `FamilyMemberCount`, `MembershipDate`, `MemberState`, `HostList`, `Tariff`, `UserList`, `ValidFromTime`, `ValidToTime`) VALUES
     251(1, 2, 1, 123, 567, 3, '0000-00-00', 2, 0, 3, 0, '2008-09-01 00:00:00', NULL),
     252(2, 3, 6, 123, 123, 2, '0000-00-00', 2, 0, 4, 0, '2008-09-01 00:00:00', NULL),
     253(3, 7, 8, 0, 0, 0, '0000-00-00', 2, 0, 2, 0, '2008-09-01 00:00:00', NULL),
     254(4, 8, 11, 0, 0, 0, '0000-00-00', 2, 0, 3, 0, '2008-09-01 00:00:00', NULL),
     255(5, 10, 1, 32423, 21, 2, '0000-00-00', 1, 0, 3, 0, '2008-09-01 00:00:00', NULL),
     256(6, 12, 12, 12, 2, 1, '0000-00-00', 3, 0, 1, 0, '2008-09-01 00:00:00', NULL);
    230257
    231258-- --------------------------------------------------------
     
    312339  `VisibleInMenu` int(11) NOT NULL default '1',
    313340  PRIMARY KEY  (`Id`)
    314 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=15 ;
     341) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=17 ;
    315342
    316343--
     
    332359(12, 'FinanceTransaction', 'Platební operace', 0, '', 1),
    333360(13, 'SystemList', 'Definice tabulek', 1, '', 1),
    334 (14, 'SystemListItem', 'Definice položek formulářů', 1, '', 0);
     361(14, 'SystemListItem', 'Definice položek formulářů', 1, '', 0),
     362(15, 'UserOnline', 'Přihlášení uživatelé', 1, '', 1),
     363(16, 'History', 'Historie záznamů', 1, '', 0);
    335364
    336365-- --------------------------------------------------------
     
    354383  `List` int(11) NOT NULL,
    355384  PRIMARY KEY  (`Id`)
    356 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=110 ;
     385) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=131 ;
    357386
    358387--
     
    387416(25, 'Phone', 'Telefón', '', 'String', '', '', 0, 1, 0, 0, 1),
    388417(26, 'Notice', 'Poznámka', '', 'String', '', '', 0, 1, 0, 0, 3),
    389 (27, 'MemberState', 'Stav připojení:', '', 'MemberState', '', '', 1, 1, 1, 0, 4),
     418(27, 'MemberState', 'Stav připojení', '', 'MemberState', '', '', 1, 1, 1, 0, 4),
    390419(28, 'HostList', 'Registrované zařízení', '', 'PointerOneToMany:Host:Member', '', '', 0, 1, 0, 0, 4),
    391420(29, 'Name', 'Označení', '', 'String', '', '', 1, 1, 1, 1, 5),
     
    414443(52, 'PurcheasedFrom', 'Zakoupeno od', '', 'PointerOneToOne:Subject', '', '', 0, 1, 0, 0, 7),
    415444(53, 'PurcheasedAsset', 'Nakoupené zboží', '', 'PointerOneToMany:Asset:PurcheasedFrom', '', '', 0, 1, 0, 0, 3),
    416 (54, 'Subject', 'Subjekt', '', 'PointerOneToOne:Subject', '', '', 0, 1, 0, 0, 1),
    417 (55, 'UserList', 'Seznam uživatelů', '', 'PointerOneToMany:User:Subject', '', '', 0, 1, 0, 0, 3),
     445(54, 'Member', 'Člen', '', 'PointerOneToOne:Member', '', '', 0, 1, 0, 0, 1),
     446(113, 'ValidFromTime', 'Platnost od', '', 'Date', '', '', 1, 1, 0, 0, 4),
    418447(57, 'Price', 'Cena', '', 'Integer', '', '', 1, 1, 1, 0, 8),
    419448(56, 'Name', 'Označení', '', 'String', '', '', 1, 1, 1, 1, 8),
     
    440469(78, 'User', 'Registroval', '', 'PointerOneToOne:User', '', '', 0, 1, 0, 0, 10),
    441470(79, 'Type', 'Typ', '', 'BankAccountType', '', '', 1, 1, 1, 0, 10),
    442 (80, 'MemberList', 'Členství', '', 'PointerOneToMany:Member:ResponsibleUser', '', '', 0, 1, 0, 0, 3),
     471(80, 'MemberList', 'Členství', '', 'PointerOneToMany:Member:Subject', '', '', 0, 1, 0, 0, 3),
    443472(81, 'Name', 'Systémové jméno typu', '', 'String', 'Jméno by mělo obsahovat pouze velké a malé písmena. V podsložece types projektu jsou umístěny výkonné soubory pro jednotlivé typy.', 'Name', 1, 1, 1, 1, 11),
    444473(82, 'ParentType', 'Rodičovský typ', '', 'String', '', '', 1, 1, 1, 0, 11),
     
    469498(107, 'Editable', 'Editovatelné', '', 'Boolean', 'Určuje zda je možné danou položku ručně editovat nebo zda je měněna automaticky systémem.', '', 1, 1, 0, 0, 14),
    470499(108, 'VisibleInList', 'Viditelné v seznamu', '', 'Boolean', 'Určuje viditelnost této položky v seznamu', '', 1, 1, 0, 0, 14),
    471 (109, 'VisibleInPointer', 'Viditelné v odkazech', '', 'Boolean', 'Určuje viditelnost této položky v názvech odkazů na tuto položku', '', 1, 1, 0, 0, 14);
     500(109, 'VisibleInPointer', 'Viditelné v odkazech', '', 'Boolean', 'Určuje viditelnost této položky v názvech odkazů na tuto položku', '', 1, 1, 0, 0, 14),
     501(110, 'Area', 'Umístění', '', 'PointerOneToOne:Area', 'Vyberte oblast, do které toto zařízení patří.', '', 0, 1, 0, 0, 2),
     502(111, 'HostList', 'Seznam zařízení', '', 'PointerOneToMany:Host:Area', '', '', 0, 1, 0, 0, 5),
     503(112, 'UserList', 'Uživatelů', '', 'PointerOneToMany:User:Member', '', '', 0, 1, 0, 0, 4),
     504(114, 'ValidToTime', 'Platnost do', '', 'Date', '', '', 1, 1, 0, 0, 4),
     505(115, 'User', 'Uživatel', '', 'PointerOneToOne:User', '', '', 1, 0, 1, 1, 15),
     506(116, 'LoginTime', 'Čas přihlášení', '', 'Date', '', '', 0, 0, 0, 0, 15),
     507(117, 'ActivityTime', 'Naposledy aktivní', '', 'Date', '', '', 0, 0, 0, 0, 15),
     508(118, 'SessionId', 'Identifikace spojení', '', 'String', '', '', 0, 0, 0, 0, 15),
     509(119, 'IpAddress', 'IP adresa', '', 'String', '', '', 0, 0, 0, 0, 15),
     510(120, 'HostName', 'Jméno počítače', '', 'String', '', '', 0, 0, 1, 0, 15),
     511(121, 'Locked', 'Zamčeno', '', 'Boolean', '', '', 0, 0, 0, 0, 1),
     512(122, 'RegistrationTime', 'Čas registrace', '', 'Date', '', '', 0, 0, 0, 0, 1),
     513(123, 'LastLoginTime', 'Čas posledního přihlášení', '', 'Date', '', '', 0, 0, 0, 0, 1),
     514(124, 'LastIpAddress', 'Poslední IP adresa', '', 'String', '', '', 0, 0, 0, 0, 1),
     515(125, 'Author', 'Autor', '', 'PointerOneToOne:User', '', '', 1, 0, 0, 0, 16),
     516(126, 'TimeCreation', 'Čas vytvoření', '', 'Date', '', '', 1, 0, 0, 0, 16),
     517(127, 'TimeValidFrom', 'Platnost od', '', 'Date', '', '', 1, 1, 0, 0, 16),
     518(128, 'TimeValidTo', 'Platnost do', '', 'Date', '', '', 1, 1, 0, 0, 16),
     519(129, 'ListId', 'Odkazovaná tabulka', '', 'PointerOneToOne:SystemList', '', '', 1, 1, 0, 0, 16),
     520(130, 'PermanentId', 'Trvalá identifikace', '', 'Integer', '', '', 1, 1, 0, 0, 16);
    472521
    473522-- --------------------------------------------------------
     
    490539  PRIMARY KEY  (`Id`),
    491540  UNIQUE KEY `Name` (`Name`)
    492 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=19 ;
     541) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=20 ;
    493542
    494543--
     
    514563(16, 'Float', 'Desetinné číslo', '', '', 1, 'FLOAT', 'TypeFloatViewHtml', 'TypeFloatEditHtml', ''),
    515564(17, 'FinanceTransactionType', 'Typ finanční transakce', 'Enumeration', 'Bankovní převod|Osobní platba', 0, '', '', '', ''),
    516 (18, 'Hyperlink', 'Internetový odkaz', '', '', 0, 'VARCHAR(255)', 'TypeHyperlinkViewHtml', 'TypeHyperlinkEditHtml', '');
     565(18, 'Hyperlink', 'Internetový odkaz', '', '', 0, 'VARCHAR(255)', 'TypeHyperlinkViewHtml', 'TypeHyperlinkEditHtml', ''),
     566(19, 'IPv4Address', 'IP adresa v4', '', '', 0, 'VARCHAR(16)', 'TypeIPv4AddressView', 'TypeIPv4AddressEdit', 'TypeIPv4AddressCheck');
    517567
    518568-- --------------------------------------------------------
     
    562612  `BirthDay` date NOT NULL,
    563613  `Phone` varchar(255) collate utf8_czech_ci NOT NULL,
    564   `Subject` int(11) NOT NULL,
     614  `Member` int(11) NOT NULL,
     615  `RegistrationTime` datetime NOT NULL,
     616  `LastLoginTime` datetime NOT NULL,
     617  `Locked` tinyint(1) NOT NULL,
     618  `LastIpAddress` varchar(255) collate utf8_czech_ci NOT NULL,
    565619  PRIMARY KEY  (`Id`)
    566620) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=13 ;
     
    570624--
    571625
    572 INSERT INTO `User` (`Id`, `UserName`, `Password`, `FirstName`, `SecondName`, `Email`, `ICQ`, `Sex`, `BirthDay`, `Phone`, `Subject`) VALUES
    573 (1, '', 'fdsfsdfsd', 'Alfons', 'Much', 'mucha@all.cz', 89, 0, '0000-00-00', '', 7),
    574 (2, '', '', 'Petr', 'Hrubý', 'hrubos@nevim.cz', 23, 0, '0000-00-00', '123456789', 0),
    575 (4, 'ferda', '123', 'Ferda', 'Mravenec', 'ferda@mraveniste.cz', 1, 0, '0000-00-00', '', 2),
    576 (5, '', '', 'Obivan', 'Kenoby', 'kenoby@mail.universe', 233, 0, '0000-00-00', '', 0),
    577 (6, '', '', 'Mistr', 'Joda', 'joda@mistr.shadow', 300, 0, '0000-00-00', '', 0),
    578 (7, '', '', 'Petr', 'Slovák', 'slovak@zdarma.cz', 34, 0, '0000-00-00', '', 0),
    579 (8, '', '', 'Alena', 'Kocourková', 'alena.kocourkova@centrum.cz', 32, 1, '0000-00-00', '223344556', 7),
    580 (9, '', '', 'Jonny', 'Hurikán', 'storm@atlas.cz', 16, 0, '0000-00-00', '224556778', 0),
    581 (10, '', '', 'Smrťák', 'Krutý', 'smrt@peklo.cz', 111222333, 0, '0000-00-00', '', 5),
    582 (11, '', '', 'Karel', 'Nejedlý', 'starosta@obec-milosice.cz', 0, 0, '0000-00-00', '443666333', 8),
    583 (12, 'fantomas', 'dsds', 'Fantomas', 'Tajemný', 'fantom@fantom.com', 0, 0, '0000-00-00', '', 12);
     626INSERT INTO `User` (`Id`, `UserName`, `Password`, `FirstName`, `SecondName`, `Email`, `ICQ`, `Sex`, `BirthDay`, `Phone`, `Member`, `RegistrationTime`, `LastLoginTime`, `Locked`, `LastIpAddress`) VALUES
     627(1, '', 'fdsfsdfsd', 'Alfons', 'Much', 'mucha@all.cz', 89, 0, '0000-00-00', '', 7, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, ''),
     628(2, '', '', 'Petr', 'Hrubý', 'hrubos@nevim.cz', 23, 0, '0000-00-00', '123456789', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, ''),
     629(4, 'ferda', '123', 'Ferda', 'Mravenec', 'ferda@mraveniste.cz', 1, 0, '0000-00-00', '', 2, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, ''),
     630(5, 'obivan', '4217be89cdd8f9dbb59fa5851dd3a0408b9a5a81', 'Obivan', 'Kenoby', 'kenoby@mail.universe', 233, 0, '0000-00-00', '', 6, '0000-00-00 00:00:00', '2008-09-29 12:50:38', 0, ''),
     631(6, '', '', 'Mistr', 'Joda', 'joda@mistr.shadow', 300, 0, '0000-00-00', '', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, ''),
     632(7, '', '', 'Petr', 'Slovák', 'slovak@zdarma.cz', 34, 0, '0000-00-00', '', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, ''),
     633(8, '', '', 'Alena', 'Kocourková', 'alena.kocourkova@centrum.cz', 32, 1, '0000-00-00', '223344556', 7, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, ''),
     634(9, '', '', 'Jonny', 'Hurikán', 'storm@atlas.cz', 16, 0, '0000-00-00', '224556778', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, ''),
     635(10, '', '', 'Smrťák', 'Krutý', 'smrt@peklo.cz', 111222333, 0, '0000-00-00', '', 5, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, ''),
     636(11, '', '', 'Karel', 'Nejedlý', 'starosta@obec-milosice.cz', 0, 0, '0000-00-00', '443666333', 1, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, ''),
     637(12, 'fantomas', 'dsds', 'Fantomas', 'Tajemný', 'fantom@fantom.com', 0, 0, '0000-00-00', '', 12, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '');
     638
     639-- --------------------------------------------------------
     640
     641--
     642-- Struktura tabulky `UserOnline`
     643--
     644
     645CREATE TABLE IF NOT EXISTS `UserOnline` (
     646  `User` int(11) NOT NULL,
     647  `LoginTime` datetime NOT NULL,
     648  `ActivityTime` datetime NOT NULL,
     649  `SessionId` varchar(255) collate utf8_czech_ci NOT NULL,
     650  `IpAddress` varchar(16) collate utf8_czech_ci NOT NULL,
     651  `HostName` varchar(255) collate utf8_czech_ci NOT NULL,
     652  `Id` int(11) NOT NULL auto_increment,
     653  PRIMARY KEY  (`Id`),
     654  KEY `User` (`User`)
     655) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=3 ;
     656
     657--
     658-- Vypisuji data pro tabulku `UserOnline`
     659--
     660
     661INSERT INTO `UserOnline` (`User`, `LoginTime`, `ActivityTime`, `SessionId`, `IpAddress`, `HostName`, `Id`) VALUES
     662(0, '2008-09-29 09:33:17', '2008-09-29 11:07:24', '96bhsqoheu6feqh7rmpa30ak92', '192.168.0.23', 'george-nb.zdechov.net', 1),
     663(5, '2008-09-29 11:07:29', '2008-09-29 14:29:45', 'ectsef5epcsgtcb4mpscq3kk84', '192.168.0.23', 'george-nb.zdechov.net', 2);
  • style.css

    r4 r8  
    3939.WideTable
    4040{
     41  border-width: 2px;
     42  border-style: solid;
    4143  border-color: black;
    42   border-style: solid;
    43   border-width: 1px 1px 0px 0px;
    44   border-spacing: 0px;
    45   margin: 3px 3px 3px 3px;
     44  border-collapse: collapse;
     45  background-color: white;
     46  margin: 0px 0px 5px 0px;
    4647}
    4748
    4849.WideTable th
    4950{
    50   border-color: black;
     51  border-color: gray;
    5152  border-style: solid;
    52   border-width: 0px 0px 1px 1px;
    53   padding: 3px 3px 3px 3px;
     53  border-width: 1px;
     54  padding: 3px;
    5455  background-color: #E0E0E0;
    5556}
     
    5859{
    5960  text-align: left;
    60   border-color: black;
     61  border-color: gray;
    6162  border-style: solid;
    62   border-width: 0px 0px 1px 1px;
    63   padding: 3px 3px 3px 3px;
     63  border-width: 1px;
     64  padding: 3px;
    6465}
    6566
     
    9798  border-left:1px #CCCCCC solid;
    9899}
     100
     101.SystemMessage
     102{
     103  background: #FFEDED;
     104  border: 1px solid #992A2A;
     105  border-top: 0;
     106  margin: 5px;
     107  padding: 0;
     108  width: auto;
     109  text-align: center;
     110}
     111
     112
     113.SystemMessage h3
     114{
     115  background: #E39090;
     116  border: 1px solid #992A2A;
     117  border-left: 0;
     118  border-right: 0;
     119  color: white;
     120  font-size: small;
     121  font-weight: bold;
     122  margin: 0;
     123  padding: 5px;
     124}
     125
     126.SystemMessage div
     127{
     128  background: transparent;
     129  border: 0;
     130  color: #992A2A;
     131  margin: 0;
     132  padding: 8px;
     133}
  • types/Boolean.php

    r5 r8  
    11<?php
    22
    3 function TypeBooleanViewHtml($Type, $Parameter, $Table, $Id)
     3function TypeBooleanViewHtml($Type, $Item)
    44{
    5   return('<input type="checkbox" name="%name%" value="%value%" disabled="1">');
     5  return('<input type="checkbox" name="'.$Item['Name'].'" value="'.$Item['Value'].'" disabled="1">');
    66}
    77
    8 function TypeBooleanEditHtml($Type, $Parameter, $Table, $Id)
     8function TypeBooleanEditHtml($Type, $Item)
    99{
    10   return('<input type="checkbox" name="%name%" value="%value%">');
     10  return('<input type="checkbox" name="'.$Item['Name'].'" value="'.$Item['Value'].'">');
    1111}
    1212
  • types/Date.php

    r5 r8  
    33$MonthList = array('0', 'Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec');
    44
    5 function TypeDateViewHtml($Type, $Parameter, $Table, $Id)
     5function TypeDateViewHtml($Type, $Item)
    66{
    77  global $MonthList;
    88
    9   $Parts = explode('-', $Parameter);
     9  $Parts = explode('-', $Item['Value']);
    1010
    1111  $Output = ($Parts[2] * 1).'.'.$MonthList[$Parts[1] * 1].'.'.$Parts[0];
     
    1313}
    1414
    15 function TypeDateEditHtml($Type, $Parameter, $Table, $Id)
     15function TypeDateEditHtml($Type, $Item)
    1616{
    1717  global $MonthList;
    1818
    19   $Parts = explode('-', $Parameter);
     19  $Parts = explode('-', $Item['Value']);
    2020
    2121  // Day
    22   $Output = '<select name="%name%-day">';
     22  $Output = '<select name="'.$Item['Name'].'-day">';
    2323  for($I = 1; $I <= 31; $I++)
    2424  {
     
    2828  $Output .= '</select>';
    2929  // Month
    30   $Output .= '<select name="%name%-month">';
     30  $Output .= '<select name="'.$Item['Name'].'-month">';
    3131  for($I = 1; $I <= 12; $I++)
    3232  {
     
    3636  $Output .= '</select>';
    3737  // Year
    38   $Output .= '<select name="%name%-month">';
     38  $Output .= '<select name="'.$Item['Name'].'-month">';
    3939  for($I = 1900; $I < 2100; $I++)
    4040  {
  • types/Enumeration.php

    r5 r8  
    11<?php
    22
    3 function TypeEnumerationViewHtml($Type, $Parameter, $Table, $Id)
     3function TypeEnumerationViewHtml($Type, $Item)
    44{
    5   $Output = $Type['Parameters'][$Parameter];
     5  $Output = $Type['Parameters'][$Item['Value']];
    66  return($Output);
    77}
    88
    9 function TypeEnumerationEditHtml($Type, $Parameter, $Table, $Id)
     9function TypeEnumerationEditHtml($Type, $Item)
    1010{
    11   $Output = '<select name="%name%">';
     11  $Output = '<select name="'.$Item['Name'].'">';
    1212  foreach($Type['Parameters'] as $Index => $StateName)
    1313  {
  • types/Float.php

    r6 r8  
    11<?php
    22
    3 function TypeFloatViewHtml($Type, $Parameter, $Table, $Id)
     3function TypeFloatViewHtml($Type, $Item)
    44{
    5   $Output = '%value%';
     5  $Output = $Item['Value'];
    66  return($Output);
    77}
    88
    9 function TypeFloatEditHtml($Type, $Parameter, $Table, $Id)
     9function TypeFloatEditHtml($Type, $Item)
    1010{
    11   $Output = '<input type="text" name="%name%" value="%value%">';
     11  $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'">';
    1212  return($Output);
    1313}
  • types/Hyperlink.php

    r6 r8  
    11<?php
    22
    3 function TypeHyperlinkViewHtml($Type, $Parameter, $Table, $Id)
     3function TypeHyperlinkViewHtml($Type, $Item)
    44{
    5   $Output = '<a href="%value%">%value%</a>';
     5  $Output = '<a href="'.$Item['Name'].'">'.$Item['Value'].'</a>';
    66  return($Output);
    77}
     
    99function TypeHyperlinkEditHtml($Type, $Parameter, $Table, $Id)
    1010{
    11   $Output = '<input type="text" name="%name%" value="%value%">';
     11  $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'">';
    1212  return($Output);
    1313}
  • types/Integer.php

    r5 r8  
    11<?php
    22
    3 function TypeIntegerViewHtml($Type, $Parameter, $Table, $Id)
     3function TypeIntegerViewHtml($Type, $Item)
    44{
    5   $Output = '%value%';
     5  $Output = $Item['Value'];
    66  return($Output);
    77}
    88
    9 function TypeIntegerEditHtml($Type, $Parameter, $Table, $Id)
     9function TypeIntegerEditHtml($Type, $Item)
    1010{
    11   $Output = '<input type="text" name="%name%" value="%value%">';
     11  $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'">';
    1212  return($Output);
    1313}
  • types/Password.php

    r5 r8  
    33function TypePasswordViewHtml($Type, $Parameter, $Table, $Id)
    44{
    5   $Output = '%value%';
     5  $Output = '';
     6  for($I = 0; $I < strlen($Item['Value']); $I++)
     7    $Output .= '*';
    68  return($Output);
    79}
     
    911function TypePasswordEditHtml($Type, $Parameter, $Table, $Id)
    1012{
    11   $Output = '<input type="password" name="%name%" value="%value%">';
     13  $Output = '<input type="password" name="'.$Item['Name'].'" value="'.$Item['Value'].'">';
    1214  return($Output);
    1315}
  • types/PointerOneToMany.php

    r5 r8  
    11<?php
    22
    3 function TypePointerOneToManyViewHtml($Type, $Parameter, $Table, $Id)
     3function TypePointerOneToManyViewHtml($Type, $Item)
    44{
    5   $Output = '<a href="?Action=ShowList&amp;TableId='.$Type['TypeDefinition'].'&amp;ParentTable='.$Table.'&amp;ParentColumn='.$Id.'">Seznam</a>';
     5  $Output = '<a href="?Action=ShowList&amp;TableId='.$Type['TypeDefinition'].'&amp;ParentTable='.$Item['SourceTable'].'&amp;ParentColumn='.$Item['SourceItemId'].'">Seznam</a>';
    66  return($Output);
    77}
    88
    9 function TypePointerOneToManyEditHtml($Type, $Parameter, $Table, $Id)
     9function TypePointerOneToManyEditHtml($Type, $Item)
    1010{
    11   $Output = '<a href="?Action=ShowList&amp;TableId='.$Type['TypeDefinition'].'&amp;ParentTable='.$Table.'&amp;ParentColumn='.$Id.'">Seznam</a>';
     11  $Output = '<a href="?Action=ShowList&amp;TableId='.$Type['TypeDefinition'].'&amp;ParentTable='.$Item['SourceTable'].'&amp;ParentColumn='.$Item['SourceItemId'].'">Seznam</a>';
    1212  return($Output);
    1313}
  • types/PointerOneToOne.php

    r6 r8  
    11<?php
    22
    3 function TypePointerOneToOneViewHtml($Type, $Parameter, $Table, $Id)
     3function TypePointerOneToOneViewHtml($Type, $Item)
    44{
    55  global $Database, $Lists;
    66
     7  //print_r($Type);
    78  $Output = '';
    89  $Columns = '';
    9   foreach($Lists[$Type['Parameter']]['Items'] as $ListItem)
     10  $ItemType = explode(':', $Item['Type']);
     11  $TargetTable = $ItemType[1];
     12
     13  foreach($Lists[$TargetTable]['Items'] as $ListItem)
    1014    if($ListItem['VisibleInPointer'] == 1) $Columns .= '`'.$ListItem['Name'].'`," ",';
    1115  $Columns = 'CONCAT('.substr($Columns, 0, -1).') AS Name, Id';
    12   $DbResult = $Database->select($Type['Parameter'], $Columns, 'Id='.$Parameter);
     16  $DbResult = $Database->select($TargetTable, $Columns, 'Id='.$Item['Value']);
    1317  //echo($Database->LastQuery);
    1418  if($DbResult->num_rows > 0)
    1519  {
    1620    $DbRow = $DbResult->fetch_array();
    17     $Output = '<a href="?Action=ViewItem&amp;Table='.$Type['Parameter'].'&amp;Item='.$DbRow['Id'].'">'.$DbRow['Name'].'</a>';
     21    $Output = '<a href="?Action=ViewItem&amp;Table='.$TargetTable.'&amp;Item='.$DbRow['Id'].'">'.$DbRow['Name'].'</a>';
    1822  }
    1923  return($Output);
    2024}
    2125
    22 function TypePointerOneToOneEditHtml($Type, $Parameter, $Table, $Id)
     26function TypePointerOneToOneEditHtml($Type, $Item)
    2327{
    2428  global $Database, $Lists;
    2529
    26   $Output = '<select name="%name%">';
     30  $Output = '<select name="'.$Item['Name'].'">';
    2731  $Columns = '';
    28   foreach($Lists[$Type['Parameter']]['Items'] as $ListItem)
     32  $ItemType = explode(':', $Item['Type']);
     33  $TargetTable = $ItemType[1];
     34  foreach($Lists[$TargetTable]['Items'] as $ListItem)
    2935    if($ListItem['VisibleInPointer'] == 1) $Columns .= '`'.$ListItem['Name'].'`," ",';
    3036  $Columns = 'CONCAT('.substr($Columns, 0, -1).') AS Name, Id';
    31   $DbResult = $Database->select($Type['Parameter'], $Columns);
     37  $DbResult = $Database->select($TargetTable, $Columns);
    3238  //echo($Database->LastQuery);
    3339  while($DbRow = $DbResult->fetch_array())
  • types/String.php

    r5 r8  
    11<?php
    22
    3 function TypeStringViewHtml($Type, $Parameter, $Table, $Id)
     3function TypeStringViewHtml($Type, $Item)
    44{
    5   $Output = '%value%';
     5  $Output = $Item['Value'];
    66  return($Output);
    77}
    88
    9 function TypeStringEditHtml($Type, $Parameter, $Table, $Id)
     9function TypeStringEditHtml($Type, $Item)
    1010{
    11   $Output = '<input type="text" name="%name%" value="%value%">';
     11  $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'">';
    1212  return($Output);
    1313}
Note: See TracChangeset for help on using the changeset viewer.