diff options
author | Daniel <darthdaniel85@gmail.com> | 2013-11-22 15:25:30 -0500 |
---|---|---|
committer | Daniel <darthdaniel85@gmail.com> | 2013-11-22 15:25:30 -0500 |
commit | ab6effd64caefa732ef0994d6c3048f5cd474bf6 (patch) | |
tree | 73f4e568295f4d7625fc16af9ce03c58bbbaab2a /framework/Wsat/pages | |
parent | 85ca63b0896be3d12a098b44b5ec0c65a5b76a6c (diff) |
WSAT beta release.
Diffstat (limited to 'framework/Wsat/pages')
-rw-r--r-- | framework/Wsat/pages/TWsatGenerateAR.page | 20 | ||||
-rw-r--r-- | framework/Wsat/pages/TWsatGenerateAR.php | 80 | ||||
-rw-r--r-- | framework/Wsat/pages/TWsatLogin.page | 7 | ||||
-rw-r--r-- | framework/Wsat/pages/TWsatLogin.php | 59 |
4 files changed, 97 insertions, 69 deletions
diff --git a/framework/Wsat/pages/TWsatGenerateAR.page b/framework/Wsat/pages/TWsatGenerateAR.page index 3905d023..acd456fd 100644 --- a/framework/Wsat/pages/TWsatGenerateAR.page +++ b/framework/Wsat/pages/TWsatGenerateAR.page @@ -1,21 +1,31 @@ <com:TContent ID="Content"> - <div style="margin-left: 220px"> + <div style="margin-left: 220px; font-size: 14px"> <div class="form_row"> - <com:TLabel Text="Table Name:" ForControl="table_name" style="margin-right: 14px" /> + <com:TLabel Text="Table Name:" ForControl="table_name" style="margin-right: 24px" /> <com:TTextBox ID="table_name" Text="*" CssClass="in_text" /> + <com:TRequiredFieldValidator ControlToValidate="table_name" Text="Table name cannot be blank." Display="Dynamic" /> </div> <div class="form_row"> - <com:TLabel Text="Class Prefix:" ForControl="class_prefix" style="margin-right: 16px"/> + <com:TLabel Text="Class Prefix:" ForControl="class_prefix" style="margin-right: 25px"/> <com:TTextBox ID="class_prefix" Text="AR_" CssClass="in_text" /> </div> <div class="form_row"> - <com:TLabel Text="Output Folder:" ForControl="output_folder"/> + <com:TLabel Text="Output Folder:" ForControl="output_folder" style="margin-right: 8px"/> <com:TTextBox ID="output_folder" Text="Application.App_Data.AR_Classes" CssClass="in_text" /> </div> + + <div class="form_row"> + <com:TLabel Text="Build Relations:" ForControl="build_rel"/> + <com:TCheckBox ID="build_rel" Checked="true" /> + </div> + + <com:TPanel ID="success_panel" Visible="false"> + <com:TLabel ID="generation_msg" /> + </com:TPanel> <br/> <div style="text-align: center"> - <com:TButton Text="Preview" OnClick="preview" /> + <com:TButton Text="Preview" OnClick="preview" Visible="false" /> <com:TButton Text="Generate" OnClick="generate" /> </div> </div> diff --git a/framework/Wsat/pages/TWsatGenerateAR.php b/framework/Wsat/pages/TWsatGenerateAR.php index 754cac5c..3d4291e2 100644 --- a/framework/Wsat/pages/TWsatGenerateAR.php +++ b/framework/Wsat/pages/TWsatGenerateAR.php @@ -1,33 +1,49 @@ -<?php
-
-/**
- * Description of Inicio
- *
- * @author daniels
- */
-Prado::using("System.Wsat.TWsatARGenerator");
-
-class TWsatGenerateAR extends TPage {
-
- public function onInit($param) {
- parent::onInit($param);
- }
-
- public function generate($sender) {
- $table_name = $this->table_name->Text;
-
- $ar_generator = new TWsatARGenerator();
- if ($table_name != "*") {
- $ar_generator->generate($table_name);
- } else {
- $ar_generator->generateAll();
- }
- }
-
- public function preview($sender) {
-
- }
-
-}
-
+<?php + +/** + * Description of Inicio + * + * @author daniels + */ +Prado::using("System.Wsat.TWsatARGenerator"); + +class TWsatGenerateAR extends TPage { + + public function generate($sender) { + if ($this->IsValid) { + $table_name = $this->table_name->Text; + $class_prefix = $this->class_prefix->Text; + $output_folder_ns = $this->output_folder->Text; + + try { + $ar_generator = new TWsatARGenerator(); + $ar_generator->setOpFile($output_folder_ns); + $ar_generator->setClasPrefix($class_prefix); + + if ($this->build_rel->Checked) { + $ar_generator->buildRelations(); + } + if ($table_name != "*") { + $ar_generator->generate($table_name); + } else { + $ar_generator->generateAll(); + } + $this->success_panel->CssClass = "success_panel"; + $this->generation_msg->Text = "The code has been generated successfully."; + } catch (Exception $ex) { + $this->success_panel->CssClass = "exception_panel"; + $this->generation_msg->Text = $ex->getMessage(); + } + $this->success_panel->Visible = true; + } + } + + public function preview($sender) { +// $ar_generator = new TWsatARGenerator(); +// $ar_generator->renderAllTablesInformation(); + throw new THttpException(500, "Not implemented yet."); + } + +} + ?>
\ No newline at end of file diff --git a/framework/Wsat/pages/TWsatLogin.page b/framework/Wsat/pages/TWsatLogin.page index b256d719..d0a94f2a 100644 --- a/framework/Wsat/pages/TWsatLogin.page +++ b/framework/Wsat/pages/TWsatLogin.page @@ -29,9 +29,10 @@ <div class="login_form"> <com:TLabel Text="Please enter your password:" ForControl="password"/><br/> <com:TTextBox ID="password" TextMode="Password" style="margin: 5px" /><br/> - <com:TRequiredFieldValidator ControlToValidate="password" Text="Password cannot be blank." /><br/> - - <com:TButton Text="Enter" OnClick="login" /> + <com:TRequiredFieldValidator ControlToValidate="password" ValidationGroup="loginGroup" Text="Password cannot be blank." /><br/> + <com:TCustomValidator ControlToValidate="password" ValidationGroup="loginGroup" OnServerValidate="validatePassword" Text="Incorrect password." /> + + <com:TButton Text="Enter" ValidationGroup="loginGroup" OnClick="login" /> </div> <div id="footer"> diff --git a/framework/Wsat/pages/TWsatLogin.php b/framework/Wsat/pages/TWsatLogin.php index 7435d75d..0bbdc53f 100644 --- a/framework/Wsat/pages/TWsatLogin.php +++ b/framework/Wsat/pages/TWsatLogin.php @@ -1,30 +1,31 @@ -<?php
-
-/**
- * Description of Inicio
- *
- * @author daniels
- */
-class TWsatLogin extends TPage {
-
- public function login() {
- $config_pass = $this->getService()->getPassword();
- $user_pass = $this->password->Text;
-
- if ($user_pass === $config_pass) {
- $this->Session["wsat_password"] = $config_pass;
-
- $authManager = $this->Application->getModule('auth');
- $url = $authManager->ReturnUrl;
- if (empty($url)) {
- $url = $this->Service->constructUrl('TWsatHome');
- }
- $this->Response->redirect($url);
- } else {
- echo "user or pass wrong";
- }
- }
-
-}
-
+<?php + +/** + * Description of Inicio + * + * @author daniels + */ +class TWsatLogin extends TPage { + + public function login() { + if ($this->IsValid) { + $this->Session["wsat_password"] = $this->getService()->getPassword(); + + $authManager = $this->Application->getModule('auth'); + $url = $authManager->ReturnUrl; + if (empty($url)) { + $url = $this->Service->constructUrl('TWsatHome'); + } + $this->Response->redirect($url); + } + } + + public function validatePassword($sender, $param) { + $config_pass = $this->getService()->getPassword(); + $user_pass = $this->password->Text; + $param->IsValid = $user_pass === $config_pass; + } + +} + ?>
\ No newline at end of file |