|
|
|
ช่วยด้วยคับมือใหม่มันขึ้น Error in block: /main/Record Login/Error/Button Button_DoLogin ไปแก้ตรงไหนคับ |
|
|
|
|
|
|
|
ช่วยด้วยคับมือใหม่มันขึ้น Error in block: /main/Record Login/Error/Button Button_DoLogin ไปแก้ตรงไหนคับ
Code (PHP)
<?php
class clsRecordLogin
{
public $ComponentType = "Record";
public $ComponentName = NULL;
public $Parent = NULL;
public $HTMLFormAction = NULL;
public $PressedButton = NULL;
public $Errors = NULL;
public $ErrorBlock = NULL;
public $FormSubmitted = NULL;
public $FormEnctype = NULL;
public $Visible = NULL;
public $IsEmpty = NULL;
public $CCSEvents = "";
public $CCSEventResult = NULL;
public $RelativePath = "";
public $InsertAllowed = false;
public $UpdateAllowed = false;
public $DeleteAllowed = false;
public $ReadAllowed = false;
public $EditMode = false;
public $ds = NULL;
public $DataSource = NULL;
public $ValidatingControls = NULL;
public $Controls = NULL;
public $Attributes = NULL;
public function clsRecordLogin( $RelativePath, &$Parent )
{
global $FileName;
global $CCSLocales;
global $DefaultDateFormat;
$this->Visible = true;
$this->Parent =& $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors( );
$this->ErrorBlock = "Record Login/Error";
$this->ReadAllowed = true;
if ( $this->Visible )
{
$this->ComponentName = "Login";
$this->Attributes = new clsAttributes( $this->ComponentName.":" );
$CCSForm = split( ":", CCGetFromGet( "ccsForm", "" ), 2 );
if ( sizeof( $CCSForm ) == 1 )
{
$CCSForm[1] = "";
}
list( $FormName, $FormMethod ) = FormName;
$this->FormEnctype = "application/x-www-form-urlencoded";
$this->FormSubmitted = $FormName == $this->ComponentName;
$Method = $this->FormSubmitted ? ccsPost : ccsGet;
$this->login = new clsControl( ccsTextBox, "login", "login", ccsText, "", CCGetRequestParam( "login", $Method, NULL ), $this );
$this->login->Required = true;
$this->password = new clsControl( ccsTextBox, "password", "password", ccsText, "", CCGetRequestParam( "password", $Method, NULL ), $this );
$this->password->Required = true;
$this->Button_DoLogin = new clsButton( "Button_DoLogin", $Method, $this );
}
}
public function Validate( )
{
global $CCSLocales;
$Validation = true;
$Where = "";
$Validation = $this->login->Validate( ) && $Validation;
$Validation = $this->password->Validate( ) && $Validation;
$this->CCSEventResult = CCGetEvent( $this->CCSEvents, "OnValidate", $this );
$Validation = $Validation && $this->login->Errors->Count( ) == 0;
$Validation = $Validation && $this->password->Errors->Count( ) == 0;
return $this->Errors->Count( ) == 0 && $Validation;
}
public function CheckErrors( )
{
$errors = false;
$errors = $errors || $this->login->Errors->Count( );
$errors = $errors || $this->password->Errors->Count( );
$errors = $errors || $this->Errors->Count( );
return $errors;
}
public function Operation( )
{
if ( !$this->Visible )
{
return;
}
global $Redirect;
global $FileName;
if ( !$this->FormSubmitted )
{
return;
}
if ( $this->FormSubmitted )
{
$this->PressedButton = "Button_DoLogin";
if ( $this->Button_DoLogin->Pressed )
{
$this->PressedButton = "Button_DoLogin";
}
}
$Redirect = $FileName;
if ( $this->Validate( ) )
{
if ( $this->PressedButton == "Button_DoLogin" && !CCGetEvent( $this->Button_DoLogin->CCSEvents, "OnClick", $this->Button_DoLogin ) )
{
$Redirect = "";
}
}
else
{
$Redirect = "";
}
}
public function Show( )
{
global $CCSUseAmp;
global $Tpl;
global $FileName;
global $CCSLocales;
$Error = "";
if ( !$this->Visible )
{
return;
}
$this->CCSEventResult = CCGetEvent( $this->CCSEvents, "BeforeSelect", $this );
$RecordBlock = "Record ".$this->ComponentName;
$ParentPath = $Tpl->block_path;
$Tpl->block_path = $ParentPath."/".$RecordBlock;
$this->EditMode = $this->EditMode && $this->ReadAllowed;
if ( !$this->FormSubmitted )
{
}
if ( $this->FormSubmitted || $this->CheckErrors( ) )
{
$Error = "";
$Error = ComposeStrings( $Error, $this->login->Errors->ToString( ) );
$Error = ComposeStrings( $Error, $this->password->Errors->ToString( ) );
$Error = ComposeStrings( $Error, $this->Errors->ToString( ) );
$Tpl->SetVar( "Error", $Error );
$Tpl->Parse( "Error", false );
}
$CCSForm = $this->EditMode ? $this->ComponentName.":"."Edit" : $this->ComponentName;
$this->HTMLFormAction = $FileName."?".CCAddParam( CCGetQueryString( "QueryString", "" ), "ccsForm", $CCSForm );
$Tpl->SetVar( "Action", !$CCSUseAmp ? $this->HTMLFormAction : str_replace( "&", "&", $this->HTMLFormAction ) );
$Tpl->SetVar( "HTMLFormName", $this->ComponentName );
$Tpl->SetVar( "HTMLFormEnctype", $this->FormEnctype );
$this->CCSEventResult = CCGetEvent( $this->CCSEvents, "BeforeShow", $this );
$this->Attributes->Show( );
if ( !$this->Visible )
{
$Tpl->block_path = $ParentPath;
}
else
{
$this->login->Show( );
$this->password->Show( );
$this->Button_DoLogin->Show( );
$Tpl->parse( );
$Tpl->block_path = $ParentPath;
}
}
}
define( "RelativePath", "." );
define( "PathToCurrentPage", "/" );
define( "FileName", "login.php" );
include( RelativePath."/Common.php" );
include( RelativePath."/Template.php" );
include( RelativePath."/Sorter.php" );
include( RelativePath."/Navigator.php" );
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
$Attributes = "";
$CCSEvents = "";
$CCSEventResult = "";
$FileName = FileName;
$Redirect = "";
$TemplateFileName = "login.html";
$BlockToParse = "main";
$TemplateEncoding = "CP874";
$PathToRoot = "./";
include( "./login_events.php" );
$CCSEventResult = CCGetEvent( $CCSEvents, "BeforeInitialize", $MainPage );
$Attributes = new clsAttributes( "page:" );
$MainPage->Attributes =& $Attributes;
$Login = new clsRecordLogin( "", $MainPage );
$MainPage->Login =& $Login;
BindEvents( );
$CCSEventResult = CCGetEvent( $CCSEvents, "AfterInitialize", $MainPage );
$Charset = $Charset ? $Charset : "windows-874";
if ( $Charset )
{
header( "Content-Type: text/html; charset=".$Charset );
}
$CCSEventResult = CCGetEvent( $CCSEvents, "OnInitializeView", $MainPage );
$Tpl = new clsTemplate( $FileEncoding, $TemplateEncoding );
$Tpl->LoadTemplate( PathToCurrentPage.$TemplateFileName, $BlockToParse, "CP874" );
$Tpl->block_path = "/{$BlockToParse}";
$CCSEventResult = CCGetEvent( $CCSEvents, "BeforeShow", $MainPage );
$Attributes->Show( );
$Login->Operation( );
if ( $Redirect )
{
$CCSEventResult = CCGetEvent( $CCSEvents, "BeforeUnload", $MainPage );
if ( $CCSFormFilter )
{
$Redirect = CCAddParam( $Redirect, "FormFilter", $CCSFormFilter );
}
header( "Location: ".$Redirect );
unset( $Login );
unset( $Tpl );
exit( );
}
$Login->Show( );
$Tpl->block_path = "";
$Tpl->Parse( $BlockToParse, false );
$main_block = $Tpl->GetVar( $BlockToParse );
$CCSEventResult = CCGetEvent( $CCSEvents, "BeforeOutput", $MainPage );
if ( $CCSEventResult )
{
echo $main_block;
}
$CCSEventResult = CCGetEvent( $CCSEvents, "BeforeUnload", $MainPage );
unset( $Login );
unset( $Tpl );
?>
Tag : PHP
|
|
|
|
|
|
Date :
2011-12-12 15:50:00 |
By :
วิศรุต |
View :
853 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
อันนี้ Source ของอะไรครับ
|
|
|
|
|
Date :
2011-12-12 16:53:23 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|