Changeset 26


Ignore:
Timestamp:
Dec 4, 2008, 12:31:09 PM (16 years ago)
Author:
george
Message:
  • Opraveno: Logování správných id položek.
  • Upraveno: Částečně zprovozněno vícestupňové zobrazení odkazů.
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • base.php

    r24 r26  
    217217  $System->Modules['DatabaseList']->EditItem($List['ItemId'], $Form->Values, $Id);
    218218  $NewId = $Database->insert_id;
    219   $System->Modules['Log']->Add($List['Id'], $NewId, $LogActionType['Edit']);
     219  $System->Modules['Log']->Add($List['ItemId'], $NewId, $LogActionType['Edit']);
    220220  $Output = 'Změny uloženy.';
    221221  $Output .= ShowViewItem($List, $Id);
     
    302302  $NewItemId = $System->Modules['DatabaseList']->AddItem($List['ItemId'], $Form->Values);
    303303  $NewId = $Database->insert_id;
    304   $System->Modules['Log']->Add($List['Id'], $NewId, $LogActionType['Add']);
     304  $System->Modules['Log']->Add($List['ItemId'], $NewId, $LogActionType['Add']);
    305305  $Output = 'Položka přidána';
    306306  $Output .= ShowViewItem($List, $NewItemId);
     
    346346    }
    347347    $Output .= ' <a href="?Action=ShowHistory&amp;Table='.$List['ItemId'].'&amp;Item='.$DbRow['ItemId'].'">Historie</a>';
     348    $Output .= ' <a href="?Action=DeleteItem&amp;Table='.$List['ItemId'].'&amp;Item='.$DbRow['ItemId'].'"  onclick="return confirmAction(\'Opravdu smazat položku?\');">Smazat</a>';
    348349    $Output .= '<div class="line"></div>';
    349350    foreach($List['Items'] as $Index => $Item)
     
    365366
    366367  if(!CheckPermission('Write', $List['ItemId'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění'));
    367   $System->Modules['Log']->Add($List['Id'], $Id, $LogActionType['Delete']);
     368  $System->Modules['Log']->Add($List['ItemId'], $Id, $LogActionType['Delete']);
    368369  $System->Modules['DatabaseList']->DeleteItem($List['ItemId'], $Id);
    369370  $Output = 'Položka smazána.';
  • lists/SystemList.php

    r23 r26  
    1717    PRIMARY KEY  (`Id`)
    1818    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;');
     19    $Database->query('ALTER TABLE `'.$Parameters['TableName'].'` ADD INDEX ( `ItemId` );');
    1920    //echo($Database->LastQuery);
    2021  }
  • lists/SystemListItem.php

    r23 r26  
    33class ListSystemListItem
    44{
     5  function RebuildOrder()
     6  {
     7    global $Database;
     8
     9    $Database->query('UPDATE SystemListItem AS Table1 SET Sequence = (SELECT COUNT(*) FROM (SELECT * FROM SystemListItem) AS Table2 WHERE (Table1.ItemId = Table2.ItemId) AND ((Table2.Sequence < Table1.Sequence) OR ((Table1.Sequence = Table2.Sequence) AND (Table2.Id < Table1.Id))))');
     10  }
     11
    512  function OnAdd($Parameters)
    613  {
     
    1623    $Database->query('ALTER TABLE `'.$DbRow2['TableName'].'` ADD `'.$Parameters['Name'].'` '.$DbRow['DbDataType'].' NOT NULL ;');
    1724    //echo($Database->LastQuery);
     25
     26    $this->RebuildOrder();
     27  }
     28
     29  function OnEdit($Parameters)
     30  {
     31    $this->RebuildOrder();
     32  }
     33
     34  function OnDelete($Parameters)
     35  {
     36    $this->RebuildOrder();
    1837  }
    1938}
  • types/PointerOneToOne.php

    r24 r26  
    1111    $List = GetListDefinition($Type['Parameters'][0]);
    1212    $TargetTable = $List['TableName'];
    13     foreach($List['Items'] as $ListItem)
    14       if($ListItem['VisibleInPointer'] == 1) $Columns .= '`'.$ListItem['Name'].'`," ",';
     13    foreach($List['Items'] as $Index => $ListItem)
     14    {
     15      //echo('ListItem');
     16      //print_r($ListItem);
     17      $Type = GetTypeDefinition($ListItem['Type']);
     18      if($ListItem['VisibleInPointer'] == 1)
     19      {
     20        if($Type['ParentType'] == TypePointerOneToOneId)
     21        {
     22          //print_r($Type);
     23          $DbResult = $Database->select($List['TableName'], '*', 'ItemId='.$Item['Value'].' ORDER BY Id DESC LIMIT 1');
     24          $DbRow = $DbResult->fetch_assoc();
     25          $DefinitionItem = array('Name' => $Index, 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'], 'Value' => $DbRow[$Index], 'SourceTable' => $List['ItemId'], 'SourceItemId' => 0);
     26          $SubTarget = $this->GetTablePointerName($Type, $DefinitionItem);
     27          $Columns .= '"'.$SubTarget['Name'].' ",';
     28        } else $Columns .= '`'.$ListItem['Name'].'`," ",';
     29      }
     30    }
    1531    $Columns = 'CONCAT('.substr($Columns, 0, -1).') AS Name, ItemId, Id';
    1632    $DbResult = $Database->select($TargetTable, $Columns, 'ItemId='.$Item['Value'].' AND (DeletionTime IS NULL) ORDER BY Id DESC LIMIT 1');
    17     //echo($Database->LastQuery);
     33    echo($Database->LastQuery);
    1834    if($DbResult->num_rows > 0)
    1935    {
     
    3652    if($DbResult->num_rows > 0)
    3753    {
     54
    3855      $Result = array(array('Name' => 'Žádný', 'Id' => 0, 'ItemId' => 0));
    3956      while($DbRow = $DbResult->fetch_assoc())
  • types/include.php

    r24 r26  
    1616include('types/File/File.php');
    1717include('types/GPS.php');
     18include('types/IPv4Address.php');
    1819
    1920define("TypeIntegerId", 1);
Note: See TracChangeset for help on using the changeset viewer.