Viewing file: nas_list.php (23.54 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//Include Common Files @1-85D370E9
define("RelativePath", ".");
define("PathToCurrentPage", "/");
define("FileName", "nas_list.php");
include(RelativePath . "/Common.php");
include(RelativePath . "/Template.php");
include(RelativePath . "/Sorter.php");
include(RelativePath . "/Navigator.php");
//End Include Common Files
//Include Page implementation @40-3DD2EFDC
include_once(RelativePath . "/Header.php");
//End Include Page implementation
class clsRecordnasSearch { //nasSearch Class @2-20708AC9
//Variables @2-F607D3A5
// Public variables
var $ComponentType = "Record";
var $ComponentName;
var $Parent;
var $HTMLFormAction;
var $PressedButton;
var $Errors;
var $ErrorBlock;
var $FormSubmitted;
var $FormEnctype;
var $Visible;
var $Recordset;
var $CCSEvents = "";
var $CCSEventResult;
var $RelativePath = "";
var $InsertAllowed = false;
var $UpdateAllowed = false;
var $DeleteAllowed = false;
var $ReadAllowed = false;
var $EditMode = false;
var $ds;
var $DataSource;
var $ValidatingControls;
var $Controls;
// Class variables
//End Variables
//Class_Initialize Event @2-095F6CB7
function clsRecordnasSearch($RelativePath, & $Parent)
{
global $FileName;
global $CCSLocales;
global $DefaultDateFormat;
$this->Visible = true;
$this->Parent = & $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Record nasSearch/Error";
$this->ReadAllowed = true;
if($this->Visible)
{
$this->ComponentName = "nasSearch";
$CCSForm = split(":", CCGetFromGet("ccsForm", ""), 2);
if(sizeof($CCSForm) == 1)
$CCSForm[1] = "";
list($FormName, $FormMethod) = $CCSForm;
$this->FormEnctype = "application/x-www-form-urlencoded";
$this->FormSubmitted = ($FormName == $this->ComponentName);
$Method = $this->FormSubmitted ? ccsPost : ccsGet;
$this->s_keyword = & new clsControl(ccsTextBox, "s_keyword", "s_keyword", ccsText, "", CCGetRequestParam("s_keyword", $Method), $this);
$this->Button_DoSearch = & new clsButton("Button_DoSearch", $Method, $this);
}
}
//End Class_Initialize Event
//Validate Method @2-A144A629
function Validate()
{
global $CCSLocales;
$Validation = true;
$Where = "";
$Validation = ($this->s_keyword->Validate() && $Validation);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate", $this);
$Validation = $Validation && ($this->s_keyword->Errors->Count() == 0);
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
//CheckErrors Method @2-D6729123
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->s_keyword->Errors->Count());
$errors = ($errors || $this->Errors->Count());
return $errors;
}
//End CheckErrors Method
//Operation Method @2-ABC7F26E
function Operation()
{
if(!$this->Visible)
return;
global $Redirect;
global $FileName;
if(!$this->FormSubmitted) {
return;
}
if($this->FormSubmitted) {
$this->PressedButton = "Button_DoSearch";
if($this->Button_DoSearch->Pressed) {
$this->PressedButton = "Button_DoSearch";
}
}
$Redirect = "nas_list.php";
if($this->Validate()) {
if($this->PressedButton == "Button_DoSearch") {
$Redirect = "nas_list.php" . "?" . CCMergeQueryStrings(CCGetQueryString("Form", array("Button_DoSearch", "Button_DoSearch_x", "Button_DoSearch_y")));
if(!CCGetEvent($this->Button_DoSearch->CCSEvents, "OnClick", $this->Button_DoSearch)) {
$Redirect = "";
}
}
} else {
$Redirect = "";
}
}
//End Operation Method
//Show Method @2-C0989453
function Show()
{
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->s_keyword->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", $this->HTMLFormAction);
$Tpl->SetVar("HTMLFormName", $this->ComponentName);
$Tpl->SetVar("HTMLFormEnctype", $this->FormEnctype);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow", $this);
if(!$this->Visible) {
$Tpl->block_path = $ParentPath;
return;
}
$this->s_keyword->Show();
$this->Button_DoSearch->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
}
//End Show Method
} //End nasSearch Class @2-FCB6E20C
class clsGridnas { //nas class @5-3FCD7EAE
//Variables @5-0C04DE5F
// Public variables
var $ComponentType = "Grid";
var $ComponentName;
var $Visible;
var $Errors;
var $ErrorBlock;
var $ds;
var $DataSource;
var $PageSize;
var $SorterName = "";
var $SorterDirection = "";
var $PageNumber;
var $CCSEvents = "";
var $CCSEventResult;
var $RelativePath = "";
// Grid Controls
var $StaticControls;
var $RowControls;
var $Sorter_id;
var $Sorter_nasname;
var $Sorter_shortname;
var $Sorter_type;
var $Sorter_ports;
var $Sorter_secret;
var $Sorter_community;
var $Sorter_description;
//End Variables
//Class_Initialize Event @5-CA1C111B
function clsGridnas($RelativePath, & $Parent)
{
global $FileName;
global $CCSLocales;
global $DefaultDateFormat;
$this->ComponentName = "nas";
$this->Visible = True;
$this->Parent = & $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Grid nas";
$this->DataSource = new clsnasDataSource($this);
$this->ds = & $this->DataSource;
$this->PageSize = CCGetParam($this->ComponentName . "PageSize", "");
if(!is_numeric($this->PageSize) || !strlen($this->PageSize))
$this->PageSize = 20;
else
$this->PageSize = intval($this->PageSize);
if ($this->PageSize > 100)
$this->PageSize = 100;
if($this->PageSize == 0)
$this->Errors->addError("<p>Form: Grid " . $this->ComponentName . "<br>Error: (CCS06) Invalid page size.</p>");
$this->PageNumber = intval(CCGetParam($this->ComponentName . "Page", 1));
if ($this->PageNumber <= 0) $this->PageNumber = 1;
$this->SorterName = CCGetParam("nasOrder", "");
$this->SorterDirection = CCGetParam("nasDir", "");
$this->id = & new clsControl(ccsLink, "id", "id", ccsInteger, "", CCGetRequestParam("id", ccsGet), $this);
$this->id->Page = "nas_maint.php";
$this->nasname = & new clsControl(ccsLabel, "nasname", "nasname", ccsText, "", CCGetRequestParam("nasname", ccsGet), $this);
$this->shortname = & new clsControl(ccsLabel, "shortname", "shortname", ccsText, "", CCGetRequestParam("shortname", ccsGet), $this);
$this->type = & new clsControl(ccsLabel, "type", "type", ccsText, "", CCGetRequestParam("type", ccsGet), $this);
$this->ports = & new clsControl(ccsLabel, "ports", "ports", ccsInteger, "", CCGetRequestParam("ports", ccsGet), $this);
$this->secret = & new clsControl(ccsLabel, "secret", "secret", ccsText, "", CCGetRequestParam("secret", ccsGet), $this);
$this->community = & new clsControl(ccsLabel, "community", "community", ccsText, "", CCGetRequestParam("community", ccsGet), $this);
$this->description = & new clsControl(ccsLabel, "description", "description", ccsText, "", CCGetRequestParam("description", ccsGet), $this);
$this->Sorter_id = & new clsSorter($this->ComponentName, "Sorter_id", $FileName, $this);
$this->Sorter_nasname = & new clsSorter($this->ComponentName, "Sorter_nasname", $FileName, $this);
$this->Sorter_shortname = & new clsSorter($this->ComponentName, "Sorter_shortname", $FileName, $this);
$this->Sorter_type = & new clsSorter($this->ComponentName, "Sorter_type", $FileName, $this);
$this->Sorter_ports = & new clsSorter($this->ComponentName, "Sorter_ports", $FileName, $this);
$this->Sorter_secret = & new clsSorter($this->ComponentName, "Sorter_secret", $FileName, $this);
$this->Sorter_community = & new clsSorter($this->ComponentName, "Sorter_community", $FileName, $this);
$this->Sorter_description = & new clsSorter($this->ComponentName, "Sorter_description", $FileName, $this);
$this->nas_Insert = & new clsControl(ccsLink, "nas_Insert", "nas_Insert", ccsText, "", CCGetRequestParam("nas_Insert", ccsGet), $this);
$this->nas_Insert->Parameters = CCGetQueryString("QueryString", array("id", "ccsForm"));
$this->nas_Insert->Page = "nas_maint.php";
$this->Navigator = & new clsNavigator($this->ComponentName, "Navigator", $FileName, 10, tpSimple, $this);
}
//End Class_Initialize Event
//Initialize Method @5-90E704C5
function Initialize()
{
if(!$this->Visible) return;
$this->DataSource->PageSize = & $this->PageSize;
$this->DataSource->AbsolutePage = & $this->PageNumber;
$this->DataSource->SetOrder($this->SorterName, $this->SorterDirection);
}
//End Initialize Method
//Show Method @5-4DEA10F9
function Show()
{
global $Tpl;
global $CCSLocales;
if(!$this->Visible) return;
$ShownRecords = 0;
$this->DataSource->Parameters["urls_keyword"] = CCGetFromGet("s_keyword", "");
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this);
$this->DataSource->Prepare();
$this->DataSource->Open();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow", $this);
if(!$this->Visible) return;
$GridBlock = "Grid " . $this->ComponentName;
$ParentPath = $Tpl->block_path;
$Tpl->block_path = $ParentPath . "/" . $GridBlock;
if(($ShownRecords < $this->PageSize) && $this->DataSource->next_record())
{
do {
$this->DataSource->SetValues();
$Tpl->block_path = $ParentPath . "/" . $GridBlock . "/Row";
$this->id->SetValue($this->DataSource->id->GetValue());
$this->id->Parameters = CCGetQueryString("QueryString", array("ccsForm"));
$this->id->Parameters = CCAddParam($this->id->Parameters, "id", $this->DataSource->f("id"));
$this->nasname->SetValue($this->DataSource->nasname->GetValue());
$this->shortname->SetValue($this->DataSource->shortname->GetValue());
$this->type->SetValue($this->DataSource->type->GetValue());
$this->ports->SetValue($this->DataSource->ports->GetValue());
$this->secret->SetValue($this->DataSource->secret->GetValue());
$this->community->SetValue($this->DataSource->community->GetValue());
$this->description->SetValue($this->DataSource->description->GetValue());
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow", $this);
$this->id->Show();
$this->nasname->Show();
$this->shortname->Show();
$this->type->Show();
$this->ports->Show();
$this->secret->Show();
$this->community->Show();
$this->description->Show();
$Tpl->block_path = $ParentPath . "/" . $GridBlock;
$Tpl->parse("Row", true);
$ShownRecords++;
} while (($ShownRecords < $this->PageSize) && $this->DataSource->next_record());
}
else // Show NoRecords block if no records are found
{
$Tpl->parse("NoRecords", false);
}
$errors = $this->GetErrors();
if(strlen($errors))
{
$Tpl->replaceblock("", $errors);
$Tpl->block_path = $ParentPath;
return;
}
$this->Navigator->PageNumber = $this->DataSource->AbsolutePage;
if ($this->DataSource->RecordsCount == "CCS not counted")
$this->Navigator->TotalPages = $this->DataSource->AbsolutePage + ($this->DataSource->next_record() ? 1 : 0);
else
$this->Navigator->TotalPages = $this->DataSource->PageCount();
$this->Sorter_id->Show();
$this->Sorter_nasname->Show();
$this->Sorter_shortname->Show();
$this->Sorter_type->Show();
$this->Sorter_ports->Show();
$this->Sorter_secret->Show();
$this->Sorter_community->Show();
$this->Sorter_description->Show();
$this->nas_Insert->Show();
$this->Navigator->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
$this->DataSource->close();
}
//End Show Method
//GetErrors Method @5-A8B68ACB
function GetErrors()
{
$errors = "";
$errors = ComposeStrings($errors, $this->id->Errors->ToString());
$errors = ComposeStrings($errors, $this->nasname->Errors->ToString());
$errors = ComposeStrings($errors, $this->shortname->Errors->ToString());
$errors = ComposeStrings($errors, $this->type->Errors->ToString());
$errors = ComposeStrings($errors, $this->ports->Errors->ToString());
$errors = ComposeStrings($errors, $this->secret->Errors->ToString());
$errors = ComposeStrings($errors, $this->community->Errors->ToString());
$errors = ComposeStrings($errors, $this->description->Errors->ToString());
$errors = ComposeStrings($errors, $this->Errors->ToString());
$errors = ComposeStrings($errors, $this->DataSource->Errors->ToString());
return $errors;
}
//End GetErrors Method
} //End nas Class @5-FCB6E20C
class clsnasDataSource extends clsDBConnection1 { //nasDataSource Class @5-1561CEED
//DataSource Variables @5-DF13E6EA
var $Parent = "";
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $CmdExecution;
var $CountSQL;
var $wp;
// Datasource fields
var $id;
var $nasname;
var $shortname;
var $type;
var $ports;
var $secret;
var $community;
var $description;
//End DataSource Variables
//DataSourceClass_Initialize Event @5-A7F083FD
function clsnasDataSource(& $Parent)
{
$this->Parent = & $Parent;
$this->ErrorBlock = "Grid nas";
$this->Initialize();
$this->id = new clsField("id", ccsInteger, "");
$this->nasname = new clsField("nasname", ccsText, "");
$this->shortname = new clsField("shortname", ccsText, "");
$this->type = new clsField("type", ccsText, "");
$this->ports = new clsField("ports", ccsInteger, "");
$this->secret = new clsField("secret", ccsText, "");
$this->community = new clsField("community", ccsText, "");
$this->description = new clsField("description", ccsText, "");
}
//End DataSourceClass_Initialize Event
//SetOrder Method @5-7322623B
function SetOrder($SorterName, $SorterDirection)
{
$this->Order = "";
$this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection,
array("Sorter_id" => array("id", ""),
"Sorter_nasname" => array("nasname", ""),
"Sorter_shortname" => array("shortname", ""),
"Sorter_type" => array("type", ""),
"Sorter_ports" => array("ports", ""),
"Sorter_secret" => array("secret", ""),
"Sorter_community" => array("community", ""),
"Sorter_description" => array("description", "")));
}
//End SetOrder Method
//Prepare Method @5-5E849291
function Prepare()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->wp = new clsSQLParameters($this->ErrorBlock);
$this->wp->AddParameter("1", "urls_keyword", ccsText, "", "", $this->Parameters["urls_keyword"], "", false);
$this->wp->AddParameter("2", "urls_keyword", ccsText, "", "", $this->Parameters["urls_keyword"], "", false);
$this->wp->AddParameter("3", "urls_keyword", ccsText, "", "", $this->Parameters["urls_keyword"], "", false);
$this->wp->AddParameter("4", "urls_keyword", ccsText, "", "", $this->Parameters["urls_keyword"], "", false);
$this->wp->AddParameter("5", "urls_keyword", ccsText, "", "", $this->Parameters["urls_keyword"], "", false);
$this->wp->AddParameter("6", "urls_keyword", ccsText, "", "", $this->Parameters["urls_keyword"], "", false);
$this->wp->Criterion[1] = $this->wp->Operation(opContains, "nasname", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsText),false);
$this->wp->Criterion[2] = $this->wp->Operation(opContains, "shortname", $this->wp->GetDBValue("2"), $this->ToSQL($this->wp->GetDBValue("2"), ccsText),false);
$this->wp->Criterion[3] = $this->wp->Operation(opContains, "type", $this->wp->GetDBValue("3"), $this->ToSQL($this->wp->GetDBValue("3"), ccsText),false);
$this->wp->Criterion[4] = $this->wp->Operation(opContains, "secret", $this->wp->GetDBValue("4"), $this->ToSQL($this->wp->GetDBValue("4"), ccsText),false);
$this->wp->Criterion[5] = $this->wp->Operation(opContains, "community", $this->wp->GetDBValue("5"), $this->ToSQL($this->wp->GetDBValue("5"), ccsText),false);
$this->wp->Criterion[6] = $this->wp->Operation(opContains, "description", $this->wp->GetDBValue("6"), $this->ToSQL($this->wp->GetDBValue("6"), ccsText),false);
$this->Where = $this->wp->opOR(
true, $this->wp->opOR(
false, $this->wp->opOR(
false, $this->wp->opOR(
false, $this->wp->opOR(
false,
$this->wp->Criterion[1],
$this->wp->Criterion[2]),
$this->wp->Criterion[3]),
$this->wp->Criterion[4]),
$this->wp->Criterion[5]),
$this->wp->Criterion[6]);
}
//End Prepare Method
//Open Method @5-23B1A1C4
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent);
$this->CountSQL = "SELECT COUNT(*) " .
"FROM nas";
$this->SQL = "SELECT nas.id, nas.nasname, nas.shortname, nas.type, nas.ports, nas.secret, nas.community, nas.description " .
"FROM nas {SQL_Where} {SQL_OrderBy}";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect", $this->Parent);
if ($this->CountSQL)
$this->RecordsCount = CCGetDBValue(CCBuildSQL($this->CountSQL, $this->Where, ""), $this);
else
$this->RecordsCount = "CCS not counted";
$this->query($this->OptimizeSQL(CCBuildSQL($this->SQL, $this->Where, $this->Order)));
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect", $this->Parent);
}
//End Open Method
//SetValues Method @5-0F3505C6
function SetValues()
{
$this->id->SetDBValue(trim($this->f("id")));
$this->nasname->SetDBValue($this->f("nasname"));
$this->shortname->SetDBValue($this->f("shortname"));
$this->type->SetDBValue($this->f("type"));
$this->ports->SetDBValue(trim($this->f("ports")));
$this->secret->SetDBValue($this->f("secret"));
$this->community->SetDBValue($this->f("community"));
$this->description->SetDBValue($this->f("description"));
}
//End SetValues Method
} //End nasDataSource Class @5-FCB6E20C
//Include Page implementation @41-58DBA1E3
include_once(RelativePath . "/Footer.php");
//End Include Page implementation
//Initialize Page @1-50AFE843
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = FileName;
$Redirect = "";
$TemplateFileName = "nas_list.html";
$BlockToParse = "main";
$TemplateEncoding = "CP1252";
$PathToRoot = "./";
//End Initialize Page
//Initialize Objects @1-827F12B3
$DBConnection1 = new clsDBConnection1();
$MainPage->Connections["Connection1"] = & $DBConnection1;
// Controls
$Header = & new clsHeader("", "Header", $MainPage);
$Header->Initialize();
$nasSearch = & new clsRecordnasSearch("", $MainPage);
$nas = & new clsGridnas("", $MainPage);
$Footer = & new clsFooter("", "Footer", $MainPage);
$Footer->Initialize();
$MainPage->Header = & $Header;
$MainPage->nasSearch = & $nasSearch;
$MainPage->nas = & $nas;
$MainPage->Footer = & $Footer;
$nas->Initialize();
$CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize", $MainPage);
$Charset = $Charset ? $Charset : "windows-1252";
if ($Charset)
header("Content-Type: text/html; charset=" . $Charset);
//End Initialize Objects
//Initialize HTML Template @1-8F4531F3
$CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView", $MainPage);
$Tpl = new clsTemplate($FileEncoding, $TemplateEncoding);
$Tpl->LoadTemplate(PathToCurrentPage . $TemplateFileName, $BlockToParse, "CP1252");
$Tpl->block_path = "/$BlockToParse";
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow", $MainPage);
//End Initialize HTML Template
//Execute Components @1-27368F9E
$Header->Operations();
$nasSearch->Operation();
$Footer->Operations();
//End Execute Components
//Go to destination page @1-409693D7
if($Redirect)
{
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBConnection1->close();
header("Location: " . $Redirect);
$Header->Class_Terminate();
unset($Header);
unset($nasSearch);
unset($nas);
$Footer->Class_Terminate();
unset($Footer);
unset($Tpl);
exit;
}
//End Go to destination page
//Show Page @1-5C601E3E
$Header->Show();
$nasSearch->Show();
$nas->Show();
$Footer->Show();
$Tpl->block_path = "";
$Tpl->Parse($BlockToParse, false);
$main_block = $Tpl->GetVar($BlockToParse);
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeOutput", $MainPage);
if ($CCSEventResult) echo $main_block;
//End Show Page
//Unload Page @1-2808A3ED
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBConnection1->close();
$Header->Class_Terminate();
unset($Header);
unset($nasSearch);
unset($nas);
$Footer->Class_Terminate();
unset($Footer);
unset($Tpl);
//End Unload Page
?>
|