Changeset 38


Ignore:
Timestamp:
May 12, 2009, 11:30:51 AM (15 years ago)
Author:
george
Message:
  • Přidáno: Typy Color pro výběr barvy a Text pro psaní obsáhlejších textů.
  • Opraveno: Ukládání položek do jiných databází než v které je systém.
Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/base.php

    r36 r38  
    5151  if(array_key_exists('OrderColumn', $_GET))
    5252  {
    53     if($_SESSION['OrderTable'] != $List['Id']) // Different table => set ascending order
     53    if(array_key_exists('OrderTable', $_SESSION) and ($_SESSION['OrderTable'] != $List['Id'])) // Different table => set ascending order
    5454      $_SESSION['OrderDirection'] = 0;
    5555    $_SESSION['OrderColumn'] = $_GET['OrderColumn'];
     
    222222      if($Type['BaseType'] != 'PointerOneToMany')
    223223      {
    224         $DefinitionItems[] = array('Name' => $Index, 'Caption' => $Item['TextBefore'].$Required, 'Value' => $DbRow[$Index], 'SourceTable' => $List['Id'], 'SourceItemId' => $DbRow[$List['IdName']], 'Type' => $Item['Type']);
    225       }
     224        if($Item['Editable'] == 1)
     225        {
     226          $DefinitionItems[] = array('Name' => $Index, 'Caption' => $Item['TextBefore'], 'Value' => $DbRow[$Index], 'SourceTable' => $List['Id'], 'SourceItemId' => $DbRow[$List['IdName']], 'Type' => $Item['Type']);
     227        } else $DefinitionItems[] = array('Name' => $Index, 'Type' => TypeHiddenId, 'Caption' => '', 'Value' => $DbRow[$Index]);
     228      }
    226229    }
    227230  }
     
    239242  $Output = 'Změny uloženy.';
    240243  $Output .= ShowViewItem($List, $Id);
    241   $Form->Values['Column'] = $_POST['Column'];
     244  if(array_key_exists('Column', $_POST)) $Form->Values['Column'] = $_POST['Column'];
     245    else $Form->Values['Column'] = '';
    242246  $Form->Values['Id'] = $Id;
    243247  $Form->Values['ListTableName'] = $List['TableName'];
     
    279283  );
    280284  $Form->OnSubmit = '?Action=AddItemFinish';
    281   $Output .= $Form->ShowEditForm().$AfterTableOutput;
     285  $Output = $Form->ShowEditForm().$AfterTableOutput;
    282286  if(($Column != '') and ($ColumnValue != 0))
    283287  {
     
    297301  $DefinitionItems = array();
    298302  $AfterTableOutput = '';
     303  if(array_key_exists('Column', $_GET)) $Column = $_GET['Column']; else $Column = '';
    299304  foreach($List['Items'] as $Item)
    300305  {
     
    401406  $DefinitionItems = array();
    402407  $AfterTableOutput = '';
     408  if(array_key_exists('Column', $_GET)) $Column = $_GET['Column']; else $Column = '';
    403409  foreach($List['Items'] as $Item)
    404410  {
     
    425431  );
    426432  $Form->OnSubmit = '?Action=Search';
    427   $Output .= $Form->ShowEditForm();
     433  $Output = $Form->ShowEditForm();
    428434  return($Output);
    429435}
     
    436442  $DefinitionItems = array();
    437443  $AfterTableOutput = '';
     444  if(array_key_exists('Column', $_GET)) $Column = $_GET['Column']; else $Column = '';
    438445  foreach($List['Items'] as $Item)
    439446  {
     
    649656    $ListObject = $ListDefinition['Class'];
    650657    if(is_callable(array($ListObject, $Event))) return($ListObject->$Event($Parameters));
    651       else return($ListDefinition['TableName'].'->'.$Event.'('.$List.')');
    652   } else return($ListDefinition['TableName'].'->'.$Event.'('.$List.')');
     658      else return($ListDefinition['TableName'].'->'.$Event.'('.$Table.')');
     659  } else return($ListDefinition['TableName'].'->'.$Event.'('.$Table.')');
    653660}
    654661
  • trunk/database_list.php

    r35 r38  
    99    $DbResult = $this->Database->query('SELECT `TableName`, `Database` FROM `SystemList` WHERE `Id`='.$TableId);
    1010    $DbRow = $DbResult->fetch_assoc();
    11     $TableName = $DbRow['TableName'];
    1211
    13     $this->Database->insert(array('Table' => $TableName), $Values);
     12    $this->Database->insert(array('Table' => $DbRow['TableName'], 'Database' => $DbRow['Database']), $Values);
    1413    return($this->Database->insert_id);
    1514  }
     
    1918    $DbResult = $this->Database->query('SELECT `TableName`, `Database` FROM `SystemList` WHERE `Id`='.$TableId);
    2019    $DbRow = $DbResult->fetch_assoc();
    21     $TableName = $DbRow['TableName'];
    22     $this->Database->delete(array('Table' => $TableName, 'Condition' => 'Id='.$ItemId), array('DeletionTime' => 'NOW()'));
     20    $this->Database->delete(array('Table' => $DbRow['TableName'], 'Database' => $DbRow['Database'], 'Condition' => 'Id='.$ItemId), array('DeletionTime' => 'NOW()'));
    2321  }
    2422
     
    2725    $DbResult = $this->Database->query('SELECT `TableName`, `Database` FROM `SystemList` WHERE `Id`='.$TableId);
    2826    $DbRow = $DbResult->fetch_assoc();
    29     $TableName = $DbRow['TableName'];
    3027    $this->DeleteItem($TableId, $ItemId);
    3128    $Values['Id'] = $ItemId;
    32     $this->Database->replace(array('Table' => $TableName), $Values);
     29    $this->Database->replace(array('Table' => $DbRow['TableName'], 'Database' => $DbRow['Database']), $Values);
    3330  }
    3431}
  • trunk/types/include.php

    r36 r38  
    1818include('types/GPS.php');
    1919include('types/IPv4Address.php');
     20include('types/Color.php');
     21include('types/Text.php');
    2022
    2123define('TypeIntegerId', 1);
     
    2931define('TypeHiddenId', 20);
    3032define('TypePointerToUserId', 37);
     33define('TypeColorId', 66);
    3134
    3235?>
Note: See TracChangeset for help on using the changeset viewer.