diff options
| author | Patrick Seeger <pseeger@ccwn.org> | 2012-04-13 23:11:05 +0200 |
|---|---|---|
| committer | Patrick Seeger <pseeger@ccwn.org> | 2012-04-13 23:11:05 +0200 |
| commit | 341cc4dd9c53ffbfb863e026dd58549c1082c7a7 (patch) | |
| tree | 1bbbed20313bafb9b063b6b4d894fe580d8b000f /framework/cli/views/webapp/protected | |
Diffstat (limited to 'framework/cli/views/webapp/protected')
35 files changed, 840 insertions, 0 deletions
diff --git a/framework/cli/views/webapp/protected/.htaccess b/framework/cli/views/webapp/protected/.htaccess new file mode 100644 index 0000000..8d2f256 --- /dev/null +++ b/framework/cli/views/webapp/protected/.htaccess @@ -0,0 +1 @@ +deny from all diff --git a/framework/cli/views/webapp/protected/commands/shell/.yii b/framework/cli/views/webapp/protected/commands/shell/.yii new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/framework/cli/views/webapp/protected/commands/shell/.yii diff --git a/framework/cli/views/webapp/protected/components/Controller.php b/framework/cli/views/webapp/protected/components/Controller.php new file mode 100644 index 0000000..4d27862 --- /dev/null +++ b/framework/cli/views/webapp/protected/components/Controller.php @@ -0,0 +1,23 @@ +<?php +/** + * Controller is the customized base controller class. + * All controller classes for this application should extend from this base class. + */ +class Controller extends CController +{ + /** + * @var string the default layout for the controller view. Defaults to '//layouts/column1', + * meaning using a single column layout. See 'protected/views/layouts/column1.php'. + */ + public $layout='//layouts/column1'; + /** + * @var array context menu items. This property will be assigned to {@link CMenu::items}. + */ + public $menu=array(); + /** + * @var array the breadcrumbs of the current page. The value of this property will + * be assigned to {@link CBreadcrumbs::links}. Please refer to {@link CBreadcrumbs::links} + * for more details on how to specify this property. + */ + public $breadcrumbs=array(); +}
\ No newline at end of file diff --git a/framework/cli/views/webapp/protected/components/UserIdentity.php b/framework/cli/views/webapp/protected/components/UserIdentity.php new file mode 100644 index 0000000..a9704e5 --- /dev/null +++ b/framework/cli/views/webapp/protected/components/UserIdentity.php @@ -0,0 +1,33 @@ +<?php + +/** + * UserIdentity represents the data needed to identity a user. + * It contains the authentication method that checks if the provided + * data can identity the user. + */ +class UserIdentity extends CUserIdentity +{ + /** + * Authenticates a user. + * The example implementation makes sure if the username and password + * are both 'demo'. + * In practical applications, this should be changed to authenticate + * against some persistent user identity storage (e.g. database). + * @return boolean whether authentication succeeds. + */ + public function authenticate() + { + $users=array( + // username => password + 'demo'=>'demo', + 'admin'=>'admin', + ); + if(!isset($users[$this->username])) + $this->errorCode=self::ERROR_USERNAME_INVALID; + else if($users[$this->username]!==$this->password) + $this->errorCode=self::ERROR_PASSWORD_INVALID; + else + $this->errorCode=self::ERROR_NONE; + return !$this->errorCode; + } +}
\ No newline at end of file diff --git a/framework/cli/views/webapp/protected/config/console.php b/framework/cli/views/webapp/protected/config/console.php new file mode 100644 index 0000000..15c9353 --- /dev/null +++ b/framework/cli/views/webapp/protected/config/console.php @@ -0,0 +1,24 @@ +<?php + +// This is the configuration for yiic console application. +// Any writable CConsoleApplication properties can be configured here. +return array( + 'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..', + 'name'=>'My Console Application', + // application components + 'components'=>array( + 'db'=>array( + 'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db', + ), + // uncomment the following to use a MySQL database + /* + 'db'=>array( + 'connectionString' => 'mysql:host=localhost;dbname=testdrive', + 'emulatePrepare' => true, + 'username' => 'root', + 'password' => '', + 'charset' => 'utf8', + ), + */ + ), +);
\ No newline at end of file diff --git a/framework/cli/views/webapp/protected/config/main.php b/framework/cli/views/webapp/protected/config/main.php new file mode 100644 index 0000000..9e840e4 --- /dev/null +++ b/framework/cli/views/webapp/protected/config/main.php @@ -0,0 +1,90 @@ +<?php + +// uncomment the following to define a path alias +// Yii::setPathOfAlias('local','path/to/local-folder'); + +// This is the main Web application configuration. Any writable +// CWebApplication properties can be configured here. +return array( + 'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..', + 'name'=>'My Web Application', + + // preloading 'log' component + 'preload'=>array('log'), + + // autoloading model and component classes + 'import'=>array( + 'application.models.*', + 'application.components.*', + ), + + 'modules'=>array( + // uncomment the following to enable the Gii tool + /* + 'gii'=>array( + 'class'=>'system.gii.GiiModule', + 'password'=>'Enter Your Password Here', + // If removed, Gii defaults to localhost only. Edit carefully to taste. + 'ipFilters'=>array('127.0.0.1','::1'), + ), + */ + ), + + // application components + 'components'=>array( + 'user'=>array( + // enable cookie-based authentication + 'allowAutoLogin'=>true, + ), + // uncomment the following to enable URLs in path-format + /* + 'urlManager'=>array( + 'urlFormat'=>'path', + 'rules'=>array( + '<controller:\w+>/<id:\d+>'=>'<controller>/view', + '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>', + '<controller:\w+>/<action:\w+>'=>'<controller>/<action>', + ), + ), + */ + 'db'=>array( + 'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db', + ), + // uncomment the following to use a MySQL database + /* + 'db'=>array( + 'connectionString' => 'mysql:host=localhost;dbname=testdrive', + 'emulatePrepare' => true, + 'username' => 'root', + 'password' => '', + 'charset' => 'utf8', + ), + */ + 'errorHandler'=>array( + // use 'site/error' action to display errors + 'errorAction'=>'site/error', + ), + 'log'=>array( + 'class'=>'CLogRouter', + 'routes'=>array( + array( + 'class'=>'CFileLogRoute', + 'levels'=>'error, warning', + ), + // uncomment the following to show log messages on web pages + /* + array( + 'class'=>'CWebLogRoute', + ), + */ + ), + ), + ), + + // application-level parameters that can be accessed + // using Yii::app()->params['paramName'] + 'params'=>array( + // this is used in contact page + 'adminEmail'=>'webmaster@example.com', + ), +);
\ No newline at end of file diff --git a/framework/cli/views/webapp/protected/config/test.php b/framework/cli/views/webapp/protected/config/test.php new file mode 100644 index 0000000..fd7085a --- /dev/null +++ b/framework/cli/views/webapp/protected/config/test.php @@ -0,0 +1,17 @@ +<?php + +return CMap::mergeArray( + require(dirname(__FILE__).'/main.php'), + array( + 'components'=>array( + 'fixture'=>array( + 'class'=>'system.test.CDbFixtureManager', + ), + /* uncomment the following to provide test database connection + 'db'=>array( + 'connectionString'=>'DSN for test database', + ), + */ + ), + ) +); diff --git a/framework/cli/views/webapp/protected/controllers/SiteController.php b/framework/cli/views/webapp/protected/controllers/SiteController.php new file mode 100644 index 0000000..8d3084c --- /dev/null +++ b/framework/cli/views/webapp/protected/controllers/SiteController.php @@ -0,0 +1,103 @@ +<?php + +class SiteController extends Controller +{ + /** + * Declares class-based actions. + */ + public function actions() + { + return array( + // captcha action renders the CAPTCHA image displayed on the contact page + 'captcha'=>array( + 'class'=>'CCaptchaAction', + 'backColor'=>0xFFFFFF, + ), + // page action renders "static" pages stored under 'protected/views/site/pages' + // They can be accessed via: index.php?r=site/page&view=FileName + 'page'=>array( + 'class'=>'CViewAction', + ), + ); + } + + /** + * This is the default 'index' action that is invoked + * when an action is not explicitly requested by users. + */ + public function actionIndex() + { + // renders the view file 'protected/views/site/index.php' + // using the default layout 'protected/views/layouts/main.php' + $this->render('index'); + } + + /** + * This is the action to handle external exceptions. + */ + public function actionError() + { + if($error=Yii::app()->errorHandler->error) + { + if(Yii::app()->request->isAjaxRequest) + echo $error['message']; + else + $this->render('error', $error); + } + } + + /** + * Displays the contact page + */ + public function actionContact() + { + $model=new ContactForm; + if(isset($_POST['ContactForm'])) + { + $model->attributes=$_POST['ContactForm']; + if($model->validate()) + { + $headers="From: {$model->email}\r\nReply-To: {$model->email}"; + mail(Yii::app()->params['adminEmail'],$model->subject,$model->body,$headers); + Yii::app()->user->setFlash('contact','Thank you for contacting us. We will respond to you as soon as possible.'); + $this->refresh(); + } + } + $this->render('contact',array('model'=>$model)); + } + + /** + * Displays the login page + */ + public function actionLogin() + { + $model=new LoginForm; + + // if it is ajax validation request + if(isset($_POST['ajax']) && $_POST['ajax']==='login-form') + { + echo CActiveForm::validate($model); + Yii::app()->end(); + } + + // collect user input data + if(isset($_POST['LoginForm'])) + { + $model->attributes=$_POST['LoginForm']; + // validate user input and redirect to the previous page if valid + if($model->validate() && $model->login()) + $this->redirect(Yii::app()->user->returnUrl); + } + // display the login form + $this->render('login',array('model'=>$model)); + } + + /** + * Logs out the current user and redirect to homepage. + */ + public function actionLogout() + { + Yii::app()->user->logout(); + $this->redirect(Yii::app()->homeUrl); + } +}
\ No newline at end of file diff --git a/framework/cli/views/webapp/protected/data/schema.mysql.sql b/framework/cli/views/webapp/protected/data/schema.mysql.sql new file mode 100644 index 0000000..32788bd --- /dev/null +++ b/framework/cli/views/webapp/protected/data/schema.mysql.sql @@ -0,0 +1,28 @@ +CREATE TABLE tbl_user ( + id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, + username VARCHAR(128) NOT NULL, + password VARCHAR(128) NOT NULL, + email VARCHAR(128) NOT NULL +); + +INSERT INTO tbl_user (username, password, email) VALUES ('test1', 'pass1', 'test1@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test2', 'pass2', 'test2@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test3', 'pass3', 'test3@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test4', 'pass4', 'test4@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test5', 'pass5', 'test5@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test6', 'pass6', 'test6@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test7', 'pass7', 'test7@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test8', 'pass8', 'test8@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test9', 'pass9', 'test9@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test10', 'pass10', 'test10@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test11', 'pass11', 'test11@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test12', 'pass12', 'test12@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test13', 'pass13', 'test13@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test14', 'pass14', 'test14@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test15', 'pass15', 'test15@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test16', 'pass16', 'test16@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test17', 'pass17', 'test17@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test18', 'pass18', 'test18@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test19', 'pass19', 'test19@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test20', 'pass20', 'test20@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test21', 'pass21', 'test21@example.com'); diff --git a/framework/cli/views/webapp/protected/data/schema.sqlite.sql b/framework/cli/views/webapp/protected/data/schema.sqlite.sql new file mode 100644 index 0000000..e5e0830 --- /dev/null +++ b/framework/cli/views/webapp/protected/data/schema.sqlite.sql @@ -0,0 +1,28 @@ +CREATE TABLE tbl_user ( + id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + username VARCHAR(128) NOT NULL, + password VARCHAR(128) NOT NULL, + email VARCHAR(128) NOT NULL +); + +INSERT INTO tbl_user (username, password, email) VALUES ('test1', 'pass1', 'test1@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test2', 'pass2', 'test2@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test3', 'pass3', 'test3@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test4', 'pass4', 'test4@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test5', 'pass5', 'test5@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test6', 'pass6', 'test6@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test7', 'pass7', 'test7@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test8', 'pass8', 'test8@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test9', 'pass9', 'test9@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test10', 'pass10', 'test10@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test11', 'pass11', 'test11@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test12', 'pass12', 'test12@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test13', 'pass13', 'test13@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test14', 'pass14', 'test14@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test15', 'pass15', 'test15@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test16', 'pass16', 'test16@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test17', 'pass17', 'test17@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test18', 'pass18', 'test18@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test19', 'pass19', 'test19@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test20', 'pass20', 'test20@example.com'); +INSERT INTO tbl_user (username, password, email) VALUES ('test21', 'pass21', 'test21@example.com'); diff --git a/framework/cli/views/webapp/protected/data/testdrive.db b/framework/cli/views/webapp/protected/data/testdrive.db Binary files differnew file mode 100644 index 0000000..0672b21 --- /dev/null +++ b/framework/cli/views/webapp/protected/data/testdrive.db diff --git a/framework/cli/views/webapp/protected/extensions/.yii b/framework/cli/views/webapp/protected/extensions/.yii new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/framework/cli/views/webapp/protected/extensions/.yii diff --git a/framework/cli/views/webapp/protected/messages/.yii b/framework/cli/views/webapp/protected/messages/.yii new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/framework/cli/views/webapp/protected/messages/.yii diff --git a/framework/cli/views/webapp/protected/migrations/.yii b/framework/cli/views/webapp/protected/migrations/.yii new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/framework/cli/views/webapp/protected/migrations/.yii diff --git a/framework/cli/views/webapp/protected/models/ContactForm.php b/framework/cli/views/webapp/protected/models/ContactForm.php new file mode 100644 index 0000000..86541cb --- /dev/null +++ b/framework/cli/views/webapp/protected/models/ContactForm.php @@ -0,0 +1,42 @@ +<?php + +/** + * ContactForm class. + * ContactForm is the data structure for keeping + * contact form data. It is used by the 'contact' action of 'SiteController'. + */ +class ContactForm extends CFormModel +{ + public $name; + public $email; + public $subject; + public $body; + public $verifyCode; + + /** + * Declares the validation rules. + */ + public function rules() + { + return array( + // name, email, subject and body are required + array('name, email, subject, body', 'required'), + // email has to be a valid email address + array('email', 'email'), + // verifyCode needs to be entered correctly + array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()), + ); + } + + /** + * Declares customized attribute labels. + * If not declared here, an attribute would have a label that is + * the same as its name with the first letter in upper case. + */ + public function attributeLabels() + { + return array( + 'verifyCode'=>'Verification Code', + ); + } +}
\ No newline at end of file diff --git a/framework/cli/views/webapp/protected/models/LoginForm.php b/framework/cli/views/webapp/protected/models/LoginForm.php new file mode 100644 index 0000000..eb36e4a --- /dev/null +++ b/framework/cli/views/webapp/protected/models/LoginForm.php @@ -0,0 +1,77 @@ +<?php + +/** + * LoginForm class. + * LoginForm is the data structure for keeping + * user login form data. It is used by the 'login' action of 'SiteController'. + */ +class LoginForm extends CFormModel +{ + public $username; + public $password; + public $rememberMe; + + private $_identity; + + /** + * Declares the validation rules. + * The rules state that username and password are required, + * and password needs to be authenticated. + */ + public function rules() + { + return array( + // username and password are required + array('username, password', 'required'), + // rememberMe needs to be a boolean + array('rememberMe', 'boolean'), + // password needs to be authenticated + array('password', 'authenticate'), + ); + } + + /** + * Declares attribute labels. + */ + public function attributeLabels() + { + return array( + 'rememberMe'=>'Remember me next time', + ); + } + + /** + * Authenticates the password. + * This is the 'authenticate' validator as declared in rules(). + */ + public function authenticate($attribute,$params) + { + if(!$this->hasErrors()) + { + $this->_identity=new UserIdentity($this->username,$this->password); + if(!$this->_identity->authenticate()) + $this->addError('password','Incorrect username or password.'); + } + } + + /** + * Logs in the user using the given username and password in the model. + * @return boolean whether login is successful + */ + public function login() + { + if($this->_identity===null) + { + $this->_identity=new UserIdentity($this->username,$this->password); + $this->_identity->authenticate(); + } + if($this->_identity->errorCode===UserIdentity::ERROR_NONE) + { + $duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days + Yii::app()->user->login($this->_identity,$duration); + return true; + } + else + return false; + } +} diff --git a/framework/cli/views/webapp/protected/runtime/.yii b/framework/cli/views/webapp/protected/runtime/.yii new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/framework/cli/views/webapp/protected/runtime/.yii diff --git a/framework/cli/views/webapp/protected/tests/WebTestCase.php b/framework/cli/views/webapp/protected/tests/WebTestCase.php new file mode 100644 index 0000000..d252bba --- /dev/null +++ b/framework/cli/views/webapp/protected/tests/WebTestCase.php @@ -0,0 +1,25 @@ +<?php + +/** + * Change the following URL based on your server configuration + * Make sure the URL ends with a slash so that we can use relative URLs in test cases + */ +define('TEST_BASE_URL','http://localhost/testdrive/index-test.php/'); + +/** + * The base class for functional test cases. + * In this class, we set the base URL for the test application. + * We also provide some common methods to be used by concrete test classes. + */ +class WebTestCase extends CWebTestCase +{ + /** + * Sets up before each test method runs. + * This mainly sets the base URL for the test application. + */ + protected function setUp() + { + parent::setUp(); + $this->setBrowserUrl(TEST_BASE_URL); + } +} diff --git a/framework/cli/views/webapp/protected/tests/bootstrap.php b/framework/cli/views/webapp/protected/tests/bootstrap.php new file mode 100644 index 0000000..4404cac --- /dev/null +++ b/framework/cli/views/webapp/protected/tests/bootstrap.php @@ -0,0 +1,10 @@ +<?php + +// change the following paths if necessary +$yiit=dirname(__FILE__).'/../../../framework/yiit.php'; +$config=dirname(__FILE__).'/../config/test.php'; + +require_once($yiit); +require_once(dirname(__FILE__).'/WebTestCase.php'); + +Yii::createWebApplication($config); diff --git a/framework/cli/views/webapp/protected/tests/fixtures/.yii b/framework/cli/views/webapp/protected/tests/fixtures/.yii new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/framework/cli/views/webapp/protected/tests/fixtures/.yii diff --git a/framework/cli/views/webapp/protected/tests/functional/SiteTest.php b/framework/cli/views/webapp/protected/tests/functional/SiteTest.php new file mode 100644 index 0000000..cb9727c --- /dev/null +++ b/framework/cli/views/webapp/protected/tests/functional/SiteTest.php @@ -0,0 +1,47 @@ +<?php + +class SiteTest extends WebTestCase +{ + public function testIndex() + { + $this->open(''); + $this->assertTextPresent('Welcome'); + } + + public function testContact() + { + $this->open('?r=site/contact'); + $this->assertTextPresent('Contact Us'); + $this->assertElementPresent('name=ContactForm[name]'); + + $this->type('name=ContactForm[name]','tester'); + $this->type('name=ContactForm[email]','tester@example.com'); + $this->type('name=ContactForm[subject]','test subject'); + $this->click("//input[@value='Submit']"); + $this->waitForTextPresent('Body cannot be blank.'); + } + + public function testLoginLogout() + { + $this->open(''); + // ensure the user is logged out + if($this->isTextPresent('Logout')) + $this->clickAndWait('link=Logout (demo)'); + + // test login process, including validation + $this->clickAndWait('link=Login'); + $this->assertElementPresent('name=LoginForm[username]'); + $this->type('name=LoginForm[username]','demo'); + $this->click("//input[@value='Login']"); + $this->waitForTextPresent('Password cannot be blank.'); + $this->type('name=LoginForm[password]','demo'); + $this->clickAndWait("//input[@value='Login']"); + $this->assertTextNotPresent('Password cannot be blank.'); + $this->assertTextPresent('Logout'); + + // test logout process + $this->assertTextNotPresent('Login'); + $this->clickAndWait('link=Logout (demo)'); + $this->assertTextPresent('Login'); + } +} diff --git a/framework/cli/views/webapp/protected/tests/phpunit.xml b/framework/cli/views/webapp/protected/tests/phpunit.xml new file mode 100644 index 0000000..22c96ff --- /dev/null +++ b/framework/cli/views/webapp/protected/tests/phpunit.xml @@ -0,0 +1,13 @@ +<phpunit bootstrap="bootstrap.php" + colors="false" + convertErrorsToExceptions="true" + convertNoticesToExceptions="true" + convertWarningsToExceptions="true" + stopOnFailure="false"> + + <selenium> + <browser name="Internet Explorer" browser="*iexplore" /> + <browser name="Firefox" browser="*firefox" /> + </selenium> + +</phpunit>
\ No newline at end of file diff --git a/framework/cli/views/webapp/protected/tests/report/.yii b/framework/cli/views/webapp/protected/tests/report/.yii new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/framework/cli/views/webapp/protected/tests/report/.yii diff --git a/framework/cli/views/webapp/protected/tests/unit/.yii b/framework/cli/views/webapp/protected/tests/unit/.yii new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/framework/cli/views/webapp/protected/tests/unit/.yii diff --git a/framework/cli/views/webapp/protected/views/layouts/column1.php b/framework/cli/views/webapp/protected/views/layouts/column1.php new file mode 100644 index 0000000..f70b154 --- /dev/null +++ b/framework/cli/views/webapp/protected/views/layouts/column1.php @@ -0,0 +1,5 @@ +<?php $this->beginContent('//layouts/main'); ?> +<div id="content"> + <?php echo $content; ?> +</div><!-- content --> +<?php $this->endContent(); ?>
\ No newline at end of file diff --git a/framework/cli/views/webapp/protected/views/layouts/column2.php b/framework/cli/views/webapp/protected/views/layouts/column2.php new file mode 100644 index 0000000..e435a69 --- /dev/null +++ b/framework/cli/views/webapp/protected/views/layouts/column2.php @@ -0,0 +1,21 @@ +<?php $this->beginContent('//layouts/main'); ?> +<div class="span-19"> + <div id="content"> + <?php echo $content; ?> + </div><!-- content --> +</div> +<div class="span-5 last"> + <div id="sidebar"> + <?php + $this->beginWidget('zii.widgets.CPortlet', array( + 'title'=>'Operations', + )); + $this->widget('zii.widgets.CMenu', array( + 'items'=>$this->menu, + 'htmlOptions'=>array('class'=>'operations'), + )); + $this->endWidget(); + ?> + </div><!-- sidebar --> +</div> +<?php $this->endContent(); ?>
\ No newline at end of file diff --git a/framework/cli/views/webapp/protected/views/layouts/main.php b/framework/cli/views/webapp/protected/views/layouts/main.php new file mode 100644 index 0000000..f2ff75a --- /dev/null +++ b/framework/cli/views/webapp/protected/views/layouts/main.php @@ -0,0 +1,58 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <meta name="language" content="en" /> + + <!-- blueprint CSS framework --> + <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/screen.css" media="screen, projection" /> + <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/print.css" media="print" /> + <!--[if lt IE 8]> + <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/ie.css" media="screen, projection" /> + <![endif]--> + + <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/main.css" /> + <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/form.css" /> + + <title><?php echo CHtml::encode($this->pageTitle); ?></title> +</head> + +<body> + +<div class="container" id="page"> + + <div id="header"> + <div id="logo"><?php echo CHtml::encode(Yii::app()->name); ?></div> + </div><!-- header --> + + <div id="mainmenu"> + <?php $this->widget('zii.widgets.CMenu',array( + 'items'=>array( + array('label'=>'Home', 'url'=>array('/site/index')), + array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')), + array('label'=>'Contact', 'url'=>array('/site/contact')), + array('label'=>'Login', 'url'=>array('/site/login'), 'visible'=>Yii::app()->user->isGuest), + array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest) + ), + )); ?> + </div><!-- mainmenu --> + <?php if(isset($this->breadcrumbs)):?> + <?php $this->widget('zii.widgets.CBreadcrumbs', array( + 'links'=>$this->breadcrumbs, + )); ?><!-- breadcrumbs --> + <?php endif?> + + <?php echo $content; ?> + + <div class="clear"></div> + + <div id="footer"> + Copyright © <?php echo date('Y'); ?> by My Company.<br/> + All Rights Reserved.<br/> + <?php echo Yii::powered(); ?> + </div><!-- footer --> + +</div><!-- page --> + +</body> +</html> diff --git a/framework/cli/views/webapp/protected/views/site/contact.php b/framework/cli/views/webapp/protected/views/site/contact.php new file mode 100644 index 0000000..51f90a9 --- /dev/null +++ b/framework/cli/views/webapp/protected/views/site/contact.php @@ -0,0 +1,81 @@ +<?php +$this->pageTitle=Yii::app()->name . ' - Contact Us'; +$this->breadcrumbs=array( + 'Contact', +); +?> + +<h1>Contact Us</h1> + +<?php if(Yii::app()->user->hasFlash('contact')): ?> + +<div class="flash-success"> + <?php echo Yii::app()->user->getFlash('contact'); ?> +</div> + +<?php else: ?> + +<p> +If you have business inquiries or other questions, please fill out the following form to contact us. Thank you. +</p> + +<div class="form"> + +<?php $form=$this->beginWidget('CActiveForm', array( + 'id'=>'contact-form', + 'enableClientValidation'=>true, + 'clientOptions'=>array( + 'validateOnSubmit'=>true, + ), +)); ?> + + <p class="note">Fields with <span class="required">*</span> are required.</p> + + <?php echo $form->errorSummary($model); ?> + + <div class="row"> + <?php echo $form->labelEx($model,'name'); ?> + <?php echo $form->textField($model,'name'); ?> + <?php echo $form->error($model,'name'); ?> + </div> + + <div class="row"> + <?php echo $form->labelEx($model,'email'); ?> + <?php echo $form->textField($model,'email'); ?> + <?php echo $form->error($model,'email'); ?> + </div> + + <div class="row"> + <?php echo $form->labelEx($model,'subject'); ?> + <?php echo $form->textField($model,'subject',array('size'=>60,'maxlength'=>128)); ?> + <?php echo $form->error($model,'subject'); ?> + </div> + + <div class="row"> + <?php echo $form->labelEx($model,'body'); ?> + <?php echo $form->textArea($model,'body',array('rows'=>6, 'cols'=>50)); ?> + <?php echo $form->error($model,'body'); ?> + </div> + + <?php if(CCaptcha::checkRequirements()): ?> + <div class="row"> + <?php echo $form->labelEx($model,'verifyCode'); ?> + <div> + <?php $this->widget('CCaptcha'); ?> + <?php echo $form->textField($model,'verifyCode'); ?> + </div> + <div class="hint">Please enter the letters as they are shown in the image above. + <br/>Letters are not case-sensitive.</div> + <?php echo $form->error($model,'verifyCode'); ?> + </div> + <?php endif; ?> + + <div class="row buttons"> + <?php echo CHtml::submitButton('Submit'); ?> + </div> + +<?php $this->endWidget(); ?> + +</div><!-- form --> + +<?php endif; ?>
\ No newline at end of file diff --git a/framework/cli/views/webapp/protected/views/site/error.php b/framework/cli/views/webapp/protected/views/site/error.php new file mode 100644 index 0000000..4607ff3 --- /dev/null +++ b/framework/cli/views/webapp/protected/views/site/error.php @@ -0,0 +1,12 @@ +<?php +$this->pageTitle=Yii::app()->name . ' - Error'; +$this->breadcrumbs=array( + 'Error', +); +?> + +<h2>Error <?php echo $code; ?></h2> + +<div class="error"> +<?php echo CHtml::encode($message); ?> +</div>
\ No newline at end of file diff --git a/framework/cli/views/webapp/protected/views/site/index.php b/framework/cli/views/webapp/protected/views/site/index.php new file mode 100644 index 0000000..b44b2e6 --- /dev/null +++ b/framework/cli/views/webapp/protected/views/site/index.php @@ -0,0 +1,16 @@ +<?php $this->pageTitle=Yii::app()->name; ?> + +<h1>Welcome to <i><?php echo CHtml::encode(Yii::app()->name); ?></i></h1> + +<p>Congratulations! You have successfully created your Yii application.</p> + +<p>You may change the content of this page by modifying the following two files:</p> +<ul> + <li>View file: <tt><?php echo __FILE__; ?></tt></li> + <li>Layout file: <tt><?php echo $this->getLayoutFile('main'); ?></tt></li> +</ul> + +<p>For more details on how to further develop this application, please read +the <a href="http://www.yiiframework.com/doc/">documentation</a>. +Feel free to ask in the <a href="http://www.yiiframework.com/forum/">forum</a>, +should you have any questions.</p>
\ No newline at end of file diff --git a/framework/cli/views/webapp/protected/views/site/login.php b/framework/cli/views/webapp/protected/views/site/login.php new file mode 100644 index 0000000..c53bf62 --- /dev/null +++ b/framework/cli/views/webapp/protected/views/site/login.php @@ -0,0 +1,49 @@ +<?php +$this->pageTitle=Yii::app()->name . ' - Login'; +$this->breadcrumbs=array( + 'Login', +); +?> + +<h1>Login</h1> + +<p>Please fill out the following form with your login credentials:</p> + +<div class="form"> +<?php $form=$this->beginWidget('CActiveForm', array( + 'id'=>'login-form', + 'enableClientValidation'=>true, + 'clientOptions'=>array( + 'validateOnSubmit'=>true, + ), +)); ?> + + <p class="note">Fields with <span class="required">*</span> are required.</p> + + <div class="row"> + <?php echo $form->labelEx($model,'username'); ?> + <?php echo $form->textField($model,'username'); ?> + <?php echo $form->error($model,'username'); ?> + </div> + + <div class="row"> + <?php echo $form->labelEx($model,'password'); ?> + <?php echo $form->passwordField($model,'password'); ?> + <?php echo $form->error($model,'password'); ?> + <p class="hint"> + Hint: You may login with <tt>demo/demo</tt> or <tt>admin/admin</tt>. + </p> + </div> + + <div class="row rememberMe"> + <?php echo $form->checkBox($model,'rememberMe'); ?> + <?php echo $form->label($model,'rememberMe'); ?> + <?php echo $form->error($model,'rememberMe'); ?> + </div> + + <div class="row buttons"> + <?php echo CHtml::submitButton('Login'); ?> + </div> + +<?php $this->endWidget(); ?> +</div><!-- form --> diff --git a/framework/cli/views/webapp/protected/views/site/pages/about.php b/framework/cli/views/webapp/protected/views/site/pages/about.php new file mode 100644 index 0000000..c6c05dc --- /dev/null +++ b/framework/cli/views/webapp/protected/views/site/pages/about.php @@ -0,0 +1,10 @@ +<?php +$this->pageTitle=Yii::app()->name . ' - About'; +$this->breadcrumbs=array( + 'About', +); +?> +<h1>About</h1> + +<p>This is a "static" page. You may change the content of this page +by updating the file <tt><?php echo __FILE__; ?></tt>.</p>
\ No newline at end of file diff --git a/framework/cli/views/webapp/protected/yiic b/framework/cli/views/webapp/protected/yiic new file mode 100644 index 0000000..7f56f54 --- /dev/null +++ b/framework/cli/views/webapp/protected/yiic @@ -0,0 +1,4 @@ +#!/usr/bin/env php +<?php + +require_once(dirname(__FILE__).'/yiic.php'); diff --git a/framework/cli/views/webapp/protected/yiic.bat b/framework/cli/views/webapp/protected/yiic.bat new file mode 100644 index 0000000..e8e4eda --- /dev/null +++ b/framework/cli/views/webapp/protected/yiic.bat @@ -0,0 +1,16 @@ +@echo off + +rem ------------------------------------------------------------- +rem Yii command line script for Windows. +rem This is the bootstrap script for running yiic on Windows. +rem ------------------------------------------------------------- + +@setlocal + +set BIN_PATH=%~dp0 + +if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe + +"%PHP_COMMAND%" "%BIN_PATH%yiic.php" %* + +@endlocal
\ No newline at end of file diff --git a/framework/cli/views/webapp/protected/yiic.php b/framework/cli/views/webapp/protected/yiic.php new file mode 100644 index 0000000..564d2f6 --- /dev/null +++ b/framework/cli/views/webapp/protected/yiic.php @@ -0,0 +1,7 @@ +<?php + +// change the following paths if necessary +$yiic=dirname(__FILE__).'/../../framework/yiic.php'; +$config=dirname(__FILE__).'/config/console.php'; + +require_once($yiic); |
