Changeset 606


Ignore:
Timestamp:
Dec 8, 2013, 5:08:37 PM (11 years ago)
Author:
chronos
Message:
  • Přidáno: Ověřování vstupů pro MAC adresu a IPv4 a 6. V případě chyby se zobrazí chybné políčko červeně s popisem formátu.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Version.php

    r605 r606  
    11<?php
    22
    3 $Revision = 605; // Subversion revision
     3$Revision = 606; // Subversion revision
    44$DatabaseRevision = 601; // SQL structure revision
    55$ReleaseTime = '2013-12-08';
  • trunk/Common/Form/Form.php

    r605 r606  
    99  var $Definition;
    1010  var $Values;
     11  var $ValuesValidate;
    1112  var $ValuesFilter;
    1213  var $OnSubmit;
     
    1920    $this->Definition = array();
    2021    $this->Values = array();   
    21     $this->ValuesFilter = array();   
     22    $this->ValuesFilter = array();
     23    $this->ValuesValidate = array();   
    2224    $this->OnSubmit = '';
    2325  }
     
    108110        if(array_key_exists('Suffix', $Item)) $Edit .= $Item['Suffix'];
    109111
     112      $Caption = $Item['Caption'].':';
     113      if(array_key_exists($Index, $this->ValuesValidate) and
     114        $this->ValuesValidate[$Index]) {
     115                $Format = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'GetValidationFormat', array());
     116                if($Format != '') $Caption .= '<br/><small>'.$Format.'</small>';
     117                $Caption = '<span style="color:red;">'.$Caption.'</span>';
     118        }
    110119      if(!$this->FormManager->Type->IsHidden($UseType))
    111           array_push($Table['Rows'], array($Item['Caption'].':', $Edit));
     120          array_push($Table['Rows'], array($Caption, $Edit));
    112121      else $Hidden .= $Edit;
    113122    }
     
    246255  function Validate()
    247256  {
    248     $Values = array();
     257    $Valid = true;
    249258    foreach($this->Definition['Items'] as $Index => $Item)
    250259    if((!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
     
    272281          else $Parameters['Null'] = false;
    273282        if(!$this->FormManager->Type->ExecuteTypeEvent($UseType, 'Validate',
    274           $Parameters)) throw new Exception('not validated');
    275     }
    276     return($Values);
     283          $Parameters)) {
     284                $this->ValuesValidate[$Index] = true;
     285                $Valid = false;
     286          }
     287    }
     288    if($Valid == false) throw new Exception('not validated');
     289    return($Valid);
    277290  }
    278291}
  • trunk/Common/Form/Types/Base.php

    r605 r606  
    6565        return(true);
    6666  }
     67
     68  function GetValidationFormat()
     69  {
     70        return('');
     71  }
    6772}
  • trunk/Common/Form/Types/IPv4Address.php

    r605 r606  
    2727        return(filter_var($Item['Value'], FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV4)));
    2828  }
     29 
     30  function GetValidationFormat()
     31  {
     32        return('x.x.x.x kde x je hodnota 0..255');
     33  }
    2934}
Note: See TracChangeset for help on using the changeset viewer.