From 0269aefc30d65ddb5d197bac7819feed5bf78de8 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sat, 23 Aug 2014 13:08:33 +0200 Subject: Manually backported Wsat --- framework/Wsat/pages/TWsatGenerateAR.page | 56 ++++++++++++++++++++++++++++ framework/Wsat/pages/TWsatGenerateAR.php | 57 +++++++++++++++++++++++++++++ framework/Wsat/pages/TWsatHome.page | 17 +++++++++ framework/Wsat/pages/TWsatHome.php | 17 +++++++++ framework/Wsat/pages/TWsatLogin.page | 45 +++++++++++++++++++++++ framework/Wsat/pages/TWsatLogin.php | 33 +++++++++++++++++ framework/Wsat/pages/TWsatScaffolding.page | 3 ++ framework/Wsat/pages/TWsatScaffolding.php | 17 +++++++++ framework/Wsat/pages/config.xml | 9 +++++ framework/Wsat/pages/layout/TWsatLayout.php | 36 ++++++++++++++++++ framework/Wsat/pages/layout/TWsatLayout.tpl | 53 +++++++++++++++++++++++++++ 11 files changed, 343 insertions(+) create mode 100644 framework/Wsat/pages/TWsatGenerateAR.page create mode 100644 framework/Wsat/pages/TWsatGenerateAR.php create mode 100644 framework/Wsat/pages/TWsatHome.page create mode 100644 framework/Wsat/pages/TWsatHome.php create mode 100644 framework/Wsat/pages/TWsatLogin.page create mode 100644 framework/Wsat/pages/TWsatLogin.php create mode 100644 framework/Wsat/pages/TWsatScaffolding.page create mode 100644 framework/Wsat/pages/TWsatScaffolding.php create mode 100644 framework/Wsat/pages/config.xml create mode 100644 framework/Wsat/pages/layout/TWsatLayout.php create mode 100644 framework/Wsat/pages/layout/TWsatLayout.tpl (limited to 'framework/Wsat/pages') diff --git a/framework/Wsat/pages/TWsatGenerateAR.page b/framework/Wsat/pages/TWsatGenerateAR.page new file mode 100644 index 00000000..926d6b0f --- /dev/null +++ b/framework/Wsat/pages/TWsatGenerateAR.page @@ -0,0 +1,56 @@ + +
Active Record Classes Generator
+
+
+ +
+
+
    +
  • If you want to generate all AR Classes, keep the "Table Name" field as appears by default.
  • +
  • "Output Folder" field refers to the directory that the new AR class file should be generated under... where Application refers to the protected folder of your project. You can let this default field value and PRADO will create the proper folders for you.
  • +
+
+
+ +
+
+ + + + +
+ +
+ + + + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + + + + +
+
+ + +
+
+ +
diff --git a/framework/Wsat/pages/TWsatGenerateAR.php b/framework/Wsat/pages/TWsatGenerateAR.php new file mode 100644 index 00000000..f0ce8430 --- /dev/null +++ b/framework/Wsat/pages/TWsatGenerateAR.php @@ -0,0 +1,57 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2013 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Id$ + * @since 3.3 + * @package Wsat.pages + */ +Prado::using("System.Wsat.TWsatARGenerator"); + +class TWsatGenerateAR extends TPage +{ + + public function generate($sender) + { + if ($this->IsValid) + { + $tableName = $this->table_name->Text; + $outputFolderNs = $this->output_folder->Text; + $classPrefix = $this->class_prefix->Text; + $classSuffix = $this->class_suffix->Text; + + try + { + $ar_generator = new TWsatARGenerator(); + $ar_generator->setOpFile($outputFolderNs); + $ar_generator->setClasPrefix($classPrefix); + $ar_generator->setClassSufix($classSuffix); + + if ($this->build_rel->Checked) + $ar_generator->buildRelations(); + + if ($tableName != "*") + $ar_generator->generate($tableName); + else + $ar_generator->generateAll(); + + $this->feedback_panel->CssClass = "green_panel"; + $this->generation_msg->Text = "The code has been generated successfully."; + } catch (Exception $ex) + { + $this->feedback_panel->CssClass = "red_panel"; + $this->generation_msg->Text = $ex->getMessage(); + } + $this->feedback_panel->Visible = true; + } + } + + public function preview($sender) + { +// throw new THttpException(500, "Not implemented yet."); + } + +} \ No newline at end of file diff --git a/framework/Wsat/pages/TWsatHome.page b/framework/Wsat/pages/TWsatHome.page new file mode 100644 index 00000000..e8796ccd --- /dev/null +++ b/framework/Wsat/pages/TWsatHome.page @@ -0,0 +1,17 @@ + + + +
Application Dir: <%= Prado::getPathOfNamespace('Application') %>
+ +
+ + + + + +
+ + + Enables you to generate all Active Record Classes with relations included. +
+
diff --git a/framework/Wsat/pages/TWsatHome.php b/framework/Wsat/pages/TWsatHome.php new file mode 100644 index 00000000..b5ae1bb4 --- /dev/null +++ b/framework/Wsat/pages/TWsatHome.php @@ -0,0 +1,17 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2013 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Id$ + * @since 3.3 + * @package Wsat.pages + */ +Prado::using("System.Wsat.TWsatARGenerator"); + +class TWsatHome extends TPage +{ + +} \ No newline at end of file diff --git a/framework/Wsat/pages/TWsatLogin.page b/framework/Wsat/pages/TWsatLogin.page new file mode 100644 index 00000000..79578f59 --- /dev/null +++ b/framework/Wsat/pages/TWsatLogin.page @@ -0,0 +1,45 @@ +<%@ MasterClass="" %> + + + + + + + + + + + + + + + + + + + + + diff --git a/framework/Wsat/pages/TWsatLogin.php b/framework/Wsat/pages/TWsatLogin.php new file mode 100644 index 00000000..21994c07 --- /dev/null +++ b/framework/Wsat/pages/TWsatLogin.php @@ -0,0 +1,33 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2013 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Id$ + * @since 3.3 + * @package Wsat.pages + */ +class TWsatLogin extends TPage +{ + + public function login() + { + if ($this->IsValid) + { + $this->Session["wsat_password"] = $this->getService()->getPassword(); + + $url = $this->Service->constructUrl('TWsatHome'); + $this->Response->redirect($url); + } + } + + public function validatePassword($sender, $param) + { + $config_pass = $this->Service->Password; + $user_pass = $this->password->Text; + $param->IsValid = $user_pass === $config_pass; + } + +} \ No newline at end of file diff --git a/framework/Wsat/pages/TWsatScaffolding.page b/framework/Wsat/pages/TWsatScaffolding.page new file mode 100644 index 00000000..42f78d09 --- /dev/null +++ b/framework/Wsat/pages/TWsatScaffolding.page @@ -0,0 +1,3 @@ + + Scaffolding will be avaliable in Prado 3.4 + diff --git a/framework/Wsat/pages/TWsatScaffolding.php b/framework/Wsat/pages/TWsatScaffolding.php new file mode 100644 index 00000000..b8e28b03 --- /dev/null +++ b/framework/Wsat/pages/TWsatScaffolding.php @@ -0,0 +1,17 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2013 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Id$ + * @since 3.3 + * @package Wsat.pages + */ +Prado::using("System.Wsat.TWsatARGenerator"); + +class TWsatScaffolding extends TPage +{ + +} \ No newline at end of file diff --git a/framework/Wsat/pages/config.xml b/framework/Wsat/pages/config.xml new file mode 100644 index 00000000..727e8eab --- /dev/null +++ b/framework/Wsat/pages/config.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/framework/Wsat/pages/layout/TWsatLayout.php b/framework/Wsat/pages/layout/TWsatLayout.php new file mode 100644 index 00000000..67caa77d --- /dev/null +++ b/framework/Wsat/pages/layout/TWsatLayout.php @@ -0,0 +1,36 @@ +validateSecurity(); + } + + private function validateSecurity() + { + if ($this->Session["wsat_password"] !== $this->getService()->getPassword()) + { + if (!$this->getPage() instanceof TWsatLogin) + { + $url = $this->Service->constructUrl('TWsatLogin'); + $this->Response->redirect($url); + } + } + } + + public function logout() + { + $this->Session["wsat_password"] = ""; + $url = $this->Service->constructUrl('TWsatLogin'); + $this->Response->redirect($url); + } + +} \ No newline at end of file diff --git a/framework/Wsat/pages/layout/TWsatLayout.tpl b/framework/Wsat/pages/layout/TWsatLayout.tpl new file mode 100644 index 00000000..d91ff333 --- /dev/null +++ b/framework/Wsat/pages/layout/TWsatLayout.tpl @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + +
+
+
+
Code Generation
+
    +
  • +
  • +
+
+
+ +
+ +
+ +
+
+ + +
+ + \ No newline at end of file -- cgit v1.2.3