From: <pan...@us...> - 2008-10-05 16:03:07
|
Revision: 406 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=406&view=rev Author: panzaboi Date: 2008-10-05 15:18:47 +0000 (Sun, 05 Oct 2008) Log Message: ----------- See R405 Comment Added Paths: ----------- website/application/modules/ website/application/modules/acm/ website/application/modules/acm/controllers/ website/application/modules/acm/controllers/ArchieveController.php website/application/modules/acm/controllers/ErrorController.php website/application/modules/acm/controllers/IndexController.php website/application/modules/acm/models/ website/application/modules/acm/models/Archieve.php website/application/modules/acm/models/Form/ website/application/modules/acm/models/Form/Login.php website/application/modules/acm/models/Index.php website/application/modules/acm/views/ website/application/modules/acm/views/helpers/ website/application/modules/acm/views/scripts/ website/application/modules/acm/views/scripts/archieve/ website/application/modules/acm/views/scripts/archieve/entry.phtml website/application/modules/acm/views/scripts/archieve/index.phtml website/application/modules/acm/views/scripts/archieve/view.phtml website/application/modules/acm/views/scripts/error/ website/application/modules/acm/views/scripts/error/error.phtml website/application/modules/acm/views/scripts/index/ website/application/modules/acm/views/scripts/index/index.phtml website/application/modules/default/ website/application/modules/default/controllers/ website/application/modules/default/controllers/ErrorController.php website/application/modules/default/controllers/IndexController.php website/application/modules/default/views/ website/application/modules/default/views/helpers/ website/application/modules/default/views/scripts/ website/application/modules/default/views/scripts/error/ website/application/modules/default/views/scripts/error/error.phtml Removed Paths: ------------- website/application/default/ website/library/Ostacium/View/Helper/CurrentUrl.php Property Changed: ---------------- website/httpdocs/scripts/ Property changes on: website/application/modules ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/modules/acm ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/modules/acm/controllers ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/acm/controllers/ArchieveController.php =================================================================== --- website/application/modules/acm/controllers/ArchieveController.php (rev 0) +++ website/application/modules/acm/controllers/ArchieveController.php 2008-10-05 15:18:47 UTC (rev 406) @@ -0,0 +1,25 @@ +<?php + +class Acm_ArchieveController extends Ostacium_Controller_Action +{ + public function indexAction() + { + $this->view->challenges = $this->_model->getChallenges(); + } + + public function viewAction() + { + $id = $this->_getParam('id'); + $problem = $this->_model->get($id); + + if (!$problem) + return $this->_forward('index', null, null, $this->_getAllParams() + array('message' => 'noProblem')); + + $this->view->problem = $problem; + } + + public function submitAction() + { + + } +} \ No newline at end of file Added: website/application/modules/acm/controllers/ErrorController.php =================================================================== --- website/application/modules/acm/controllers/ErrorController.php (rev 0) +++ website/application/modules/acm/controllers/ErrorController.php 2008-10-05 15:18:47 UTC (rev 406) @@ -0,0 +1,37 @@ +<?php + +class ErrorController extends Ostacium_Controller_Action +{ + public function errorAction() + { + $this->getResponse()->clearBody(); + $error = $this->_getParam('error_handler'); + + switch ($error->type) { + case Ostacium_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER: + case Ostacium_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION: + $this->getResponse()->setHttpResponseCode(404); + + $this->view->msg = $this->view->translate('error_404'); + break; + case Ostacium_Controller_Plugin_ErrorHandler::EXCEPTION_NOTALLOWED: + $this->getResponse()->setHttpResponseCode(403); + + $this->view->msg = $this->view->translate('error_403'); + break; + default: + $this->view->msg = $this->view->translate('error_other'); + break; + } + + Zend_Registry::get('Zend_Log')->log('Type:'.$error->type.($error->exception ? "\nTrace:".$error->exception->getTraceAsString() : ""), Zend_Log::ERR); + + $this->view->env = $this->getInvokeArg('environment'); + $this->view->request = ($error->request ? $error->request : $this->getRequest()); + + if ($error->exception) + $this->view->exception = $error->exception; + else + $this->view->other_message = $this->_getParam('message'); + } +} \ No newline at end of file Added: website/application/modules/acm/controllers/IndexController.php =================================================================== --- website/application/modules/acm/controllers/IndexController.php (rev 0) +++ website/application/modules/acm/controllers/IndexController.php 2008-10-05 15:18:47 UTC (rev 406) @@ -0,0 +1,66 @@ +<?php + +class Acm_IndexController extends Ostacium_Controller_Action +{ + public function indexAction() + { + echo $this->getLoginForm(); + } + + public function loginAction() + { + $form = $this->getLoginForm(); + + if (!$this->getRequest()->isPost()) + { + return $this->_forward('index', null, null, $this->_getAllParams()); + } + + if (!$form->isValid($this->getRequest()->getPost())) + { + $this->view->form = $form; + $this->renderScript('layout/loginform.phtml', 'login'); + return $this->_forward('index'); + } + + $values = $form->getValues(); + + $result = $this->_model->authoricate($values); + + if (!$result) + { + $form->setDescription($this->view->translate('wrongEmailPwd')); + $this->view->form = $form; + //$this->renderScript('layout/loginform.phtml', 'login'); + + return $this->_forward('index'); + } + + $redirect = new Zend_Session_Namespace('Redirect'); + if ($redirect->to) + { + $this->getRequest()->setParam('redirect', $redirect->to); + $redirect->unsetAll(); + } + else + { + return $this->_redirect('/acm/index/index'); + } + + $this->_helper->getHelper('viewRenderer')->setNoRender(true); + } + + public function logoutAction() + { + Zend_Auth::getInstance()->clearIdentity(); + } + + protected function getLoginForm() + { + return new Form_Login(array( + 'action' => $this->getRequest()->getBaseUrl() . 'acm/index/login', + 'method' => 'post', + 'name' => 'loginform', + )); + } +} \ No newline at end of file Property changes on: website/application/modules/acm/models ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/acm/models/Archieve.php =================================================================== --- website/application/modules/acm/models/Archieve.php (rev 0) +++ website/application/modules/acm/models/Archieve.php 2008-10-05 15:18:47 UTC (rev 406) @@ -0,0 +1,27 @@ +<?php + +class Archieve extends Ostacium_Model +{ + public function getChallenges() + { + $challenges = new Challenges(); + return $challenges->getAll(); + } + + public function get($id) + { + $challenges = new Challenges(); + return $challenges->get($id); + } +} + +class Challenges extends Ostacium_Db_Table +{ + protected $_name = 'challenges'; + protected $_primary = 'id'; + + public function getAll() + { + return $this->select()->from($this)->where('enabled = ?', 1)->query()->fetchAll(); + } +} \ No newline at end of file Property changes on: website/application/modules/acm/models/Form ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/acm/models/Form/Login.php =================================================================== --- website/application/modules/acm/models/Form/Login.php (rev 0) +++ website/application/modules/acm/models/Form/Login.php 2008-10-05 15:18:47 UTC (rev 406) @@ -0,0 +1,80 @@ +<?php + +class Form_Login extends Zend_Dojo_Form +{ + public $elementDecorators = array( + 'DijitElement', + 'Errors', + array('Label', array('class' => 'overlabel')), + array('HtmlTag', array('tag' => 'div', 'class' => 'elcontainer')) + ); + + public $buttonDecorators = array( + 'DijitElement', + ); + + public function init() + { + $translate = Zend_Registry::get('Zend_Translate'); + //$this->addElementPrefixPath('Ostacium_Form', 'Ostacium/Form/'); + + $this->addElement('ValidationTextBox', 'username', array( + 'decorators' => $this->elementDecorators, + 'filters' => array('StringTrim', 'StringToLower'), + 'validators' => array( + array('StringLength', false, array(5, 50)), + ), + 'required' => true, + 'maxlength' => 50, + 'trim' => true, + 'lowercase' => true, + 'style' => 'height: 18px; width: 100px;', + 'regExp' => '[\S]{5,50}', + 'invalidMessage' => sprintf($translate->_('errorBetween'), 5, 50), + 'title' => 'Username', + 'label' => 'Username:', + )); + + + + $this->addElement('PasswordTextBox', 'password', array( + 'decorators' => $this->elementDecorators, + 'filters' => array('StringTrim'), + 'validators' => array( + 'Alnum', + array('StringLength', false, array(5, 32)), + ), + 'required' => true, + 'trim' => true, + 'style' => 'height: 18px; width: 100px;', + 'regExp' => '^[a-z0-9]{5,32}$', + 'invalidMessage' => sprintf($translate->_('errorBetween'), 5, 32), + 'title' => 'Password', + 'label' => 'Password:', + )); + + + + $this->addElement('SubmitButton', 'loginbutton', array( + 'decorators' => $this->buttonDecorators, + 'required' => false, + 'ignore' => true, + 'label' => 'Login', + )); + } + + public function loadDefaultDecorators() + { +// $this->setDecorators(array( +// 'FormElements', +// 'Form', +// array('Description', array('placement' => 'prepend', 'tag' => 'div', 'class' => 'error')), +// )); + + $this->setDecorators(array( + 'FormElements', + 'DijitForm', + array('Description', array('placement' => 'prepend', 'tag' => 'div', 'class' => 'error')), + )); + } +} \ No newline at end of file Added: website/application/modules/acm/models/Index.php =================================================================== --- website/application/modules/acm/models/Index.php (rev 0) +++ website/application/modules/acm/models/Index.php 2008-10-05 15:18:47 UTC (rev 406) @@ -0,0 +1,24 @@ +<?php + +class Index extends Ostacium_Model +{ + public function authoricate($login) + { + $auth = Zend_Auth::getInstance(); + $adapter = Zend_Registry::get('auth'); + $acl = Zend_Registry::get('acl'); + + $adapter->setIdentity($login['username']) + ->setCredential($login['password']); + + $result = $adapter->authenticate(); + + if ($result->isValid()) { + $row = $adapter->getResultRowObject(); + + $auth->getStorage()->write($row); + } + + return $result->isValid(); + } +} \ No newline at end of file Property changes on: website/application/modules/acm/views ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/modules/acm/views/helpers ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/modules/acm/views/scripts ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/modules/acm/views/scripts/archieve ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/acm/views/scripts/archieve/entry.phtml =================================================================== --- website/application/modules/acm/views/scripts/archieve/entry.phtml (rev 0) +++ website/application/modules/acm/views/scripts/archieve/entry.phtml 2008-10-05 15:18:47 UTC (rev 406) @@ -0,0 +1,18 @@ +<tr bgcolor="#f4f3f8" align="middle"> + <td style="border-left: 0px none; border-right: 1px solid rgb(196, 196, 219);"> + <a href="<?= $this->url( array('action' => 'view', 'id' => $this->id), null) ?>"><?= $this->id ?></a> + </td> + + <td align="left" style="border-left: 0px none; border-right: 1px solid rgb(196, 196, 219);"> + <a href="<?= $this->url( array('action' => 'view', 'id' => $this->id), null) ?>"><?= $this->name ?></a> + </td> + + <td style="border-left: 0px none; border-right: 1px solid rgb(196, 196, 219);"><?= $this->tries ?></td> + + <td style="border-left: 0px none; border-right: 1px solid rgb(196, 196, 219);"><?= $this->accepted ?></td> + + <td style="border-left: 0px none; border-right: 0px solid rgb(196, 196, 219);"> + <img height="17" width="22" alt="Здати" src="images/b_find.gif"/> + <img height="17" width="22" alt="Показати як здають" src="images/probstatus.png"/> + </td> +</tr> \ No newline at end of file Added: website/application/modules/acm/views/scripts/archieve/index.phtml =================================================================== --- website/application/modules/acm/views/scripts/archieve/index.phtml (rev 0) +++ website/application/modules/acm/views/scripts/archieve/index.phtml 2008-10-05 15:18:47 UTC (rev 406) @@ -0,0 +1,5 @@ +<table cellspacing="1" cellpadding="8" border="0" width="100%"><tbody><tr><td width="100%" valign="top" class="name"><table cellspacing="0" cellpadding="0" border="0" width="100%"><tbody><tr><td bgcolor="#d0d4de" width="4" class="name"><img height="18" width="4" src="http://web.archive.org/web/20070323032706/http://acm.lviv.ua/"/></td><td nowrap="" bgcolor="#122a5b" width="*" class="name"> <font color="#d4d0e2"><b><small>Набiр задач</small></b><small/></font></td><td nowrap="" bgcolor="#122a5b" align="right" class="name"> <font color="#d4d0e2"><b><small> 05:26 23 березня 2007 року </small></b><small/></font></td></tr></tbody></table> <table cellspacing="0" cellpadding="0" border="0" width="100%" summary=""><tbody><tr><td bgcolor="#f4f3f8" align="middle" colspan="14"><b>Архів задач</b></td></tr><tr><td bgcolor="#c4c4db" colspan="20"><img height="1" width="1" src="http://web.archive.org/web/20070323032706/http://acm.lviv.ua/" alt=""/></td></tr><tr bgcolor="#e1e1e1" align="middle"> +<th width="70">Задача</th><th align="left" width="*"> Назва</th><th width="70">Спробували</th><th width="70">Здали</th><th align="middle" width="70">Дії</th></tr><tr><td height="1" bgcolor="#c4c4db" colspan="20"><img height="1" width="1" src="http://web.archive.org/web/20070323032706/http://acm.lviv.ua/" alt=""/></td></tr> +<?= $this->partialLoop('archieve/entry.phtml', $this->challenges) ?> + +</table><br/></td></tr></table> \ No newline at end of file Added: website/application/modules/acm/views/scripts/archieve/view.phtml =================================================================== --- website/application/modules/acm/views/scripts/archieve/view.phtml (rev 0) +++ website/application/modules/acm/views/scripts/archieve/view.phtml 2008-10-05 15:18:47 UTC (rev 406) @@ -0,0 +1,5 @@ +<?php + +var_dump($this->problem); + +?> \ No newline at end of file Property changes on: website/application/modules/acm/views/scripts/error ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/acm/views/scripts/error/error.phtml =================================================================== --- website/application/modules/acm/views/scripts/error/error.phtml (rev 0) +++ website/application/modules/acm/views/scripts/error/error.phtml 2008-10-05 15:18:47 UTC (rev 406) @@ -0,0 +1,14 @@ +<h1>An error occurred</h1> +<h2><?= $this->msg ?></h2> +<? if ('development' == $this->env): ?> +<h3>Exception information:</h3> + <p> + <b>Message:</b> <?= $this->exception->getMessage() ?> + </p> + + <h3>Stack trace:</h3> + <pre><?= $this->exception->getTraceAsString() ?></pre> + + <h3>Request Parameters:</h3> + <pre><? var_dump($this->request->getParams()) ?></pre> +<? endif ?> Property changes on: website/application/modules/acm/views/scripts/index ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/acm/views/scripts/index/index.phtml =================================================================== --- website/application/modules/acm/views/scripts/index/index.phtml (rev 0) +++ website/application/modules/acm/views/scripts/index/index.phtml 2008-10-05 15:18:47 UTC (rev 406) @@ -0,0 +1 @@ +<table cellspacing="1" cellpadding="8" border="0" width="100%"><tbody><tr><td width="100%" valign="top" class="name"><table cellspacing="0" cellpadding="0" border="0" width="100%"><tbody><tr><td bgcolor="#d0d4de" width="4" class="name"><img height="18" width="4" src="http://web.archive.org/web/20070323032459/http://acm.lviv.ua/"/></td><td nowrap="" bgcolor="#122a5b" width="*" class="name"> <font color="#d4d0e2"><b><small>Про систему</small></b><small/></font></td><td nowrap="" bgcolor="#122a5b" align="right" class="name"> <font color="#d4d0e2"><b><small> 05:24 23 березня 2007 року </small></b><small/></font></td></tr></tbody></table> <p style="font-size: 20px; font-family: arial; text-align: center;"><b>ACM Contester</b></p><p align="justify" style="font-size: 20px; font-family: arial; text-align: justify;"><font size="3">Ми, команда розробників цієї системи, дуже раді вітати Вас - учасників цієї системи. </font></p><p align="justify" style="font-size: 20px; font-family: arial; text-align: justify;"><font size="3">Тут Ви маєте можливість спробувати свої сили у розв'язанні різних типів задач. Змагайтесь!!!</font></p><p> </p></td></tr></tbody></table> \ No newline at end of file Property changes on: website/application/modules/default ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/modules/default/controllers ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/default/controllers/ErrorController.php =================================================================== --- website/application/modules/default/controllers/ErrorController.php (rev 0) +++ website/application/modules/default/controllers/ErrorController.php 2008-10-05 15:18:47 UTC (rev 406) @@ -0,0 +1,37 @@ +<?php + +class ErrorController extends Ostacium_Controller_Action +{ + public function errorAction() + { + $this->getResponse()->clearBody(); + $error = $this->_getParam('error_handler'); + + switch ($error->type) { + case Ostacium_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER: + case Ostacium_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION: + $this->getResponse()->setHttpResponseCode(404); + + $this->view->msg = $this->view->translate('error_404'); + break; + case Ostacium_Controller_Plugin_ErrorHandler::EXCEPTION_NOTALLOWED: + $this->getResponse()->setHttpResponseCode(403); + + $this->view->msg = $this->view->translate('error_403'); + break; + default: + $this->view->msg = $this->view->translate('error_other'); + break; + } + + Zend_Registry::get('Zend_Log')->log('Type:'.$error->type.($error->exception ? "\nTrace:".$error->exception->getTraceAsString() : ""), Zend_Log::ERR); + + $this->view->env = $this->getInvokeArg('environment'); + $this->view->request = ($error->request ? $error->request : $this->getRequest()); + + if ($error->exception) + $this->view->exception = $error->exception; + else + $this->view->other_message = $this->_getParam('message'); + } +} \ No newline at end of file Added: website/application/modules/default/controllers/IndexController.php =================================================================== --- website/application/modules/default/controllers/IndexController.php (rev 0) +++ website/application/modules/default/controllers/IndexController.php 2008-10-05 15:18:47 UTC (rev 406) @@ -0,0 +1,11 @@ +<?php + +class IndexController extends Ostacium_Controller_Action +{ + public function indexAction() + { + $this->getHelper('viewRenderer')->setNoRender(true); + //return $this->_redirect('/acm/'); + var_dump($this->view->url()); + } +} \ No newline at end of file Property changes on: website/application/modules/default/views ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/modules/default/views/helpers ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/modules/default/views/scripts ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/modules/default/views/scripts/error ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/default/views/scripts/error/error.phtml =================================================================== --- website/application/modules/default/views/scripts/error/error.phtml (rev 0) +++ website/application/modules/default/views/scripts/error/error.phtml 2008-10-05 15:18:47 UTC (rev 406) @@ -0,0 +1,14 @@ +<h1>An error occurred</h1> +<h2><?= $this->msg ?></h2> +<? if ('development' == $this->env): ?> +<h3>Exception information:</h3> + <p> + <b>Message:</b> <?= ($this->exception ? $this->exception->getMessage() : ($this->other_message ? $this->other_message : $this->translate("unknownError"))) ?> + </p> + + <h3>Stack trace:</h3> + <pre><?= ($this->exception ? $this->exception->getTraceAsString() : "") ?></pre> + + <h3>Request Parameters:</h3> + <pre><? var_dump($this->request->getParams()) ?></pre> +<? endif ?> Property changes on: website/httpdocs/scripts ___________________________________________________________________ Added: svn:ignore + dojo dojox dijit util Deleted: website/library/Ostacium/View/Helper/CurrentUrl.php =================================================================== --- website/library/Ostacium/View/Helper/CurrentUrl.php 2008-10-05 15:06:51 UTC (rev 405) +++ website/library/Ostacium/View/Helper/CurrentUrl.php 2008-10-05 15:18:47 UTC (rev 406) @@ -1,13 +0,0 @@ -<?php - -class Ostacium_View_Helper_CurrentUrl -{ - public function currentUrl() - { - $request = Zend_Controller_Front::getInstance()->getRequest(); - - return $request->getBaseUrl() . ($request->getModuleName() != 'default' ? '/' . $request->getModuleName() : '' ) . '/' . $request->getControllerName() . '/' . $request->getActionName(); - } -} - -?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |