From: <pan...@us...> - 2008-09-18 14:16:16
|
Revision: 353 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=353&view=rev Author: panzaboi Date: 2008-09-18 21:16:26 +0000 (Thu, 18 Sep 2008) Log Message: ----------- Remove unneeded files Removed Paths: ------------- website/application/default/models/Card.php website/application/default/models/CardEffect.php website/application/default/models/EventHandler.php website/application/default/models/Field.php website/application/default/models/MonsterCard.php website/application/default/models/Player.php website/application/default/models/Que.php website/application/default/models/SpellCard.php Property Changed: ---------------- website/library/Zend/ Deleted: website/application/default/models/Card.php =================================================================== --- website/application/default/models/Card.php 2008-09-18 21:05:20 UTC (rev 352) +++ website/application/default/models/Card.php 2008-09-18 21:16:26 UTC (rev 353) @@ -1,58 +0,0 @@ -<?php - -class Card -{ - const CARDTYPE_MONSTER = "monster"; - const CARDTYPE_SPELL = "spell"; - const CARDTYPE_TRAP = "trap"; - - protected $name; - protected $description; - protected $reference; - protected $cardtype; - - protected $down = true; - - public function __construct($name, $description, $reference, $cardtype) - { - $this->name = $name; - $this->description = $description; - $this->reference = $reference; - $this->cardtype = strtolower($cardtype); - } - - public function getName() { return $this->name; } - public function getDescription() { return $this->description; } - public function getReference() { return $this->reference; } - public function getCardType() { return $this->cardtype; } - public function getFaceDown() { return $this->down; } - - public function setFaceDown($down) { $this->facedown = $down; } - -// public function onSet(){} -// public function onPlay(){} -// public function onFlip(){} -// -// public function onAlliedAttack(){} -// public function onAlliedDefend(){} -// -// public function onDestroy(){} -// public function onDestroyed(){} -// -// public function onAlliedDestroy(){} -// public function onAlliedDestroyed(){} -// -// public function onDraw(){} -// public function onStandby(){} -// public function onMain1(){} -// public function onBattle(){} -// public function onMain2(){} -// public function onEnd(){} - - public function __call($function, $args) - { - return false; - } -} - -?> \ No newline at end of file Deleted: website/application/default/models/CardEffect.php =================================================================== --- website/application/default/models/CardEffect.php 2008-09-18 21:05:20 UTC (rev 352) +++ website/application/default/models/CardEffect.php 2008-09-18 21:16:26 UTC (rev 353) @@ -1,47 +0,0 @@ -<?php - -class CardEffect extends Card -{ - protected $card; - - public function __construct(Card $card) - { - $this->card = $card; - } - - public function __call($function, $args) - { - return call_user_func_array(array($this->card, $function), $args); - } - - public function __get($name) - { - return $this->card->{$name}; - } - - public function __set($name, $value) - { - $this->card->{$name} = $value; - } - - /*********************************/ - - public function getName() { return $this->card->getName(); } - public function getDescription() { return $this->card->getDescription(); } - public function getNumber() { return $this->card->getNumber(); } - public function getCardType() { return $this->card->getCardType(); } - public function getFaceDown() { return $this->card->getFaceDown(); } - public function setFaceDown($down) { $this->card->setFaceDown($down); } - -// public function onSet() -// { -// return $this->card->onSet(); -// } -// -// public function onPlay() -// { -// return $this->card->onSet(); -// } -} - -?> \ No newline at end of file Deleted: website/application/default/models/EventHandler.php =================================================================== --- website/application/default/models/EventHandler.php 2008-09-18 21:05:20 UTC (rev 352) +++ website/application/default/models/EventHandler.php 2008-09-18 21:16:26 UTC (rev 353) @@ -1,26 +0,0 @@ -<?php - -class EventHandler -{ - const EVENT_PLAY = 1; - const EVENT_SET = 2; - - protected $registeredEvents = array(); - - public function registerEvent($event) - { - if ( !isset($this->registeredEvents[$event->type]) ) - { - $this->registeredEvents[$event->type][$event->id] = array($event); - } - } - - public function fireEvent($event) - { - if ( isset($this->registeredEvents[$event->type]) && isset($this->registeredEvents[$event->type][$event->id]) ) - { - $this->registeredEvents[$event->type][$event->id]->fire(); - } - } - -} \ No newline at end of file Deleted: website/application/default/models/Field.php =================================================================== --- website/application/default/models/Field.php 2008-09-18 21:05:20 UTC (rev 352) +++ website/application/default/models/Field.php 2008-09-18 21:16:26 UTC (rev 353) @@ -1,164 +0,0 @@ -<?php - -class Field extends Ostacium_Model -{ - const ERR_OK = 1; - const ERR_NOSPACE = 2; - const ERR_SPTAKEN = 3; - - const STATE_DRAW = 1; - const STATE_STANDBY = 2; - const STATE_MAIN1 = 3; - const STATE_BATTLE = 4; - const STATE_MAIN2 = 5; - const STATE_END = 6; - - protected $fieldcard = null; - - protected $currentPlayer = null; - protected $currentState = null; - - protected $numToState = array(1 => 'onDraw', 2 => 'onStandby', 3 => 'onMain1', 4 => 'onBattle', 5 => 'onMain2', 6 => 'onEnd'); - protected $numToStateName = array(1 => 'Draw', 2 => 'Stand-By', 3 => 'Main 1', 4 => 'Battle', 5 => 'Main 2', 6 => 'End'); - - protected $player1; - protected $player2; - - public function __construct($id = null) - { - parent::__construct(); - - $this->player1 = new Player(); - $this->player2 = new Player(); - - if ($id) - $this->_load($id); - } - - protected function _load($id) - { - $game = $this->_db->select()->from('games')->where('id = ?', $id)->query()->fetch(); - - foreach (array('player1', 'player2') as $player) - { - $this->{$player}->load($game[$player.'username'], $game[$player.'lifepoints'], $game[$player.'hand'], $game[$player.'cards'], $game[$player.'monsters'], $game[$player.'spells'], $game[$player.'fusion'], $game[$player.'grave']); - } - - $this->fieldcard = $game['fieldcard']; - } - - public function playCard($player, $card, $where) - { - if (($error = $this->{$player}->canSet($where, $card)) == ERR_OK) - { - $c =& $this->{$player}->playFromHand($where, $card); - // $this->addEvent($c, 'play'); - } - else return $error; - } - - public function setCard($player, $card, $where) - { - if (($error = $this->{$player}->canSet($where, $card)) == ERR_OK) - { - $c =& $this->{$player}->setFromHand($where, $card); - // $this->addEvent($c, 'play'); - } - else return $error; - } - - /******************************************************************************************************************/ - - protected function _getCurrentState($name = false) - { - if ($name) - return $this->numToStateName[$this->currentState]; - else - return $this->currentState; - } - - protected function _getNextState($name = false) - { - $st = ($this->currentState == STATE_END ? STATE_DRAW : $this->currentState + 1); - - if ($name) - return $this->numToStateName[$st]; - else - return $st; - } - - protected function _moveToNextState() - { - $this->currentState = ($this->currentState == STATE_END ? STATE_DRAW : $this->currentState + 1); - $this->{$this->numToState[$this->currentState]}(); - } - - protected function _getCurrentPlayer($obj = false) - { - if ($obj) - return $this->{$this->currentPlayer}; - else - return $this->currentPlayer; - } - - protected function _getNextPlayer($obj = false) - { - $pl = ($this->currentPlayer == 'player1' ? 'player2' : 'player1'); - - if ($obj) - return $this->{$pl}; - else - return $pl; - } - - protected function _getAllCards() - { - $c = $this->_getCurrentPlayer(); - $n = $this->_getNextPlayer(); - - return ($this->monsterzone[$c] + $this->spellzone[$c] + $this->monsterzone[$n] + $this->spellzone[$n]); - } - - /******************************************************************************************************************/ - - public function getEnemyPlayer() - { - $auth = Zend_Auth::getInstance(); - $me = $auth->getStorage()->read()->username; - - return ($me == $this->player1->getUsername() ? $this->player2 : $this->player1); - } - - public function getThisPlayer() - { - $auth = Zend_Auth::getInstance(); - $me = $auth->getStorage()->read()->username; - - return ($me == $this->player1->getUsername() ? $this->player1 : $this->player2); - } - - public function __call($function, $args) - { - if (substr($function, 0, 2) == 'on') - { - $cards = $this->_getAllCards(); - foreach ($cards as $key => $card) - { - try - { - $method = new ReflectionMethod(get_class($card), $function); - if ($method->getDeclaringClass() != 'Card' && $method->getStartLine() != $method->getEndLine()) - { - $method->invoke($card, $args); - } - } - catch(Exception $e) - { - return false; - } - } - } - } -} - -?> \ No newline at end of file Deleted: website/application/default/models/MonsterCard.php =================================================================== --- website/application/default/models/MonsterCard.php 2008-09-18 21:05:20 UTC (rev 352) +++ website/application/default/models/MonsterCard.php 2008-09-18 21:16:26 UTC (rev 353) @@ -1,105 +0,0 @@ -<?php - -class MonsterCard extends Card -{ -// const TYPE_Dragon = "Dragon"; -// const TYPE_Spellcaster = "Spellcaster"; -// const TYPE_Zombie = "Zombie"; -// const TYPE_Warrior = "Warrior"; -// const TYPE_BeastWarrior = "Beast-Warrior"; -// const TYPE_Beast = "Beast"; -// const TYPE_WingedBeast = "Winged Beast"; -// const TYPE_Fiend = "Fiend"; -// const TYPE_Fairy = "Fairy"; -// const TYPE_Insect = "Insect"; -// const TYPE_Dinosaur = "Dinosaur"; -// const TYPE_Reptile = "Reptile"; -// const TYPE_Fish = "Fish"; -// const TYPE_SeaSerpent = "Sea Serpent"; -// const TYPE_Machine = "Machine"; -// const TYPE_Thunder = "Thunder"; -// const TYPE_Aqua = "Aqua"; -// const TYPE_Pyro = "Pyro"; -// const TYPE_Rock = "Rock"; -// const TYPE_Plant = "Plant"; -// -// const SUB_Spirit = "Spirit"; -// const SUB_Gemini = "Gemini"; -// const SUB_Toon = "Toon"; -// const SUB_Union = "Union"; -// -// const ATTR_Dark = "Dark"; -// const ATTR_Earth = "Earth"; -// const ATTR_Fire = "Fire"; -// const ATTR_Light = "Light"; -// const ATTR_Water = "Water"; -// const ATTR_Wind = "Wind"; -// -// const MON_Normal = "Normal"; -// const MON_Effect = "Effect"; -// const MON_Fussion = "Fusion"; -// const MON_Ritual = "Ritual"; -// -// const EFF_NoEffect = "No Effect"; -// const EFF_Flip = "Flip Effect"; -// const EFF_Continious = "Continuous Effect"; -// const EFF_Ignition = "Ignition Effect"; -// const EFF_Trigger = "Trigger Effect"; -// const EFF_MultiTrig = "Multi-Trigger Effect"; - - const MODE_ATTACK = "Attack"; - const MODE_DEFENCE = "Defence"; - - protected $level; - protected $attribute; - protected $type; - protected $subtype; - protected $card; - protected $atk; - protected $def; - - protected $mode; - -/**************************************************/ - public function onAttack(){} - public function onDefend(){} - - public function onAlliedAttack(){} - public function onAlliedDefend(){} - - public function onDestroy(){} - public function onDestroyed(){} - - public function onAlliedDestroy(){} - public function onAlliedDestroyed(){} - - public function onTribute(){} -/**************************************************/ - public function getAttack() { return $this->atk; } - public function getDefence() { return $this->def; } - public function getLevel() { return $this->level; } - public function getAttribute() { return $this->attribute; } - public function getType() { return $this->type; } - public function getSubType() { return $this->subtype; } - - public function getMode() { return $this->mode; } - public function setMode($mode) { $this->mode = $mode; } -/**************************************************/ - public function __construct($options) - { - foreach ($options as $key => $value) - { - if ($key == 'name' || $key == 'description' || $key == 'reference' || $key == 'level' || $key == 'attribute' || $key == 'type' || $key == 'subtype' || $key == 'atk' || $key == 'def' || $key == 'cardtype') - { - $this->{$key} = $value; - } - } - } -/**************************************************/ - public function attach(SpellCard $card, $arguments) - { - return new $card($this, $arguments); - } -} - -?> \ No newline at end of file Deleted: website/application/default/models/Player.php =================================================================== --- website/application/default/models/Player.php 2008-09-18 21:05:20 UTC (rev 352) +++ website/application/default/models/Player.php 2008-09-18 21:16:26 UTC (rev 353) @@ -1,150 +0,0 @@ -<?php - -class Player extends Ostacium_Model -{ - protected $username; - protected $lifepoints; - - protected $hand = array(); - protected $monsterzone = array(); - protected $spellzone = array(); - protected $deckzone = array(); - protected $graveyard = array(); - protected $fusionzone = array(); - - public function __construct() - { - parent::__construct(); - -// if (true) -// $this->load(); - } - - public function load($username, $lifepoints, $handcards, $deck, $monsters, $spells, $fusion, $grave) - { - $this->username = $username; - $this->lifepoints = (int)$lifepoints; - - $hand = explode(";", $handcards); - $monsterzone = explode(";", $monsters); - $spellzone = explode(";", $spells); - $deckzone = explode(";", $deck); - $graveyard = explode(";", $grave); - $fusionzone = explode(";", $fusion); - - $toload = implode(', ', array_merge($hand, $monsterzone, $spellzone, $deckzone, $graveyard, $fusionzone)); - $temp = $this->_db->select()->from('cards')->joinLeft('cardtypes', 'cardtypes.id=cards.cardtype_id', 'cardtypes.name as cardtype')->where('cards.id IN ('.$toload.')')->query()->fetchAll(); - - $cards = array(); - - foreach ($temp as $card) - { - $cards[$card['id']] = $card; - } - - foreach (array('hand', 'monsterzone', 'spellzone', 'deckzone', 'graveyard', 'fusionzone') as $type) - { - foreach (${$type} as $card) - { - if ($card) - { - if (strtolower($cards[$card]['cardtype']) == Card::CARDTYPE_MONSTER) - { - $this->{$type}[] = new MonsterCard($cards[$card]); - } - else - { - $this->{$type}[] = new SpellCard($cards[$card]); - } - } - } - } - } - - public function canSet($where, $card) - { - $what = $this->peekHandCard($card)->getCardType(); - - if ($this->{'get'.ucfirst($what).'Count'}() == 5) return Field::ERR_NOSPACE; - elseif (isset($this->{$what.'zone'}[$where]) && $this->{$what.'zone'}[$where] instanceof Card) return Field::ERR_SPACETAKEN; - else return Field::ERR_OK; - } - - public function &setFromHand($where, $c) - { - $card = $this->getHandCard($c); - $this->{$card->getCardType().'zone'}[$where] = $card; - $card->setFaceDown(true); - - if ($card->getCardType() == Card::CARDTYPE_MONSTER) - $card->setMode(MonsterCard::MODE_DEFENCE); - - return $card; - } - - public function &playFromHand($where, $card) - { - $card = $this->getHandCard($c); - $this->{$card->getCardType().'zone'}[$where] = $card; - $card->setFaceDown(false); - - if ($card->getCardType() == Card::CARDTYPE_MONSTER) - $card->setMode(MonsterCard::MODE_ATTACK); - - return $card; - } - - public function peekHandCard($card) - { - if (isset($this->hand[$card]) && $this->hand[$card] instanceof Card) return $this->hand[$card]; - else return false; - } - - /****************************************************/ - - public function getMonsterCards() - { - return $this->monsterzone; - } - - public function getSpellCards() - { - return $this->spellzone; - } - - public function getUsername() - { - return $this->username; - } - - public function getMonsterCount() - { - return count($monsterzone); - } - - public function getSpellCount() - { - return count($monsterzone); - } - - public function getNextDeckCard() - { - return array_pop($this->deckzone); - } - - public function getHandCard($card) - { - if (isset($this->hand[$card]) && $this->hand[$card] instanceof Card) - { - $what = $this->hand[$card]; - unset($this->hand[$card]); - - return $what; - } - else return false; - } - - /****************************************************/ -} - -?> \ No newline at end of file Deleted: website/application/default/models/Que.php =================================================================== --- website/application/default/models/Que.php 2008-09-18 21:05:20 UTC (rev 352) +++ website/application/default/models/Que.php 2008-09-18 21:16:26 UTC (rev 353) @@ -1,19 +0,0 @@ -<?php - -class Que -{ - protected $que = array(); - - - public function add($item) - { - array_push($this->que, $item); - } - - public function process() - { - $que[0]->execute; - array_shift($que); - } - -} \ No newline at end of file Deleted: website/application/default/models/SpellCard.php =================================================================== --- website/application/default/models/SpellCard.php 2008-09-18 21:05:20 UTC (rev 352) +++ website/application/default/models/SpellCard.php 2008-09-18 21:16:26 UTC (rev 353) @@ -1,39 +0,0 @@ -<?php - -class SpellCard -{ -// const TYPE_Spell = "Spell"; -// const TYPE_Trap = "Trap"; -// -// const ATTR_NORMAL = "Normal"; -// const ATTR_EQUIP = "Equip"; -// const ATTR_FIELD = "Field"; -// const ATTR_QUICK = "Quick-Play"; -// const ATTR_RITUAL = "Ritual"; -// const ATTR_CONT = "Continuous"; -// const ATTR_COUNT = "Counter"; - /**************************************************/ - public function onBlock(){} - /**************************************************/ - - protected $type; - protected $attribute; - /**************************************************/ - public function getType() { return $this->type; } - public function getAttribute() { return $this->attribute; } - /**************************************************/ - public function __construct($options) - { - foreach ($options as $key => $value) - { - if ($key == 'name' || $key == 'description' || $key == 'number' || $key == 'level' || $key == 'attribute' || $key == 'type' || $key == 'atk' || $key == 'def' || $key == 'effect') - { - $this->{$key} = $value; - } - } - } - - /**************************************************/ -} - -?> \ No newline at end of file Property changes on: website/library/Zend ___________________________________________________________________ Added: svn:ignore + Auth Cache Config Console Controller Currency Date Db Feed Filter Form Gdata Http InfoCard Json Layout Ldap Loader Locale Log Mail Measure Memory Mime OpenId Pdf Request Rest Search Server Service Session TimeSync Translate Uri Validate View XmlRpc Acl.php Auth.php Cache.php Config.php Currency.php Date.php Db.php Debug.php Exception.php Feed.php Filter.php Form.php Gdata.php InfoCard.php Json.php Layout.php Ldap.php Loader.php Locale.php Log.php Mail.php Memory.php Mime.php OpenId.php Pdf.php Registry.php Session.php TimeSync.php Translate.php Uri.php Validate.php Version.php View.php Acl This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pan...@us...> - 2008-09-20 19:57:50
|
Revision: 359 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=359&view=rev Author: panzaboi Date: 2008-09-20 19:57:45 +0000 (Sat, 20 Sep 2008) Log Message: ----------- New Design Incorporated Modified Paths: -------------- website/application/default/controllers/IndexController.php website/application/default/layouts/layout.phtml website/config/config.ini website/httpdocs/scripts/main.js website/httpdocs/styles/style.css Added Paths: ----------- website/httpdocs/images/ website/httpdocs/images/arrow.gif website/httpdocs/images/arrow2.gif website/httpdocs/images/b_find.gif website/httpdocs/images/logo.gif website/httpdocs/images/logod.gif Modified: website/application/default/controllers/IndexController.php =================================================================== --- website/application/default/controllers/IndexController.php 2008-09-20 19:56:01 UTC (rev 358) +++ website/application/default/controllers/IndexController.php 2008-09-20 19:57:45 UTC (rev 359) @@ -29,15 +29,8 @@ echo $form; return; } - - return $this->_redirect('/index/board'); } - public function boardAction() - { - $this->view->field = new Field(1); - } - protected function getLoginForm() { return new LoginForm(array( Modified: website/application/default/layouts/layout.phtml =================================================================== --- website/application/default/layouts/layout.phtml 2008-09-20 19:56:01 UTC (rev 358) +++ website/application/default/layouts/layout.phtml 2008-09-20 19:57:45 UTC (rev 359) @@ -6,14 +6,79 @@ <?= $this->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8') ?> <?= $this->headLink()->appendStylesheet('styles/style.css') ?> - <?= $this->headLink()->appendStylesheet('styles/ie6.css', 'screen', 'IE 6') ?> - <?= $this->headLink()->appendStylesheet('styles/ie7.css', 'screen', 'IE 7') ?> + <?= /*$this->headLink()->appendStylesheet('styles/ie6.css', 'screen', 'IE 6')*/'' ?> + <?= /*$this->headLink()->appendStylesheet('styles/ie7.css', 'screen', 'IE 7')*/'' ?> <?= $this->headScript()->appendFile('/scripts/main.js') ?> </head> <body> - <div id="wrapper"> - <?= $this->layout()->content ?> - </div> + <table border="0" cellpadding="0" cellspacing="0" width="100%"> + <tr bgcolor="#122a5b"> + <td><img height="43" src="images/logo.gif" width="490"></td> + </tr> + <tr bgcolor="#e1e1e1"> + <td><img height=26 src="images/logod.gif" width="490"></td> + </tr> + <tr> + <td bgcolor=#122a5b colspan=2><img height=2 src="images/0.gif" width=1></td> + </tr> + </table> + <table border=0 cellpadding=0 cellspacing=0 width="100%" summary="" height="20%"> + <tr> + <td bgcolor=#e1e1e1 valign=top width="200"> + <table width="100%" border="0" cellpadding="0" cellspacing="5"> + <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="index/about">Що це за проект</a></td></tr> + <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="index/rule">Правила</a></td></tr> + <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="archieve/problemset">Набір завдань</a></td></tr> + <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="archieve/submit">Протестувати Розв'язок</a></td></tr> + <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="archieve/results">Результати Тестувань</a></td></tr> + <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="archieve/ranks">Рейтинг Учасників</a></td></tr> + <tr><td><hr></td></tr> + <!--<tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="contests.php">Змагання</a></td></tr> + <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="problemset.php">Завдання</a></td></tr> + <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="monitor.php">Монітор</a></td></tr> + <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="clar.php">Уточнення умов</a></td></tr>--> + </table> + + <table border=0 cellpadding=4 cellspacing=0 width="100%" summary=""> + <tr><td align=middle bgcolor=#122a5b><font color=#d4d0e2><b><small>вхід</small></b></font></td></tr> + <tr><td> + <form onsubmit="return checkform(this);" method="post" action="login.php?rid=45fed5d9b297f" style="margin:0"> + <input type="hidden" name="path" value="/"> + <table border=0 cellPadding=1 cellSpacing=0 summary="" width=100%> + <tr> + <td class=name nowrap><small><font color=#122a5b> логін:</font></small></td> + <td><input name=lgn style="height: 18px; width: 100px"></td> + <td> </td> + </tr> + <tr> + <td class=name nowrap><small><font color=#122a5b> пароль:</font></small></td> + <td><input name=pswd type=password style="height: 18px; width: 100px"></td> + <td><input name="login" src="images/b_find.gif" type="image"> + </tr> + </table> + </form> + +<CENTER><A href="register.php">Зареєструватись</a><BR><a href=createteam.php>Створити команду</a></CENTER> +</TABLE><TABLE border=0 cellPadding=4 cellSpacing=0 width="100%"> +<TR><TD align=middle bgColor=#122a5b> +<FONT color=#d4d0e2><B><SMALL>F.A.Q.</SMALL></B></FONT> +<TR><TD><TABLE border=0 cellPadding=0 cellSpacing=2 width="100%"><TR><TD><P>Мені здається що програма написана правильно, але система видає "Помилка під час виконання"... +<P>Якщо Ви використовуєте С++, і описали функцію void main(){...} - навіть якщо програма видасть +правильний результат, то система видасть "помилка під час виконання". Це пов'язано з тим, що +в такому випадку код завершення програми непердбачуваний, і практично ніколи небуває нульовим. +<BR>Для того, щоб програму Вам зарахувало (якщо все правильно), необхідно описувати основну +функцію як int main(){...} і обов'язково завершувати програму через return 0. +<TR><TD align=right><P><SMALL><A href="allfaq.php">[ Всі питання ]</p></SMALL></TABLE><TR><TD align=middle bgColor=#122a5b> +<FONT color=#d4d0e2> </FONT> +<TR><TD><TABLE border=0 cellPadding=0 cellSpacing=2 width="100%"><TR><TD align=center> + +</TABLE></TABLE><TD bgColor=#f4f3f8 vAlign=top height=100%><TABLE border=0 cellPadding=8 cellSpacing=1 width="100%"><TR><TD class=name vAlign=top width="100%"><TABLE border=0 cellPadding=0 cellSpacing=0 width="100%"><TR><TD bgColor=#d0d4de class=name width=4><IMG height=18 src="" width=4><TD nowrap bgColor=#122a5b class=name width=*> <FONT color=#d4d0e2><B><SMALL>Про систему</B></SMALL></FONT><TD nowrap bgColor=#122a5b class=name align=right> <FONT color=#d4d0e2><B><SMALL> 20:26 19 березня 2007 року </B></SMALL></FONT></TABLE><?= $this->layout()->content ?></table></table> +<TABLE> +<TR vAlign=Bottom><TABLE border=0 cellPadding=0 cellSpacing=0 width="100%" summary=""><TR bgColor=#122a5b><TD colSpan=3><IMG alt="" height=5 src="images/pixel.gif" width=1><TR bgColor=#122a5b><TD class=copyright>© 2004-2005, <a class=copyrightlink href="mailto: ac...@ia..."><B><FONT COLOR="#d1d1d1">A-S</FONT>tudio</B></A><TD align=middle><TD align=right class=copyright><A class=copyrightlink href="http://www.acm.lviv.ua">ACM Контестер</A><TR bgColor=#122a5b><TD colSpan=3><IMG alt="" height=5 src="images/pixel.gif" width=1></TABLE> </body> -</html> \ No newline at end of file +</html> + + + + Modified: website/config/config.ini =================================================================== --- website/config/config.ini 2008-09-20 19:56:01 UTC (rev 358) +++ website/config/config.ini 2008-09-20 19:57:45 UTC (rev 359) @@ -15,7 +15,7 @@ #auth.noauth.module = "default" auth.noauth.controller = "index" -auth.noauth.action = "login" +auth.noauth.action = "index" auth.noacl.module = "default" auth.noacl.controller = "error" @@ -30,7 +30,7 @@ lang.path = "lang/"; lang.default = "uk"; -title = "ACM" +title = "ACM Contester" titlesep = " - " [development: general] Property changes on: website/httpdocs/images/arrow.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: website/httpdocs/images/arrow2.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: website/httpdocs/images/b_find.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: website/httpdocs/images/logo.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: website/httpdocs/images/logod.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: website/httpdocs/scripts/main.js =================================================================== --- website/httpdocs/scripts/main.js 2008-09-20 19:56:01 UTC (rev 358) +++ website/httpdocs/scripts/main.js 2008-09-20 19:57:45 UTC (rev 359) @@ -0,0 +1 @@ +function checkForm(form){if(form.lgn.value.length<3){alert('Логін повинен мати як мінімум 3 символи!');return false;}} \ No newline at end of file Modified: website/httpdocs/styles/style.css =================================================================== --- website/httpdocs/styles/style.css 2008-09-20 19:56:01 UTC (rev 358) +++ website/httpdocs/styles/style.css 2008-09-20 19:57:45 UTC (rev 359) @@ -1,15 +1,124 @@ -* -{ - padding: 0; - margin: 0; +BODY { + BACKGROUND-COLOR: #ffffff; MARGIN: 0px } - -div#wrapper -{ - text-align: center; +BODY { + COLOR: #000000; FONT-FAMILY: verdana,arial,sans-serif; FONT-SIZE: 8pt } - -div#wrapper table#table -{ - margin: 0 auto; +TBODY { + COLOR: #000000; FONT-FAMILY: verdana,arial,sans-serif; FONT-SIZE: 8pt +} +COL { + COLOR: #000000; FONT-FAMILY: verdana,arial,sans-serif; FONT-SIZE: 8pt +} +COLGROUP { + COLOR: #000000; FONT-FAMILY: verdana,arial,sans-serif; FONT-SIZE: 8pt +} +TD { + COLOR: #000000; FONT-FAMILY: verdana,arial,sans-serif; FONT-SIZE: 8pt +} +P { + COLOR: #000000; FONT-FAMILY: verdana,arial,sans-serif; FONT-SIZE: 8pt +} +DIV { + COLOR: #000000; FONT-FAMILY: verdana,arial,sans-serif; FONT-SIZE: 8pt +} +TEXTAREA { + COLOR: #000000; FONT-FAMILY: verdana,arial,sans-serif; FONT-SIZE: 8pt +} +INPUT { + COLOR: #000000; FONT-FAMILY: verdana,arial,sans-serif; FONT-SIZE: 8pt +} +SELECT { + COLOR: #000000; FONT-FAMILY: verdana,arial,sans-serif; FONT-SIZE: 8pt +} +OPTION { + COLOR: #000000; FONT-FAMILY: verdana,arial,sans-serif; FONT-SIZE: 8pt +} +SMALL { + FONT-SIZE: 7pt +} +FORM { + MARGIN: 0px +} +A { + COLOR: #999999; TEXT-DECORATION: none +} +A:link { + COLOR: #999999; TEXT-DECORATION: none +} +A:visited { + COLOR: #999999; TEXT-DECORATION: none +} +A:hover { + COLOR: #122a5b; TEXT-DECORATION: underline +} +A:active { + COLOR: #122a5b; TEXT-DECORATION: none +} +A.staticmenu { + COLOR: #000000; FONT-WEIGHT: bold +} +A.staticmenu:link { + COLOR: #000000; FONT-WEIGHT: bold +} +A.staticmenu:visited { + COLOR: #000000; FONT-WEIGHT: bold +} +A.staticmenu:hover { + COLOR: #000000; FONT-WEIGHT: bold +} +A.staticmenu:active { + COLOR: #000000; FONT-WEIGHT: bold +} +LI { + COLOR: #000000; FONT-FAMILY: verdana,arial,sans-serif +} +.copyright { + COLOR: #ffffff; FONT-SIZE: 7pt; PADDING-LEFT: 10px; PADDING-RIGHT: 10px +} +A.copyrightlink { + COLOR: #edf0fc; FONT-SIZE: 7pt; FONT-WEIGHT: bold +} +A.copyrightlink:link { + COLOR: #edf0fc +} +A.copyrightlink:visited { + COLOR: #edf0fc +} +A.copyrightlink:hover { + COLOR: #edf0fc +} +A.copyrightlink:active { + COLOR: #edf0fc +} +.division { + BACKGROUND: #122a5b +} +.error { + COLOR: #ff0000; FONT-WEIGHT: bold +} +.header { + BACKGROUND: #122a5b; COLOR: #d4d0e2; FONT-SIZE: 7pt; FONT-STYLE: normal; FONT-VARIANT: normal; FONT-WEIGHT: bold; LINE-HEIGHT: normal; PADDING-LEFT: 10px +} +.pager { +} +.tablefix { + WIDTH: 520px +} +.tablevar { + WIDTH: 100% +} +.theme { + BACKGROUND: #edf0fc +} +.themesub { + BACKGROUND: #f4f3f8 +} +.themeother { + BACKGROUND: #f4f3f8 +} +.wtuheaders { + BACKGROUND: none transparent scroll repeat 0% 0% +} +.date { } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pan...@us...> - 2008-09-20 19:59:32
|
Revision: 360 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=360&view=rev Author: panzaboi Date: 2008-09-20 19:59:23 +0000 (Sat, 20 Sep 2008) Log Message: ----------- Small fixes. Added 2nd language Modified Paths: -------------- website/library/Application.php website/library/Ostacium/Controller/Action.php Added Paths: ----------- website/lang/en.csv website/lang/uk.csv Modified: website/library/Application.php =================================================================== --- website/library/Application.php 2008-09-20 19:57:45 UTC (rev 359) +++ website/library/Application.php 2008-09-20 19:59:23 UTC (rev 360) @@ -38,7 +38,10 @@ $this->setupRoutes($frontController); $frontController->dispatch(); } - catch (Exception $e) {/*var_dump($e);*/} + catch (Exception $e) + { + //var_dump($e); + } } protected function _initialize() @@ -76,9 +79,9 @@ // Setup Error Handler $frontController->registerPlugin(new Zend_Controller_Plugin_ErrorHandler(array( - 'module' => 'default', - 'controller' => 'error', - 'action' => 'error' + 'module' => $_config->auth->noacl->module, + 'controller' => $_config->auth->noacl->controller, + 'action' => $_config->auth->noacl->action ))); // Setup Languages @@ -196,11 +199,11 @@ $_config = Zend_Registry::get('config'); $_db = Zend_Registry::get('db'); - //$translate = new Zend_Translate('csv', $_config->lang->path . $_config->lang->default . '.csv', $_config->lang->default); - //$translate->addTranslation('path/to/other.csv', 'fr'); + $translate = new Zend_Translate('csv', $_config->lang->path . $_config->lang->default . '.csv', $_config->lang->default); + $translate->addTranslation($_config->lang->path . 'en.csv', 'en'); - //$translate->setLocale($_config->lang->default); - //Zend_Registry::set('Zend_Translate', $translate); + $translate->setLocale($_config->lang->default); + Zend_Registry::set('Zend_Translate', $translate); /**********************************************/ $user_messages = $_db->select()->from('messages')->query()->fetchAll(); Modified: website/library/Ostacium/Controller/Action.php =================================================================== --- website/library/Ostacium/Controller/Action.php 2008-09-20 19:57:45 UTC (rev 359) +++ website/library/Ostacium/Controller/Action.php 2008-09-20 19:59:23 UTC (rev 360) @@ -40,6 +40,7 @@ foreach ($params as $key => $value) { + if (is_array($value) || is_object($value)) continue; $from[] = ($key == 'controller' || $key == 'action' ? $value : $key . '-' . $value); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pan...@us...> - 2008-09-20 20:01:20
|
Revision: 362 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=362&view=rev Author: panzaboi Date: 2008-09-20 20:01:14 +0000 (Sat, 20 Sep 2008) Log Message: ----------- Added file to keep updated database structure. Added Paths: ----------- website/other/ website/other/db.sql Added: website/other/db.sql =================================================================== --- website/other/db.sql (rev 0) +++ website/other/db.sql 2008-09-20 20:01:14 UTC (rev 362) @@ -0,0 +1,1550 @@ +-- phpMyAdmin SQL Dump +-- version 2.11.7 +-- http://www.phpmyadmin.net +-- +-- Host: localhost +-- Generation Time: Sep 20, 2008 at 10:52 PM +-- Server version: 5.0.51 +-- PHP Version: 5.2.6 + +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; + +-- +-- Database: `acm` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `archieve_submits` +-- + +CREATE TABLE IF NOT EXISTS `archieve_submits` ( + `id` int(11) NOT NULL, + `username` varchar(50) NOT NULL, + `challengeid` int(11) NOT NULL, + `languageid` int(11) NOT NULL, + `state` int(11) NOT NULL, + `tests` int(11) NOT NULL, + `firsttest` tinyint(1) NOT NULL default '0', + `runtime` double NOT NULL, + `memory` int(11) NOT NULL, + `when` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `archieve_submits` +-- + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `challenges` +-- + +CREATE TABLE IF NOT EXISTS `challenges` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(200) NOT NULL, + `description` text NOT NULL, + `timelimit` double NOT NULL default '0', + `memorylimit` int(11) NOT NULL default '0', + `outputlimit` int(11) NOT NULL default '0', + `tries` int(11) NOT NULL default '0', + `accepted` int(11) NOT NULL default '0', + `author` varchar(50) character set latin1 NOT NULL, + `enabled` tinyint(1) NOT NULL default '1', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1195 ; + +-- +-- Dumping data for table `challenges` +-- + +INSERT INTO `challenges` (`id`, `name`, `description`, `timelimit`, `memorylimit`, `outputlimit`, `tries`, `accepted`, `author`, `enabled`) VALUES +(1000, 'Swap', '<P align=left><B>Завдання</B></P><P>Дано два цілих числа a та b. Написати програму, яка б міняла їхні значення місцями. Тобто після виконання програми замість а значення b, а замість b - а. <P><B>Вхідні дані</B></P><P>В єдиному рядку записано два числа - а та b. (-32000 < a, b < 32000). <P><B>Вихідні дані</B></P><P>Вивести в єдиний рядок через пропуск два числа: спочатку b, а потім a. <P><B>Приклад введення 1</B></P><P><PRE>1 2</PRE><P><B>Приклад виведення 1</B></P><P><PRE>2 1</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>2 3</PRE><P><B>Приклад виведення 2</B></P><P><PRE>3 2</PRE><BR>', 1000, 5120000, 204800, 0, 0, '', 1), +(1001, 'A in power k', '<P align=left><B>Завдання</B></P><P>Для заданого цілого а та натурального k обчислити a<SUP>k</SUP>.<P><B>Вхідні дані</B></P><P>В єдиному рядку записано два числа a та k (-32000 < a <= 32000, 0 < k < 32000).<P><B>Вихідні дані</B></P><P>Єдине число - відповідь. Гарантується, що відповідь не більша за 2*10<SUP>9</SUP>.<P><B>Приклад введення 1</B></P><P><PRE>1 1</PRE><P><B>Приклад виведення 1</B></P><P><PRE>1</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>2 3</PRE><P><B>Приклад виведення 2</B></P><P><PRE>8</PRE><BR>', 1000, 5120000, 204800, 0, 0, '', 1), +(1002, 'Послідовність Фібоначчі', '<P align=left><B>Завдання</B></P><P>Послідовність фібоначчі визначається наступним чином:<BR></P><UL><LI>a<SUB>0</SUB>=0;<LI>a<SUB>1</SUB>=1;<LI>a<SUB>k</SUB>=a<SUB>k-1</SUB> + a<SUB>k-2</SUB></LI></UL><BR><BR>Для заданого n знайти значення n-го елемента послідовності Фібоначчі (a<SUB>n</SUB>).<P><B>Вхідні дані</B></P><P>В єдиному рядку записане єдине число N (1 <= N <= 40).<P><B>Вихідні дані</B></P><P>Єдине число - відповідь.<P><B>Приклад введення 1</B></P><P><PRE>1</PRE><P><B>Приклад виведення 1</B></P><P><PRE>1</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>5</PRE><P><B>Приклад виведення 2</B></P><P><PRE>5</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>8</PRE><P><B>Приклад виведення 3</B></P><P><PRE>21</PRE><BR>', 1000, 5120000, 204800, 0, 0, '', 1), +(1003, 'Рукавички', '<P align=left><B>Завдання</B></P><P>Комірник видає по К рукавичок кожному робітнику. Тобто другий робітник отримає рукавички від (K+1)-шої до (2∙K)-ї включно, рукавички номер (2∙K+2) отримає третій робітник і для нього вони будуть другими.<P>Напишіть програму, яка за номером виданих рукавичок визначає номер робітника, якому їх видано та порядковий номер цих рукавичок в цього робітника<P><B>Вхідні дані</B></P><P>В єдиному рядку записано два числа - K та N. K - кількість рукавичок кожному робітнику, N - номер пари рукавичок (1 <= K <= 200, 1 <= N <= 20000) розділені пропуском.<P><B>Вихідні дані</B></P><P>Номер робітника та номер рукавичок в цього робітника, розділені пропуском.<P><B>Приклад введення 1</B></P><P><PRE>50 1</PRE><P><B>Приклад виведення 1</B></P><P><PRE>1 1</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>20 25</PRE><P><B>Приклад виведення 2</B></P><P><PRE>2 5</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>15 43</PRE><P><B>Приклад виведення 3</B></P><P><PRE>3 13</PRE><BR>', 1000, 5120000, 204800, 0, 0, '', 1), +(1004, 'Супер проста проблема', '<P align=left><B>Завдання</B></P><P>Знайти квадрат N-го простого числа.<P><B>Вхідні дані</B></P><P>В єдиному рядку записане єдине число N (1 <= N <= 100).<P><B>Вихідні дані</B></P><P>Єдине число - квадрат N-го простого числа<P><B>Приклад введення 1</B></P><P><PRE>1</PRE><P><B>Приклад виведення 1</B></P><P><PRE>4</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>2</PRE><P><B>Приклад виведення 2</B></P><P><PRE>9</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>5</PRE><P><B>Приклад виведення 3</B></P><P><PRE>121</PRE><BR>', 1000, 3072000, 204800, 0, 0, '', 1), +(1005, '0-1 проблема', '<P align=left><B>Завдання</B></P><P>Над рядочком 01 виконаємо наступні операції:<UL><LI>Скопіюємо в кінець рядочка самого себе (отримаємо 0101)<LI>В другій половині рядка всі 0 змінимо на 1, а всі 1 на 0 (отримаємо 0110)</LI></UL>Над рядочком 0110 виконаємо ті самі операції. Отримаємо 01101001. І т. д.Таким чином отримаємо нескінченний рядочок нулів та одиниць.Ваше завдання – знайти n-тий символ такого рядочка.<P><B>Вхідні дані</B></P><P>В єдиному рядку записане єдине число N (1 <= N <= 2000000000).<P><B>Вихідні дані</B></P><P>Єдиний символ, який буде на N-й позиції.<P><B>Приклад введення 1</B></P><P><PRE>1</PRE><P><B>Приклад виведення 1</B></P><P><PRE>0</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>2</PRE><P><B>Приклад виведення 2</B></P><P><PRE>1</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>5</PRE><P><B>Приклад виведення 3</B></P><P><PRE>1</PRE><BR>', 1000, 3072000, 2048, 0, 0, '', 1), +(1006, 'Одинадцять', '<P align=left><B>Завдання</B></P><P>Ваше завдання – визначити чи ділиться дане число на 11.<P><B>Вхідні дані</B></P><P>В єдиному рядку записане єдине число N (1 <= n). Число має не більше тисячі знаків.<P><B>Вихідні дані</B></P><P>Вам потрібно вивести “Yes” – якщо число ділиться на 11, і “No” – в протилежному випадку.<P><B>Приклад введення 1</B></P><P><PRE>323455693</PRE><P><B>Приклад виведення 1</B></P><P><PRE>Yes</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>5038297</PRE><P><B>Приклад виведення 2</B></P><P><PRE>Yes</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>112234</PRE><P><B>Приклад виведення 3</B></P><P><PRE>No</PRE><BR>', 1000, 3072000, 2048, 0, 0, '', 1), +(1007, 'Супер послідовність', '<P align=left><B>Завдання</B></P><P>Послідовність чисел a1, a2, … an називається супер послідовністю, якщо виконуються наступні умови:<UL><LI>0 < a1 < a2 < … < an<LI>жодне з чисел не є сумою двох або більше інших чисел</LI></UL><P><B>Вхідні дані</B></P><P>В єдиному рядку записане число N (1 <= n <= 50), далі задано N чисел, кожне з яких не менше 1 і не більше 1000.<P><B>Вихідні дані</B></P><P>Вам необхідно вивести “Yes” – якщо дано супер послідовність, “No” – в протилежному випадку.<P><B>Приклад введення 1</B></P><P><PRE>2 1 2</PRE><P><B>Приклад виведення 1</B></P><P><PRE>Yes</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>3 1 2 3</PRE><P><B>Приклад виведення 2</B></P><P><PRE>No</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>10 1 3 16 19 25 70 100 243 245 306</PRE><P><B>Приклад виведення 3</B></P><P><PRE>No</PRE><BR>', 1000, 3072000, 2048, 0, 0, '', 1), +(1008, 'Супер яйця', '<P align=left><B>Задання</B></P><P>Нехай у вас є n супер яєць і ви живете в k поверховому будинку. Вам необхідно визначити за найменшу кількість кидків найбільший номер поверху з якого кинуте вниз супер яйце не розбивається. Тобто, за яку найменшу кількість спроб можна визначити найвищий поверх, з якого супер яйце не розбивається. Зауважте, якщо в результаті деякої спроби яйце не розбилось, то воно може бути використане в наступних спробах.<P><B>Вхідні дані</B></P><P>В єдиному рядку записано 2 цілих числа N (N<=30)- кількість яєць та M (M<=2 000 000 000)- кількість поверхів.<P><B>Вихідні дані</B></P><P>У єдиному рядку треба вивести єдине число – мінімальна необхідна кількість спроб. Якщо необхідно більше 30 спроб виведіть -1.<P><B>Приклад введення 1</B></P><P><PRE>1 15</PRE><P><B>Приклад виведення 1</B></P><P><PRE>15</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>2 100</PRE><P><B>Приклад виведення 2</B></P><P><PRE>14</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>10 786599</PRE><P><B>Приклад виведення 3</B></P><P><PRE>21</PRE><BR><P><B>Приклад введення 4</B></P><P><PRE>4 786599</PRE><P><B>Приклад виведення 3</B></P><P><PRE>-1</PRE><BR>', 1000, 5120000, 2048, 0, 0, '', 1), +(1009, 'Супер карти', '<P align=left><B>Завдання</B></P><P>Дана колода впорядкованих супер карт від 1 до n. Верхня супер карта має номер 1, нижня – n. Поки в колоді є хоча б дві супер карти викидаємо верхню карту, а наступну ставимо вниз колоди.<P>Необхідно знайти номер супер карти, що залишиться.<P><B>Вхідні дані</B></P><P>В єдиному рядку записане єдине число N - число супер карт в колоді (1 <= n <= 1000000).<P><B>Вихідні дані</B></P><P>Єдине число - номер супер карти, що залишиться.<P><B>Приклад введення 1</B></P><P><PRE>7</PRE><P><B>Приклад виведення 1</B></P><P><PRE>6</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>19</PRE><P><B>Приклад виведення 2</B></P><P><PRE>6</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>10</PRE><P><B>Приклад виведення 3</B></P><P><PRE>4</PRE><BR><P><B>Приклад введення 4</B></P><P><PRE>6</PRE><P><B>Приклад виведення 4</B></P><P><PRE>4</PRE><BR>', 1000, 3072000, 2048, 0, 0, '', 1), +(1010, 'Остання проблема', '<P align=left><B>Завдання</B></P><P>Ваше завдання – визначити чи дане число N можна представити у вигляді суми двох простих чисел.<P><B>Вхідні дані</B></P><P>В єдиному рядку записане єдине число N (1 <= N <= 1000000).<P><B>Вихідні дані</B></P><P>Cума двох простих чисел, що рівна n, або -1, якщо такої не існує. В сумі перше число не більше другого і якщо існує декілька таких можливих сум – вивести ту, в якої перший доданок найменший.<P><B>Приклад введення 1</B></P><P><PRE>9</PRE><P><B>Приклад виведення 1</B></P><P><PRE>2+7</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>10</PRE><P><B>Приклад виведення 2</B></P><P><PRE>3+7</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>11</PRE><P><B>Приклад виведення 3</B></P><P><PRE>-1</PRE><BR>', 1000, 3072000, 2048, 0, 0, '', 1), +(1011, 'Медіанний фільтр', '<P align=left><B>Завдання</B></P><P>Медіаною у відсортованому по неспаданню масиву розмірності N називається елемент, який знаходиться у середній позиції масиву, тобто у позиції (N+1)/2 (цілочисельне ділення). <P>Медіанним фільтром для растрового зображення називається таке перетворення кожної точки, колір якої вибирається як медіана із множини точок з певного околу (радіусом R) цієї точки (квадратної області із центром у вибраній точці – розміри квадрата рівні [R+1+ R]×[ R+1+R]). Медіанний фільтр використовують для видалення дрібного шуму із зображення. На межі зображення точки, що виходять за межі, вважаються точками із кольором фону (абсолютне значення рівне нулю).<P>Для заданого малюнку прямокутної форми шириною W та висотою H знайдіть максимальне значення медіани для розміру околу R. Вважається, що малюнок монохромний із 256 градаціями одного кольору.<P><B>Вхідні дані</B></P><P>В першому рядку задані 3 числа: розмір околу R (1≤R≤20), H(1≤H≤400), W(1≤W≤250). В наступних H рядках знаходиться по W чисел розділених пропуском. Числа – це кольори відповідних точок.<P><B>Вихідні дані</B></P><P>Виведіть результат – максимальне значення медіани для заданого малюнку та радіусу.<P><B>Приклад введення</B></P><P><PRE>1 4 3</PRE><PRE>1 1 1</PRE><PRE>1 2 4</PRE><PRE>2 3 2</PRE><PRE>1 1 1</PRE><P><B>Приклад виведення</B></P><P><PRE>2</PRE>', 1500, 3072000, 204800, 0, 0, '', 1), +(1012, 'Дужки і Нобелівська премія', '<P align=left><B>Завдання</B></P><P>Директор однієї відомої програмістської фірми Білл (ви напевно його знаєте) захотів одержати Нобелівську премію. Для цього він запропонував додати в арифметичні вирази крім круглих дужок ще й квадратні, причому: спочатку виконуються обчислення в квадратних дужках, що стоять лівіше, потім в наступних квадратних і т.д.; в такому ж порядку виконуються обчислення в круглих дужках. Наприклад: у виразі порядок обчислення виразів в дужках такий: <CENTER><IMG src="/fusion/images/problems/1012/pic1.jpg"></CENTER><P>Працівники фірми встигнуть в запланований термін реалізувати тільки виконання всіх потрібних операцій в виразах без дужок. Тому пан Білл звернувся до нас за допомогою. Отже, ваше завдання таке: <BR>1) виведіть на екран "YES", якщо дужки у виразі розставлені правильно і "NO" в протилежному випадку;<BR>2) у випадку правильно розставлених дужок виведіть на екран через пропуск в окремому рядку для кожної пари дужок позиції їх розташування в заданому виразі, якщо він буде обчислюватися згідно описаних вище правил. <P><B>Вхідні дані</B></P><P>В першому рядку знаходиться вираз. Довжина рядка не перевищує 255 символів. <P><B>Вихідні дані</B></P><P>Результат виконання програми. <P><B>Приклад введення</B></P><P><PRE>а+(2-с)-[21-8*b+(-2)]+[3]</PRE><P><B>Приклад виведення</B></P><P><PRE>YES</PRE><PRE>17 20</PRE><PRE>9 21</PRE><PRE>23 25</PRE><PRE>3 7<BR></PRE>', 500, 3072000, 2048, 0, 0, '', 1), +(1013, 'Електронний пристрій', '<P align=left><B>Завдання</B></P><P>Одному визначному вченому майже вдалося побудувати новий електронний пристрій визначення поведінки погоди. Йому потрібна програма, яка б дозволяла аналізувати вміст результатів дослідження. Ваше завдання – допомогти йому. <P>Результати – це послідовність чисел (нуль або один). Вам потрібно дати відповідь чи всі числа рівні між і-тим та j-тим елементами послідовності включно. <P><B>Вхідні дані</B></P><P>В першому рядку задано число N(0 < N ≤ 3*10<SUP>5</SUP>) – кількість елементів послідовності. В другому рядку розділені пропуском записані елементи послідовності. В третьому рядку записано число M(0 < M ≤ 5*10<SUP>4</SUP>) – кількість запитань. Далі в M рядках розділені пропуском записані позиції і та j. <P><B>Вихідні дані</B></P><P>Потрібно вивести M чисел по одному в рядку. 1 в разі ствердної відповіді на запитання і 0 в протилежному випадку. <P><B>Приклад введення</B></P><P><PRE>10</PRE><PRE>1 0 0 1 0 0 0 1 1 1</PRE><PRE>4</PRE><PRE>1 3</PRE><PRE>2 3</PRE><PRE>8 10</PRE><PRE>5 8</PRE><P><B>Приклад виведення</B></P><P><PRE>0</PRE><PRE>1</PRE><PRE>1</PRE><PRE>0</PRE><BR>', 500, 3072000, 204800, 0, 0, '', 1), +(1014, 'Гра', '<P align=left><B>Завдання</B></P><P>Поле гри складається з N зрозміщених вряд одна за одною клітинок. На початку гри в першій і N-тій клітинці знаходяться дві фішки. Кожен з двох гравців може переміщувати свою фішку на не більше ніж K позицій вправо чи вліво. Забороняється залишатися на місці і перескакувати фішку суперника. Програє той, хто не може зробити хід. Напишіть програму, яка повідомить хто виграє, якщо кожен з гравців буде намагатись використовувати виграшну стратегію.<P><B>Вхідні дані</B></P><P>В єдиному рядку записано N(1 < N ≤ 500) та K(0 < K ≤ 50), які розділені пропуском.<P><B>Вихідні дані</B></P><P>Виведіть „1”, якщо переможе перший гравець та „2” в протилежному випадку.<P><B>Приклад введення</B></P><P><PRE>5 2</PRE><P><B>Приклад виведення</B></P><P><PRE>2</PRE><BR>', 500, 3072000, 2048, 0, 0, '', 1), +(1015, 'Числа Фібоначчі', '<P align=left><B>Завдання</B></P><P>Числа Фібоначчі визначаються рекурентною формулою:<BR></P><CENTER>f<SUB>0</SUB> = 0; f<SUB>1</SUB> = 1; f<SUB>n</SUB> = f<SUB>n-1</SUB> + f<SUB>n-2</SUB>;</CENTER><BR><P>Початок послідовності має вигляд 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ... . <P><B>Вхідні дані</B></P><P>В єдиному рядку знаходиться число N (0 ≤ N ≤ 10000).<P><B>Вихідні дані</B></P><P>Виведіть N-те число Фібоначчі.<P><B>Приклад введення</B></P><P><PRE>7</PRE><P><B>Приклад виведення</B></P><P><PRE>13</PRE><BR>', 500, 3072000, 204800, 0, 0, '', 1), +(1016, 'Скарб', '<P align=left><B>Завдання</B></P><P>Знайти закопаний піратами скарб дуже легко. Все що для цього необхідно - карта. Як відомо, пірати малюють карти від руки і описують алгоритм знаходження потрібного місця наступним чином: "Станьте біля одинокої пальми, пройдіть 30 кроків в сторону лісу, 15 в сторону озера, ..." <P>Вважається, що карта задана як послідовність переміщень по заданому напрямку (1 - північ, 2 - північний схід, 3 - схід, 4 - південний схід, 5 - південь, 6 - південний захід, 7 - захід, 8 - північний захід) в кроках (довжина кроку рівна 1) від початкової точки з координатами (0, 0).<P>Подорож по такому маршруту, зазвичай, є прекрасною можливістю оглянути місцевість, але в наш час ні в кого на це часу немає. Тому скарбошукачі попросили Вас написати програму, яка по заданій карті буде обчислювати місцезнаходження скарбу.<P><B>Вхідні дані</B></P><P>В першому рядку записане ціле число N - кількість переміщень (1 <= N <= 40). Наступні N рядків містять напрям (цифра від 1 до 8) та кількість кроків, які необхідно пройти у вказаному напрямку (ціле число від 1 до 1000). <P><B>Вихідні дані</B></P><P>В єдиному рядку записано два дійсні числа - координа X та Y місця, де закопаний скарб. Координати необхідно виводити через пропуск з 3-ма знаками після коми.<P><B>Приклад введення 1</B></P><P><PRE>6</PRE><PRE>1 3</PRE><PRE>3 1</PRE><PRE>1 1</PRE><PRE>3 3</PRE><PRE>5 2</PRE><PRE>7 1</PRE><P><B>Приклад виведення 1</B></P><P><PRE>3.000 2.000</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>1</PRE><PRE>8 10</PRE><P><B>Приклад виведення 2</B></P><P><PRE>-7.071 7.071</PRE><BR>', 1000, 3072000, 204800, 0, 0, '', 1), +(1017, 'Ланцюг', '<P align=left>Є N шматків ланцюга, кожен i-й з яких містить Li ланок. Можна розгинати довільні ланки та потім згинати їх знову, з’єднуючи окремі шматки.</P><P><B>Завдання</B></P><P>Напишіть програму, що за кількістю шматків ланцюга N та кількістю ланок у шматках Li визначає мінімальну кількість ланок, яку потрібно розігнути та зігнути знову, щоб з’єднати усі шматки в один ланцюг. Ланцюг не може мати розгалужень, тобто кожна його ланка повинна бути з’єднана з двома іншими ланками (крім двох ланок з країв ланцюга, що повинні бути з’єднані лише з однією ланкою).<P><B>Вхідні дані</B></P><P>В першому рядку знаходиться ціле число N (2 <= N <= 10 000). В другому рядку знаходяться N цілих чисел Li (1 <= Li <= 1 000 000 000), розділених пропуском. <P><B>Вихідні дані</B></P><P>В єдиному рядку повинно знаходитися ціле число — найменша кількість ланок, яку потрібно розігнути та зігнути знову, щоб отримати один ланцюг з усіх шматків.<P><B>Приклад введення</B></P><P><PRE>3</PRE><PRE>100 3 4</PRE><P><B>Приклад виведення</B></P><P><PRE>2</PRE><BR>', 500, 3072000, 204800, 0, 0, '', 1), +(1018, 'Ксорленд', '<P align=left><B>Завдання</B></P><P>В Національному університеті Ксорленду, названого на честь великого ученого Ксора, розробили нову криптосистему, яка, на їхню думку, повинна забезпечити найнадійніший захист електронних документів. У системі, ключі передаються відкрито. Щоб ключ не потрапив до рук сторонніх людей, разом з ключем передавали дуже багато інших псевдоключів. Перехопивши повідомлення, сторонні не могли визначити дійсний ключ. Перебирати всі ключі також не можливо, оскільки їх дуже багато. Ключ, та псевдоключі, є цілими невідємними 32-бітними числами.<P>На офіційній презентації криптосистеми розказали про те, як при отриманні повідомлення знаходиться ключ: кількість псевдоключів - парна кількість, і кожному псевдоключеві відповідає ще один такий самий псевдоключ. Справжньому ключеві пари немає. Отже загальна кількість ключів, які передаються разом із повідомленням, непарна. <P>Учені стверджують, що відшукання ключа серед псевдоключів вимагає декілька років і тому система надійна. Залишилась єдина незрозуміла річ: яким чином отримувач повідомлення знаходить ключ. <P>Ваше завдання: напишіть програму яка зможе відшукати дійсний ключ серед великої кількості псевдоключів.<P><B>Вхідні дані</B></P><P>В першому рядку задано N - кількість чисел (2 <= N <=3*10<SUP>10</SUP>). В кожному з наступних n рядків записано по одному ключу.<P><B>Вихідні дані</B></P><P>В єдиному рядку записане єдине число - потрібний ключ.<P><B>Приклад введення 1</B></P><P><PRE>5</PRE><PRE>1</PRE><PRE>3</PRE><PRE>2</PRE><PRE>1</PRE><PRE>2</PRE><P><B>Приклад виведення 1</B></P><P><PRE>3</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>5</PRE><PRE>1</PRE><PRE>1</PRE><PRE>1</PRE><PRE>1</PRE><PRE>1</PRE><P><B>Приклад виведення 2</B></P><P><PRE>1</PRE>', 20000, 3072000, 2048, 0, 0, '', 1), +(1019, 'Поле чудес', '<P><B>Завдання</B></P><P>Для гри у поле чудес використовується поділений на сектори круглий барабан і стрілка. На кожному секторі написане якесь число. У різних секторах можуть бути записані однакові числа. <P>Одного разу ведучий вирішив змінити правила гри. Він сам обертав барабан і називав числа, які проходили під стрілкою. Гравець не бачив барабан. Вийшло так, що барабан зробив цілу кількість обертів, тобто стрілка вказувала на той самий сектор, що й до обертання. <P>Після цього ведучий поставив запитання: яка найменша кількість секторів може бути на барабані? <P>Ваше завдання: напишіть програму, яка буде відповідати на це запитання <P><B>Вхідні дані</B></P><P>В першому рядку задано N - кількість чисел (2 <= N <= 30000), продиктованих ведучим. В наступному рядку, через пропуск записано a1, ..., an - числа, записані у тому порядку, у якому диктував ведучий (0 <= ai <= 32000). <P><B>Вихідні дані</B></P><P>В єдиному рядку записане єдине число - відповідь. <P><B>Приклад введення 1</B></P><P><PRE>13<BR>5 3 1 3 5 2 5 3 1 3 5 2 5</PRE><P><B>Приклад виведення 1</B></P><P><PRE>6</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>4<BR>1 1 1 1</PRE><P><B>Приклад виведення 2</B></P><P><PRE>1</PRE><BR>', 1000, 3072000, 2048, 0, 0, '', 1), +(1020, 'Армія', '<P align=left><B>Завдання</B></P><P>Одного семестру деякі студенти не здали сесію. Деякі не змогли здати історію, деякі програмування, а хтось – фізику…<P>Лейтенант наказав всім призовникам стати в одну шеренгу, а потім вирішив посортувати їх за незданим предметом. Спочатку повинні були іти «історики»(1), потім «програмісти»(2), а далі «фізики»(3). Лейтенант, за один крок, може поміняти місцями довільних двох студентів.<P>Порахувати мінімальну кількість кроків необхідних для такого сортування.<P><B>Вхідні дані</B></P>Число призовників N (1<=N<=1000) та перераховані типи призовників в шерензі («історики» - 1, «програмісти» - 2, «фізики» - 3)<P><B>Вихідні дані</B></P>Мінімальна кількість кроків для такого сортування.<P><B>Приклад введення</B></P><P><PRE>9</PRE><PRE>2</PRE><PRE>2</PRE><PRE>1</PRE><PRE>3</PRE><PRE>3</PRE><PRE>3</PRE><PRE>2</PRE><PRE>3</PRE><PRE>1</PRE><P><B>Приклад виведення</B></P><P><PRE>4</PRE><BR>', 500, 3072000, 2048, 0, 0, '', 1), +(1021, 'Книги', '<P align=left><B>Завдання</B></P><P>Книжки можна використовувати по різному. Можна, наприклад, поставивши їх на купу, зсунути одну відносно одної, поміряти наскільки далеко вони звисають за межею столу. Найвища книжка є першою, всі книжки однакові. <P>Першу книжку можна зсунути менше ніж на 0.5 її довжини, другу можна зсунути відносно столу або наступної книжки менше ніж на 1/3 її довжини. Сумарно вони будуть звисати над краєм столу менше ніж на 1/2 + 1/3. Третю книжку можна зсунути до 1/4, з номером n до 1/(n + 1).<P>За заданою схемою 5 книжок можна зсунути на віддаль до 1.45<P>Визначити мінімальну кількість книжок в купі за довжиною звисання.<P><B>Вхідні дані</B></P><P>Одне дійсне число від 0.01 до 5.20, точно 3 цифри.<P><B>Вихідні дані</B></P><P>Кількість книжок.<P><B>Приклад введення 1</B></P><P><PRE>1.00</PRE><P><B>Приклад виведення 1</B></P><P><PRE>3</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>1.45</PRE><P><B>Приклад виведення 2</B></P><P><PRE>6</PRE><BR>', 500, 3072000, 2048, 0, 0, '', 1), +(1022, 'Космозаправки', '<P align=left><B>Завдання</B></P><P>Із далекої планети до ще дальшої летить зореліт. Йому потрібно зробити заправку спеціального палива, яке є лише на заправочних станціях з номерами від 0 до нескінченості включно. Всі заправки розташовані на прямій лінії послідовно, відстань між ними дорівнює одному світловому року.</P><P>Нажаль існують фальшиві заправки, що заливають бракований бензин і навіть погіршують його у заправках, що знаходяться на відстані до K світлових років включно (покищо вчені галактики не можуть пояснити це явище).</P><P>Попередники розказали пілотам вашого зорельоту одну цікаву особливість цих заправок: фальшиві заправки мають такі номери, що діляться лише на самого себе і на один (мають рівно 2 різних дільники!).</P><P>Ваш зореліт летить від заправки А до заправки В.</P><P>Потрібно сказати скільки є заправок між А та В включно, на яких можна заправитися якісним (НЕ бракованим) бензином.</P><P><B>Вхідні дані</B></P><P>Дано три числа A, B, K.</P><P>1<=A<=B<=1000000</P><P>0<=K<=1000000</P><P><B>Вихідні дані</B></P><P>Єдине число, кількість заправок на яких можна заправитися.</P><P><B>Приклад введення 1</B></P><PRE>10 21</PRE><PRE>1</PRE><P><B>Приклад виведення 1</B></P><P><PRE>2</PRE><BR><P><B>Приклад введення 2</B></P><PRE>13 19</PRE><PRE>0</PRE><P><B>Приклад виведення 1</B></P><P><PRE>4</PRE><P></P><P><B>Автори задачі:</B><I> Бабіля Руслан, Коркуна Остап</I></P>', 1000, 5120000, 2048, 0, 0, '', 1), +(1023, 'ГігаЛотерея', '<P align=left><B>Завдання</B></P><P>2077 рік. "Найспекотніша" планета Сонячної системи Меркурій стає центром казино та азартних ігор нашої та сусідніх галактик. Особливої популярністі в земної та інших рас набула гра під назвою ГігаЛотерея. Головним призом є 2 гігабайти віртуальних грошей.</P><P>Правила лотереї такі: кожен учасник отримує номер, що відповідає його порядковому номеру реєстрації. Наприклад якщо в ГігаЛотереї зареєструвалось 7 осіб, то їх номери 1, 2, 3, 4, 5, 6, 7. Далі Суперкомп''ютер ГігаЛотереї вибирає випадкове число М і як у лічилці починає викидати кожного М-того учасника, поки не залишиться один - переможець. Якщо М=3, то у нашому прикладі послідовність викинутих учасників буде така: 3, 6, 2, 7, 5, 1. Переможцем стане учасник з номером 4.</P><P>Відомого авантюриста Остапа Бендера-молодшого не оминула жага легкої наживи. Він зареєструвався на олімпіаді під номером К. Але після цього зрозумів, що для стовідсооткового виграшу цього недостатньо. Всі знають, що Остап Бендер-молодший є відомим хакером з поганою славою, це йому передалось від його далекого родича, Остапа Бендера, який жив на початку ХХ століття в Одесі і був першим в світі хакером; він був хакером ще тоді, коли не було комп''ютерів!!!</P><P>Остап Бендер-молодший "взламав" сервер ГігаЛотереї і взнав кількість зареєстрованих учасників - N. Тепер йому треба встановити число М так, щоб переможцем став саме він. Ваше завдання знайти таке М.</P><P><B>Вхідні дані</B></P><P>Два цілі числа N і К (1 <= K <= N <= 1000).</P><P><B>Вихідні дані</B></P><P>Єдине додатнє число М (M <= N). Якщо є кілька можливих відповідей, вивести найменшу з них. Якщо неможливо знайти таке М, виведіть "-1" (без лапок).</P><P><B>Приклад введення</B></P><P>7 4</P><P><B>Приклад виведення</B></P><P>3</P><P><B>Автори задачі:</B><I> Бабіля Руслан, Коркуна Остап</I></P>', 1000, 3072000, 2048, 0, 0, '', 1), +(1024, 'Марсостриб', '<P align=left><B>Завдання</B></P><P>2077 рік. Наука далеко пішла вперед в галузі дослідження космосу. Вже не стоїть завдання долетіти до певної планети, щоб дослідити її. Люди освоюють найближчі планети, зокрема Марс. Ексцентричні багатії наприклад придумали собі перегони по прямій на спеціальних пристроях. Пристрої ці ще недавно були лише на озброєнні спецслужб, а зараз їх може собі дозволити купити кожен пересічний мультимільярдер. Називаються вони Марсострибунами, а змагання Марсостриб.</P><P>Побудований марсострибун так, що може стрибнути за раз на одну з заданих відстаней, при чому стрибає марсострибун лише вперед.</P><P>Змагання відбуваються по прямій ділянці довжиною N, на якій можуть зустрічатися кратери (ями). Якщо гравець потрапляє в яму, він автоматично вибуває з гри. Виграє той, хто дістанеться в точку фінішу (конкретно в цю точку) за меншу кількість стрибків.</P><P><B>Вхідні дані</B></P><P>В першому рядку задано число N (1 <= N <= 100000) - довжина ділянки забігу (застрибу). Марсострибун стартує в точці з координатою 0 і щоб перемогти повинен потрапити в точку (N-1).</P><P>В наступному рядку знаходиться число К (1 <= K <= 100) - кількість можливих варіантів (довжин) стрибка, в наступних К рядках знаходяться ці можливі довжини. В наступному рядку знаходиться число М - кількість кратерів (ям). Далі в М рядках - координати кратерів (числа від 1 до N-1 включно).</P><P><B>Вихідні дані</B></P><P>Мінімальна кількість стрибків за яку марсострибун з точки 0 може попасти в точку (N-1). Якщо це неможливо вивести "-1" (без лапок).</P><P><B>Приклад введення</B></P><PRE>6</PRE><PRE>2</PRE><PRE>1</PRE><PRE>2</PRE><PRE>2</PRE><PRE>1</PRE><PRE>4</PRE><P><B>Приклад виведення</B></P><P><FONT size=2>3</FONT></P><P>Підказка: Спочатку марсострибун стрибає в точку 2, потім в точку 3, тоді в точку 5 - фініш і перемагає в Марсострибі.</P><P><B>Автори задачі:</B><I> Бабіля Руслан, Коркуна Остап</I></P>', 1000, 3072000, 2048, 0, 0, '', 1), +(1025, 'Міжпланетне повідомлення', '<P align=left><B>Завдання</B></P><P>Із планети Уран передається спеціальне повідомлення на планету Нептун. Повідомлення є дійсним числом start, яке передається на кінцеву планету через 4 інші планети в довільному порядку і з довільною кількістю повторів. На Юпітері (літера "u") число, яке прийшло на цю планету у повідомленні, множиться на 2, на Меркурії (m) - ділиться на 2, на Сатурні (s) - до повідомлення додається 9, на Плутоні (p) - віднімається 11.</P><P>Також зберігається разом із повідомленням шлях проходження цього повідомлення по планетах. Якщо повідомлення проходило через планети у такому порядку Юпітер, Меркурій, Сатурн, Плутон, Юпітер, а далі на Нептун, то шлях буде таким "umspu".</P><P>u - Юпітер</P><P>m - Меркурій</P><P>s - Сатурн</P><P>p - Плутон</P><P>Якщо відправлено повідомлення Y, то отримають повідомлення:</P><P>(Y*2/2+9-11)*2</P><P>Після чергового відправленого повідомлення виявляється, що у шляху повідомлення одна літера втрачена і замінилася на "х". Але жителям Нептуна обов''язково потрібно знати, яка ця планета, оскільки від цього залежить чи вони зможуть зіграти зіркобол із жителями Урану. Щоб знайти цю планету нептунці, знаючи число яке дійшло до них finish та шлях повідомлення (з одним втраченим символом), зв''язалися із уранцями і запитали у них, яке число відправляли вони - start.</P><P><STRONG>Примітка:</STRONG> При виконанні всіх арифметичних операцій жителі планет сонячної системи використовують стандартні типи даних з плаваючою крапкою (<STRONG>double</STRONG> в С++ чи <STRONG>real</STRONG> в Pascal)</P><P><B>Вхідні дані</B></P><P>У першому рядку два дійсних числа start, finish (-10^9 <= start, finish <= 10^9).</P><P>У наступному одне натуральне N - кількість планет у шляху повідомлення. (N <= 10000)</P><P>В останньому рядку сам шлях повідомлення, яке пошкодилося, заміною одного номера планети на "х".</P><P><B>Вихідні дані</B></P><P>Єдина літера, яка відповідає тій планеті, що повинна стояти на місці "х". Якщо знайти таке неможливо, то результат "-1" (без лапок).</P><P>Якщо можливі декілька варіантів відповіді, то вивести найперший з них (в порядку u, m, s, p).</P><P><B>Приклад введення 1</B></P><PRE>5 8</PRE><PRE>5</PRE><PRE>uxpmu</PRE><P><B>Приклад виведення 1</B></P><P><PRE>s</PRE><BR><P><B>Приклад введення 2</B></P><PRE>10 5</PRE><PRE>4</PRE><PRE>msxu</PRE><P><B>Приклад виведення 1</B></P><P><PRE>-1</PRE><P></P><P><B>Автори задачі:</B><I> Бабіля Руслан, Коркуна Остап</I></P>', 1000, 2048000, 2048, 0, 0, '', 1); +INSERT INTO `challenges` (`id`, `name`, `description`, `timelimit`, `memorylimit`, `outputlimit`, `tries`, `accepted`, `author`, `enabled`) VALUES +(1026, 'Полювання', '<P><B>Завдання</B></P><P>2077 рік. Не тільки наука і техніка з шаленою швидкісю ідуть вперед, також розвивається сфера розваг. Поїздкою на Багами чи Мальдіви тепер нікого не здивуєш, але в моді і далі залишається сафарі. Оскільки Африка перетворилась на найпотужніший (після України) центр бізнесу та підприємництва, то крім як на гроші, там полювати немає на що. Тепер сафарі відбувається на планеті Зайцеоленіон. Очевидно, що на цій планеті крім невеликої популяції зайцеоленіонців проживають ще й звірі (яке ж сафарі без звірів?), а саме космозайці і космоолені.</P><P>Правила сафарі дуже прості. Мисливцю видають звичайну однозарядну гіпернаноплазморушницю, висаджують посеред поля і дозволяють зробити один постріл. Всі звірі, яких промінь з гіпернаноплазморушниці поранить, або хоча б торкнеться стають здобиччю мисливця.Донецький бізнесмен на ім''я Лунат Рахметов за порадою своїх африканських колег вирішив спробувати щастя в зайцеоленіонському сафарі, але йому потрібна ваша допомога, адже він хоче підстрелити якомога більше звірів за свій один постріл.</P><P>Поле для сафарі є квадратом розміру 20000 на 20000 клітинок. Мисливця висаджують в центрі цього квадрата - точці з координатами (0;0), відповідно вершини квадратного поля мають координати (10000;10000), (10000;-10000), (-10000;-10000), (-10000;10000). В межах цього поля знаходяться M космозайців та N космооленів (0 <= M,N <= 200). Як космозайці так і космоолені через малу кількість зелені на планеті не мають що їсти і є дуже худими, тому будемо вважати, що зайці - це точки, олені - відрізки на даному полі. Гіпернаноплазморушниця стріляє променем, який ми будемо вважати променем з початком в точці (0;0). Космозаєць вважається підстреленим, якщо промінь пройде через точку, в якій знаходиться космозаєць. Космоолень вважається підстреленим, якщо промінь перетне відрізок, що зображає оленя, чи пройде крізь один з його кінців.</P><P>Жоден космозаєць не може сидіти на голові в мисливця, тобто в точці (0;0) та жоден космоолень не може лежати під мисливцем, тобто перетинати точку (0;0). Але космоолені та космозайці можуть перетинатися, чи знаходитись в одній і тій самій точці, тобто попавши в точку на якій сидять два космозайці, чи перетинаються два космоолені, ви підстрелите обох. Розміри космооленів можуть бути довільні, починаючи від 0 включно, але кожен космоолень знаходиться усім тілом в полі.</P><P>Ваше завдання вивести число - максимальну кількість тварин, яких Лунат Рахметов може підстрелити за один постріл.</P><P><B>Вхідні дані</B></P><P>В першому рядку задано ціле число M - кількість космозайців (0 <= M <= 200). В наступних M рядках - по два числа - координати Х та Y відповідного космозайця. Після цього записане число N - кількість космооленів (0 <= N <= 200), за ним в N рядках по чотири числа: перші два - координати Х та Y початку відрізка (початку космооленя), наступні два - координати Х та Y кінця відрізка (кінця космооленя). Всі координати є ЦІЛИМИ числами в межах від -10000 до 10000 включно.</P><P><B>Вихідні дані</B></P><P>Єдине ціле число - максимальна кількість звірів, яких можна вбити одним пострілом.</P><P><B>Приклад введення</B></P><PRE>1</PRE><PRE>-1 -1</PRE><PRE>3</PRE><PRE>1 2 2 1</PRE><PRE>2 3 4 2</PRE><PRE>3 -3 4 -4</PRE><P><B>Приклад виведення</B></P><P>2</P><P>Підказка: Мисливець може вбити одним пострілом першого та другого космооленів.</P><P><B>Автори задачі:</B><I> Бабіля Руслан, Коркуна Остап</I></P>', 1000, 3072000, 2048, 0, 0, '', 1), +(1027, 'Шлюзи', '<P align=left><B>Завдання</B></P><P>2077 рік. Космічні подорожі ввійшли в повсякденне життя майже всіх людей, а для декого це стало навіть роботою. Зокрема для працівників галактичної посильної служби в Віконній Галактиці. Їх робота полягає в доставці посилок та бандеролей від однієї планети до іншої. Але на шляху посильних стоїть досить вагома перешкода - Космічний Брандмауер - система захисту Віконної Галактики. Космічний Брандмауер захіщає Віконну Галактику від контрабандистів та космічних піратів.</P><P>Побудований Космічний Брандмауер за таким принципом: кожна планета закрита одним шлюзом від відкритого космосу. Якщо шлюз замкнений, то неможливо ні попасти на планету, ні покинути її. З планети А в планету В можна потрапити лише коли на планеті А та на планеті В відкриті шлюзи. Відкривається та закривається шлюз дуже складним пристроєм, побудованим на кінетично-магнітному ефекті насиченої плазми, під назвою Рубильник. Для кожного шлюза існує один і лише один рубильник. Рубильник для певного шлюзу може знаходитись на будьякій планеті, навіть на тій, де знаходиться шлюз.</P><P>На початку подорожі посильний знаходиться на планеті з номером 0 і шлюз на цій планеті відкритий. Всього в галактиці є N (1 <= N <= 100) планет. На всіх них (крім 0-вої) шлюзи закриті. В кінці подорожі посильний повинен знаходитися на останній планеті (з номером N-1), при чому на ВСІХ ІНШИХ планетах шлюзи повинні бути ЗАКРИТІ. По дорозі посильний може довільну кількість разів потрапляти на довільні планети та довільну кількість разів відкривати/закривати шлюзи. Важливою є лише кількість виходів в відкритий космос (кожен переліт з планети на планету супроводжується одним виходом у відкритий космос). Потрібно знайти таку найменшу кількість виходів у відкритий космос, за які можна виконати поставлене завдання.</P><P><B>Вхідні дані</B></P><P>В першому рядку записане число N (1 <= N <= 100) - кількість планет у галактиці. В другому рядку через пробіл записані N чисел: перше - номер планети, на якій знаходиться рубильник від шлюза на 0-вій планеті, друге - від шлюза 1-шої планети, і т. д. N-не - номер планети, на якій знаходиться рубильник від шлюза на останній (N-1)-шій планеті.</P><P><B>Вихідні дані</B></P><P>Невід''ємне число - мінімальна кількість виходів у відкритий космос, за які можна виконати завдання посильного. Якщо виконати завдання неможливо, то вивести "-1" (без лапок).</P><P><B>Приклад введення</B></P><P><PRE>3</PRE><PRE>1 2 0</PRE><P></P><P><B>Приклад виведення</B></P><P><PRE>3</PRE><P></P><P>Підказка: Спочатку посильний відкриває шлюз на планеті 2, тоді перелітає з планети 0 на планету 2, відкриває шлюз на планеті 1, перелітає з планети 2 на планету 1, закриває шлюз на планеті 0, перелітає з планети 1 на планету 2, закриває шлюз на планеті 1. Всього 3 виходи у відкритий космос.</P><P><B>Автори задачі:</B><I> Бабіля Руслан, Коркуна Остап</I></P>', 1000, 3072000, 2048, 0, 0, '', 1), +(1028, 'Факторіал', '<P align=left><B>Завдання</B></P><P>Підрахуйте кількість нулів в кінці запису факторіалу числа N.<P><B>Вхiднi данi</B></P><P>Єдине число N (1 <= N <= 2000000000)<P><B>Вихiднi данi</B></P><P>Єдине число - кількість нулів в кінці числа.<P><B>Приклад введення</B></P><P><PRE>8</PRE><P><B>Приклад виведення</B></P><P><PRE>1</PRE><BR>', 500, 3072000, 2048, 0, 0, '', 1), +(1029, 'Свічки', '<P align=left><B>Завдання</B></P><P>Миша св''яткує свій n-й день народження. Мами миші порізала св''ятковий торт на декілька частин зробивши рівно m розрізів по прямій лінії. Торт круглий з радіусом r і центром в точці (0; 0). За звичаєм, кількість свічок на торті така сама, скільки років виповнилось імениннику. Кожен гість вз''яв по одному шматкові торта. Миші цікаво, чи не попалось комусь із гостей більше одної свічки. <P><B>Вхідні дані</B></P><P>У першому рядку знаходяться цілі числа n, m і r (1 <= n <= 10000, 0 <= m <= 1000, 1 <= r <= 2000). <P>Наступні n рядків містять інформацію про координати x та y кожної свічки (цілі числа). Гарантується, що свічки знаходяться в середині круга і ніякі дві свічки не співпадають. Розмірами свічки можна знехтувати. <P>В останніх m рядках знаходиться трійки цілих чисел a, b, c - інформація про розрізи (-10000 <= a, b, c <= 10000). Це коефіціенти рівнянь прямих у вигляді ax+by+c=0. Ніякі два розрізи не співпадають, ніякий розріз не проходить через свічку. <P><B>Вихідні дані</B></P><P>Якщо кому-небуть з гостей попало більше одної свічки - вивести "YES", або "NO" в іншому випадку. <P><B>Приклад введення</B> <P><PRE>3 2 3</PRE><PRE>2 2</PRE><PRE>1 -1</PRE><PRE>-2 0</PRE><PRE>2 -1 0</PRE><PRE>0 1 -1</PRE><P><B>Приклад виведення</B> <P><PRE>NO</PRE><BR>', 1000, 3072000, 2048, 0, 0, '', 1), +(1030, 'Посладовність', '<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-SIZE: 14pt; FONT-FAMILY: ''Courier New''"> <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></B></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">Двоє вірних друзів Бен і Дон, з метою покращення своїх математичних навиків, вирішили якось побавитись в послідовність. Кожен з них по черзі обраховував наступний член послідовності за формулою:<o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: center" align=center><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 14pt; FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">X<SUB>N</SUB></SPAN></B><B style="mso-bidi-font-weight: normal"><SUB><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: ''Courier New''; mso-ansi-language: RU">+1</SPAN></SUB></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: ''Courier New''; mso-ansi-language: RU"> = </SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 14pt; FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">A</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: ''Courier New''; mso-ansi-language: RU">*</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 14pt; FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">X<SUB>N</SUB></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: ''Courier New''; mso-ansi-language: RU"> + </SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 14pt; FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">B</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: ''Courier New''; mso-ansi-language: RU">*</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 14pt; FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">X<SUB>N</SUB></SPAN></B><B style="mso-bidi-font-weight: normal"><SUB><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: ''Courier New''; mso-ansi-language: RU">-1</SPAN></SUB></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: ''Courier New''; mso-ansi-language: RU"> + </SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 14pt; FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">C</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-SIZE: 14pt; FONT-FAMILY: ''Courier New''"><o:p></o:p></SPAN></B></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: center" align=center><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-SIZE: 14pt; FONT-FAMILY: ''Courier New''"> <o:p></o:p></SPAN></B></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">На початку гри два перші члени послідовності були задані. Бавились вони один з одним довго й нудно. Спочатку один, потім другий, потім знову перший ... Одним словом по черзі...<o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">На наступний день вони хотіли продовжити свою захоплюючу забавку. Але змогли пригадати тільки перший та останній члени...<o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">Допоможіть їм продовжити займатися улюбленою справою.<o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''"> <o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">Вхідні дані: </SPAN></B><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">В першому рядочку міститься три цілі числа </SPAN><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">A</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">, </SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">B</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">, </SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">C<o:p></o:p></SPAN></B></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">У наступному міститься число </SPAN><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">N</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''"> – </SPAN></B><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">кількість порахованих вчора елементів послідовності.<o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">У третьому містяться два цілі числа </SPAN><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">X</SPAN></B><B style="mso-bidi-font-weight: normal"><SUB><SPAN style="FONT-FAMILY: ''Courier New''; mso-ansi-language: RU">1</SPAN></SUB></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: ''Courier New''; mso-ansi-language: RU"> </SPAN></B><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">та </SPAN><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">X<SUB>N</SUB></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: ''Courier New''; mso-ansi-language: RU"><o:p></o:p></SPAN></B></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: ''Courier New''; mso-ansi-language: RU"> <o:p></o:p></SPAN></B></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">Обмеження: 2</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-GB style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-GB"> <= </SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">N</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-GB style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-GB"> <= 100000,</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''"><o:p></o:p></SPAN></B></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">1</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-GB style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-GB"> <= </SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">A, B</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-GB style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-GB"> <= 1000,</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''"> -1000000000 </SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US"><= C <= 1000000</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">000</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">,<o:p></o:p></SPAN></B></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">-1000000</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-GB style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-GB"> <= </SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">x<SUB>i</SUB></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-GB style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-GB"> <= 100</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">0000</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-GB style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-GB">, </SPAN></B><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">тобто всі елементи вчорашньої послідовності задовольняють цій умові.<o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">Існування розв’язку гарантується.<o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''"> <o:p></o:p></SPAN></B></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">Вихідні дані: </SPAN></B><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">Ціле число – </SPAN><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">x</SPAN></B><B style="mso-bidi-font-weight: normal"><SUB><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">2</SPAN></SUB></B><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">.<o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''"> <o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">Приклад вводу:<o:p></o:p></SPAN></B></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">2 3 -35<o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">5<o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">10 20<o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''"> <o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">Приклад виводу:<o:p></o:p></SPAN></B></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">8<o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=UK> <o:p></o:p></SPAN></P>', 500, 5120000, 204800, 0, 0, '', 1), +(1031, 'Фігурки', '<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">Маленький Антошка кожного ранку йде в садочок. Мама відводить його туди і залишає на цілий день. Любиме заняття малого бешкетника – малювати різні фігурки. Але так як Антошка ще досить маленький, малювати він вміє лише прямокутники та кола. Одного разу намалювавши прямокутник та два кола, Антон сів і задумався над цим творінням. Пізніше підійшла пані вихователь і теж собі почала милуватися шедевром мистецтва...<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">Через декілька років, вже будучи школярем, Антошка знайшов цю картину. І от тоді його зацікавило таке питання: яка спільна площа цих трьох фігур?<o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">Ну тут без допомоги Антоша не обійдеться...<o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''"> <o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">Вхідні дані: </SPAN></B><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">В першому рядочку знаходяться </SPAN><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">x</SPAN></B><B style="mso-bidi-font-weight: normal"><SUB><SPAN style="FONT-FAMILY: ''Courier New''; mso-ansi-language: RU">1</SPAN></SUB></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: ''Courier New''; mso-ansi-language: RU">, </SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">y</SPAN></B><B style="mso-bidi-font-weight: normal"><SUB><SPAN style="FONT-FAMILY: ''Courier New''; mso-ansi-language: RU">1</SPAN></SUB></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: ''Courier New''; mso-ansi-language: RU">, </SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">x</SPAN></B><B style="mso-bidi-font-weight: normal"><SUB><SPAN style="FONT-FAMILY: ''Courier New''; mso-ansi-language: RU">2</SPAN></SUB></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: ''Courier New''; mso-ansi-language: RU">, </SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">y</SPAN></B><B style="mso-bidi-font-weight: normal"><SUB><SPAN style="FONT-FAMILY: ''Courier New''; mso-ansi-language: RU">2</SPAN></SUB></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: ''Courier New''; mso-ansi-language: RU"> - </SPAN></B><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">координати двох протилежних вершин прямокутника<B style="mso-bidi-font-weight: normal">. </B>В другому та третьому рядках знаходяться трійки чисел </SPAN><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">x</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: ''Courier New''; mso-ansi-language: RU">, </SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">y</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: ''Courier New''; mso-ansi-language: RU">, </SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: ''Courier New''; mso-ansi-language: EN-US">r</SPAN></B><SPAN style="FONT-FAMILY: ''Courier New''; mso-ansi-language: RU"> - </SPAN><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">координати центру та радіус кола.<o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''"> <o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">Обмеження: </SPAN></B><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">Всі числа цілі від <B style="mso-bidi-font-weight: normal">0</B> до <B style="mso-bidi-font-weight: normal">100</B> включно</SPAN><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: ''Courier New''; mso-ansi-language: RU">.<o:p></o:p></SPAN></B></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: ''Courier New''; mso-ansi-language: RU"> <o:p></o:p></SPAN></B></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">Вихідні дані: </SPAN></B><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">Спільна площа з точністю до </SPAN><SPAN style="FONT-FAMILY: ''Courier New''; mso-ansi-language: RU">1</SPAN><SPAN lang=UK style="FONT-FAMILY: ''Courier New''"> знак</SPAN><SPAN style="FONT-FAMILY: ''Courier New''; mso-ansi-language: RU">у</SPAN><SPAN lang=UK style="FONT-FAMILY: ''Courier New''"> після коми<B style="mso-bidi-font-weight: normal">. </B>Правила заокруглення – стандартні математичні.<o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''"> <o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">Приклад вводу:<o:p></o:p></SPAN></B></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">0 0 10 10<o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">0 10 3<o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">5 5 12<o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><SPAN style="FONT-FAMILY: ''Courier New''; mso-ansi-language: RU"> <o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; TEXT-ALIGN: justify"><B style="mso-bidi-font-weight: normal"><SPAN lang=UK style="FONT-FAMILY: ''Courier New''">Приклад виводу:<o:p></o:p></SPAN></B></P><SPAN lang=UK style="FONT-SIZE: 12pt; FONT-FAMILY: ''Courier New''; mso-ansi-language: UK; mso-fareast-font-family: ''Times New Roman''; mso-fareast-language: UK; mso-bidi-language: AR-S... [truncated message content] |
From: <vl...@us...> - 2008-09-28 18:32:27
|
Revision: 393 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=393&view=rev Author: vladykx Date: 2008-09-28 18:32:15 +0000 (Sun, 28 Sep 2008) Log Message: ----------- All langs as array in config.ini Modified Paths: -------------- website/config/config.ini website/library/Application.php Modified: website/config/config.ini =================================================================== --- website/config/config.ini 2008-09-26 20:22:27 UTC (rev 392) +++ website/config/config.ini 2008-09-28 18:32:15 UTC (rev 393) @@ -8,7 +8,7 @@ truncate.length = "300" truncate.ending = "..." -truncate.exact' = "0" +truncate.exact = "0" truncate.considerHtml = "1" table.perpage = "10" @@ -29,6 +29,8 @@ lang.path = "lang/"; lang.default = "uk"; +lang.langs[] = "uk"; +lang.langs[] = "en"; title = "ACM Contester" titlesep = " - " @@ -36,8 +38,11 @@ [development: general] db.adapter = "Mysqli" +db.params.host = "localhost" db.params.dbname = "acm" db.params.username = "acm" db.params.password = "c0nt3st3r" +db.params.profiler.enabled = true +db.params.profiler.class = Zend_Db_Profiler_Firebug [stable: genral] \ No newline at end of file Modified: website/library/Application.php =================================================================== --- website/library/Application.php 2008-09-26 20:22:27 UTC (rev 392) +++ website/library/Application.php 2008-09-28 18:32:15 UTC (rev 393) @@ -204,7 +204,11 @@ $_db = Zend_Registry::get('db'); $translate = new Zend_Translate('csv', $this->_docroot.'/'.$_config->lang->path . $_config->lang->default . '.csv', $_config->lang->default); - $translate->addTranslation($this->_docroot.'/'.$_config->lang->path . 'en.csv', 'en'); + foreach($_config->lang->langs as $lang) + { + if ($lang != $_config->lang->default) + $translate->addTranslation($this->_docroot.'/'.$_config->lang->path . $lang .'.csv', 'en'); + } $translate->setLocale($_config->lang->default); Zend_Registry::set('Zend_Translate', $translate); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-09-25 23:11:07
|
Revision: 389 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=389&view=rev Author: brus07 Date: 2008-09-25 21:49:54 +0000 (Thu, 25 Sep 2008) Log Message: ----------- System commit. Added logminsize property to this folder. Now, smallest log message can be 5 symbols. Property Changed: ---------------- website/ website/application/ website/application/default/ website/application/default/controllers/ website/application/default/layouts/ website/application/default/models/ website/application/default/views/ website/application/default/views/helpers/ website/application/default/views/scripts/ website/application/default/views/scripts/archieve/ website/application/default/views/scripts/error/ website/application/default/views/scripts/index/ website/config/ website/httpdocs/ website/httpdocs/images/ website/httpdocs/scripts/ website/httpdocs/styles/ website/lang/ website/library/ website/library/Ostacium/ website/library/Ostacium/Controller/ website/library/Ostacium/Controller/Plugin/ website/library/Ostacium/Db/ website/library/Ostacium/Db/Table/ website/library/Ostacium/Form/ website/library/Ostacium/Form/Decorator/ website/library/Ostacium/Form/Element/ website/library/Ostacium/Validate/ website/library/Ostacium/View/ website/library/Ostacium/View/Helper/ website/library/Zend/ website/other/ Property changes on: website ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/default ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/default/controllers ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/default/layouts ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/default/models ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/default/views ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/default/views/helpers ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/default/views/scripts ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/default/views/scripts/archieve ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/default/views/scripts/error ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/default/views/scripts/index ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/config ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/httpdocs ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/httpdocs/images ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/httpdocs/scripts ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/httpdocs/styles ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/lang ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/library ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/library/Ostacium ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/library/Ostacium/Controller ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/library/Ostacium/Controller/Plugin ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/library/Ostacium/Db ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/library/Ostacium/Db/Table ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/library/Ostacium/Form ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/library/Ostacium/Form/Decorator ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/library/Ostacium/Form/Element ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/library/Ostacium/Validate ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/library/Ostacium/View ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/library/Ostacium/View/Helper ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/library/Zend ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/other ___________________________________________________________________ Added: tsvn:logminsize + 5 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pan...@us...> - 2008-10-05 15:11:16
|
Revision: 405 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=405&view=rev Author: panzaboi Date: 2008-10-05 15:06:51 +0000 (Sun, 05 Oct 2008) Log Message: ----------- Application() -> __construct() Added Logger Dynamic DB Encoding (From UTF-8) Changed Structure -> modules with multi-lang support Extended Error_Handler to catch NOT_ALLOWED,NO_CONTROLLER,NO_ACTION errors on preDispatch + NOTALLOwED - new Exception Type Ostacium_Controller_Plugin_Router_Exception More flexible configuration for Zend_View + Zend_Layout Extended Zend_Auth_Adapter_DbTable to be able to select from multiple tables during authorication Added Multilanguage support (ability to change language during navigation/set per user) Removed Messages from DB (translations will be read from file) Added Custom Routes Support Extended Zend_Controller_Router_Route_Module to support :lang/:module/:controller/:action/:params Removed ?> at the end of files Ostacium_Date: Small fix + removed ?> Ostacium_View_Helper_BaseUrl: New implementation from Zend Framework proposals with slashes stripping Ostacium_View_Helper_Currency: Added default options - can be set statically in bootstrap from config Ostacium_View_Helper_CurrentUrl: Removed as duplicate of: $this->url(); Ostacium_View_Helper_Truncate: fixed to extend Zend_View_Helper_Abstract db.sql: Updated DB Structure Ostacium_Controller_Plugin_Layout: Support separate layouts for different modules + general one in failuture Ostacium_Controller_Request_Http: Added getIP function Ostacium_View_Helper_DebugInfo: Ability to show debug info + write to logger during development stage todo.txt: update Todo List index.php: changed DIRECTORY_SEPARATOR to / as make no difference config.ini: updated configurations Modified Paths: -------------- website/config/config.ini website/httpdocs/index.php website/lang/en.csv website/lang/uk.csv website/library/Application.php website/library/Ostacium/Acl.php website/library/Ostacium/Controller/Action.php website/library/Ostacium/Controller/Plugin/ErrorHandler.php website/library/Ostacium/Controller/Plugin/Router.php website/library/Ostacium/Date.php website/library/Ostacium/Db/Table/Rowset.php website/library/Ostacium/Db/Table.php website/library/Ostacium/Model.php website/library/Ostacium/View/Helper/BaseUrl.php website/library/Ostacium/View/Helper/Currency.php website/library/Ostacium/View/Helper/FormFile.php website/library/Ostacium/View/Helper/ListTable.php website/library/Ostacium/View/Helper/Truncate.php website/other/db.sql Added Paths: ----------- website/library/Ostacium/Auth/ website/library/Ostacium/Auth/Adapter/ website/library/Ostacium/Auth/Adapter/DbTable.php website/library/Ostacium/Controller/Plugin/Layout.php website/library/Ostacium/Controller/Request/ website/library/Ostacium/Controller/Request/Http.php website/library/Ostacium/Controller/Router/ website/library/Ostacium/Controller/Router/Route/ website/library/Ostacium/Controller/Router/Route/Language.php website/library/Ostacium/Log/ website/library/Ostacium/Log/Writer/ website/library/Ostacium/Log/Writer/Db.php website/library/Ostacium/View/Helper/DebugInfo.php website/other/todo.txt Modified: website/config/config.ini =================================================================== --- website/config/config.ini 2008-10-04 23:18:38 UTC (rev 404) +++ website/config/config.ini 2008-10-05 15:06:51 UTC (rev 405) @@ -4,7 +4,7 @@ error.display = "1" error.throw = "1" -date.timezone = "Europe/Kiev" +#date.timezone = "Europe/Kiev" truncate.length = "300" truncate.ending = "..." @@ -13,6 +13,8 @@ table.perpage = "10" +date.format_type = "php" + #auth.noauth.module = "default" auth.noauth.controller = "index" auth.noauth.action = "index" @@ -26,18 +28,50 @@ auth.user = "username" auth.pass = "password" auth.passtreat = "MD5(?) AND activated IS NULL" +auth.referenceMap.0.table = "usersdetails"; +auth.referenceMap.0.reference = "usersdetails.username=users.username"; +auth.referenceMap.0.columns = "*"; +auth.referenceMap.1.table = "roles"; +auth.referenceMap.1.reference = "roles.id=users.roleid"; +auth.referenceMap.1.columns = "roles.name as role"; +lang.languageKey = "language"; lang.path = "lang/"; lang.default = "uk"; lang.langs[] = "uk"; lang.langs[] = "en"; +layout.layoutpath = "application/layouts"; +layout.layout = "layout"; +layout.contentKey = "content"; +layout.pluginclass = "Ostacium_Controller_Plugin_Layout"; + +view.encoding = "UTF-8"; +view.helperPathPrefix = "Ostacium_View_Helper"; +view.helperPath = "/library/Ostacium/View/Helper"; + +log.table = "log"; +log.columnMap.type = "priorityName"; +log.columnMap.message = "message"; +log.columnMap.username = "username"; +log.columnMap.when = "timestamp"; +log.columnMap.ip = "ip"; + +email.admin = "admin" + +listtable.class = "crudtable" + +#currency.format = "1" +#currency.precision = "2" +currency.display = "2" + title = "ACM Contester" titlesep = " - " [development: general] db.adapter = "Mysqli" +db.encoding = "UTF8" db.params.host = "localhost" db.params.dbname = "acm" db.params.username = "acm" Modified: website/httpdocs/index.php =================================================================== --- website/httpdocs/index.php 2008-10-04 23:18:38 UTC (rev 404) +++ website/httpdocs/index.php 2008-10-05 15:06:51 UTC (rev 405) @@ -6,10 +6,8 @@ $_docroot = dirname($_SERVER["DOCUMENT_ROOT"]); $_approot = dirname(__FILE__); -require_once $_docroot . DIRECTORY_SEPARATOR . 'library/Application.php'; +require_once $_docroot . '/library/Application.php'; $app = new Application($_approot); $app->setEnvironment('development'); -$app->bootstrap(); - -?> \ No newline at end of file +$app->bootstrap(); \ No newline at end of file Modified: website/lang/en.csv =================================================================== --- website/lang/en.csv 2008-10-04 23:18:38 UTC (rev 404) +++ website/lang/en.csv 2008-10-05 15:06:51 UTC (rev 405) @@ -5,6 +5,7 @@ error_other;There was unknow error, please contact administrator error_404;The page you requested was not found +error_403;You don't have the rights to access that page errorBetween;Value should be between %1$s and %2$s characters Modified: website/lang/uk.csv =================================================================== --- website/lang/uk.csv 2008-10-04 23:18:38 UTC (rev 404) +++ website/lang/uk.csv 2008-10-05 15:06:51 UTC (rev 405) @@ -5,6 +5,7 @@ error_other;There was unknow error, please contact administrator error_404;The page you requested was not found +error_403;You don't have the rights to access that page errorBetween;Value should be between %1$s and %2$s characters Modified: website/library/Application.php =================================================================== --- website/library/Application.php 2008-10-04 23:18:38 UTC (rev 404) +++ website/library/Application.php 2008-10-05 15:06:51 UTC (rev 405) @@ -4,18 +4,25 @@ { protected $_environment; protected static $_approot; + protected static $_start; protected $_docroot; - public function Application($_approot) + public function __construct($_approot) { self::$_approot = $_approot; $this->_docroot = dirname($_SERVER["DOCUMENT_ROOT"]); + self::$_start = microtime(true); } public static function getAppRoot() { return self::$_approot; } + + public static function getRunTime() + { + return (microtime(true) - self::$_start); + } public function setEnvironment($environment) { @@ -32,15 +39,18 @@ if (!$this->_environment) { throw new Exception('Please set the environment using ::setEnvironment'); } - + try { $frontController = $this->_initialize(); - $this->setupRoutes($frontController); + $this->_setupRoutes($frontController); $frontController->dispatch(); } catch (Exception $e) { - var_dump($e); + if(Zend_Registry::offsetExists('Zend_Log')) + Zend_Registry::get('Zend_Log')->log($e->getMessage(), Zend_Log::ERR); + else + var_dump($e); } } @@ -61,29 +71,29 @@ // Setup Session Zend_Session::start(); - // Setup Date - Ostacium_Date::setOptions(array('format_type' => 'php')); - // Setup Config $_config = $this->_setupConfig(); + + // Setup Front Controller + $frontController = $this->_setupFrontController(); + + // Setup Date + Ostacium_Date::setOptions($_config->date->toArray()); + //date_default_timezone_set($_config->date->timezone); // Setup DB $this->_setupDB(); - + // Setup Helpers Ostacium_View_Helper_Truncate::setDefault($_config->truncate->toArray()); - Ostacium_View_Helper_listTable::setDefaultAttribs(array('class' => 'crudtable')); - - // Setup Front Controller - $frontController = $this->_setupFrontController(); + Ostacium_View_Helper_listTable::setDefaultAttribs($_config->listtable->toArray()); - // Setup Error Handler - $frontController->registerPlugin(new Ostacium_Controller_Plugin_ErrorHandler(array( - 'module' => $_config->auth->noacl->module, - 'controller' => $_config->auth->noacl->controller, - 'action' => $_config->auth->noacl->action - ))); + // Setup Log + $this->_setupLog(); + // Setup Authorication + $acl = $this->_setupAuth(); + // Setup Languages $this->_setupLang(); @@ -92,15 +102,13 @@ // Setup View $this->_setupView(); - - // Setup Authorication - $acl = $this->_setupAuth(); // Setup Email - $mail = new Zend_Mail_Transport_Sendmail('-fadmin@'.$_SERVER["SERVER_NAME"]); + $mail = new Zend_Mail_Transport_Sendmail('-f'.$_config->email->admin.'@'.$_SERVER["SERVER_NAME"]); Zend_Mail::setDefaultTransport($mail); - $routerPlugin = new Ostacium_Controller_Plugin_Router($acl, $_config->auth->noauth->toArray(), $_config->auth->noacl->toArray()); + // Setup Plugins + $routerPlugin = new Ostacium_Controller_Plugin_Router($acl, $_config->auth->noauth->toArray(), $_config->auth->noacl->toArray()); $frontController->registerPlugin($routerPlugin, -1); return $frontController; @@ -127,7 +135,6 @@ error_reporting((int)$_config->error->report); ini_set('display_errors', (int)$_config->error->display); - date_default_timezone_set($_config->date->timezone); Zend_Registry::set('config', $_config); @@ -139,7 +146,8 @@ $_config = Zend_Registry::get('config'); $_db = Zend_Db::factory($_config->db); - $_db->query("SET NAMES UTF8"); + $_db->query("SET NAMES ".$_config->db->encoding); + Ostacium_Db_Table::setDefaultAdapter($_db); Ostacium_Db_CrudTable::setPerPage($_config->table->perpage); @@ -153,10 +161,17 @@ $frontController = Zend_Controller_Front::getInstance(); $frontController->throwExceptions((bool) $_config->error->throw); $frontController->setParam('environment', $this->_environment); - $frontController->setControllerDirectory(array( - 'default' => $this->_docroot . '/application/default/controllers', - 'admin' => $this->_docroot . '/application/admin/controllers', - )); + $frontController->setModuleControllerDirectoryName('controllers'); + $frontController->addModuleDirectory($this->_docroot . '/application/modules/'); + $frontController->setRequest('Ostacium_Controller_Request_Http'); + + // Error Handler + $frontController->setParam('noErrorHandler', 1); + $frontController->registerPlugin(new Ostacium_Controller_Plugin_ErrorHandler(array( + 'module' => $_config->auth->noacl->module, + 'controller' => $_config->auth->noacl->controller, + 'action' => $_config->auth->noacl->action + ))); return $frontController; } @@ -165,21 +180,20 @@ { $_config = Zend_Registry::get('config'); - Zend_Layout::startMvc(array('layoutPath' => $this->_docroot . '/application/default/layouts')); - - $view = new Zend_View( array( - 'encoding' => 'UTF-8', - 'helperPathPrefix' => 'Ostacium_View_Helper', - 'helperPath' => $this->_docroot . '/library/Ostacium/View/Helper' - )); - + $options = $_config->view->toArray(); + $options['helperPath'] = $this->_docroot . '/' . $options['helperPath']; + $view = new Zend_View($options); + + // Setup DocType $view->doctype('XHTML1_TRANSITIONAL'); // Setup Title - //$view->placeholder('title')->set($_config->title); $view->headTitle($_config->title)->setSeparator($_config->titlesep); // Setup Dojo Zend_Dojo::enableView($view); + $options = $_config->layout->toArray(); + $options['layoutpath'] = $this->_docroot . '/' . $options['layoutpath']; + Zend_Layout::startMvc($options + array('view' => $view)); $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view); Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); @@ -190,7 +204,8 @@ $_config = Zend_Registry::get('config'); $acl = new Ostacium_Acl($_config->auth->order); - $auth = new Zend_Auth_Adapter_DbTable(Zend_Registry::get('db'), $_config->auth->table, $_config->auth->user, $_config->auth->pass, $_config->auth->passtreat); + $auth = new Ostacium_Auth_Adapter_DbTable(Zend_Registry::get('db'), $_config->auth->table, $_config->auth->user, $_config->auth->pass, $_config->auth->passtreat); + $auth->setReferenceMap($_config->auth->referenceMap->toArray()); Zend_Registry::set('auth', $auth); Zend_Registry::set('acl', $acl); @@ -202,50 +217,51 @@ { $_config = Zend_Registry::get('config'); $_db = Zend_Registry::get('db'); + $_auth = Zend_Auth::getInstance(); - $translate = new Zend_Translate('csv', $this->_docroot.'/'.$_config->lang->path . $_config->lang->default . '.csv', $_config->lang->default); + $translate = new Zend_Translate('csv', $this->_docroot . '/' . $_config->lang->path . $_config->lang->default . '.csv', $_config->lang->default); foreach($_config->lang->langs as $lang) { if ($lang != $_config->lang->default) - $translate->addTranslation($this->_docroot.'/'.$_config->lang->path . $lang .'.csv', 'en'); + $translate->addTranslation($this->_docroot . '/' . $_config->lang->path . $lang .'.csv', 'en'); } - $translate->setLocale($_config->lang->default); + if ($_auth->hasIdentity()) + $language = $_auth->getIdentity()->language; + else + $language = $_config->lang->default; + + $translate->setLocale($language); Zend_Registry::set('Zend_Translate', $translate); - - /**********************************************/ - $user_messages = $_db->select()->from('messages')->query()->fetchAll(); - - $stdMessages = new stdClass(); - foreach ($user_messages as $values) - { - $stdMessages->{$values['name']} = $values['message']; - } - - Zend_Registry::set('messages', $stdMessages); } - protected function setupRoutes(Zend_Controller_Front $frontController) + protected function _setupRoutes(Zend_Controller_Front $frontController) { - // Retrieve the router from the frontcontroller + $_config = Zend_Registry::get('config'); $router = $frontController->getRouter(); + + $router->addRoute('default', new Ostacium_Controller_Router_Route_Language(array(), $frontController->getDispatcher(), $frontController->getRequest())); + + if ($_config->routes) + $router->addConfig($_config->routes); - /* - * You can add routes here like so: - * $router->addRoute( - * 'home', - * new Zend_Controller_Router_Route('home', array( - * 'controller' => 'index', - * 'action' => 'index' - * )) - * ); - */ - return $router; } + + protected function _setupLog() + { + $_db = Zend_Registry::get('db'); + $_config = Zend_Registry::get('config'); + + $writer = new Ostacium_Log_Writer_Db($_db, $_config->log->table, $_config->log->columnMap); + $log = new Zend_Log($writer); + $log->addWriter(new Zend_Log_Writer_Firebug()); + + Zend_Registry::set('Zend_Log', $log); + } }; -function br2nl($text) +/*function br2nl($text) { return preg_replace('/<br\\\\s*?\\/??>/i', "\\n", $text); } @@ -258,5 +274,4 @@ return $string; } -} -?> \ No newline at end of file +}*/ \ No newline at end of file Modified: website/library/Ostacium/Acl.php =================================================================== --- website/library/Ostacium/Acl.php 2008-10-04 23:18:38 UTC (rev 404) +++ website/library/Ostacium/Acl.php 2008-10-05 15:06:51 UTC (rev 405) @@ -63,12 +63,9 @@ } } - public function getRoleById($id) { return (isset($this->_idtorole[$id]) ? $this->_idtorole[$id] : 'guest' ); } -} - -?> \ No newline at end of file +} \ No newline at end of file Property changes on: website/library/Ostacium/Auth ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/library/Ostacium/Auth/Adapter ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/library/Ostacium/Auth/Adapter/DbTable.php =================================================================== --- website/library/Ostacium/Auth/Adapter/DbTable.php (rev 0) +++ website/library/Ostacium/Auth/Adapter/DbTable.php 2008-10-05 15:06:51 UTC (rev 405) @@ -0,0 +1,69 @@ +<?php + +class Ostacium_Auth_Adapter_DbTable extends Zend_Auth_Adapter_DbTable +{ + /** + * $_referenceMap - Other tables to be used while fetching result rows + * + * @var array + */ + protected $_referenceMap = null; + + /** + * __construct() - Sets configuration options + * + * @param Zend_Db_Adapter_Abstract $zendDb + * @param string $tableName + * @param string $identityColumn + * @param string $credentialColumn + * @param string $credentialTreatment + * @param array $referenceMap + * @return void + */ + public function __construct(Zend_Db_Adapter_Abstract $zendDb, $tableName = null, $identityColumn = null, + $credentialColumn = null, $credentialTreatment = null, $referenceMap = null) + { + parent::__construct($zendDb, $tableName, $identityColumn, $credentialColumn, $credentialTreatment); + + if (null !== $referenceMap) { + $this->setReferenceMap($referenceMap); + } + } + + + /** + * setReferenceMap() - set the reference of the tables to be fetched during authotication + * + * @param array $referenceMap + * @return Zend_Auth_Adapter_DbTable Provides a fluent interface + */ + public function setReferenceMap($referenceMap) + { + $this->_referenceMap = $referenceMap; + return $this; + } + + /** + * _authenticateCreateSelect() - This method creates a Zend_Db_Select object that + * is completely configured to be queried against the database. + * + * @return Zend_Db_Select + */ + protected function _authenticateCreateSelect() + { + $dbSelect = parent::_authenticateCreateSelect(); + + if (null !== $this->_referenceMap && is_array($this->_referenceMap)) + { + foreach ($this->_referenceMap as $options) + { + $dbSelect->joinInner($options['table'], $options['reference'], $options['columns']); + } + } + + $dbSelect->reset( Zend_Db_Select::WHERE ); + $dbSelect->where($this->_zendDb->quoteIdentifier($this->_tableName . '.' . $this->_identityColumn, true) . ' = ?', $this->_identity); + + return $dbSelect; + } +} \ No newline at end of file Modified: website/library/Ostacium/Controller/Action.php =================================================================== --- website/library/Ostacium/Controller/Action.php 2008-10-04 23:18:38 UTC (rev 404) +++ website/library/Ostacium/Controller/Action.php 2008-10-05 15:06:51 UTC (rev 405) @@ -12,11 +12,11 @@ $name = ucfirst($this->getRequest()->getControllerName()); // Setup LayoutPath - $layoutPath = $this->_helper->getHelper('viewRenderer')->getModuleDirectory() . DIRECTORY_SEPARATOR . 'layouts'; - $this->_helper->layout()->setLayoutPath($layoutPath); + //$layoutPath = $this->_helper->getHelper('viewRenderer')->getModuleDirectory() . '/layouts'; + //$this->_helper->layout()->setLayoutPath($layoutPath); // Setup ModelPath - $modelPath = $this->_helper->getHelper('viewRenderer')->getModuleDirectory() . DIRECTORY_SEPARATOR . 'models'; + $modelPath = $this->_helper->getHelper('viewRenderer')->getModuleDirectory() . '/models'; set_include_path( $modelPath . PATH_SEPARATOR . get_include_path() ); // Setup Model @@ -74,6 +74,4 @@ { return $this->_translate->_($msg); } -} - -?> \ No newline at end of file +} \ No newline at end of file Modified: website/library/Ostacium/Controller/Plugin/ErrorHandler.php =================================================================== --- website/library/Ostacium/Controller/Plugin/ErrorHandler.php 2008-10-04 23:18:38 UTC (rev 404) +++ website/library/Ostacium/Controller/Plugin/ErrorHandler.php 2008-10-05 15:06:51 UTC (rev 405) @@ -4,29 +4,38 @@ { protected $_isPreDispatch = false; + const EXCEPTION_NOTALLOWED = 'EXCEPTION_NOTALLOWED'; + public function preDispatch(Zend_Controller_Request_Abstract $request) - { + { $frontController = Zend_Controller_Front::getInstance(); $dispatcher = $frontController->getDispatcher(); $response = $this->getResponse(); - if ($frontController->getParam('noErrorHandler') || $this->_isInsideErrorHandlerLoop) { - return; - } - $error = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS); $error->exception = current($response->getException()); if (!$dispatcher->isDispatchable($request)) { $error->type = self::EXCEPTION_NO_CONTROLLER; + if (!$error->exception) + $error->exception = new Zend_Controller_Dispatcher_Exception("Resource doesn't exist", 404); } elseif (!$this->isProperAction($dispatcher, $request)) { $error->type = self::EXCEPTION_NO_ACTION; + if (!$error->exception) + $error->exception = new Zend_Controller_Dispatcher_Exception("Resource doesn't exist", 404); + } elseif ($error->exception) { + $error->type = self::EXCEPTION_OTHER; + } elseif ($request->getParam('error_message') != "") + { + $error->type = self::EXCEPTION_NOTALLOWED; + if (!$error->exception) + $error->exception = new Ostacium_Controller_Plugin_Router_Exception("No rights to access the resouce", 403); } if (isset($error->type)) { $this->_isInsideErrorHandlerLoop = true; $this->_isPreDispatch = true; - $this->_exceptionCountAtFirstEncounter = count($response->getException()); + $this->_exceptionCountAtFirstEncounter = count($response->getException()); $error->request = clone $request; $request->setParam('error_handler', $error) @@ -38,27 +47,78 @@ public function postDispatch(Zend_Controller_Request_Abstract $request) { - $response = $this->getResponse(); - if (!$this->_isInsideErrorHandlerLoop && count($response->getException()) > $this->_exceptionCountAtFirstEncounter) + $response = $this->getResponse(); + + if (!$this->_isInsideErrorHandlerLoop && count($response->getException()) > $this->_exceptionCountAtFirstEncounter) { - parent::postDispatch($request); + + if ($this->_isInsideErrorHandlerLoop) { + $exceptions = $response->getException(); + if (count($exceptions) > $this->_exceptionCountAtFirstEncounter) { + // Exception thrown by error handler; tell the front controller to throw it + $frontController->throwExceptions(true); + throw array_pop($exceptions); + } + } + + // check for an exception AND allow the error handler controller the option to forward + if (($response->isException()) && (!$this->_isInsideErrorHandlerLoop)) { + $this->_isInsideErrorHandlerLoop = true; + + // Get exception information + $error = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS); + $exceptions = $response->getException(); + $exception = $exceptions[0]; + $exceptionType = get_class($exception); + $error->exception = $exception; + switch ($exceptionType) { + case 'Zend_Controller_Dispatcher_Exception': + $error->type = self::EXCEPTION_NO_CONTROLLER; + break; + case 'Zend_Controller_Action_Exception': + if (404 == $exception->getCode()) { + $error->type = self::EXCEPTION_NO_ACTION; + } else { + $error->type = self::EXCEPTION_OTHER; + } + break; + default: + $error->type = self::EXCEPTION_OTHER; + break; + } + + // Keep a copy of the original request + $error->request = clone $request; + + // get a count of the number of exceptions encountered + $this->_exceptionCountAtFirstEncounter = count($exceptions); + + // Forward to the error handler + $request->setParam('error_handler', $error) + ->setModuleName($this->getErrorHandlerModule()) + ->setControllerName($this->getErrorHandlerController()) + ->setActionName($this->getErrorHandlerAction()) + ->setDispatched(false); + } } - } public function isProperAction($dispatcher, $request) { $className = $dispatcher->loadClass($dispatcher->getControllerClass($request)); $actionName = $request->getActionName(); + if (empty($actionName)) { $actionName = $dispatcher->getDefaultAction(); } + $methodName = $dispatcher->formatActionName($actionName); + $class = new ReflectionClass($className); - $class = new ReflectionClass($className); if ($class->hasMethod($methodName)) { return true; } + return false; } } \ No newline at end of file Added: website/library/Ostacium/Controller/Plugin/Layout.php =================================================================== --- website/library/Ostacium/Controller/Plugin/Layout.php (rev 0) +++ website/library/Ostacium/Controller/Plugin/Layout.php 2008-10-05 15:06:51 UTC (rev 405) @@ -0,0 +1,25 @@ +<?php + +class Ostacium_Controller_Plugin_Layout extends Zend_Layout_Controller_Plugin_Layout +{ + protected $_defaultLayoutPath = ''; + + public function __construct(Zend_Layout $layout = null) + { + parent::__construct($layout); + + $this->_defaultLayoutPath = $this->getLayout()->getLayoutPath(); + } + + public function preDispatch(Zend_Controller_Request_Abstract $request) + { + $_config = Zend_Registry::get('config'); + $path = Zend_Controller_Front::getInstance()->getModuleDirectory() . '/layouts/'; + + if (file_exists($path . $this->getLayout()->getLayout() . '.' . $this->getLayout()->getViewSuffix())) + $this->getLayout()->setLayoutPath($path); + else + $this->getLayout()->setLayoutPath($this->_defaultLayoutPath); + } + +} \ No newline at end of file Modified: website/library/Ostacium/Controller/Plugin/Router.php =================================================================== --- website/library/Ostacium/Controller/Plugin/Router.php 2008-10-04 23:18:38 UTC (rev 404) +++ website/library/Ostacium/Controller/Plugin/Router.php 2008-10-05 15:06:51 UTC (rev 405) @@ -1,7 +1,9 @@ <?php -class Ostacium_Controller_Plugin_Router extends Zend_Controller_Plugin_Abstract { +class Ostacium_Controller_Plugin_Router_Exception extends Zend_Controller_Exception {} +class Ostacium_Controller_Plugin_Router extends Zend_Controller_Plugin_Abstract +{ private $_acl; private $_noauth = array( /*'module' => 'default',*/ 'controller' => 'index', @@ -19,6 +21,7 @@ public function preDispatch(Zend_Controller_Request_Abstract $request) { $auth = Zend_Auth::getInstance(); + $dispatcher = Zend_Controller_Front::getInstance()->getDispatcher(); if ($auth->hasIdentity()) { $role = $this->_acl->getRoleById($auth->getIdentity()->roleid) ? $this->_acl->getRoleById($auth->getIdentity()->roleid) : 'guest'; @@ -31,16 +34,12 @@ $module = $request->getModuleName(); $resource = ($module != 'default' ? $module . ':' . $controller : $controller); - if (!$this->_acl->has($resource)) + if (!$this->_acl->has($resource) || !$dispatcher->isDispatchable($request) || !$this->isProperAction($dispatcher, $request)) { $e = new Zend_Controller_Dispatcher_Exception("Resource doesn't exist", 404); $response = $this->getResponse(); $response->setException($e); - -// $module = $this->_noacl['module']; -// $controller = $this->_noacl['controller']; -// $action = $this->_noacl['action']; } elseif (!$this->_acl->isAllowed($role, $resource, $action)) { if (!$auth->hasIdentity()) { @@ -48,13 +47,13 @@ $controller = $this->_noauth['controller']; $action = $this->_noauth['action']; - $request->setParam('message', 'nologin'); + $request->setParam('error_message', 'nologin'); } else { $module = $this->_noacl['module']; $controller = $this->_noacl['controller']; $action = $this->_noacl['action']; - $request->setParam('message', 'noallowed'); + $request->setParam('error_message', 'noallowed'); } } @@ -62,6 +61,23 @@ $request->setControllerName($controller); $request->setActionName($action); } -} - -?> \ No newline at end of file + + public function isProperAction($dispatcher, $request) + { + $className = $dispatcher->loadClass($dispatcher->getControllerClass($request)); + $actionName = $request->getActionName(); + + if (empty($actionName)) { + $actionName = $dispatcher->getDefaultAction(); + } + + $methodName = $dispatcher->formatActionName($actionName); + $class = new ReflectionClass($className); + + if ($class->hasMethod($methodName)) { + return true; + } + + return false; + } +} \ No newline at end of file Property changes on: website/library/Ostacium/Controller/Request ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/library/Ostacium/Controller/Request/Http.php =================================================================== --- website/library/Ostacium/Controller/Request/Http.php (rev 0) +++ website/library/Ostacium/Controller/Request/Http.php 2008-10-05 15:06:51 UTC (rev 405) @@ -0,0 +1,9 @@ +<?php + +class Ostacium_Controller_Request_Http extends Zend_Controller_Request_Http +{ + public function getIP() + { + return $this->getServer('HTTP_X_FORWARDED_FOR', $this->getServer('HTTP_VIA', $this->getServer('REMOTE_ADDR', '0.0.0.0') ) ); + } +} \ No newline at end of file Property changes on: website/library/Ostacium/Controller/Router ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/library/Ostacium/Controller/Router/Route ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/library/Ostacium/Controller/Router/Route/Language.php =================================================================== --- website/library/Ostacium/Controller/Router/Route/Language.php (rev 0) +++ website/library/Ostacium/Controller/Router/Route/Language.php 2008-10-05 15:06:51 UTC (rev 405) @@ -0,0 +1,139 @@ +<?php + +class Ostacium_Controller_Router_Route_Language extends Zend_Controller_Router_Route_Module +{ + protected $translate; + protected $config; + + protected $_languageKey = 'language'; + + public function __construct(array $defaults = array(), + Zend_Controller_Dispatcher_Interface $dispatcher = null, + Zend_Controller_Request_Abstract $request = null) + { + parent::__construct($defaults, $dispatcher, $request); + + $this->translate = Zend_Registry::get('Zend_Translate'); + $this->config = Zend_Registry::get('config'); + } + + protected function _setRequestKeys() + { + parent::_setRequestKeys(); + + $this->_languageKey = $this->config->lang->languageKey; + $language = $this->translate->getLocale(); + + if (null !== $this->_dispatcher) { + $this->_defaults += array($this->_languageKey => $language); + } + } + + public function match($path) + { + $this->_setRequestKeys(); + + $values = array(); + $params = array(); + $path = trim($path, self::URI_DELIMITER); + + if ($path != '') { + $path = explode(self::URI_DELIMITER, $path); + + if ($this->translate->isAvailable($path[0])) { + $values[$this->_languageKey] = array_shift($path); + $this->translate->setLocale($values[$this->_languageKey]); + } + + if (count($path) && !empty($path[0]) && $this->_dispatcher && $this->_dispatcher->isValidModule($path[0])) { + $values[$this->_moduleKey] = array_shift($path); + $this->_moduleValid = true; + } + + if (count($path) && !empty($path[0])) { + $values[$this->_controllerKey] = array_shift($path); + } + + if (count($path) && !empty($path[0])) { + $values[$this->_actionKey] = array_shift($path); + } + + if ($numSegs = count($path)) { + for ($i = 0; $i < $numSegs; $i = $i + 2) { + $key = urldecode($path[$i]); + $val = isset($path[$i + 1]) ? urldecode($path[$i + 1]) : null; + $params[$key] = $val; + } + } + } + + $this->_values = $values + $params; + + return $this->_values + $this->_defaults; + } + + public function assemble($data = array(), $reset = false, $encode = true) + { + if (!$this->_keysSet) { + $this->_setRequestKeys(); + } + + $params = (!$reset) ? $this->_values : array(); + + foreach ($data as $key => $value) { + if ($value !== null) { + $params[$key] = $value; + } elseif (isset($params[$key])) { + unset($params[$key]); + } + } + + $params += $this->_defaults; + + $url = ''; + + $language = $params[$this->_languageKey]; + unset($params[$this->_languageKey]); + + if ($this->_moduleValid || array_key_exists($this->_moduleKey, $data)) { + if ($params[$this->_moduleKey] != $this->_defaults[$this->_moduleKey]) { + $module = $params[$this->_moduleKey]; + } + } + unset($params[$this->_moduleKey]); + + $controller = $params[$this->_controllerKey]; + unset($params[$this->_controllerKey]); + + $action = $params[$this->_actionKey]; + unset($params[$this->_actionKey]); + + foreach ($params as $key => $value) { + if ($encode) $value = urlencode($value); + $url .= '/' . $key; + $url .= '/' . $value; + } + + if (!empty($url) || $action !== $this->_defaults[$this->_actionKey]) { + if ($encode) $action = urlencode($action); + $url = '/' . $action . $url; + } + + if (!empty($url) || $controller !== $this->_defaults[$this->_controllerKey]) { + if ($encode) $controller = urlencode($controller); + $url = '/' . $controller . $url; + } + + if (isset($module)) { + if ($encode) $module = urlencode($module); + $url = '/' . $module . $url; + } + + if ($this->translate->isAvailable($language)) { + if ($encode) $language = urlencode($language); + $url = '/' . $language . $url; + } + + return ltrim($url, self::URI_DELIMITER); + } +} \ No newline at end of file Modified: website/library/Ostacium/Date.php =================================================================== --- website/library/Ostacium/Date.php 2008-10-04 23:18:38 UTC (rev 404) +++ website/library/Ostacium/Date.php 2008-10-05 15:06:51 UTC (rev 405) @@ -8,8 +8,6 @@ } public static function getInstance($date = null, $part = null, $locale = null) { - return new self($date = null, $part = null, $locale = null); + return new self($date, $part, $locale); } -} - -?> \ No newline at end of file +} \ No newline at end of file Modified: website/library/Ostacium/Db/Table/Rowset.php =================================================================== --- website/library/Ostacium/Db/Table/Rowset.php 2008-10-04 23:18:38 UTC (rev 404) +++ website/library/Ostacium/Db/Table/Rowset.php 2008-10-05 15:06:51 UTC (rev 405) @@ -38,6 +38,4 @@ return parent::toArray(); } } -} - -?> \ No newline at end of file +} \ No newline at end of file Modified: website/library/Ostacium/Db/Table.php =================================================================== --- website/library/Ostacium/Db/Table.php 2008-10-04 23:18:38 UTC (rev 404) +++ website/library/Ostacium/Db/Table.php 2008-10-05 15:06:51 UTC (rev 405) @@ -10,10 +10,8 @@ public function get($pPrimaryKey) { $get = parent::find($pPrimaryKey)->current(); - if ($get) - return $get->toArray(); - else - return $get; + + return $get; } public function insert($data) @@ -31,8 +29,7 @@ public function count($_where = null) { - $select = $this->select() - ->from($this->_name, new Zend_Db_Expr('COUNT(*)')); + $select = $this->select()->from($this->_name, new Zend_Db_Expr('COUNT(*)')); if ($_where !== null) { @@ -60,6 +57,4 @@ $data = array_intersect_key($data, array_flip($this->_cols)); } -} - -?> \ No newline at end of file +} \ No newline at end of file Property changes on: website/library/Ostacium/Log ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/library/Ostacium/Log/Writer ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/library/Ostacium/Log/Writer/Db.php =================================================================== --- website/library/Ostacium/Log/Writer/Db.php (rev 0) +++ website/library/Ostacium/Log/Writer/Db.php 2008-10-05 15:06:51 UTC (rev 405) @@ -0,0 +1,20 @@ +<?php + +class Ostacium_Log_Writer_Db extends Zend_Log_Writer_Db +{ + protected function _write($event) + { + $auth = Zend_Auth::getInstance(); + $_config = Zend_Registry::get('config'); + + if ($auth->hasIdentity()) + $event['username'] = $auth->getIdentity()->{$_config->auth->user}; + else + $event['username'] = 'guest'; + + $event['ip'] = Zend_Controller_Front::getInstance()->getRequest()->getIp(); + $event['timestamp'] = time(); + + return parent::_write($event); + } +} \ No newline at end of file Modified: website/library/Ostacium/Model.php =================================================================== --- website/library/Ostacium/Model.php 2008-10-04 23:18:38 UTC (rev 404) +++ website/library/Ostacium/Model.php 2008-10-05 15:06:51 UTC (rev 405) @@ -13,6 +13,4 @@ } public function init() {} -} - -?> \ No newline at end of file +} \ No newline at end of file Modified: website/library/Ostacium/View/Helper/BaseUrl.php =================================================================== --- website/library/Ostacium/View/Helper/BaseUrl.php 2008-10-04 23:18:38 UTC (rev 404) +++ website/library/Ostacium/View/Helper/BaseUrl.php 2008-10-05 15:06:51 UTC (rev 405) @@ -1,12 +1,18 @@ <?php -class Ostacium_View_Helper_BaseUrl +class Ostacium_View_Helper_BaseUrl extends Zend_View_Helper_Abstract { public function baseUrl($file = null) { - return Zend_Controller_Front::getInstance()->getRequest()->getBaseUrl() - . ($file ? ('/' . trim((string) $file, '/\\')) : ''); + // Get baseUrl + $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl(); + + // Remove trailing slashes + $file = ($file !== null) ? ltrim($file, '/\\') : null; + + // Build return + $return = rtrim($baseUrl, '/\\') . (($file !== null) ? ('/' . $file) : ''); + + return $return; } -} - -?> \ No newline at end of file +} \ No newline at end of file Modified: website/library/Ostacium/View/Helper/Currency.php =================================================================== --- website/library/Ostacium/View/Helper/Currency.php 2008-10-04 23:18:38 UTC (rev 404) +++ website/library/Ostacium/View/Helper/Currency.php 2008-10-05 15:06:51 UTC (rev 405) @@ -1,16 +1,19 @@ <?php -class Ostacium_View_Helper_Currency +class Ostacium_View_Helper_Currency extends Zend_View_Helper_Abstract { + public static $default_options = array('display' => Zend_Currency::USE_SYMBOL); + + public static function setDefault(array $options) { + self::$default_options = $options; + } + public function currency($amount, $currency, $locale = null) { - if (isset($locale)) - $c = new Zend_Currency($currency, $locale); - else - $c = new Zend_Currency($currency); - - return $c->toCurrency($amount, array('display' => Zend_Currency::USE_SYMBOL)); + if (!isset($locale)) + $locale = Zend_Registry::get('Zend_Translate')->getLocale(); + + $currency = new Zend_Currency($currency, $locale); + return $currency->toCurrency($amount, self::$default_options); } -} - -?> \ No newline at end of file +} \ No newline at end of file Added: website/library/Ostacium/View/Helper/DebugInfo.php =================================================================== --- website/library/Ostacium/View/Helper/DebugInfo.php (rev 0) +++ website/library/Ostacium/View/Helper/DebugInfo.php 2008-10-05 15:06:51 UTC (rev 405) @@ -0,0 +1,24 @@ +<?php + +class Ostacium_View_Helper_DebugInfo extends Zend_View_Helper_Abstract +{ + public function debugInfo($writetolog = false) + { + $translate = Zend_Registry::get('Zend_Translate'); + $profiler = Zend_Registry::get('db')->getProfiler(); + $environment = Zend_Controller_Front::getInstance()->getParam('environment'); + $return = null; + + if ($environment == 'development') + { + $return = $translate->_('runtime') . ': ' .Application::getRunTime() . '; ' . $translate->_('totalqueries') . ': ' . $profiler->getTotalNumQueries() . '; ' . $translate->_('totalqueriestime') . ': ' . $profiler->getTotalElapsedSecs(); + + if ($writetolog) + { + Zend_Registry::get('Zend_Log')->log($return, Zend_Log::NOTICE); + } + } + + return $return; + } +} \ No newline at end of file Modified: website/library/Ostacium/View/Helper/FormFile.php =================================================================== --- website/library/Ostacium/View/Helper/FormFile.php 2008-10-04 23:18:38 UTC (rev 404) +++ website/library/Ostacium/View/Helper/FormFile.php 2008-10-05 15:06:51 UTC (rev 405) @@ -18,6 +18,4 @@ return $xhtml; } -} - -?> \ No newline at end of file +} \ No newline at end of file Modified: website/library/Ostacium/View/Helper/ListTable.php =================================================================== --- website/library/Ostacium/View/Helper/ListTable.php 2008-10-04 23:18:38 UTC (rev 404) +++ website/library/Ostacium/View/Helper/ListTable.php 2008-10-05 15:06:51 UTC (rev 405) @@ -140,6 +140,4 @@ break; } } -} - -?> \ No newline at end of file +} \ No newline at end of file Modified: website/library/Ostacium/View/Helper/Truncate.php =================================================================== --- website/library/Ostacium/View/Helper/Truncate.php 2008-10-04 23:18:38 UTC (rev 404) +++ website/library/Ostacium/View/Helper/Truncate.php 2008-10-05 15:06:51 UTC (rev 405) @@ -1,8 +1,7 @@ <?php -class Ostacium_View_Helper_Truncate +class Ostacium_View_Helper_Truncate extends Zend_View_Helper_Abstract { - public $view; public static $default_options = array( 'length' => 300, 'ending' => '...', @@ -10,10 +9,6 @@ 'considerHtml' => true ); - public function setView(Zend_View_Interface $view) { - $this->view = $view; - } - public static function setDefault(array $options) { self::$default_options = $options; } @@ -131,9 +126,6 @@ } return $truncate; - } -} - -?> \ No newline at end of file +} \ No newline at end of file Modified: website/other/db.sql =================================================================== --- website/other/db.sql 2008-10-04 23:18:38 UTC (rev 404) +++ website/other/db.sql 2008-10-05 15:06:51 UTC (rev 405) @@ -3,7 +3,7 @@ -- http://www.phpmyadmin.net -- -- Host: localhost --- Generation Time: Sep 20, 2008 at 10:52 PM +-- Generation Time: Oct 05, 2008 at 05:59 PM -- Server version: 5.0.51 -- PHP Version: 5.2.6 @@ -46,8 +46,6 @@ CREATE TABLE IF NOT EXISTS `challenges` ( `id` int(11) NOT NULL auto_increment, - `name` varchar(200) NOT NULL, - `description` text NOT NULL, `timelimit` double NOT NULL default '0', `memorylimit` int(11) NOT NULL default '0', `outputlimit` int(11) NOT NULL default '0', @@ -62,216 +60,431 @@ -- Dumping data for table `challenges` -- -INSERT INTO `challenges` (`id`, `name`, `description`, `timelimit`, `memorylimit`, `outputlimit`, `tries`, `accepted`, `author`, `enabled`) VALUES -(1000, 'Swap', '<P align=left><B>Завдання</B></P><P>Дано два цілих числа a та b. Написати програму, яка б міняла їхні значення місцями. Тобто після виконання програми замість а значення b, а замість b - а. <P><B>Вхідні дані</B></P><P>В єдиному рядку записано два числа - а та b. (-32000 < a, b < 32000). <P><B>Вихідні дані</B></P><P>Вивести в єдиний рядок через пропуск два числа: спочатку b, а потім a. <P><B>Приклад введення 1</B></P><P><PRE>1 2</PRE><P><B>Приклад виведення 1</B></P><P><PRE>2 1</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>2 3</PRE><P><B>Приклад виведення 2</B></P><P><PRE>3 2</PRE><BR>', 1000, 5120000, 204800, 0, 0, '', 1), -(1001, 'A in power k', '<P align=left><B>Завдання</B></P><P>Для заданого цілого а та натурального k обчислити a<SUP>k</SUP>.<P><B>Вхідні дані</B></P><P>В єдиному рядку записано два числа a та k (-32000 < a <= 32000, 0 < k < 32000).<P><B>Вихідні дані</B></P><P>Єдине число - відповідь. Гарантується, що відповідь не більша за 2*10<SUP>9</SUP>.<P><B>Приклад введення 1</B></P><P><PRE>1 1</PRE><P><B>Приклад виведення 1</B></P><P><PRE>1</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>2 3</PRE><P><B>Приклад виведення 2</B></P><P><PRE>8</PRE><BR>', 1000, 5120000, 204800, 0, 0, '', 1), -(1002, 'Послідовність Фібоначчі', '<P align=left><B>Завдання</B></P><P>Послідовність фібоначчі визначається наступним чином:<BR></P><UL><LI>a<SUB>0</SUB>=0;<LI>a<SUB>1</SUB>=1;<LI>a<SUB>k</SUB>=a<SUB>k-1</SUB> + a<SUB>k-2</SUB></LI></UL><BR><BR>Для заданого n знайти значення n-го елемента послідовності Фібоначчі (a<SUB>n</SUB>).<P><B>Вхідні дані</B></P><P>В єдиному рядку записане єдине число N (1 <= N <= 40).<P><B>Вихідні дані</B></P><P>Єдине число - відповідь.<P><B>Приклад введення 1</B></P><P><PRE>1</PRE><P><B>Приклад виведення 1</B></P><P><PRE>1</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>5</PRE><P><B>Приклад виведення 2</B></P><P><PRE>5</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>8</PRE><P><B>Приклад виведення 3</B></P><P><PRE>21</PRE><BR>', 1000, 5120000, 204800, 0, 0, '', 1), -(1003, 'Рукавички', '<P align=left><B>Завдання</B></P><P>Комірник видає по К рукавичок кожному робітнику. Тобто другий робітник отримає рукавички від (K+1)-шої до (2∙K)-ї включно, рукавички номер (2∙K+2) отримає третій робітник і для нього вони будуть другими.<P>Напишіть програму, яка за номером виданих рукавичок визначає номер робітника, якому їх видано та порядковий номер цих рукавичок в цього робітника<P><B>Вхідні дані</B></P><P>В єдиному рядку записано два числа - K та N. K - кількість рукавичок кожному робітнику, N - номер пари рукавичок (1 <= K <= 200, 1 <= N <= 20000) розділені пропуском.<P><B>Вихідні дані</B></P><P>Номер робітника та номер рукавичок в цього робітника, розділені пропуском.<P><B>Приклад введення 1</B></P><P><PRE>50 1</PRE><P><B>Приклад виведення 1</B></P><P><PRE>1 1</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>20 25</PRE><P><B>Приклад виведення 2</B></P><P><PRE>2 5</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>15 43</PRE><P><B>Приклад виведення 3</B></P><P><PRE>3 13</PRE><BR>', 1000, 5120000, 204800, 0, 0, '', 1), -(1004, 'Супер проста проблема', '<P align=left><B>Завдання</B></P><P>Знайти квадрат N-го простого числа.<P><B>Вхідні дані</B></P><P>В єдиному рядку записане єдине число N (1 <= N <= 100).<P><B>Вихідні дані</B></P><P>Єдине число - квадрат N-го простого числа<P><B>Приклад введення 1</B></P><P><PRE>1</PRE><P><B>Приклад виведення 1</B></P><P><PRE>4</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>2</PRE><P><B>Приклад виведення 2</B></P><P><PRE>9</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>5</PRE><P><B>Приклад виведення 3</B></P><P><PRE>121</PRE><BR>', 1000, 3072000, 204800, 0, 0, '', 1), -(1005, '0-1 проблема', '<P align=left><B>Завдання</B></P><P>Над рядочком 01 виконаємо наступні операції:<UL><LI>Скопіюємо в кінець рядочка самого себе (отримаємо 0101)<LI>В другій половині рядка всі 0 змінимо на 1, а всі 1 на 0 (отримаємо 0110)</LI></UL>Над рядочком 0110 виконаємо ті самі операції. Отримаємо 01101001. І т. д.Таким чином отримаємо нескінченний рядочок нулів та одиниць.Ваше завдання – знайти n-тий символ такого рядочка.<P><B>Вхідні дані</B></P><P>В єдиному рядку записане єдине число N (1 <= N <= 2000000000).<P><B>Вихідні дані</B></P><P>Єдиний символ, який буде на N-й позиції.<P><B>Приклад введення 1</B></P><P><PRE>1</PRE><P><B>Приклад виведення 1</B></P><P><PRE>0</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>2</PRE><P><B>Приклад виведення 2</B></P><P><PRE>1</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>5</PRE><P><B>Приклад виведення 3</B></P><P><PRE>1</PRE><BR>', 1000, 3072000, 2048, 0, 0, '', 1), -(1006, 'Одинадцять', '<P align=left><B>Завдання</B></P><P>Ваше завдання – визначити чи ділиться дане число на 11.<P><B>Вхідні дані</B></P><P>В єдиному рядку записане єдине число N (1 <= n). Число має не більше тисячі знаків.<P><B>Вихідні дані</B></P><P>Вам потрібно вивести “Yes” – якщо число ділиться на 11, і “No” – в протилежному випадку.<P><B>Приклад введення 1</B></P><P><PRE>323455693</PRE><P><B>Приклад виведення 1</B></P><P><PRE>Yes</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>5038297</PRE><P><B>Приклад виведення 2</B></P><P><PRE>Yes</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>112234</PRE><P><B>Приклад виведення 3</B></P><P><PRE>No</PRE><BR>', 1000, 3072000, 2048, 0, 0, '', 1), -(1007, 'Супер послідовність', '<P align=left><B>Завдання</B></P><P>Послідовність чисел a1, a2, … an називається супер послідовністю, якщо виконуються наступні умови:<UL><LI>0 < a1 < a2 < … < an<LI>жодне з чисел не є сумою двох або більше інших чисел</LI></UL><P><B>Вхідні дані</B></P><P>В єдиному рядку записане число N (1 <= n <= 50), далі задано N чисел, кожне з яких не менше 1 і не більше 1000.<P><B>Вихідні дані</B></P><P>Вам необхідно вивести “Yes” – якщо дано супер послідовність, “No” – в протилежному випадку.<P><B>Приклад введення 1</B></P><P><PRE>2 1 2</PRE><P><B>Приклад виведення 1</B></P><P><PRE>Yes</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>3 1 2 3</PRE><P><B>Приклад виведення 2</B></P><P><PRE>No</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>10 1 3 16 19 25 70 100 243 245 306</PRE><P><B>Приклад виведення 3</B></P><P><PRE>No</PRE><BR>', 1000, 3072000, 2048, 0, 0, '', 1), -(1008, 'Супер яйця', '<P align=left><B>Задання</B></P><P>Нехай у вас є n супер яєць і ви живете в k поверховому будинку. Вам необхідно визначити за найменшу кількість кидків найбільший номер поверху з якого кинуте вниз супер яйце не розбивається. Тобто, за яку найменшу кількість спроб можна визначити найвищий поверх, з якого супер яйце не розбивається. Зауважте, якщо в результаті деякої спроби яйце не розбилось, то воно може бути використане в наступних спробах.<P><B>Вхідні дані</B></P><P>В єдиному рядку записано 2 цілих числа N (N<=30)- кількість яєць та M (M<=2 000 000 000)- кількість поверхів.<P><B>Вихідні дані</B></P><P>У єдиному рядку треба вивести єдине число – мінімальна необхідна кількість спроб. Якщо необхідно більше 30 спроб виведіть -1.<P><B>Приклад введення 1</B></P><P><PRE>1 15</PRE><P><B>Приклад виведення 1</B></P><P><PRE>15</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>2 100</PRE><P><B>Приклад виведення 2</B></P><P><PRE>14</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>10 786599</PRE><P><B>Приклад виведення 3</B></P><P><PRE>21</PRE><BR><P><B>Приклад введення 4</B></P><P><PRE>4 786599</PRE><P><B>Приклад виведення 3</B></P><P><PRE>-1</PRE><BR>', 1000, 5120000, 2048, 0, 0, '', 1), -(1009, 'Супер карти', '<P align=left><B>Завдання</B></P><P>Дана колода впорядкованих супер карт від 1 до n. Верхня супер карта має номер 1, нижня – n. Поки в колоді є хоча б дві супер карти викидаємо верхню карту, а наступну ставимо вниз колоди.<P>Необхідно знайти номер супер карти, що залишиться.<P><B>Вхідні дані</B></P><P>В єдиному рядку записане єдине число N - число супер карт в колоді (1 <= n <= 1000000).<P><B>Вихідні дані</B></P><P>Єдине число - номер супер карти, що залишиться.<P><B>Приклад введення 1</B></P><P><PRE>7</PRE><P><B>Приклад виведення 1</B></P><P><PRE>6</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>19</PRE><P><B>Приклад виведення 2</B></P><P><PRE>6</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>10</PRE><P><B>Приклад виведення 3</B></P><P><PRE>4</PRE><BR><P><B>Приклад введення 4</B></P><P><PRE>6</PRE><P><B>Приклад виведення 4</B></P><P><PRE>4</PRE><BR>', 1000, 3072000, 2048, 0, 0, '', 1), -(1010, 'Остання проблема', '<P align=left><B>Завдання</B></P><P>Ваше завдання – визначити чи дане число N можна представити у вигляді суми двох простих чисел.<P><B>Вхідні дані</B></P><P>В єдиному рядку записане єдине число N (1 <= N <= 1000000).<P><B>Вихідні дані</B></P><P>Cума двох простих чисел, що рівна n, або -1, якщо такої не існує. В сумі перше число не більше другого і якщо існує декілька таких можливих сум – вивести ту, в якої перший доданок найменший.<P><B>Приклад введення 1</B></P><P><PRE>9</PRE><P><B>Приклад виведення 1</B></P><P><PRE>2+7</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>10</PRE><P><B>Приклад виведення 2</B></P><P><PRE>3+7</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>11</PRE><P><B>Приклад виведення 3</B></P><P><PRE>-1</PRE><BR>', 1000, 3072000, 2048, 0, 0, '', 1), -(1011, 'Медіанний фільтр', '<P align=left><B>Завдання</B></P><P>Медіаною у відсортованому по неспаданню масиву розмірності N називається елемент, який знаходиться у середній позиції масиву, тобто у позиції (N+1)/2 (цілочисельне ділення). <P>Медіанним фільтром для растрового зображення називається таке перетворення кожної точки, колір якої вибирається як медіана із множини точок з певного околу (радіусом R) цієї точки (квадратної області із центром у вибраній точці – розміри квадрата рівні [R+1+ R]×[ R+1+R]). Медіанний фільтр використовують для видалення дрібного шуму із зображення. На межі зображення точки, що виходять за межі, вважаються точками із кольором фону (абсолютне значення рівне нулю).<P>Для заданого малюнку прямокутної форми шириною W та висотою H знайдіть максимальне значення медіани для розміру околу R. Вважається, що малюнок монохромний із 256 градаціями одного кольору.<P><B>Вхідні дані</B></P><P>В першому рядку задані 3 числа: розмір околу R (1≤R≤20), H(1≤H≤400), W(1≤W≤250). В наступних H рядках знаходиться по W чисел розділених пропуском. Числа – це кольори відповідних точок.<P><B>Вихідні дані</B></P><P>Виведіть результат – максимальне значення медіани для заданого малюнку та радіусу.<P><B>Приклад введення</B></P><P><PRE>1 4 3</PRE><PRE>1 1 1</PRE><PRE>1 2 4</PRE><PRE>2 3 2</PRE><PRE>1 1 1</PRE><P><B>Приклад виведення</B></P><P><PRE>2</PRE>', 1500, 3072000, 204800, 0, 0, '', 1), -(1012, 'Дужки і Нобелівська премія', '<P align=left><B>Завдання</B></P><P>Директор однієї відомої програмістської фірми Білл (ви напевно його знаєте) захотів одержати Нобелівську премію. Для цього він запропонував додати в арифметичні вирази крім круглих дужок ще й квадратні, причому: спочатку виконуються обчислення в квадратних дужках, що стоять лівіше, потім в наступних квадратних і т.д.; в такому ж порядку виконуються обчислення в круглих дужках. Наприклад: у виразі порядок обчислення виразів в дужках такий: <CENTER><IMG src="/fusion/images/problems/1012/pic1.jpg"></CENTER><P>Працівники фірми встигнуть в запланований термін реалізувати тільки виконання всіх потрібних операцій в виразах без дужок. Тому пан Білл звернувся до нас за допомогою. Отже, ваше завдання таке: <BR>1) виведіть на екран "YES", якщо дужки у виразі розставлені правильно і "NO" в протилежному випадку;<BR>2) у випадку правильно розставлених дужок виведіть на екран через пропуск в окремому рядку для кожної пари дужок позиції їх розташування в заданому виразі, якщо він буде обчислюватися згідно описаних вище правил. <P><B>Вхідні дані</B></P><P>В першому рядку знаходиться вираз. Довжина рядка не перевищує 255 символів. <P><B>Вихідні дані</B></P><P>Результат виконання програми. <P><B>Приклад введення</B></P><P><PRE>а+(2-с)-[21-8*b+(-2)]+[3]</PRE><P><B>Приклад виведення</B></P><P><PRE>YES</PRE><PRE>17 20</PRE><PRE>9 21</PRE><PRE>23 25</PRE><PRE>3 7<BR></PRE>', 500, 3072000, 2048, 0, 0, '', 1), -(1013, 'Електронний пристрій', '<P align=left><B>Завдання</B></P><P>Одному визначному вченому майже вдалося побудувати новий електронний пристрій визначення поведінки погоди. Йому потрібна програма, яка б дозволяла аналізувати вміст результатів дослідження. Ваше завдання – допомогти йому. <P>Результати – це послідовність чисел (нуль або один). Вам потрібно дати відповідь чи всі числа рівні між і-тим та j-тим елементами послідовності включно. <P><B>Вхідні дані</B></P><P>В першому рядку задано число N(0 < N ≤ 3*10<SUP>5</SUP>) – кількість елементів послідовності. В другому рядку розділені пропуском записані елементи послідовності. В третьому рядку записано число M(0 < M ≤ 5*10<SUP>4</SUP>) – кількість запитань. Далі в M рядках розділ... [truncated message content] |
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. |
From: <pan...@us...> - 2008-12-06 23:13:26
|
Revision: 435 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=435&view=rev Author: panzaboi Date: 2008-12-06 23:13:21 +0000 (Sat, 06 Dec 2008) Log Message: ----------- Added functionality to submit problems by textarea or file upload. Modified Paths: -------------- website/application/layouts/layout.phtml website/application/modules/acm/controllers/ArchieveController.php website/application/modules/acm/controllers/IndexController.php website/application/modules/acm/models/Archieve.php 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/index/index.phtml website/config/config.ini website/httpdocs/scripts/main.js website/library/Application.php website/library/Ostacium/Controller/Plugin/ErrorHandler.php website/library/Ostacium/Controller/Router/Route/Language.php website/library/Ostacium/Db/Table.php website/other/todo.txt Added Paths: ----------- website/application/modules/acm/models/Form/Submit.php website/application/modules/acm/views/scripts/archieve/submit.phtml website/other/submits/ website/other/uploads/ Property Changed: ---------------- website/library/ Modified: website/application/layouts/layout.phtml =================================================================== --- website/application/layouts/layout.phtml 2008-12-06 13:12:31 UTC (rev 434) +++ website/application/layouts/layout.phtml 2008-12-06 23:13:21 UTC (rev 435) @@ -12,6 +12,7 @@ <?= $this->headLink()->appendStylesheet('styles/style.css') ?> <?= /*$this->headLink()->appendStylesheet('styles/ie6.css', 'screen', 'IE 6')*/'' ?> <?= /*$this->headLink()->appendStylesheet('styles/ie7.css', 'screen', 'IE 7')*/'' ?> + <?= $this->headScript()->appendFile('/scripts/main.js') ?> <? if ($this->dojo()->isEnabled()): $this->dojo()->setLocalPath('/scripts/dojo/dojo.js') @@ -19,7 +20,6 @@ echo $this->dojo(); endif; ?> - <?= $this->headScript()->appendFile('/scripts/main.js') ?> </head> <body class="tundra"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> @@ -39,10 +39,10 @@ <table width="100%" border="0" cellpadding="0" cellspacing="5"> <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="index/about">Що це за проект</a></td></tr> <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="index/rule">Правила</a></td></tr> - <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="archieve/index">Набір завдань</a></td></tr> - <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="archieve/submit">Протестувати Розв'язок</a></td></tr> - <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="archieve/results">Результати Тестувань</a></td></tr> - <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="archieve/ranks">Рейтинг Учасників</a></td></tr> + <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="/acm/archieve/index">Набір завдань</a></td></tr> + <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="/acm/archieve/submit">Протестувати Розв'язок</a></td></tr> + <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="/acm/archieve/results">Результати Тестувань</a></td></tr> + <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="/acm/archieve/ranks">Рейтинг Учасників</a></td></tr> <tr><td><hr></td></tr> </table> Modified: website/application/modules/acm/controllers/ArchieveController.php =================================================================== --- website/application/modules/acm/controllers/ArchieveController.php 2008-12-06 13:12:31 UTC (rev 434) +++ website/application/modules/acm/controllers/ArchieveController.php 2008-12-06 23:13:21 UTC (rev 435) @@ -15,11 +15,76 @@ if (!$problem) return $this->_forward('index', null, null, $this->_getAllParams() + array('message' => 'noProblem')); - $this->view->problem = $problem; + $this->view->assign($problem); } public function submitAction() { + $this->_helper->getHelper('viewRenderer')->setNoRender(true); + $form = $this->_model->getSubmitForm(array( + 'action' => $this->view->url(array('action' => 'upload', 'id' => $this->_getParam('id')), null), + 'method' => 'post', + 'name' => 'submitform', + )); + + $this->view->dojo()->addOnLoad('function(){ changeEditor('.$form->type->getValue().'); }'); + + echo $form; } + + public function uploadAction() + { + $this->_helper->getHelper('viewRenderer')->setNoRender(true); + $form = $this->_model->getSubmitForm(array( + 'action' => $this->view->url(array('action' => 'upload', 'id' => $this->_getParam('id')), null), + 'method' => 'post', + 'name' => 'submitform', + )); + + if (!$this->getRequest()->isPost()) + { + return $this->_forward('submit', null, null, $this->_getAllParams()); + } + + if ($_POST['type'] == 0) + { + $form->code->setRequired(true); + } + elseif ($_POST['type'] == 1) + { + $form->codefile->setRequired(true); + } + + $result = $form->isValid($this->getRequest()->getPost()); + $this->view->dojo()->addOnLoad('function(){ changeEditor('.$form->type->getValue().'); }'); + + if ($form->type->getValue() == 0) + { + $form->code->setRequired(false); + } + elseif ($form->type->getValue() == 1) + { + $form->codefile->setRequired(false); + } + + if (!$result) + { + echo $form; + return; + } + + $values = $form->getValues(); + $values += $this->_getAllParams(); + $id = $this->_model->addSubmit($values); + + if ($values['type'] == 0) + { + file_put_contents(Application::getDocRoot().'/other/submits/'.$id.'.cpp', $values['code']); + } + elseif ($values['type'] == 1) + { + rename($form->codefile->getFileName(), Application::getDocRoot().'/other/submits/'.$id.'.cpp'); + } + } } \ No newline at end of file Modified: website/application/modules/acm/controllers/IndexController.php =================================================================== --- website/application/modules/acm/controllers/IndexController.php 2008-12-06 13:12:31 UTC (rev 434) +++ website/application/modules/acm/controllers/IndexController.php 2008-12-06 23:13:21 UTC (rev 435) @@ -58,7 +58,7 @@ protected function getLoginForm() { return new Form_Login(array( - 'action' => $this->getRequest()->getBaseUrl() . 'acm/index/login', + 'action' => $this->view->url(array('action' => 'login'), null), 'method' => 'post', 'name' => 'loginform', )); Modified: website/application/modules/acm/models/Archieve.php =================================================================== --- website/application/modules/acm/models/Archieve.php 2008-12-06 13:12:31 UTC (rev 434) +++ website/application/modules/acm/models/Archieve.php 2008-12-06 23:13:21 UTC (rev 435) @@ -13,6 +13,37 @@ $challenges = new Challenges(); return $challenges->get($id); } + + public function getCodeLanguages() + { + return $this->_db->fetchPairs($this->_db->select()->from('code_languages', array('id', 'name'))); + } + + public function addSubmit($values) + { + $data = array( + 'username' => Zend_Auth::getInstance()->getStorage()->read()->username, + 'challengeid' => $values['id'], + 'languageid' => $values['languageid'], + 'firsttest' => $values['firsttest'], + 'when' => time() + ); + + $submits = new Submits(); + return $submits->insert($data); + } + + public function getSubmitForm($options = array()) + { + $form = new Form_Submit($options); + $user = Zend_Auth::getInstance()->getStorage()->read(); + + $languageid = $form->getElement('languageid'); + $languageid->addMultiOptions($this->getCodeLanguages()); + $languageid->setValue($user->codelangid); + + return $form; + } } class Challenges extends Ostacium_Db_Table @@ -20,8 +51,19 @@ protected $_name = 'challenges'; protected $_primary = 'id'; + public function get($id) + { + return $this->selectLang(array('name', 'description'))->where($this->_name.'.id = ?', $id)->query()->fetch(); + } + public function getAll() { - return $this->select()->from($this)->where('enabled = ?', 1)->query()->fetchAll(); + return $this->selectLang(array('name', 'description'))->where('enabled = ?', 1)->query()->fetchAll(); } +} + +class Submits extends Ostacium_Db_Table +{ + protected $_name = 'archieve_submits'; + protected $_primary = 'id'; } \ No newline at end of file Added: website/application/modules/acm/models/Form/Submit.php =================================================================== --- website/application/modules/acm/models/Form/Submit.php (rev 0) +++ website/application/modules/acm/models/Form/Submit.php 2008-12-06 23:13:21 UTC (rev 435) @@ -0,0 +1,82 @@ +<?php + +class Form_Submit extends Zend_Dojo_Form +{ + public $elementDecorators = array( + 'DijitElement', + 'Errors', + array('Label', array('class' => 'overlabel')), + array('HtmlTag', array('tag' => 'div', 'class' => 'elcontainer')) + ); + + public $simpleDecorators = array( + '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->setAttrib('enctype', 'multipart/form-data'); + + $this->addElement('FilteringSelect', 'languageid', array( + 'decorators' => $this->elementDecorators, + 'required' => true, + 'style' => 'height: 18px; width: 100px;', + 'title' => $translate->_('code_language'), + 'label' => $translate->_('code_language').': ', + )); + + $this->addElement('RadioButton', 'type', array( + 'decorators' => $this->elementDecorators, + 'required' => true, + 'title' => $translate->_('upload_type'), + 'label' => $translate->_('upload_type ').': ', + 'multiOptions' => array($translate->_('editor'), $translate->_('file_upload')), + 'onclick' => 'changeEditor(this.value);', + 'value' => 0 + )); + + $this->addElement('SimpleTextarea', 'code', array( + 'decorators' => $this->elementDecorators, + 'style' => 'height: 400px; width: 500px;', + 'title' => $translate->_('enter_code'), + 'label' => $translate->_('enter_code'), + )); + + $this->addElement('File', 'codefile', array( + 'decorators' => array_merge(array('File'), $this->simpleDecorators), + 'validators' => array(array('Count', false, 1)), + 'destination' => Application::getDocRoot().'/other/uploads/', + 'label' => $translate->_('enter_code'), + )); + + $this->addElement('Checkbox', 'firsttest', array( + 'decorators' => $this->elementDecorators, + 'title' => $translate->_('first_test'), + 'label' => $translate->_('first_test ').': ' + )); + + $this->addElement('SubmitButton', 'submitbutton', array( + 'decorators' => $this->buttonDecorators, + 'required' => false, + 'ignore' => true, + 'label' => $translate->_('submit'), + )); + } + + public function loadDefaultDecorators() + { + $this->setDecorators(array( + 'FormElements', + 'DijitForm', + array('Description', array('placement' => 'prepend', 'tag' => 'div', 'class' => 'error')), + )); + } +} \ No newline at end of file Modified: website/application/modules/acm/views/scripts/archieve/entry.phtml =================================================================== --- website/application/modules/acm/views/scripts/archieve/entry.phtml 2008-12-06 13:12:31 UTC (rev 434) +++ website/application/modules/acm/views/scripts/archieve/entry.phtml 2008-12-06 23:13:21 UTC (rev 435) @@ -12,7 +12,7 @@ <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"/> + <a href="<?= $this->url( array('action' => 'submit', 'id' => $this->id), null) ?>"><img height="17" width="22" alt="Здати" title="Здати" src="images/b_find.gif"/></a> + <a href="<?= $this->url( array('action' => 'status', 'id' => $this->id), null) ?>"><img height="17" width="22" alt="Показати як здають" src="images/probstatus.png"/> </td> </tr> \ No newline at end of file Modified: website/application/modules/acm/views/scripts/archieve/index.phtml =================================================================== --- website/application/modules/acm/views/scripts/archieve/index.phtml 2008-12-06 13:12:31 UTC (rev 434) +++ website/application/modules/acm/views/scripts/archieve/index.phtml 2008-12-06 23:13:21 UTC (rev 435) @@ -1,5 +1,10 @@ -<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> +<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" summary="" align="center"><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="270"> Назва</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 Modified: website/application/modules/acm/views/scripts/archieve/view.phtml =================================================================== --- website/application/modules/acm/views/scripts/archieve/view.phtml 2008-12-06 13:12:31 UTC (rev 434) +++ website/application/modules/acm/views/scripts/archieve/view.phtml 2008-12-06 23:13:21 UTC (rev 435) @@ -1,5 +1,12 @@ -<?php +<h2 align="center"><?= $this->id.' - '.$this->name ?></h2> +<div align="center"> + <?= $this->translate('timelimit') ?>: <?= $this->measure("Time", $this->timelimit, Zend_Measure_Time::MILLISECOND, Zend_Measure_Time::SECOND, 0 ) ?><br /> + <?= $this->translate('memorylimit') ?>: <?= $this->measure("Binary", $this->memorylimit, Zend_Measure_Binary::BYTE, Zend_Measure_Binary::KILOBYTE ) ?><br /> + <?= $this->translate('outputlimit') ?>: <?= $this->measure("Binary", $this->outputlimit, Zend_Measure_Binary::BYTE, Zend_Measure_Binary::KILOBYTE ) ?><br /> +</div> +<br /> +<p><?= $this->description ?></p> -var_dump($this->problem); - -?> \ No newline at end of file +<div> + <a href="<?= $this->url(array('action' => 'submit', 'id' => $this->id), null) ?>"><?= $this->translate('submit') ?></a> +</div> \ No newline at end of file Modified: website/application/modules/acm/views/scripts/index/index.phtml =================================================================== --- website/application/modules/acm/views/scripts/index/index.phtml 2008-12-06 13:12:31 UTC (rev 434) +++ website/application/modules/acm/views/scripts/index/index.phtml 2008-12-06 23:13:21 UTC (rev 435) @@ -1 +1,9 @@ -<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 +<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 Modified: website/config/config.ini =================================================================== --- website/config/config.ini 2008-12-06 13:12:31 UTC (rev 434) +++ website/config/config.ini 2008-12-06 23:13:21 UTC (rev 435) @@ -65,8 +65,9 @@ #currency.precision = "2" currency.display = "2" -title = "ACM Contester" -titlesep = " - " +general.title = "ACM Contester" +general.titlesep = " - " +general.extention = "html" [development: general] @@ -76,7 +77,8 @@ db.params.dbname = "acm" db.params.username = "acm" db.params.password = "c0nt3st3r" +db.params.profiler.label = Db Profiler db.params.profiler.enabled = true -db.params.profiler.class = Zend_Db_Profiler_Firebug +db.params.profiler.class = Ostacium_Db_Profiler_Firebug [stable: genral] \ No newline at end of file Modified: website/httpdocs/scripts/main.js =================================================================== --- website/httpdocs/scripts/main.js 2008-12-06 13:12:31 UTC (rev 434) +++ website/httpdocs/scripts/main.js 2008-12-06 23:13:21 UTC (rev 435) @@ -1 +1,19 @@ +function changeEditor(value) +{ + if (!dojo.byId('code') || !dojo.byId('codefile')) return false; + + if (value == 0) + { + dojo.byId('code').parentNode.style.display = 'block'; + dojo.byId('codefile').parentNode.style.display = 'none'; + } + else if(value == 1) + { + dojo.byId('code').parentNode.style.display = 'none'; + dojo.byId('codefile').parentNode.style.display = 'block'; + } + + return false; +} + function checkForm(form){if(form.lgn.value.length<3){alert('Логін повинен мати як мінімум 3 символи!');return false;}} \ No newline at end of file Property changes on: website/library ___________________________________________________________________ Modified: svn:ignore - Zend + Zend ZendX Modified: website/library/Application.php =================================================================== --- website/library/Application.php 2008-12-06 13:12:31 UTC (rev 434) +++ website/library/Application.php 2008-12-06 23:13:21 UTC (rev 435) @@ -5,12 +5,12 @@ protected $_environment; protected static $_approot; protected static $_start; - protected $_docroot; + protected static $_docroot; public function __construct($_approot) { self::$_approot = $_approot; - $this->_docroot = dirname($_SERVER["DOCUMENT_ROOT"]); + self::$_docroot = dirname($_SERVER["DOCUMENT_ROOT"]); self::$_start = microtime(true); } @@ -19,6 +19,11 @@ return self::$_approot; } + public static function getDocRoot() + { + return self::$_docroot; + } + public static function getRunTime() { return (microtime(true) - self::$_start); @@ -58,9 +63,9 @@ { // Set Include paths set_include_path( - $this->_docroot . PATH_SEPARATOR - . $this->_docroot . '/application' . PATH_SEPARATOR - . $this->_docroot . '/library' . PATH_SEPARATOR + self::$_docroot . PATH_SEPARATOR + . self::$_docroot . '/application' . PATH_SEPARATOR + . self::$_docroot . '/library' . PATH_SEPARATOR . get_include_path() ); @@ -74,15 +79,15 @@ // Setup Config $_config = $this->_setupConfig(); + // Setup DB + $this->_setupDB(); + // Setup Front Controller $frontController = $this->_setupFrontController(); // Setup Date Ostacium_Date::setOptions($_config->date->toArray()); //date_default_timezone_set($_config->date->timezone); - - // Setup DB - $this->_setupDB(); // Setup Helpers Ostacium_View_Helper_Truncate::setDefault($_config->truncate->toArray()); @@ -90,9 +95,6 @@ // Setup Log $this->_setupLog(); - - // Setup Authorication - $acl = $this->_setupAuth(); // Setup Languages $this->_setupLang(); @@ -108,8 +110,8 @@ Zend_Mail::setDefaultTransport($mail); // Setup Plugins - $routerPlugin = new Ostacium_Controller_Plugin_Router($acl, $_config->auth->noauth->toArray(), $_config->auth->noacl->toArray()); - $frontController->registerPlugin($routerPlugin, -1); + //$routerPlugin = new Ostacium_Controller_Plugin_Router($acl, $_config->auth->noauth->toArray(), $_config->auth->noacl->toArray()); + //$frontController->registerPlugin($routerPlugin, -1); return $frontController; } @@ -131,7 +133,7 @@ protected function _setupConfig() { - $_config = new Zend_Config_Ini($this->_docroot . '/config/config.ini', $this->getEnvironment()); + $_config = new Zend_Config_Ini(self::$_docroot . '/config/config.ini', $this->getEnvironment()); error_reporting((int)$_config->error->report); ini_set('display_errors', (int)$_config->error->display); @@ -162,16 +164,15 @@ $frontController->throwExceptions((bool) $_config->error->throw); $frontController->setParam('environment', $this->_environment); $frontController->setModuleControllerDirectoryName('controllers'); - $frontController->addModuleDirectory($this->_docroot . '/application/modules/'); + $frontController->addModuleDirectory(self::$_docroot . '/application/modules/'); $frontController->setRequest('Ostacium_Controller_Request_Http'); + // Setup Authorication + $acl = $this->_setupAuth(); + // Error Handler $frontController->setParam('noErrorHandler', 1); - $frontController->registerPlugin(new Ostacium_Controller_Plugin_ErrorHandler(array( - 'module' => $_config->auth->noacl->module, - 'controller' => $_config->auth->noacl->controller, - 'action' => $_config->auth->noacl->action - ))); + $frontController->registerPlugin(new Ostacium_Controller_Plugin_ErrorHandler($acl, $_config->auth->noauth->toArray())); return $frontController; } @@ -181,18 +182,20 @@ $_config = Zend_Registry::get('config'); $options = $_config->view->toArray(); - $options['helperPath'] = $this->_docroot . '/' . $options['helperPath']; + $options['helperPath'] = self::$_docroot . '/' . $options['helperPath']; $view = new Zend_View($options); // Setup DocType $view->doctype('XHTML1_TRANSITIONAL'); + // Setup Title - $view->headTitle($_config->title)->setSeparator($_config->titlesep); + $view->headTitle($_config->general->title)->setSeparator($_config->general->titlesep); + // Setup Dojo Zend_Dojo::enableView($view); $options = $_config->layout->toArray(); - $options['layoutpath'] = $this->_docroot . '/' . $options['layoutpath']; + $options['layoutpath'] = self::$_docroot . '/' . $options['layoutpath']; Zend_Layout::startMvc($options + array('view' => $view)); $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view); @@ -205,6 +208,7 @@ $acl = new Ostacium_Acl($_config->auth->order); $auth = new Ostacium_Auth_Adapter_DbTable(Zend_Registry::get('db'), $_config->auth->table, $_config->auth->user, $_config->auth->pass, $_config->auth->passtreat); + $auth->setReferenceMap($_config->auth->referenceMap->toArray()); Zend_Registry::set('auth', $auth); @@ -219,11 +223,11 @@ $_db = Zend_Registry::get('db'); $_auth = Zend_Auth::getInstance(); - $translate = new Zend_Translate('csv', $this->_docroot . '/' . $_config->lang->path . $_config->lang->default . '.csv', $_config->lang->default); - foreach($_config->lang->langs as $lang) + $translate = new Zend_Translate('csv', self::$_docroot . '/' . $_config->lang->path . $_config->lang->default . '.csv', $_config->lang->default); + foreach ($_config->lang->langs as $lang) { if ($lang != $_config->lang->default) - $translate->addTranslation($this->_docroot . '/' . $_config->lang->path . $lang .'.csv', 'en'); + $translate->addTranslation(self::$_docroot . '/' . $_config->lang->path . $lang .'.csv', 'en'); } if ($_auth->hasIdentity()) @@ -240,7 +244,7 @@ $_config = Zend_Registry::get('config'); $router = $frontController->getRouter(); - $router->addRoute('default', new Ostacium_Controller_Router_Route_Language(array(), $frontController->getDispatcher(), $frontController->getRequest())); + $router->addRoute('default', new Ostacium_Controller_Router_Route_Language(array(), $frontController->getDispatcher(), $frontController->getRequest(), $_config->general->extention)); if ($_config->routes) $router->addConfig($_config->routes); Modified: website/library/Ostacium/Controller/Plugin/ErrorHandler.php =================================================================== --- website/library/Ostacium/Controller/Plugin/ErrorHandler.php 2008-12-06 13:12:31 UTC (rev 434) +++ website/library/Ostacium/Controller/Plugin/ErrorHandler.php 2008-12-06 23:13:21 UTC (rev 435) @@ -3,33 +3,50 @@ class Ostacium_Controller_Plugin_ErrorHandler extends Zend_Controller_Plugin_ErrorHandler { protected $_isPreDispatch = false; + protected $_acl; + protected $_noauth = array( + 'controller' => 'index', + 'action' => 'login' + ); + + public function __construct($acl, $noauth = null) { + $this->_acl = $acl; + $this->_noauth = is_array($noauth) ? $noauth : $this->_noauth; + } const EXCEPTION_NOTALLOWED = 'EXCEPTION_NOTALLOWED'; public function preDispatch(Zend_Controller_Request_Abstract $request) - { + { $frontController = Zend_Controller_Front::getInstance(); $dispatcher = $frontController->getDispatcher(); $response = $this->getResponse(); $error = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS); $error->exception = current($response->getException()); - + if (!$dispatcher->isDispatchable($request)) { $error->type = self::EXCEPTION_NO_CONTROLLER; if (!$error->exception) $error->exception = new Zend_Controller_Dispatcher_Exception("Resource doesn't exist", 404); - } elseif (!$this->isProperAction($dispatcher, $request)) { + } elseif (!$this->isProperAction($dispatcher, $request) || !$this->existsResource($dispatcher, $request)) { $error->type = self::EXCEPTION_NO_ACTION; if (!$error->exception) $error->exception = new Zend_Controller_Dispatcher_Exception("Resource doesn't exist", 404); + } elseif (!$this->isAllowed($request)) { + if (!$auth->hasIdentity()) { + $request->setControllerName($this->_noauth['controller']); + $request->setActionName($this->_noauth['action']); + $request->setParam('message', 'nologin'); + + return $request; + } + + $error->type = self::EXCEPTION_NOTALLOWED; + if (!$error->exception) + $error->exception = new Zend_Controller_Dispatcher_Exception("No rights to access the resouce", 403); } elseif ($error->exception) { $error->type = self::EXCEPTION_OTHER; - } elseif ($request->getParam('error_message') != "") - { - $error->type = self::EXCEPTION_NOTALLOWED; - if (!$error->exception) - $error->exception = new Ostacium_Controller_Plugin_Router_Exception("No rights to access the resouce", 403); } if (isset($error->type)) { @@ -103,7 +120,7 @@ } } - public function isProperAction($dispatcher, $request) + public function isProperAction($dispatcher, Zend_Controller_Request_Abstract $request) { $className = $dispatcher->loadClass($dispatcher->getControllerClass($request)); $actionName = $request->getActionName(); @@ -121,4 +138,42 @@ return false; } + + public function existsResource($dispatcher, Zend_Controller_Request_Abstract $request) + { + $controller = $request->getControllerName(); + $action = $request->getActionName(); + $module = $request->getModuleName(); + $resource = ($module != 'default' ? $module . ':' . $controller : $controller); + + if (!$this->_acl->has($resource) || !$dispatcher->isDispatchable($request) || !$this->isProperAction($dispatcher, $request)) + { + return false; + } + + return true; + } + + public function isAllowed(Zend_Controller_Request_Abstract $request) + { + $auth = Zend_Auth::getInstance(); + $dispatcher = Zend_Controller_Front::getInstance()->getDispatcher(); + + if ($auth->hasIdentity()) { + $role = $this->_acl->getRoleById($auth->getIdentity()->roleid) ? $this->_acl->getRoleById($auth->getIdentity()->roleid) : 'guest'; + } else { + $role = 'guest'; + } + + $controller = $request->getControllerName(); + $action = $request->getActionName(); + $module = $request->getModuleName(); + $resource = ($module != 'default' ? $module . ':' . $controller : $controller); + + + if (!$this->_acl->isAllowed($role, $resource, $action)) + return false; + + return true; + } } \ No newline at end of file Modified: website/library/Ostacium/Controller/Router/Route/Language.php =================================================================== --- website/library/Ostacium/Controller/Router/Route/Language.php 2008-12-06 13:12:31 UTC (rev 434) +++ website/library/Ostacium/Controller/Router/Route/Language.php 2008-12-06 23:13:21 UTC (rev 435) @@ -4,17 +4,20 @@ { protected $translate; protected $config; + protected $extention; protected $_languageKey = 'language'; public function __construct(array $defaults = array(), Zend_Controller_Dispatcher_Interface $dispatcher = null, - Zend_Controller_Request_Abstract $request = null) + Zend_Controller_Request_Abstract $request = null, + $extention = null) { parent::__construct($defaults, $dispatcher, $request); $this->translate = Zend_Registry::get('Zend_Translate'); $this->config = Zend_Registry::get('config'); + $this->extention = $extention; } protected function _setRequestKeys() @@ -36,6 +39,13 @@ $values = array(); $params = array(); $path = trim($path, self::URI_DELIMITER); + + if ($this->extention) + { + $ext = strrchr($path, '.' . $this->extention); + if ($ext) $path = substr($path, 0, -strlen($ext)); + //else $path = ''; + } if ($path != '') { $path = explode(self::URI_DELIMITER, $path); @@ -133,6 +143,11 @@ if ($encode) $language = urlencode($language); $url = '/' . $language . $url; } + + if (!empty($url) && substr($url, 0, -1) != '/' && $this->extention) + { + $url .= '.' . $this->extention; + } return ltrim($url, self::URI_DELIMITER); } Modified: website/library/Ostacium/Db/Table.php =================================================================== --- website/library/Ostacium/Db/Table.php 2008-12-06 13:12:31 UTC (rev 434) +++ website/library/Ostacium/Db/Table.php 2008-12-06 23:13:21 UTC (rev 435) @@ -49,10 +49,26 @@ return $query->fetchColumn(); } + public function selectLang(array $cols = array()) + { + $translate = Zend_Registry::get('Zend_Translate'); + $_config = Zend_Registry::get('config'); + $columns = array(); + + foreach ($cols as $col) + { + $columns[] = 'IF (l.id, l.'.$col.', d.'.$col.') AS '.$col; + } + + return $this->select()->setIntegrityCheck(false)->from($this->_name, array('*', implode(', ', $columns))) + ->joinLeft(array('d' => $this->_name.'_lang'), 'd.id = '.$this->_name.'.id AND d.langcode = \''.$_config->lang->default.'\'', array()) + ->joinLeft(array('l' => $this->_name.'_lang'), 'l.id = '.$this->_name.'.id AND l.langcode = \''.$translate->getLocale().'\'', array()); + } + protected function _dataFilter(&$data) { if(empty($this->_cols)) { - $this->_setupMetadata(); + $this->_getCols(); } $data = array_intersect_key($data, array_flip($this->_cols)); Property changes on: website/other/submits ___________________________________________________________________ Added: tsvn:logminsize + 5 Modified: website/other/todo.txt =================================================================== --- website/other/todo.txt 2008-12-06 13:12:31 UTC (rev 434) +++ website/other/todo.txt 2008-12-06 23:13:21 UTC (rev 435) @@ -1,10 +1,10 @@ -1. Add Zend_Log, write - undecided, FILE? DB? ++/-1. Add Zend_Log, write - undecided, FILE? DB? 2. Design Change 3. Ostacium_CrudAction redesign 4. Ostacium_View_Helper_listTable redesign 5. Front_Controller => catch Exception => go to Error Controller 6. Caching for DB, VIEW, etc. -7. Table Prefix - відложено +-7. Table Prefix - відложено 8. Custom Admin Email 9. Add mb_ support to everything 10!. _authenticateCreateSelect - quote the reference! how? Property changes on: website/other/uploads ___________________________________________________________________ Added: tsvn:logminsize + 5 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pan...@us...> - 2008-12-07 22:02:07
|
Revision: 437 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=437&view=rev Author: panzaboi Date: 2008-12-07 21:57:19 +0000 (Sun, 07 Dec 2008) Log Message: ----------- Archive: Added results, moved form info into the form class User: Created register and activate actions with email activation Tester: Added methods to communicate with tester, send and receive data Mail: Added setBodyTemplate to add bodyHtml as rendered file DB: Updated Skeleton. Modified Paths: -------------- website/application/modules/acm/controllers/ArchieveController.php website/application/modules/acm/controllers/IndexController.php website/application/modules/acm/models/Archieve.php website/application/modules/acm/models/Form/Login.php website/application/modules/acm/models/Form/Submit.php website/config/config.ini website/library/Application.php website/library/Ostacium/Controller/Action.php website/library/Ostacium/Controller/Plugin/ErrorHandler.php website/library/Ostacium/Controller/Router/Route/Language.php Added Paths: ----------- website/application/modules/acm/controllers/TesterController.php website/application/modules/acm/controllers/UserController.php website/application/modules/acm/models/Form/Register.php website/application/modules/acm/models/Tester.php website/application/modules/acm/models/User.php website/application/modules/acm/views/helpers/State.php website/application/modules/acm/views/scripts/archieve/result.phtml website/application/modules/acm/views/scripts/archieve/results.phtml website/application/modules/acm/views/scripts/emails/ website/application/modules/acm/views/scripts/emails/register.phtml website/application/modules/acm/views/scripts/tester/ website/application/modules/acm/views/scripts/tester/entry.phtml website/application/modules/acm/views/scripts/tester/submits.phtml website/application/modules/acm/views/scripts/user/ website/application/modules/acm/views/scripts/user/activated.phtml website/application/modules/acm/views/scripts/user/notactivated.phtml website/application/modules/acm/views/scripts/user/registered.phtml website/library/Ostacium/Mail.php website/library/Ostacium/View/Helper/Date.php website/other/dq.sql website/other/submits/3 website/other/submits/4 website/other/submits/5 Removed Paths: ------------- website/application/modules/acm/views/scripts/archieve/submit.phtml website/other/db.sql Modified: website/application/modules/acm/controllers/ArchieveController.php =================================================================== --- website/application/modules/acm/controllers/ArchieveController.php 2008-12-06 23:14:20 UTC (rev 436) +++ website/application/modules/acm/controllers/ArchieveController.php 2008-12-07 21:57:19 UTC (rev 437) @@ -22,11 +22,7 @@ { $this->_helper->getHelper('viewRenderer')->setNoRender(true); - $form = $this->_model->getSubmitForm(array( - 'action' => $this->view->url(array('action' => 'upload', 'id' => $this->_getParam('id')), null), - 'method' => 'post', - 'name' => 'submitform', - )); + $form = new Form_Submit(); $this->view->dojo()->addOnLoad('function(){ changeEditor('.$form->type->getValue().'); }'); @@ -36,11 +32,7 @@ public function uploadAction() { $this->_helper->getHelper('viewRenderer')->setNoRender(true); - $form = $this->_model->getSubmitForm(array( - 'action' => $this->view->url(array('action' => 'upload', 'id' => $this->_getParam('id')), null), - 'method' => 'post', - 'name' => 'submitform', - )); + $form = new Form_Submit(); if (!$this->getRequest()->isPost()) { @@ -80,11 +72,16 @@ if ($values['type'] == 0) { - file_put_contents(Application::getDocRoot().'/other/submits/'.$id.'.cpp', $values['code']); + file_put_contents(Application::getDocRoot().'/other/submits/'.$id, $values['code']); } elseif ($values['type'] == 1) { - rename($form->codefile->getFileName(), Application::getDocRoot().'/other/submits/'.$id.'.cpp'); + rename($form->codefile->getFileName(), Application::getDocRoot().'/other/submits/'.$id); } } + + public function resultsAction() + { + $this->view->submits = $this->_model->getSubmits(); + } } \ No newline at end of file Modified: website/application/modules/acm/controllers/IndexController.php =================================================================== --- website/application/modules/acm/controllers/IndexController.php 2008-12-06 23:14:20 UTC (rev 436) +++ website/application/modules/acm/controllers/IndexController.php 2008-12-07 21:57:19 UTC (rev 437) @@ -4,12 +4,13 @@ { public function indexAction() { - echo $this->getLoginForm(); + $form = new Form_Login(); + echo $form; } public function loginAction() { - $form = $this->getLoginForm(); + $form = new Form_Login(); if (!$this->getRequest()->isPost()) { @@ -54,13 +55,4 @@ { Zend_Auth::getInstance()->clearIdentity(); } - - protected function getLoginForm() - { - return new Form_Login(array( - 'action' => $this->view->url(array('action' => 'login'), null), - 'method' => 'post', - 'name' => 'loginform', - )); - } } \ No newline at end of file Added: website/application/modules/acm/controllers/TesterController.php =================================================================== --- website/application/modules/acm/controllers/TesterController.php (rev 0) +++ website/application/modules/acm/controllers/TesterController.php 2008-12-07 21:57:19 UTC (rev 437) @@ -0,0 +1,36 @@ +<?php + +class Acm_TesterController extends Ostacium_Controller_Action +{ + public function init() + { + parent::init(); + $this->_helper->getHelper('Layout')->disableLayout(); + } + + public function submitsAction() + { + $this->getResponse()->setHeader('Content-Type', 'application/xml'); + $this->view->submits = $this->_model->getSubmits(); + } + + public function resultAction() + { + $id = $this->_getParam('id'); + $data['tests'] = (int)$this->_getParam('tests'); + $data['runtime'] = (int)$this->_getParam('runtime'); + $data['memory'] = (int)$this->_getParam('memory'); + $data['state'] = (int)$this->_getParam('state'); + + if ($data['tests'] && $data['runtime'] && $data['memory'] && $data['state']) + { + echo ($this->_model->updateSubmit($id, $data) ? "success" : "error"); + } + else + { + echo "error"; + } + + $this->_helper->getHelper('viewRenderer')->setNoRender(true); + } +} \ No newline at end of file Added: website/application/modules/acm/controllers/UserController.php =================================================================== --- website/application/modules/acm/controllers/UserController.php (rev 0) +++ website/application/modules/acm/controllers/UserController.php 2008-12-07 21:57:19 UTC (rev 437) @@ -0,0 +1,76 @@ +<?php + +class Acm_UserController extends Ostacium_Controller_Action +{ + public function registerAction() + { + $this->_helper->getHelper('viewRenderer')->setNoRender(true); + + $form = new Form_Register(); + + if (!$this->getRequest()->isPost()) + { + echo $form; + return; + } + + if (!$form->isValid($this->getRequest()->getPost())) + { + echo $form; + return; + } + + // check cpassword == password + + $values = $form->getValues(); + $values['ip'] = $this->getRequest()->getIp(); + $code = substr(md5(time()), mt_rand(0, 27), 5); + $result = $this->_model->registerUser($values, $code); + + if (!$result) + { + $form->setDescription($this->view->translate('wrongEmailPwd')); + + echo $form; + } + else + { + $arguments = array('code' => $code, 'fullname' => $values['name'].' '.$values['surname'], 'username' => $values['username']); + $mail = new Ostacium_Mail(); + $mail->setFrom($this->_config->email->from.'@'.$_SERVER["SERVER_NAME"], $this->_config->general->title.' Staff') + ->addTo($values['email'], $values['name'].' '.$values['surname']) + ->setSubject($this->_('registration_email')) + ->setBodyTemplate(array('template' => 'register.phtml', 'arguments' => $arguments)) + ->send(); + + return $this->_redirect($this->view->url(array('action' => 'registered'))); + } + } + + public function registeredAction() + { + + } + + public function activateAction() + { + $username = $this->_getParam('username'); + $code = $this->_getParam('code'); + + $result = $this->_model->activateUser($username, $code); + + if ($result) + { + return $this->render('activated'); + } + else + { + return $this->render('notactivated'); + } + } + + public function viewAction() + { + + } +} \ No newline at end of file Modified: website/application/modules/acm/models/Archieve.php =================================================================== --- website/application/modules/acm/models/Archieve.php 2008-12-06 23:14:20 UTC (rev 436) +++ website/application/modules/acm/models/Archieve.php 2008-12-07 21:57:19 UTC (rev 437) @@ -8,42 +8,34 @@ return $challenges->getAll(); } + public function getSubmits() + { + $submits = new Submits(); + return $submits->getAll(); + } + public function get($id) { $challenges = new Challenges(); return $challenges->get($id); } - public function getCodeLanguages() - { - return $this->_db->fetchPairs($this->_db->select()->from('code_languages', array('id', 'name'))); - } - public function addSubmit($values) { $data = array( 'username' => Zend_Auth::getInstance()->getStorage()->read()->username, - 'challengeid' => $values['id'], - 'languageid' => $values['languageid'], + 'challengeid' => (int)$values['id'], + 'codelangid' => $values['languageid'], 'firsttest' => $values['firsttest'], 'when' => time() ); + $challenges = new Challenges(); + $challenges->update(array('tries' => 'tries + 1'), $this->_db->quoteInto('id = ?', $data['challengeid'])); + $submits = new Submits(); return $submits->insert($data); } - - public function getSubmitForm($options = array()) - { - $form = new Form_Submit($options); - $user = Zend_Auth::getInstance()->getStorage()->read(); - - $languageid = $form->getElement('languageid'); - $languageid->addMultiOptions($this->getCodeLanguages()); - $languageid->setValue($user->codelangid); - - return $form; - } } class Challenges extends Ostacium_Db_Table @@ -66,4 +58,9 @@ { protected $_name = 'archieve_submits'; protected $_primary = 'id'; + + public function getAll() + { + return $this->select()->from($this)->setIntegrityCheck(false)->joinLeft('code_languages', 'code_languages.id = archieve_submits.codelangid', array('codelang' => 'name'))->order('id DESC')->query()->fetchAll(); + } } \ No newline at end of file Modified: website/application/modules/acm/models/Form/Login.php =================================================================== --- website/application/modules/acm/models/Form/Login.php 2008-12-06 23:14:20 UTC (rev 436) +++ website/application/modules/acm/models/Form/Login.php 2008-12-07 21:57:19 UTC (rev 437) @@ -16,8 +16,12 @@ public function init() { $translate = Zend_Registry::get('Zend_Translate'); - //$this->addElementPrefixPath('Ostacium_Form', 'Ostacium/Form/'); + $router = Zend_Controller_Front::getInstance()->getRouter(); + $this->setAction($router->assemble(array('action' => 'login'), null)); + $this->setMethod('post'); + $this->setName('loginform'); + $this->addElement('ValidationTextBox', 'username', array( 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim', 'StringToLower'), @@ -29,14 +33,12 @@ 'trim' => true, 'lowercase' => true, 'style' => 'height: 18px; width: 100px;', - 'regExp' => '[\S]{5,50}', - 'invalidMessage' => sprintf($translate->_('errorBetween'), 5, 50), + 'regExp' => '[\w]{5,50}', + 'invalidMessage' => sprintf($translate->_('wordErrorBetween'), 5, 50), 'title' => 'Username', 'label' => 'Username:', )); - - $this->addElement('PasswordTextBox', 'password', array( 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), @@ -47,7 +49,7 @@ 'required' => true, 'trim' => true, 'style' => 'height: 18px; width: 100px;', - 'regExp' => '^[a-z0-9]{5,32}$', + 'regExp' => '[\S]{5,32}', 'invalidMessage' => sprintf($translate->_('errorBetween'), 5, 32), 'title' => 'Password', 'label' => 'Password:', Added: website/application/modules/acm/models/Form/Register.php =================================================================== --- website/application/modules/acm/models/Form/Register.php (rev 0) +++ website/application/modules/acm/models/Form/Register.php 2008-12-07 21:57:19 UTC (rev 437) @@ -0,0 +1,314 @@ +<?php + +class Form_Register extends Zend_Dojo_Form +{ + public $elementDecorators = array( + 'DijitElement', + 'Errors', + array('Label', array('class' => 'overlabel')), + array('HtmlTag', array('tag' => 'div', 'class' => 'elcontainer')) + ); + + public $simpleDecorators = array( + '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'); + $db = Zend_Registry::get('db'); + $router = Zend_Controller_Front::getInstance()->getRouter(); + + $this->setAction($router->assemble(array('action' => 'register'), null)); + $this->setMethod('post'); + $this->setName('registerform'); + + $this->addElement('ValidationTextBox', 'username', array( + 'decorators' => $this->elementDecorators, + 'validators' => array( + array('StringLength', false, array(5, 50)), + ), + 'maxlength' => 50, + 'trim' => true, + 'required' => true, + 'regExp' => '[\w]{5,50}', + 'invalidMessage' => sprintf($translate->_('errorBetween'), 5, 50), + 'title' => $translate->_('username'), + 'label' => $translate->_('username').': ', + )); + + $this->addElement('PasswordTextBox', 'password', array( + 'decorators' => $this->elementDecorators, + 'validators' => array( + array('StringLength', false, array(5, 32)), + ), + 'maxlength' => 32, + 'trim' => true, + 'required' => true, + 'regExp' => '[\S]{5,32}', + 'invalidMessage' => sprintf($translate->_('errorBetween'), 5, 32), + 'title' => $translate->_('password'), + 'label' => $translate->_('password').': ', + )); + + $this->addElement('PasswordTextBox', 'cpassword', array( + 'decorators' => $this->elementDecorators, + 'validators' => array( + array('StringLength', false, array(5, 32)), + ), + 'maxlength' => 32, + 'trim' => true, + 'propercase' => true, + 'required' => true, + 'regExp' => '[\S]{5,32}', + 'invalidMessage' => sprintf($translate->_('errorBetween'), 5, 32), + 'title' => $translate->_('confirm_password'), + 'label' => $translate->_('confirm_password').': ', + )); + + $this->addElement('ValidationTextBox', 'email', array( + 'decorators' => $this->elementDecorators, + 'validators' => array( + 'EmailAddress', + array('StringLength', false, 1) + ), + 'filters' => array('StringToLower'), + 'trim' => true, + 'lowercase' => true, + 'required' => true, + 'regExp' => '.{1,}', + 'invalidMessage' => $translate->_('errorEmpty'), + 'title' => $translate->_('email'), + 'label' => $translate->_('email').': ', + )); + + $this->addElement('Checkbox', 'hideemail', array( + 'decorators' => $this->elementDecorators, + 'required' => true, + 'title' => $translate->_('hideemail'), + 'label' => $translate->_('hideemail').': ', + 'multiOptions' => array($translate->_('no'), $translate->_('yes')), + )); + + $this->addElement('ValidationTextBox', 'name', array( + 'decorators' => $this->elementDecorators, + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'maxlength' => 50, + 'trim' => true, + 'required' => false, + 'regExp' => '[\w ]{0,50}', + 'invalidMessage' => sprintf($translate->_('errorMore'), 50), + 'title' => $translate->_('name'), + 'label' => $translate->_('name').': ', + )); + + $this->addElement('ValidationTextBox', 'surname', array( + 'decorators' => $this->elementDecorators, + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'maxlength' => 50, + 'trim' => true, + 'required' => false, + 'regExp' => '[\w ]{0,50}', + 'invalidMessage' => sprintf($translate->_('errorMore'), 50), + 'title' => $translate->_('surname'), + 'label' => $translate->_('surname').': ', + )); + + $this->addElement('ValidationTextBox', 'study', array( + 'decorators' => $this->elementDecorators, + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'maxlength' => 50, + 'trim' => true, + 'required' => false, + 'regExp' => '[\w ]{0,50}', + 'invalidMessage' => sprintf($translate->_('errorMore'), 50), + 'title' => $translate->_('study'), + 'label' => $translate->_('study').': ', + )); + + $this->addElement('DateTextBox', 'birthday', array( + 'decorators' => $this->elementDecorators, + 'required' => false, + 'invalidMessage' => $translate->_('invalidDate'), + 'title' => $translate->_('birthday'), + 'label' => $translate->_('birthday').': ', + 'formatLength' => 'short' + )); + + $this->addElement('ValidationTextBox', 'aim', array( + 'decorators' => $this->elementDecorators, + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'maxlength' => 50, + 'trim' => true, + 'required' => false, + 'regExp' => '[\S]{0,50}', + 'invalidMessage' => sprintf($translate->_('errorMore'), 50), + 'title' => $translate->_('aim'), + 'label' => $translate->_('aim').': ', + )); + + $this->addElement('ValidationTextBox', 'icq', array( + 'decorators' => $this->elementDecorators, + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'maxlength' => 50, + 'trim' => true, + 'required' => false, + 'regExp' => '[\S]{0,50}', + 'invalidMessage' => sprintf($translate->_('errorMore'), 50), + 'title' => $translate->_('icq'), + 'label' => $translate->_('icq').': ', + )); + + $this->addElement('ValidationTextBox', 'msn', array( + 'decorators' => $this->elementDecorators, + 'validators' => array( + array('StringLength', false, array(0, 100)), + ), + 'maxlength' => 100, + 'trim' => true, + 'required' => false, + 'regExp' => '[\S]{0,100}', + 'invalidMessage' => sprintf($translate->_('errorMore'), 100), + 'title' => $translate->_('msn'), + 'label' => $translate->_('msn').': ', + )); + + $this->addElement('ValidationTextBox', 'skype', array( + 'decorators' => $this->elementDecorators, + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'maxlength' => 50, + 'trim' => true, + 'required' => false, + 'regExp' => '[\S]{0,50}', + 'invalidMessage' => sprintf($translate->_('errorMore'), 50), + 'title' => $translate->_('skype'), + 'label' => $translate->_('skype').': ', + )); + + $this->addElement('ValidationTextBox', 'yahoo', array( + 'decorators' => $this->elementDecorators, + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'maxlength' => 50, + 'trim' => true, + 'required' => false, + 'regExp' => '[\S]{0,50}', + 'invalidMessage' => sprintf($translate->_('errorMore'), 50), + 'title' => $translate->_('yahoo'), + 'label' => $translate->_('yahoo').': ', + )); + + $this->addElement('ValidationTextBox', 'web', array( + 'decorators' => $this->elementDecorators, + 'validators' => array( + array('StringLength', false, array(0, 100)), + ), + 'maxlength' => 200, + 'trim' => true, + 'required' => false, + 'regExp' => '[\S]{0,100}', + 'invalidMessage' => sprintf($translate->_('errorMore'), 100), + 'title' => $translate->_('web'), + 'label' => $translate->_('web').': ', + )); + + $this->addElement('ValidationTextBox', 'topcoder', array( + 'decorators' => $this->elementDecorators, + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'maxlength' => 50, + 'trim' => true, + 'required' => false, + 'regExp' => '[\S]{0,50}', + 'invalidMessage' => sprintf($translate->_('errorMore'), 50), + 'title' => $translate->_('topcoder'), + 'label' => $translate->_('topcoder').': ', + )); + + $this->addElement('ValidationTextBox', 'timus', array( + 'decorators' => $this->elementDecorators, + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'maxlength' => 50, + 'trim' => true, + 'required' => false, + 'regExp' => '[\S]{0,50}', + 'invalidMessage' => sprintf($translate->_('errorMore'), 50), + 'title' => $translate->_('timus'), + 'label' => $translate->_('timus').': ', + )); + + $offset = array(-12 => -12, -11 => -11, -10 => -10, -9 => -9, -8 => -8, -7 => -7, -6 => -6, -5 => -5, -4 => -4, -3 => -3, -2 => -2, -1 => -1, 0 => 0, '+1' => '+1', '+2' => '+2', '+3' => '+3', '+4' => '+4', '+5' => '+5', '+6' => '+6', '+7' => '+7', '+8' => '+8', '+9' => '+9', '+10' => '+10', '+11' => '+11', '+12' => '+12', '+13' => '+13'); + + $this->addElement('FilteringSelect', 'timeoffset', array( + 'decorators' => $this->elementDecorators, + 'required' => true, + 'title' => $translate->_('timeoffset'), + 'label' => $translate->_('timeoffset').': ', + 'multiOptions' => $offset, + 'value' => 0 + )); + + $this->addElement('FilteringSelect', 'codelangid', array( + 'decorators' => $this->elementDecorators, + 'required' => true, + 'title' => $translate->_('code_language'), + 'label' => $translate->_('code_language').': ', + 'multiOptions' => $db->fetchPairs($db->select()->from('code_languages', array('id', 'name'))), + )); + + $this->addElement('FilteringSelect', 'language', array( + 'decorators' => $this->elementDecorators, + 'required' => true, + 'title' => $translate->_('language'), + 'label' => $translate->_('language').': ', + 'multiOptions' => $db->fetchPairs($db->select()->from('languages', array('code', 'name'))), + 'value' => Zend_Registry::get('config')->lang->default + )); + + $this->addElement('FilteringSelect', 'tshirtsize', array( + 'decorators' => $this->elementDecorators, + 'required' => true, + 'title' => $translate->_('tshirtsize'), + 'label' => $translate->_('tshirtsize').': ', + 'multiOptions' => array('S' => 'Small', 'M' => 'Medium', 'L' => 'Large'), + )); + + $this->addElement('SubmitButton', 'registerbutton', array( + 'decorators' => $this->buttonDecorators, + 'required' => false, + 'ignore' => true, + 'label' => $translate->_('register'), + )); + } + + public function loadDefaultDecorators() + { + $this->setDecorators(array( + 'FormElements', + 'DijitForm', + array('Description', array('placement' => 'prepend', 'tag' => 'div', 'class' => 'error')), + )); + } +} \ No newline at end of file Modified: website/application/modules/acm/models/Form/Submit.php =================================================================== --- website/application/modules/acm/models/Form/Submit.php 2008-12-06 23:14:20 UTC (rev 436) +++ website/application/modules/acm/models/Form/Submit.php 2008-12-07 21:57:19 UTC (rev 437) @@ -22,8 +22,14 @@ public function init() { $translate = Zend_Registry::get('Zend_Translate'); + $db = Zend_Registry::get('db'); + $router = Zend_Controller_Front::getInstance()->getRouter(); + $request = Zend_Controller_Front::getInstance()->getRequest(); $this->setAttrib('enctype', 'multipart/form-data'); + $this->setAction($router->assemble(array('action' => 'upload', 'id' => $request->getParam('id')), null)); + $this->setMethod('post'); + $this->setName('submitform'); $this->addElement('FilteringSelect', 'languageid', array( 'decorators' => $this->elementDecorators, @@ -31,6 +37,8 @@ 'style' => 'height: 18px; width: 100px;', 'title' => $translate->_('code_language'), 'label' => $translate->_('code_language').': ', + 'multiOptions' => $db->fetchPairs($db->select()->from('code_languages', array('id', 'name'))), + 'value' => (Zend_Auth::getInstance()->getStorage()->read()->codelangid) )); $this->addElement('RadioButton', 'type', array( Added: website/application/modules/acm/models/Tester.php =================================================================== --- website/application/modules/acm/models/Tester.php (rev 0) +++ website/application/modules/acm/models/Tester.php 2008-12-07 21:57:19 UTC (rev 437) @@ -0,0 +1,27 @@ +<?php + +class Tester extends Ostacium_Model +{ + public function getSubmits() + { + $submits = new Submits(); + return $submits->getUntested(); + } + + public function updateSubmit($id, $data) + { + $submits = new Submits(); + return $submits->update($data, $this->_db->quoteInto('id = ? AND state = 0', $id)); + } +} + +class Submits extends Ostacium_Db_Table +{ + protected $_name = 'archieve_submits'; + protected $_primary = 'id'; + + public function getUntested() + { + return $this->select()->from($this)->setIntegrityCheck(false)->joinLeft('code_languages', 'code_languages.id = archieve_submits.codelangid', array('codelang' => 'name'))->where('state = 0')->order('id ASC')->query()->fetchAll(); + } +} \ No newline at end of file Added: website/application/modules/acm/models/User.php =================================================================== --- website/application/modules/acm/models/User.php (rev 0) +++ website/application/modules/acm/models/User.php 2008-12-07 21:57:19 UTC (rev 437) @@ -0,0 +1,51 @@ +<?php + +class User extends Ostacium_Model +{ + public function registerUser($data, $code) + { + $data['registered'] = time(); + $data['online'] = $data['registered']; + $data['roleid'] = Zend_Registry::get('config')->general->roleid; + $data['activated'] = $code; + $data['password'] = md5($data['password']); + + $users = new Users(); + $users->insert($data); + + $usersdetails = new UsersDetails(); + $usersdetails->insert($data); + + $usersstats = new UsersStats(); + $usersstats->insert($data); + + return true; + } + + public function activateUser($username, $code) + { + $where = $this->_db->quoteInto('username = ?', $username).' AND activated = ?'; + $where = $this->_db->quoteInto($where, $code); + + $users = new Users(); + return $users->update(array('activated' => null), $where); + } +} + +class Users extends Ostacium_Db_Table +{ + protected $_name = 'users'; + protected $_primaty = 'username'; +} + +class UsersDetails extends Ostacium_Db_Table +{ + protected $_name = 'usersdetails'; + protected $_primaty = 'username'; +} + +class UsersStats extends Ostacium_Db_Table +{ + protected $_name = 'usersstats'; + protected $_primaty = 'username'; +} \ No newline at end of file Added: website/application/modules/acm/views/helpers/State.php =================================================================== --- website/application/modules/acm/views/helpers/State.php (rev 0) +++ website/application/modules/acm/views/helpers/State.php 2008-12-07 21:57:19 UTC (rev 437) @@ -0,0 +1,39 @@ +<?php + +class Acm_View_Helper_State extends Zend_View_Helper_Abstract +{ + public function state($stateid) + { + switch ($stateid) { + case 0: + $return = 'in_que'; + break; + case 1: + $return = 'AC'; + break; + case 2: + $return = 'TL'; + break; + case 3: + $return = 'ML'; + break; + case 4: + $return = 'OL'; + break; + case 5: + $return = 'CE'; + break; + case 6: + $return = 'RE'; + break; + case 7: + $return = 'WA'; + break; + case 8: + $return = 'DF'; + break; + } + + return $this->view->translate($return); + } +} \ No newline at end of file Added: website/application/modules/acm/views/scripts/archieve/result.phtml =================================================================== --- website/application/modules/acm/views/scripts/archieve/result.phtml (rev 0) +++ website/application/modules/acm/views/scripts/archieve/result.phtml 2008-12-07 21:57:19 UTC (rev 437) @@ -0,0 +1,10 @@ +<tr> + <td align="center"><?= $this->id ?></td> + <td align="center"><?= $this->date($this->when) ?></td> + <td align="center"><?= $this->username ?></td> + <td align="center"><a href="<?= $this->url( array('action' => 'view', 'id' => $this->challengeid), null) ?>"><?= $this->challengeid ?></a></td> + <td align="center"><?= $this->codelang ?></td> + <td align="center"><?= $this->state($this->state) ?></td> + <td align="center"><?= ($this->tests == 0 ? '-' : $this->tests) ?></td> + <td align="center"><?= ($this->runtime == 0 ? '-' : $this->runtime) ?>/<?= ($this->memory == 0 ? '-' : $this->memory) ?></td> +</tr> \ No newline at end of file Added: website/application/modules/acm/views/scripts/archieve/results.phtml =================================================================== --- website/application/modules/acm/views/scripts/archieve/results.phtml (rev 0) +++ website/application/modules/acm/views/scripts/archieve/results.phtml 2008-12-07 21:57:19 UTC (rev 437) @@ -0,0 +1,33 @@ +<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 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" summary="" align="center" width="80%"> +<tbody> +<tr><td bgcolor="#f4f3f8" align="middle" colspan="14"><b>Архів задач</b></td></tr> +<tr bgcolor="#e1e1e1" align="middle"> +<th>ID</th> +<th>Дата</th> +<th>Логін</th> +<th>Задача</th> +<th>Мова</th> +<th>Стан</th> +<th>Тест</th> +<th>Час/Пам'ять</th> +</tr> + +<?= $this->partialLoop('archieve/result.phtml', $this->submits) ?> +</table> + +</td></tr></table> \ No newline at end of file Property changes on: website/application/modules/acm/views/scripts/emails ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/acm/views/scripts/emails/register.phtml =================================================================== --- website/application/modules/acm/views/scripts/emails/register.phtml (rev 0) +++ website/application/modules/acm/views/scripts/emails/register.phtml 2008-12-07 21:57:19 UTC (rev 437) @@ -0,0 +1,8 @@ +Dear <?= $this->fullname ?>, +<br /><br /> +Thank you for registering on <?= Zend_Registry::get('config')->general->title ?>. To activate your account please +<a href="<?= $_SERVER["SERVER_NAME"] ?><?= $this->url(array('action' => 'activate', 'username' => $this->username, 'code' => $this->code), null) ?>">click here</a>. +<br /><br /> +------------ +<?= Zend_Registry::get('config')->general->title ?> Staff<br /> +<?= $_SERVER["SERVER_NAME"] ?> \ No newline at end of file Property changes on: website/application/modules/acm/views/scripts/tester ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/acm/views/scripts/tester/entry.phtml =================================================================== --- website/application/modules/acm/views/scripts/tester/entry.phtml (rev 0) +++ website/application/modules/acm/views/scripts/tester/entry.phtml 2008-12-07 21:57:19 UTC (rev 437) @@ -0,0 +1,3 @@ +<entry id="<?= $this->id ?>" problemid="<?= $this->challengeid ?>" language="<?= $this->codelang ?>"> +<?= htmlentities(file_get_contents(Application::getDocRoot().'/other/submits/'.$this->id)) ?> +</entry> \ No newline at end of file Added: website/application/modules/acm/views/scripts/tester/submits.phtml =================================================================== --- website/application/modules/acm/views/scripts/tester/submits.phtml (rev 0) +++ website/application/modules/acm/views/scripts/tester/submits.phtml 2008-12-07 21:57:19 UTC (rev 437) @@ -0,0 +1,4 @@ +<?= '<?xml version="1.0" encoding="UTF-8"?>' ?> +<entries> +<?= $this->partialLoop('tester/entry.phtml', $this->submits) ?> +</entries> \ No newline at end of file Property changes on: website/application/modules/acm/views/scripts/user ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/acm/views/scripts/user/activated.phtml =================================================================== --- website/application/modules/acm/views/scripts/user/activated.phtml (rev 0) +++ website/application/modules/acm/views/scripts/user/activated.phtml 2008-12-07 21:57:19 UTC (rev 437) @@ -0,0 +1 @@ +You have successfully activated your account. You can login now. \ No newline at end of file Added: website/application/modules/acm/views/scripts/user/notactivated.phtml =================================================================== --- website/application/modules/acm/views/scripts/user/notactivated.phtml (rev 0) +++ website/application/modules/acm/views/scripts/user/notactivated.phtml 2008-12-07 21:57:19 UTC (rev 437) @@ -0,0 +1,3 @@ +There's was an error activating your account. You could try following resolution:<br /> +1) Click here to resend your activation key, if you haven't recieved it.<br /> +2) Click here to manualy enter the activation key, if url in your email is deformed. \ No newline at end of file Added: website/application/modules/acm/views/scripts/user/registered.phtml =================================================================== --- website/application/modules/acm/views/scripts/user/registered.phtml (rev 0) +++ website/application/modules/acm/views/scripts/user/registered.phtml 2008-12-07 21:57:19 UTC (rev 437) @@ -0,0 +1 @@ +You have successfully registered account. Please check your mail. \ No newline at end of file Modified: website/config/config.ini =================================================================== --- website/config/config.ini 2008-12-06 23:14:20 UTC (rev 436) +++ website/config/config.ini 2008-12-07 21:57:19 UTC (rev 437) @@ -57,7 +57,7 @@ log.columnMap.when = "timestamp"; log.columnMap.ip = "ip"; -email.admin = "admin" +email.from = "admin" listtable.class = "crudtable" @@ -68,6 +68,7 @@ general.title = "ACM Contester" general.titlesep = " - " general.extention = "html" +general.roleid = "2" [development: general] Modified: website/library/Application.php =================================================================== --- website/library/Application.php 2008-12-06 23:14:20 UTC (rev 436) +++ website/library/Application.php 2008-12-07 21:57:19 UTC (rev 437) @@ -106,7 +106,8 @@ $this->_setupView(); // Setup Email - $mail = new Zend_Mail_Transport_Sendmail('-f'.$_config->email->admin.'@'.$_SERVER["SERVER_NAME"]); + //$mail = new Zend_Mail_Transport_Sendmail('-f'.$_config->email->from.'@'.$_SERVER["SERVER_NAME"]); + $mail = new Zend_Mail_Transport_Smtp('mail.ostacium.com', array('auth' => 'login', 'username' => 'ad...@os...', 'password' => 'g3n1u535')); Zend_Mail::setDefaultTransport($mail); // Setup Plugins @@ -236,7 +237,9 @@ $language = $_config->lang->default; $translate->setLocale($language); + Zend_Registry::set('Zend_Translate', $translate); + Zend_Registry::set('Zend_Locale', new Zend_Locale($language)); } protected function _setupRoutes(Zend_Controller_Front $frontController) Modified: website/library/Ostacium/Controller/Action.php =================================================================== --- website/library/Ostacium/Controller/Action.php 2008-12-06 23:14:20 UTC (rev 436) +++ website/library/Ostacium/Controller/Action.php 2008-12-07 21:57:19 UTC (rev 437) @@ -4,10 +4,12 @@ { protected $_model; protected $_translate; + protected $_config; public function init() { $this->_translate = Zend_Registry::get('Zend_Translate'); + $this->_config = Zend_Registry::get('config'); $name = ucfirst($this->getRequest()->getControllerName()); Modified: website/library/Ostacium/Controller/Plugin/ErrorHandler.php =================================================================== --- website/library/Ostacium/Controller/Plugin/ErrorHandler.php 2008-12-06 23:14:20 UTC (rev 436) +++ website/library/Ostacium/Controller/Plugin/ErrorHandler.php 2008-12-07 21:57:19 UTC (rev 437) @@ -25,6 +25,8 @@ $error = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS); $error->exception = current($response->getException()); + $auth = Zend_Auth::getInstance(); + if (!$dispatcher->isDispatchable($request)) { $error->type = self::EXCEPTION_NO_CONTROLLER; if (!$error->exception) Modified: website/library/Ostacium/Controller/Router/Route/Language.php =================================================================== --- website/library/Ostacium/Controller/Router/Route/Language.php 2008-12-06 23:14:20 UTC (rev 436) +++ website/library/Ostacium/Controller/Router/Route/Language.php 2008-12-07 21:57:19 UTC (rev 437) @@ -16,6 +16,7 @@ parent::__construct($defaults, $dispatcher, $request); $this->translate = Zend_Registry::get('Zend_Translate'); + $this->locale = Zend_Registry::get('Zend_Locale'); $this->config = Zend_Registry::get('config'); $this->extention = $extention; } @@ -53,6 +54,7 @@ if ($this->translate->isAvailable($path[0])) { $values[$this->_languageKey] = array_shift($path); $this->translate->setLocale($values[$this->_languageKey]); + $this->locale->setLocale($values[$this->_languageKey]); } if (count($path) && !empty($path[0]) && $this->_dispatcher && $this->_dispatcher->isValidModule($path[0])) { Added: website/library/Ostacium/Mail.php =================================================================== --- website/library/Ostacium/Mail.php (rev 0) +++ website/library/Ostacium/Mail.php 2008-12-07 21:57:19 UTC (rev 437) @@ -0,0 +1,19 @@ +<?php + +class Ostacium_Mail extends Zend_Mail +{ + public function setBodyTemplate($options) + { + $template = $options['template']; + $arguments = $options['arguments']; + + $view = Zend_Controller_Action_HelperBroker::getExistingHelper('ViewRenderer')->view; + $view->assign($arguments); + + $body = $view->render('emails/'.$template); + + $this->setBodyHtml($body); + + return $this; + } +} \ No newline at end of file Added: website/library/Ostacium/View/Helper/Date.php =================================================================== --- website/library/Ostacium/View/Helper/Date.php (rev 0) +++ website/library/Ostacium/View/Helper/Date.php 2008-12-07 21:57:19 UTC (rev 437) @@ -0,0 +1,17 @@ +<?php + +class Ostacium_View_Helper_Date extends Zend_View_Helper_Abstract +{ + public function date($date = null, $format = null, $part = null, $locale = null) + { + try + { + $d = new Zend_Date($date, $part, $locale); + return $d->toString($format); + } + catch (Exception $e) + { + return false; + } + } +} \ No newline at end of file Deleted: website/other/db.sql =================================================================== --- website/other/db.sql 2008-12-06 23:14:20 UTC (rev 436) +++ website/other/db.sql 2008-12-07 21:57:19 UTC (rev 437) @@ -1,759 +0,0 @@ --- phpMyAdmin SQL Dump --- version 2.11.7 --- http://www.phpmyadmin.net --- --- Host: localhost --- Generation Time: Oct 05, 2008 at 05:59 PM --- Server version: 5.0.51 --- PHP Version: 5.2.6 - -SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; - --- --- Database: `acm` --- - --- -------------------------------------------------------- - --- --- Table structure for table `archieve_submits` --- - -CREATE TABLE IF NOT EXISTS `archieve_submits` ( - `id` int(11) NOT NULL, - `username` varchar(50) NOT NULL, - `challengeid` int(11) NOT NULL, - `languageid` int(11) NOT NULL, - `state` int(11) NOT NULL, - `tests` int(11) NOT NULL, - `firsttest` tinyint(1) NOT NULL default '0', - `runtime` double NOT NULL, - `memory` int(11) NOT NULL, - `when` int(11) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- --- Dumping data for table `archieve_submits` --- - - --- -------------------------------------------------------- - --- --- Table structure for table `challenges` --- - -CREATE TABLE IF NOT EXISTS `challenges` ( - `id` int(11) NOT NULL auto_increment, - `timelimit` double NOT NULL default '0', - `memorylimit` int(11) NOT NULL default '0', - `outputlimit` int(11) NOT NULL default '0', - `tries` int(11) NOT NULL default '0', - `accepted` int(11) NOT NULL default '0', - `author` varchar(50) character set latin1 NOT NULL, - `enabled` tinyint(1) NOT NULL default '1', - PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1195 ; - --- --- Dumping data for table `challenges` --- - -INSERT INTO `challenges` (`id`, `timelimit`, `memorylimit`, `outputlimit`, `tries`, `accepted`, `author`, `enabled`) VALUES -(1000, 1000, 5120000, 204800, 0, 0, '', 1), -(1001, 1000, 5120000, 204800, 0, 0, '', 1), -(1002, 1000, 5120000, 204800, 0, 0, '', 1), -(1003, 1000, 5120000, 204800, 0, 0, '', 1), -(1004, 1000, 3072000, 204800, 0, 0, '', 1), -(1005, 1000, 3072000, 2048, 0, 0, '', 1), -(1006, 1000, 3072000, 2048, 0, 0, '', 1), -(1007, 1000, 3072000, 2048, 0, 0, '', 1), -(1008, 1000, 5120000, 2048, 0, 0, '', 1), -(1009, 1000, 3072000, 2048, 0, 0, '', 1), -(1010, 1000, 3072000, 2048, 0, 0, '', 1), -(1011, 1500, 3072000, 204800, 0, 0, '', 1), -(1012, 500, 3072000, 2048, 0, 0, '', 1), -(1013, 500, 3072000, 204800, 0, 0, '', 1), -(1014, 500, 3072000, 2048, 0, 0, '', 1), -(1015, 500, 3072000, 204800, 0, 0, '', 1), -(1016, 1000, 3072000, 204800, 0, 0, '', 1), -(1017, 500, 3072000, 204800, 0, 0, '', 1), -(1018, 20000, 3072000, 2048, 0, 0, '', 1), -(1019, 1000, 3072000, 2048, 0, 0, '', 1), -(1020, 500, 3072000, 2048, 0, 0, '', 1), -(1021, 500, 3072000, 2048, 0, 0, '', 1), -(1022, 1000, 5120000, 2048, 0, 0, '', 1), -(1023, 1000, 3072000, 2048, 0, 0, '', 1), -(1024, 1000, 3072000, 2048, 0, 0, '', 1), -(1025, 1000, 2048000, 2048, 0, 0, '', 1), -(1026, 1000, 3072000, 2048, 0, 0, '', 1), -(1027, 1000, 3072000, 2048, 0, 0, '', 1), -(1028, 500, 3072000, 2048, 0, 0, '', 1), -(1029, 1000, 3072000, 2048, 0, 0, '', 1), -(1030, 500, 5120000, 204800, 0, 0, '', 1), -(1031, 1000, 2048000, 2048, 0, 0, '', 0), -(1032, 1000, 10240000, 2048, 0, 0, '', 1), -(1033, 500, 2048000, 2048, 0, 0, '', 1), -(1034, 2000, 2048000, 2048, 0, 0, '', 1), -(1035, 500, 2048000, 2048, 0, 0, '', 1), -(1036, 500, 2048000, 204800, 0, 0, '', 1), -(1037, 500, 20480000, 2048, 0, 0, '', 1), -(1038, 500, 20480000, 2048, 0, 0, '', 1), -(1039, 500, 20480000, 2048, 0, 0, '', 1), -(1040, 1000, 20480000, 2048, 0, 0, '', 1), -(1041, 1000, 20480000, 2048, 0, 0, '', 1), -(1042, 500, 20480000, 2048, 0, 0, '', 1), -(1043, 500, 20480000, 2048, 0, 0, '', 1), -(1044, 1000, 20480000, 2048, 0, 0, '', 1), -(1045, 1000, 20480000, 204800, 0, 0, '', 1), -(1046, 1000, 20480000, 512000, 0, 0, '', 1), -(1047, 1000, 20480000, 2048, 0, 0, '', 1), -(1048, 1000, 20480000, 2048, 0, 0, '', 1), -(1049, 1000, 20480000, 2048, 0, 0, '', 1), -(1050, 1000, 20480000, 2048, 0, 0, '', 1), -(1051, 500, 20480000, 1024, 0, 0, '', 1), -(1052, 500, 20480000, 1024, 0, 0, '', 0), -(1053, 500, 20480000, 1024, 0, 0, '', 1), -(1054, 500, 20480000, 1024, 0, 0, '', 1), -(1055, 500, 20480000, 1024, 0, 0, '', 1), -(1056, 500, 20480000, 1024, 0, 0, '', 1), -(1057, 500, 20480000, 1024, 0, 0, '', 1), -(1058, 1000, 5120000, 204800, 0, 0, '', 1), -(1059, 1000, 5120000, 204800, 0, 0, '', 1), -(1060, 1000, 3072000, 5120, 0, 0, '', 1), -(1061, 2000, 2048000, 2048000, 0, 0, '', 1), -(1062, 1000, 10240000, 2048, 0, 0, '', 1), -(1063, 3000, 20480000, 2048, 0, 0, '', 1), -(1064, 500, 20480000, 20480, 0, 0, '', 1), -(1065, 500, 3072000, 20480000, 0, 0, '', 1), -(1066, 1000, 102400000, 2048, 0, 0, '', 1), -(1067, 500, 20480000, 20480000, 0, 0, '', 1), -(1068, 1000, 5120000, 2048, 0, 0, '', 1), -(1069, 500, 5120000, 2048, 0, 0, '', 1), -(1070, 2000, 5120000, 2048, 0, 0, '', 1), -(1071, 1000, 5120000, 2048, 0, 0, '', 1), -(1072, 2000, 20480000, 2048, 0, 0, '', 1), -(1073, 250, 5120000, 2048, 0, 0, '', 1), -(1074, 500, 5120000, 2048, 0, 0, '', 1), -(1075, 1000, 5120000, 2048, 0, 0, '', 1), -(1076, 2000, 20480000, 2048, 0, 0, '', 1), -(1077, 1000, 5120000, 2048, 0, 0, '', 1), -(1078, 1000, 5120000, 2048, 0, 0, '', 1), -(1079, 1000, 5120000, 2048, 0, 0, '', 1), -(1080, 1000, 5120000, 2048, 0, 0, '', 1), -(1081, 1000, 2097152, 2048, 0, 0, '', 1), -(1082, 1000, 5120000, 2048, 0, 0, '', 1), -(1083, 1000, 5120000, 2048, 0, 0, '', 1), -(1084, 1000, 5120000, 2048, 0, 0, '', 1), -(1085, 500, 5120000, 2048, 0, 0, '', 1), -(1086, 1000, 2097152, 2048, 0, 0, '', 1), -(1087, 1000, 65536000, 2048, 0, 0, '', 1), -(1088, 1000, 65536000, 2048, 0, 0, '', 1), -(1089, 1000, 65536000, 2048, 0, 0, '', 1), -(1090, 1000, 65536000, 2048, 0, 0, '', 1), -(1091, 5000, 65536000, 2048, 0, 0, '', 1), -(1092, 1000, 65536000, 2048, 0, 0, '', 1), -(1093, 1000, 65536000, 2048, 0, 0, '', 1), -(1094, 1000, 5120000, 2048, 0, 0, '', 1), -(1095, 1000, 5120000, 2048, 0, 0, '', 1), -(1096, 1000, 16384000, 2048, 0, 0, '', 1), -(1097, 1000, 5120000, 2048, 0, 0, '', 1), -(1098, 1000, 5120000, 2048, 0, 0, '', 1), -(1099, 500, 5120000, 2048, 0, 0, '', 1), -(1100, 1500, 65536000, 10240000, 0, 0, '', 1), -(1101, 45000, 5120000, 2048, 0, 0, '', 1), -(1102, 5000, 20480000, 512, 0, 0, '', 1), -(1103, 5000, 20480000, 2048, 0, 0, '', 1), -(1104, 5000, 20480000, 2048, 0, 0, '', 1), -(1105, 5000, 20480000, 2048, 0, 0, '', 1), -(1106, 5000, 20480000, 2048, 0, 0, '', 1), -(1107, 1000, 5120000, 2048, 0, 0, '', 1), -(1108, 5000, 5120000, 2048, 0, 0, '', 1), -(1109, 1000, 5120000, 2048, 0, 0, '', 1), -(1110, 1000, 5120000, 2048, 0, 0, '', 1), -(1111, 1000, 5120000, 2048, 0, 0, '', 1), -(1112, 1000, 5120000, 2048, 0, 0, '', 1), -(1113, 1000, 5120000, 2048, 0, 0, '', 1), -(1114, 1000, 5120000, 51200, 0, 0, '', 1), -(1115, 1000, 5120000, 2048, 0, 0, '', 1), -(1116, 1000, 5120000, 2048, 0, 0, '', 1), -(1117, 1000, 5120000, 2048, 0, 0, '', 1), -(1118, 1000, 5120000, 2048, 0, 0, '', 1), -(1119, 1000, 5120000, 2048, 0, 0, '', 1), -(1120, 1000, 5120000, 2048, 0, 0, '', 1), -(1121, 1000, 5120000, 2048, 0, 0, '', 1), -(1122, 1000, 5120000, 2048, 0, 0, '', 1), -(1123, 1000, 5120000, 2048, 0, 0, '', 1), -(1124, 1000, 5120000, 2048, 0, 0, '', 1), -(1125, 1000, 5120000, 2048, 0, 0, '', 1), -(1126, 1000, 5120000, 2048, 0, 0, '', 1), -(1127, 1000, 5120000, 2048, 0, 0, '', 1), -(1128, 1000, 5120000, 256000, 0, 0, '', 1), -(1129, 1000, 5120000, 2048, 0, 0, '', 1), -(1130, 1000, 5120000, 2048, 0, 0, '', 1), -(1131, 1000, 5120000, 2048, 0, 0, '', 1), -(1132, 1000, 5120000, 2048, 0, 0, '', 1), -(1133, 1000, 5120000, 2048, 0, 0, '', 1), -(1134, 500, 5120000, 102400, 0, 0, '', 1), -(1135, 1000, 5120000, 2048, 0, 0, '', 1), -(1136, 1000, 5120000, 2048, 0, 0, '', 1), -(1137, 1000, 51200000, 5120000, 0, 0, '', 1), -(1138, 2000, 5120000, 2048000, 0, 0, '', 1), -(1139, 1000, 10240000, 2048, 0, 0, '', 1), -(1140, 1000, 10240000, 2048, 0, 0, '', 1), -(1141, 5000, 131072000, 2048, 0, 0, '', 1), -(1142, 5000, 131072000, 2048, 0, 0, '', 1), -(1143, 5000, 131072000, 2048, 0, 0, '', 1), -(1144, 5000, 131072000, 2048, 0, 0, '', 1), -(1145, 5000, 131072000, 2048, 0, 0, '', 1), -(1146, 1000, 16384000, 2048, 0, 0, '', 1), -(1147, 5000, 131072000, 2048, 0, 0, '', 1), -(1148, 1000, 5120000, 2048, 0, 0, '', 1), -(1149, 1000, 5120000, 2048, 0, 0, '', 1), -(1150, 1000, 5120000, 2048, 0, 0, '', 1), -(1151, 1000, 5120000, 2048, 0, 0, '', 1), -(1152, 1000, 5120000, 2048, 0, 0, '', 1), -(1153, 3000, 65536000, 5120000, 0, 0, '', 1), -(1154, 1000, 5120000, 2048, 0, 0, '', 1), -(1155, 2000, 65536000, 2048, 0, 0, '', 1), -(1156, 1000, 5120000, 2048, 0, 0, '', 1), -(1157, 500, 5120000, 204800, 0, 0, '', 1), -(1158, 1000, 5120000, 2048, 0, 0, '', 1), -(1159, 1000, 5120000, 2048, 0, 0, '', 1), -(1160, 1000, 5120000, 2048, 0, 0, '', 1), -(1161, 1000, 5120000, 2048000, 0, 0, '', 1), -(1162, 1000, 5120000, 2048, 0, 0, '', 1), -(1163, 1000, 5120000, 2048, 0, 0, '', 1), -(1164, 1000, 5120000, 2048, 0, 0, '', 1), -(1165, 1000, 5120000, 2048, 0, 0, '', 1), -(1166, 1000, 5120000, 2048, 0, 0, '', 1), -(1167, 1000, 5120000, 2048, 0, 0, '', 1), -(1168, 5000, 5120000, 2048, 0, 0, '', 1), -(1169, 1000, 5120000, 2048, 0, 0, '', 1), -(1170, 1000, 5120000, 2048, 0, 0, '', 1), -(1171, 1000, 5120000, 2048, 0, 0, '', 1), -(1172, 1000, 5120000, 2048, 0, 0, '', 1), -(1173, 250, 16384000, 16384, 0, 0, '', 1), -(1174, 1000, 5120000, 2048, 0, 0, '', 1), -(1175, 2000, 51200000, 5120, 0, 0, '', 1), -(1176, 1000, 51200000, 2048, 0, 0, '', 1), -(1177, 1000, 51200000, 2048000, 0, 0, '', 1), -(1178, 1000, 5120000, 2048, 0, 0, '', 1), -(1179, 500, 51200000, 2048, 0, 0, '', 1), -(1180, 1000, 5120000, 2048, 0, 0, '', 1), -(1181, 4000, 16384000, 2048, 0, 0, '', 1), -(1182, 250, 5120000, 2048, 0, 0, '', 1), -(1183, 1000, 20480000, 2048000, 0, 0, '', 1), -(1184, 1000, 20480000, 2048000, 0, 0, '', 1), -(1185, 1000, 5120000, 2048, 0, 0, '', 1), -(1186, 3000, 5120000, 2048, 0, 0, '', 1), -(1187, 1000, 5120000, 2048000, 0, 0, '', 1), -(1188, 2000, 5120000, 2048000, 0, 0, '', 1), -(1189, 1000, 5120000, 2048, 0, 0, '', 1), -(1190, 500, 5120000, 2048000, 0, 0, '', 1), -(1191, 1000, 5120000, 2048, 0, 0, '', 1), -(1192, 1000, 5120000, 2048, 0, 0, '', 1), -(1193, 10000, 5120000, 2048, 0, 0, '', 1), -(1194, 1000, 5120000, 2048, 0, 0, '', 1); - --- -------------------------------------------------------- - --- --- Table structure for table `challenges_lang` --- - -CREATE TABLE IF NOT EXISTS `challenges_lang` ( - `id` int(11) NOT NULL, - `langcode` varchar(2) NOT NULL, - `name` varchar(200) NOT NULL, - `description` text NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- --- Dumping data for table `challenges_lang` --- - -INSERT INTO `challenges_lang` (`id`, `langcode`, `name`, `description`) VALUES -(1000, 'uk', 'Swap', '<P align=left><B>Завдання</B></P><P>Дано два цілих числа a та b. Написати програму, яка б міняла їхні значення місцями. Тобто після виконання програми замість а значення b, а замість b - а. <P><B>Вхідні дані</B></P><P>В єдиному рядку записано два числа - а та b. (-32000 < a, b < 32000). <P><B>Вихідні дані</B></P><P>Вивести в єдиний рядок через пропуск два числа: спочатку b, а потім a. <P><B>Приклад введення 1</B></P><P><PRE>1 2</PRE><P><B>Приклад виведення 1</B></P><P><PRE>2 1</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>2 3</PRE><P><B>Приклад виведення 2</B></P><P><PRE>3 2</PRE><BR>'), -(1001, 'uk', 'A in power k', '<P align=left><B>Завдання</B></P><P>Для заданого цілого а та натурального k обчислити a<SUP>k</SUP>.<P><B>Вхідні дані</B></P><P>В єдиному рядку записано два числа a та k (-32000 < a <= 32000, 0 < k < 32000).<P><B>Вихідні дані</B></P><P>Єдине число - відповідь. Гарантується, що відповідь не більша за 2*10<SUP>9</SUP>.<P><B>Приклад введення 1</B></P><P><PRE>1 1</PRE><P><B>Приклад виведення 1</B></P><P><PRE>1</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>2 3</PRE><P><B>Приклад виведення 2</B></P><P><PRE>8</PRE><BR>'), -(1002, 'uk', 'Послідовність Фібоначчі', '<P align=left><B>Завдання</B></P><P>Послідовність фібоначчі визначається наступним чином:<BR></P><UL><LI>a<SUB>0</SUB>=0;<LI>a<SUB>1</SUB>=1;<LI>a<SUB>k</SUB>=a<SUB>k-1</SUB> + a<SUB>k-2</SUB></LI></UL><BR><BR>Для заданого n знайти значення n-го елемента послідовності Фібоначчі (a<SUB>n</SUB>).<P><B>Вхідні дані</B></P><P>В єдиному рядку записане єдине число N (1 <= N <= 40).<P><B>Вихідні дані</B></P><P>Єдине число - відповідь.<P><B>Приклад введення 1</B></P><P><PRE>1</PRE><P><B>Приклад виведення 1</B></P><P><PRE>1</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>5</PRE><P><B>Приклад виведення 2</B></P><P><PRE>5</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>8</PRE><P><B>Приклад виведення 3</B></P><P><PRE>21</PRE><BR>'), -(1003, 'uk', 'Рукавички', '<P align=left><B>Завдання</B></P><P>Комірник видає по К рукавичок кожному робітнику. Тобто другий робітник отримає рукавички від (K+1)-шої до (2∙K)-ї включно, рукавички номер (2∙K+2) отримає третій робітник і для нього вони будуть другими.<P>Напишіть програму, яка за номером виданих рукавичок визначає номер робітника, якому їх видано та порядковий номер цих рукавичок в цього робітника<P><B>Вхідні дані</B></P><P>В єдиному рядку записано два числа - K та N. K - кількість рукавичок кожному робітнику, N - номер пари рукавичок (1 <= K <= 200, 1 <= N <= 20000) розділені пропуском.<P><B>Вихідні дані</B></P><P>Номер робітника та номер рукавичок в цього робітника, розділені пропуском.<P><B>Приклад введення 1</B></P><P><PRE>50 1</PRE><P><B>Приклад виведення 1</B></P><P><PRE>1 1</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>20 25</PRE><P><B>Приклад виведення 2</B></P><P><PRE>2 5</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>15 43</PRE><P><B>Приклад виведення 3</B></P><P><PRE>3 13</PRE><BR>'), -(1004, 'uk', 'Супер проста проблема', '<P align=left><B>Завдання</B></P><P>Знайти квадрат N-го простого числа.<P><B>Вхідні дані</B></P><P>В єдиному рядку записане єдине число N (1 <= N <= 100).<P><B>Вихідні дані</B></P><P>Єдине число - квадрат N-го простого числа<P><B>Приклад введення 1</B></P><P><PRE>1</PRE><P><B>Приклад виведення 1</B></P><P><PRE>4</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>2</PRE><P><B>Приклад виведення 2</B></P><P><PRE>9</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>5</PRE><P><B>Приклад виведення 3</B></P><P><PRE>121</PRE><BR>'), -(1005, 'uk', '0-1 проблема', '<P align=left><B>Завдання</B></P><P>Над рядочком 01 виконаємо наступні операції:<UL><LI>Скопіюємо в кінець рядочка самого себе (отримаємо 0101)<LI>В другій половині рядка всі 0 змінимо на 1, а всі 1 на 0 (отримаємо 0110)</LI></UL>Над рядочком 0110 виконаємо ті самі операції. Отримаємо 01101001. І т. д.Таким чином отримаємо нескінченний рядочок нулів та одиниць.Ваше завдання – знайти n-тий символ такого рядочка.<P><B>Вхідні дані</B></P><P>В єдиному рядку записане єдине число N (1 <= N <= 2000000000).<P><B>Вихідні дані</B></P><P>Єдиний символ, який буде на N-й позиції.<P><B>Приклад введення 1</B></P><P><PRE>1</PRE><P><B>Приклад виведення 1</B></P><P><PRE>0</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>2</PRE><P><B>Приклад виведення 2</B></P><P><PRE>1</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>5</PRE><P><B>Приклад виведення 3</B></P><P><PRE>1</PRE><BR>'), -(1006, 'uk', 'Одинадцять', '<P align=left><B>Завдання</B></P><P>Ваше завдання – визначити чи ділиться дане число на 11.<P><B>Вхідні дані</B></P><P>В єдиному рядку записане єдине число N (1 <= n). Число має не більше тисячі знаків.<P><B>Вихідні дані</B></P><P>Вам потрібно вивести “Yes” – якщо число ділиться на 11, і “No” – в протилежному випадку.<P><B>Приклад введення 1</B></P><P><PRE>323455693</PRE><P><B>Приклад виведення 1</B></P><P><PRE>Yes</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>5038297</PRE><P><B>Приклад виведення 2</B></P><P><PRE>Yes</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>112234</PRE><P><B>Приклад виведення 3</B></P><P><PRE>No</PRE><BR>'), -(1007, 'uk', 'Супер послідовність', '<P align=left><B>Завдання</B></P><P>Послідовність чисел a1, a2, … an називається супер послідовністю, якщо виконуються наступні умови:<UL><LI>0 < a1 < a2 < … < an<LI>жодне з чисел не є сумою двох або більше інших чисел</LI></UL><P><B>Вхідні дані</B></P><P>В єдиному рядку записане число N (1 <= n <= 50), далі задано N чисел, кожне з яких не менше 1 і не більше 1000.<P><B>Вихідні дані</B></P><P>Вам необхідно вивести “Yes” – якщо дано супер послідовність, “No” – в протилежному випадку.<P><B>Приклад введення 1</B></P><P><PRE>2 1 2</PRE><P><B>Приклад виведення 1</B></P><P><PRE>Yes</PRE><BR><P><B>Приклад введення 2</B></P><P><PRE>3 1 2 3</PRE><P><B>Приклад виведення 2</B></P><P><PRE>No</PRE><BR><P><B>Приклад введення 3</B></P><P><PRE>10 1 3 16 19 25 70 100 243 245 306</PRE><P><B>Приклад виведення 3</B></... [truncated message content] |
From: <pan...@us...> - 2008-12-10 17:34:21
|
Revision: 442 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=442&view=rev Author: panzaboi Date: 2008-12-10 17:34:11 +0000 (Wed, 10 Dec 2008) Log Message: ----------- Added Contests Added support for teams Added support for Virtual Contests and Team Contests Fixed XML structure to support the new tester Modified Paths: -------------- website/application/modules/acm/controllers/ArchieveController.php website/application/modules/acm/models/Archieve.php website/application/modules/acm/models/Form/Login.php website/application/modules/acm/views/scripts/tester/entry.phtml website/application/modules/acm/views/scripts/tester/submits.phtml website/other/dq.sql website/other/todo.txt Added Paths: ----------- website/application/modules/acm/controllers/ContestController.php website/application/modules/acm/models/Contest.php website/application/modules/acm/views/scripts/contest/ website/application/modules/acm/views/scripts/contest/contest.phtml website/application/modules/acm/views/scripts/contest/entry.phtml website/application/modules/acm/views/scripts/contest/incontest.phtml website/application/modules/acm/views/scripts/contest/index.phtml website/application/modules/acm/views/scripts/contest/notrun.phtml website/application/modules/acm/views/scripts/contest/problemset.phtml website/application/modules/acm/views/scripts/contest/registered.phtml website/application/modules/acm/views/scripts/contest/result.phtml website/application/modules/acm/views/scripts/contest/results.phtml website/application/modules/acm/views/scripts/contest/view.phtml website/other/submits/6 website/other/submits/7 website/other/submits/8 website/other/submits/9 Modified: website/application/modules/acm/controllers/ArchieveController.php =================================================================== --- website/application/modules/acm/controllers/ArchieveController.php 2008-12-10 00:41:43 UTC (rev 441) +++ website/application/modules/acm/controllers/ArchieveController.php 2008-12-10 17:34:11 UTC (rev 442) @@ -10,7 +10,7 @@ public function viewAction() { $id = $this->_getParam('id'); - $problem = $this->_model->get($id); + $problem = $this->_model->getChallenge($id); if (!$problem) return $this->_forward('index', null, null, $this->_getAllParams() + array('message' => 'noProblem')); Added: website/application/modules/acm/controllers/ContestController.php =================================================================== --- website/application/modules/acm/controllers/ContestController.php (rev 0) +++ website/application/modules/acm/controllers/ContestController.php 2008-12-10 17:34:11 UTC (rev 442) @@ -0,0 +1,134 @@ +<?php + +class Acm_ContestController extends Ostacium_Controller_Action +{ + public function indexAction() + { + $this->view->contests = $this->_model->getContests(); + } + + public function registerAction() + { + $contestid = $this->_getParam('contestid'); + + if (!$this->_model->isContestRunning($contestid)) + { + return $this->render('notrun'); + } + + if ($this->_model->isInContest($contestid)) + { + return $this->render('incontest'); + } + + $this->_model->registerUser($contestid); + + return $this->render('registered'); + } + + public function viewAction() + { + $id = $this->_getParam('id'); + $contestid = $this->_getParam('contestid'); + + $problem = $this->_model->getChallenge($id, $contestid); + + if (!$problem) + return $this->_forward('problemset', null, null, $this->_getAllParams() + array('message' => 'noProblem')); + + $this->view->assign($problem); + } + + public function problemsetAction() + { + $contestid = $this->_getParam('contestid'); + + // check if user is in this contest + + $this->view->challenges = $this->_model->getChallenges($contestid); + } + + public function submitAction() + { + $contestid = $this->_getParam('contestid'); + + if (!$this->_model->isContestRunning($contestid)) + { + return $this->render('notrun'); + } + + $this->_helper->getHelper('viewRenderer')->setNoRender(true); + + $form = new Form_Submit(); + + $this->view->dojo()->addOnLoad('function(){ changeEditor('.$form->type->getValue().'); }'); + + echo $form; + } + + public function uploadAction() + { + $this->_helper->getHelper('viewRenderer')->setNoRender(true); + $form = new Form_Submit(); + + if (!$this->getRequest()->isPost()) + { + return $this->_forward('submit', null, null, $this->_getAllParams()); + } + + if ($_POST['type'] == 0) + { + $form->code->setRequired(true); + } + elseif ($_POST['type'] == 1) + { + $form->codefile->setRequired(true); + } + + $result = $form->isValid($this->getRequest()->getPost()); + $this->view->dojo()->addOnLoad('function(){ changeEditor('.$form->type->getValue().'); }'); + + if ($form->type->getValue() == 0) + { + $form->code->setRequired(false); + } + elseif ($form->type->getValue() == 1) + { + $form->codefile->setRequired(false); + } + + if (!$result) + { + echo $form; + return; + } + + $values = $form->getValues(); + $values += $this->_getAllParams(); + $id = $this->_model->addSubmit($values); + + if ($id === false) + { + if ($values['type'] == 1) + unlink($form->codefile->getFileName()); + + return $this->render('notrun'); + } + + if ($values['type'] == 0) + { + file_put_contents(Application::getDocRoot().'/other/submits/'.$id, $values['code']); + } + elseif ($values['type'] == 1) + { + rename($form->codefile->getFileName(), Application::getDocRoot().'/other/submits/'.$id); + } + } + + public function resultsAction() + { + $contestid = $this->_getParam('contestid'); + + $this->view->submits = $this->_model->getSubmits($contestid); + } +} \ No newline at end of file Modified: website/application/modules/acm/models/Archieve.php =================================================================== --- website/application/modules/acm/models/Archieve.php 2008-12-10 00:41:43 UTC (rev 441) +++ website/application/modules/acm/models/Archieve.php 2008-12-10 17:34:11 UTC (rev 442) @@ -14,7 +14,7 @@ return $submits->getAll(); } - public function get($id) + public function getChallenge($id) { $challenges = new Challenges(); return $challenges->get($id); @@ -23,6 +23,7 @@ public function addSubmit($values) { $data = array( + 'contestid' => 0, 'username' => Zend_Auth::getInstance()->getStorage()->read()->username, 'challengeid' => (int)$values['id'], 'codelangid' => $values['languageid'], @@ -30,8 +31,9 @@ 'when' => time() ); - $challenges = new Challenges(); - $challenges->update(array('tries' => 'tries + 1'), $this->_db->quoteInto('id = ?', $data['challengeid'])); + //$challenges = new Challenges(); + //$challenges->update(array('tries' => 'tries + 1'), $this->_db->quoteInto('id = ?', $data['challengeid'])); + // move this to the page, where we recieve data from Tester, add tries and accepts there. $submits = new Submits(); return $submits->insert($data); @@ -45,22 +47,22 @@ public function get($id) { - return $this->selectLang(array('name', 'description'))->where($this->_name.'.id = ?', $id)->query()->fetch(); + return $this->selectLang(array('name', 'description'))->where('challenges.id = ? AND enabled = 1', $id)->query()->fetch(); } public function getAll() { - return $this->selectLang(array('name', 'description'))->where('enabled = ?', 1)->query()->fetchAll(); + return $this->selectLang(array('name', 'description'))->where('challenges.enabled = 1')->query()->fetchAll(); } } class Submits extends Ostacium_Db_Table { - protected $_name = 'archieve_submits'; + protected $_name = 'submits'; protected $_primary = 'id'; public function getAll() { - return $this->select()->from($this)->setIntegrityCheck(false)->joinLeft('code_languages', 'code_languages.id = archieve_submits.codelangid', array('codelang' => 'name'))->order('id DESC')->query()->fetchAll(); + return $this->select()->from($this)->setIntegrityCheck(false)->joinLeft('code_languages', 'code_languages.id = submits.codelangid', array('codelang' => 'name'))->where('contestid = 0')->order('submits.id DESC')->query()->fetchAll(); } } \ No newline at end of file Added: website/application/modules/acm/models/Contest.php =================================================================== --- website/application/modules/acm/models/Contest.php (rev 0) +++ website/application/modules/acm/models/Contest.php 2008-12-10 17:34:11 UTC (rev 442) @@ -0,0 +1,165 @@ +<?php + +class Contest extends Ostacium_Model +{ + public function getContests() + { + $contests = new Contests(); + return $contests->getAll(); + } + + public function registerUser($id) + { + $username = Zend_Auth::getInstance()->getStorage()->read()->username; + + $ca = new ContestsApplicants(); + $ca->insert(array('username' => $username, 'contestid' => $id)); + + return true; + } + + public function isContestRunning($contestid) + { + $contest = new Contests(); + return $contest->isRunning($contestid); + } + + public function isInContest($contestid) + { + $username = Zend_Auth::getInstance()->getStorage()->read()->username; + $contest = new Contests(); + + return $contest->isInContest($contestid, $username); + } + + public function getChallenges($contestid) + { + $challenges = new Challenges(); + return $challenges->getAll($contestid); + } + + public function getChallenge($id, $contestid) + { + $challenges = new Challenges(); + return $challenges->get($id, $contestid); + } + + public function addSubmit($values) + { + $data = array( + 'contestid' => $values['contestid'], + 'username' => Zend_Auth::getInstance()->getStorage()->read()->username, + 'challengeid' => (int)$values['id'], + 'codelangid' => $values['languageid'], + 'firsttest' => $values['firsttest'], + 'when' => time() + ); + + $contest = new Contests(); + + if ($contest->isRunning($values['contestid'])) + { + $submits = new Submits(); + return $submits->insert($data); + } + else + return false; + } + + public function getSubmits($contestid) + { + $submits = new Submits(); + return $submits->getAll($contestid); + } +} + +class Challenges extends Ostacium_Db_Table +{ + protected $_name = 'challenges'; + protected $_primary = 'id'; + + public function getAll($contestid) + { + return $this->selectLang(array('name', 'description')) + ->joinLeft(array('c' => 'contests'), $this->getAdapter()->quoteInto('c.id = ? AND c.start <= UNIX_TIMESTAMP() AND c.end > UNIX_TIMESTAMP()', $contestid), array()) + ->joinLeft(array('cc' => 'contests_challenges'), 'cc.contestid = c.id', 'contestid') + ->where('challenges.id = cc.challengeid') + ->query()->fetchAll(); + } + + public function get($id, $contestid) + { + return $this->selectLang(array('name', 'description')) + ->joinLeft(array('c' => 'contests'), $this->getAdapter()->quoteInto('c.id = ? AND c.start <= UNIX_TIMESTAMP() AND c.end > UNIX_TIMESTAMP()', $contestid), array()) + ->joinLeft(array('cc' => 'contests_challenges'), $this->getAdapter()->quoteInto('cc.contestid = c.id AND cc.challengeid = ?', $id), 'contestid') + ->where('challenges.id = cc.challengeid') + ->query()->fetch(); + } +} + +class Submits extends Ostacium_Db_Table +{ + protected $_name = 'submits'; + protected $_primary = 'id'; + + public function getAll($contestid) + { + return $this->select()->setIntegrityCheck(false) + ->from($this) + ->joinLeft('code_languages', 'code_languages.id = submits.codelangid', array('codelang' => 'name')) + ->joinLeft(array('c' => 'contests'), $this->getAdapter()->quoteInto('c.id = ?', $contestid), array()) + ->where('submits.contestid = c.id')->order('submits.id DESC') + ->query()->fetchAll(); + } +} + +class Contests extends Ostacium_Db_Table +{ + protected $_name = 'contests'; + protected $_primary = 'id'; + + public function isRunning($contestid) + { + $id = $this->select()->from($this, 'id') + ->where('id = ? AND start <= UNIX_TIMESTAMP() AND end >= UNIX_TIMESTAMP() AND enabled = 1', $contestid) + ->query()->fetchColumn('id'); + + if ($id && $id == $contestid) + return true; + else + return false; + } + + public function getAll() + { + return $this->selectLang(array('name', 'description')) + ->where('enabled = 1 AND start <= UNIX_TIMESTAMP() AND end > UNIX_TIMESTAMP()') + ->query()->fetchAll(); + } + + public function isInContest($contestid, $username) + { + $id = $this->select()->setIntegrityCheck(false) + ->from(array('c' => $this->_name), 'id') + ->joinInner(array('a' => 'contests_applicants'), 'c.id=a.contestid', array()) + ->where('c.id = ?', $contestid) + ->where('a.username = ?', $username) + ->query()->fetchColumn('username'); + + if ($id && $id == $contestid) return true; + else return false; + } +} + +class ContestsApplicants extends Ostacium_Db_Table +{ + protected $_name = 'contests_applicants'; + protected $_primary = array('contestid', 'username'); +} + + +class Users extends Ostacium_Db_Table +{ + protected $_name = 'users'; + protected $_primaty = 'username'; +} \ No newline at end of file Modified: website/application/modules/acm/models/Form/Login.php =================================================================== --- website/application/modules/acm/models/Form/Login.php 2008-12-10 00:41:43 UTC (rev 441) +++ website/application/modules/acm/models/Form/Login.php 2008-12-10 17:34:11 UTC (rev 442) @@ -18,7 +18,7 @@ $translate = Zend_Registry::get('Zend_Translate'); $router = Zend_Controller_Front::getInstance()->getRouter(); - $this->setAction($router->assemble(array('action' => 'login'), null)); + $this->setAction($router->assemble(array('action' => 'login', 'controller' => 'index'), null)); $this->setMethod('post'); $this->setName('loginform'); Property changes on: website/application/modules/acm/views/scripts/contest ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/acm/views/scripts/contest/contest.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/contest.phtml (rev 0) +++ website/application/modules/acm/views/scripts/contest/contest.phtml 2008-12-10 17:34:11 UTC (rev 442) @@ -0,0 +1,7 @@ +<tr> + <td align="center"><?= $this->id ?></td> + <td align="center"><?= $this->name ?></td> + <td align="center"><?= $this->date($this->start, "d.m.Y H:i:s") ?></td> + <td align="center"><?= $this->date($this->end, "d.m.Y H:i:s") ?></td> + <td align="center"><a href="<?= $this->url(array('action' => 'register', 'contestid' => $this->id), null) ?>"><?= $this->translate('register') ?></a></td> +</tr> \ No newline at end of file Added: website/application/modules/acm/views/scripts/contest/entry.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/entry.phtml (rev 0) +++ website/application/modules/acm/views/scripts/contest/entry.phtml 2008-12-10 17:34:11 UTC (rev 442) @@ -0,0 +1,14 @@ +<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', 'contest' => $this->contestid, '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', 'contest' => $this->contestid, 'id' => $this->id), null) ?>"><?= $this->name ?></a> + </td> + + <td style="border-left: 0px none; border-right: 0px solid rgb(196, 196, 219);"> + <a href="<?= $this->url( array('action' => 'submit', 'contest' => $this->contestid, 'id' => $this->id), null) ?>"><img height="17" width="22" alt="Здати" title="Здати" src="images/b_find.gif"/></a> + <a href="<?= $this->url( array('action' => 'status', 'contest' => $this->contestid, 'id' => $this->id), null) ?>"><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/contest/incontest.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/incontest.phtml (rev 0) +++ website/application/modules/acm/views/scripts/contest/incontest.phtml 2008-12-10 17:34:11 UTC (rev 442) @@ -0,0 +1 @@ +You are already in this contest \ No newline at end of file Added: website/application/modules/acm/views/scripts/contest/index.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/index.phtml (rev 0) +++ website/application/modules/acm/views/scripts/contest/index.phtml 2008-12-10 17:34:11 UTC (rev 442) @@ -0,0 +1,10 @@ +<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 width="60%" cellspacing="0" cellpadding="0" border="0" summary="" align="center"><tbody><tr><td bgcolor="#f4f3f8" align="middle" colspan="14"><b>Архів контестів</b></td></tr><tr bgcolor="#e1e1e1" align="middle"> +<th>Номер</th><th>Назва</th><th>Початок</th><th>Кінець</th><th>Зареєструватись</th></tr> +<?= $this->partialLoop('contest/contest.phtml', $this->contests) ?> +</table><br/></td></tr></table> \ No newline at end of file Added: website/application/modules/acm/views/scripts/contest/notrun.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/notrun.phtml (rev 0) +++ website/application/modules/acm/views/scripts/contest/notrun.phtml 2008-12-10 17:34:11 UTC (rev 442) @@ -0,0 +1 @@ +The contest is not running at the moment \ No newline at end of file Added: website/application/modules/acm/views/scripts/contest/problemset.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/problemset.phtml (rev 0) +++ website/application/modules/acm/views/scripts/contest/problemset.phtml 2008-12-10 17:34:11 UTC (rev 442) @@ -0,0 +1,10 @@ +<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" summary="" align="center"><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="270"> Назва</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('contest/entry.phtml', $this->challenges) ?> +</table><br/></td></tr></table> \ No newline at end of file Added: website/application/modules/acm/views/scripts/contest/registered.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/registered.phtml (rev 0) +++ website/application/modules/acm/views/scripts/contest/registered.phtml 2008-12-10 17:34:11 UTC (rev 442) @@ -0,0 +1 @@ +You have successfully registered for contest \ No newline at end of file Added: website/application/modules/acm/views/scripts/contest/result.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/result.phtml (rev 0) +++ website/application/modules/acm/views/scripts/contest/result.phtml 2008-12-10 17:34:11 UTC (rev 442) @@ -0,0 +1,10 @@ +<tr> + <td align="center"><?= $this->id ?></td> + <td align="center"><?= $this->date($this->when) ?></td> + <td align="center"><?= $this->username ?></td> + <td align="center"><a href="<?= $this->url( array('action' => 'view', 'id' => $this->challengeid), null) ?>"><?= $this->challengeid ?></a></td> + <td align="center"><?= $this->codelang ?></td> + <td align="center"><?= $this->state($this->state) ?></td> + <td align="center"><?= ($this->tests == 0 ? '-' : $this->tests) ?></td> + <td align="center"><?= ($this->runtime == 0 ? '-' : $this->runtime) ?>/<?= ($this->memory == 0 ? '-' : $this->memory) ?></td> +</tr> \ No newline at end of file Added: website/application/modules/acm/views/scripts/contest/results.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/results.phtml (rev 0) +++ website/application/modules/acm/views/scripts/contest/results.phtml 2008-12-10 17:34:11 UTC (rev 442) @@ -0,0 +1,33 @@ +<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 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" summary="" align="center" width="80%"> +<tbody> +<tr><td bgcolor="#f4f3f8" align="middle" colspan="14"><b>Архів задач</b></td></tr> +<tr bgcolor="#e1e1e1" align="middle"> +<th>ID</th> +<th>Дата</th> +<th>Логін</th> +<th>Задача</th> +<th>Мова</th> +<th>Стан</th> +<th>Тест</th> +<th>Час/Пам'ять</th> +</tr> + +<?= $this->partialLoop('archieve/result.phtml', $this->submits) ?> +</table> + +</td></tr></table> \ No newline at end of file Added: website/application/modules/acm/views/scripts/contest/view.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/view.phtml (rev 0) +++ website/application/modules/acm/views/scripts/contest/view.phtml 2008-12-10 17:34:11 UTC (rev 442) @@ -0,0 +1,12 @@ +<h2 align="center"><?= $this->id.' - '.$this->name ?></h2> +<div align="center"> + <?= $this->translate('timelimit') ?>: <?= $this->measure("Time", $this->timelimit, Zend_Measure_Time::MILLISECOND, Zend_Measure_Time::SECOND, 0 ) ?><br /> + <?= $this->translate('memorylimit') ?>: <?= $this->measure("Binary", $this->memorylimit, Zend_Measure_Binary::BYTE, Zend_Measure_Binary::KILOBYTE ) ?><br /> + <?= $this->translate('outputlimit') ?>: <?= $this->measure("Binary", $this->outputlimit, Zend_Measure_Binary::BYTE, Zend_Measure_Binary::KILOBYTE ) ?><br /> +</div> +<br /> +<p><?= $this->description ?></p> + +<div> + <a href="<?= $this->url(array('action' => 'submit', 'contest' => $this->contestid, 'id' => $this->id), null) ?>"><?= $this->translate('submit') ?></a> +</div> \ No newline at end of file Modified: website/application/modules/acm/views/scripts/tester/entry.phtml =================================================================== --- website/application/modules/acm/views/scripts/tester/entry.phtml 2008-12-10 00:41:43 UTC (rev 441) +++ website/application/modules/acm/views/scripts/tester/entry.phtml 2008-12-10 17:34:11 UTC (rev 442) @@ -1,3 +1,6 @@ -<entry id="<?= $this->id ?>" problemid="<?= $this->challengeid ?>" language="<?= $this->codelang ?>"> -<?= htmlentities(file_get_contents(Application::getDocRoot().'/other/submits/'.$this->id)) ?> -</entry> \ No newline at end of file +<submit> + <id><?= $this->id ?></id> + <sourceCode><?= htmlentities(file_get_contents(Application::getDocRoot().'/other/submits/'.$this->id)) ?></sourceCode> + <language><?= $this->codelangid ?></language> + <problem><?= $this->challengeid ?></problem> +</submit> \ No newline at end of file Modified: website/application/modules/acm/views/scripts/tester/submits.phtml =================================================================== --- website/application/modules/acm/views/scripts/tester/submits.phtml 2008-12-10 00:41:43 UTC (rev 441) +++ website/application/modules/acm/views/scripts/tester/submits.phtml 2008-12-10 17:34:11 UTC (rev 442) @@ -1,4 +1,4 @@ <?= '<?xml version="1.0" encoding="UTF-8"?>' ?> -<entries> +<submitList> <?= $this->partialLoop('tester/entry.phtml', $this->submits) ?> -</entries> \ No newline at end of file +</submitList> \ No newline at end of file Modified: website/other/dq.sql =================================================================== --- website/other/dq.sql 2008-12-10 00:41:43 UTC (rev 441) +++ website/other/dq.sql 2008-12-10 17:34:11 UTC (rev 442) @@ -3,7 +3,7 @@ -- http://www.phpmyadmin.net -- -- Host: localhost --- Generation Time: Dec 07, 2008 at 11:51 PM +-- Generation Time: Dec 10, 2008 at 07:16 PM -- Server version: 5.0.51 -- PHP Version: 5.2.6 @@ -22,34 +22,6 @@ -- -------------------------------------------------------- -- --- Table structure for table `archieve_submits` --- - -CREATE TABLE IF NOT EXISTS `archieve_submits` ( - `id` int(11) NOT NULL auto_increment, - `username` varchar(50) NOT NULL, - `challengeid` int(11) NOT NULL, - `codelangid` int(11) NOT NULL, - `state` int(11) NOT NULL default '0', - `tests` int(11) NOT NULL default '0', - `firsttest` tinyint(1) NOT NULL, - `runtime` double NOT NULL default '0', - `memory` int(11) NOT NULL default '0', - `when` int(11) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ; - --- --- Dumping data for table `archieve_submits` --- - -INSERT INTO `archieve_submits` (`id`, `username`, `challengeid`, `codelangid`, `state`, `tests`, `firsttest`, `runtime`, `memory`, `when`) VALUES -(3, 'tester', 1000, 1, 1, 100, 0, 1002, 1001, 1228664380), -(5, 'panza', 1000, 1, 0, 0, 1, 0, 0, 1228685834); - --- -------------------------------------------------------- - --- -- Table structure for table `challenges` -- @@ -277,7 +249,7 @@ `langcode` varchar(2) NOT NULL, `name` varchar(200) NOT NULL, `description` text NOT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`,`langcode`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- @@ -520,21 +492,45 @@ CREATE TABLE IF NOT EXISTS `contests` ( `id` int(11) NOT NULL auto_increment, - `name` varchar(50) NOT NULL, - `description` varchar(100) NOT NULL, `start` int(11) NOT NULL, `end` int(11) NOT NULL, + `enabled` tinyint(1) NOT NULL default '0', + `virtual` tinyint(1) NOT NULL default '0', + `team` tinyint(1) NOT NULL default '0', PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; -- -- Dumping data for table `contests` -- +INSERT INTO `contests` (`id`, `start`, `end`, `enabled`, `virtual`, `team`) VALUES +(1, 228766000, 2147483647, 1, 0, 0); -- -------------------------------------------------------- -- +-- Table structure for table `contests_applicants` +-- + +CREATE TABLE IF NOT EXISTS `contests_applicants` ( + `contestid` int(11) NOT NULL, + `username` varchar(50) NOT NULL, + PRIMARY KEY (`contestid`,`username`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `contests_applicants` +-- + +INSERT INTO `contests_applicants` (`contestid`, `username`) VALUES +(0, 'panza'), +(1, 'admin'), +(1, 'panza'); + +-- -------------------------------------------------------- + +-- -- Table structure for table `contests_challenges` -- @@ -548,10 +544,72 @@ -- Dumping data for table `contests_challenges` -- +INSERT INTO `contests_challenges` (`contestid`, `challengeid`) VALUES +(1, 1000), +(1, 1001); -- -------------------------------------------------------- -- +-- Table structure for table `contests_lang` +-- + +CREATE TABLE IF NOT EXISTS `contests_lang` ( + `id` int(11) NOT NULL, + `langcode` varchar(2) NOT NULL, + `name` varchar(200) NOT NULL, + `description` text NOT NULL, + PRIMARY KEY (`id`,`langcode`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `contests_lang` +-- + +INSERT INTO `contests_lang` (`id`, `langcode`, `name`, `description`) VALUES +(1, 'uk', 'Тестовий Контест', 'Тестовий Контест'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `contests_results` +-- + +CREATE TABLE IF NOT EXISTS `contests_results` ( + `contestid` int(11) NOT NULL, + `username` varchar(50) NOT NULL, + `challengeid` int(11) NOT NULL, + `tries` int(11) NOT NULL, + `penalty` int(11) NOT NULL, + `accepted` tinyint(1) NOT NULL, + PRIMARY KEY (`contestid`,`username`,`challengeid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `contests_results` +-- + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `contests_teams` +-- + +CREATE TABLE IF NOT EXISTS `contests_teams` ( + `contestid` int(11) NOT NULL, + `teamid` int(11) NOT NULL, + PRIMARY KEY (`contestid`,`teamid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `contests_teams` +-- + + +-- -------------------------------------------------------- + +-- -- Table structure for table `languages` -- @@ -583,12 +641,117 @@ `message` text NOT NULL, `ip` varchar(15) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=105 ; -- -- Dumping data for table `log` -- +INSERT INTO `log` (`id`, `when`, `username`, `type`, `message`, `ip`) VALUES +(1, 1228687021, 'panza', 'NOTICE', 'runtime: 0.402740955353; totalqueries: 5; totalqueriestime: 0.000763177871704', '127.0.0.1'), +(2, 1228687062, 'panza', 'ERR', 'Type:EXCEPTION_NO_ACTION\nTrace:#0 D:\\server\\library\\Zend\\Controller\\Plugin\\Broker.php(309): Ostacium_Controller_Plugin_ErrorHandler->preDispatch(Object(Ostacium_Controller_Request_Http))\n#1 D:\\server\\library\\Zend\\Controller\\Front.php(921): Zend_Controller_Plugin_Broker->preDispatch(Object(Ostacium_Controller_Request_Http))\n#2 D:\\server\\library\\Application.php(51): Zend_Controller_Front->dispatch()\n#3 D:\\server\\httpdocs\\index.php(13): Application->bootstrap()\n#4 {main}', '127.0.0.1'), +(3, 1228687062, 'panza', 'NOTICE', 'runtime: 0.268155813217; totalqueries: 6; totalqueriestime: 0.000887155532837', '127.0.0.1'), +(4, 1228687077, 'panza', 'ERR', 'Type:EXCEPTION_NOTALLOWED\nTrace:#0 D:\\server\\library\\Zend\\Controller\\Plugin\\Broker.php(309): Ostacium_Controller_Plugin_ErrorHandler->preDispatch(Object(Ostacium_Controller_Request_Http))\n#1 D:\\server\\library\\Zend\\Controller\\Front.php(921): Zend_Controller_Plugin_Broker->preDispatch(Object(Ostacium_Controller_Request_Http))\n#2 D:\\server\\library\\Application.php(51): Zend_Controller_Front->dispatch()\n#3 D:\\server\\httpdocs\\index.php(13): Application->bootstrap()\n#4 {main}', '127.0.0.1'), +(5, 1228687077, 'panza', 'NOTICE', 'runtime: 0.255424976349; totalqueries: 6; totalqueriestime: 0.00112795829773', '127.0.0.1'), +(6, 1228687081, 'panza', 'ERR', 'Type:EXCEPTION_NO_ACTION\nTrace:#0 D:\\server\\library\\Zend\\Controller\\Plugin\\Broker.php(309): Ostacium_Controller_Plugin_ErrorHandler->preDispatch(Object(Ostacium_Controller_Request_Http))\n#1 D:\\server\\library\\Zend\\Controller\\Front.php(921): Zend_Controller_Plugin_Broker->preDispatch(Object(Ostacium_Controller_Request_Http))\n#2 D:\\server\\library\\Application.php(51): Zend_Controller_Front->dispatch()\n#3 D:\\server\\httpdocs\\index.php(13): Application->bootstrap()\n#4 {main}', '127.0.0.1'), +(7, 1228687081, 'panza', 'NOTICE', 'runtime: 0.252156019211; totalqueries: 6; totalqueriestime: 0.000904083251953', '127.0.0.1'), +(8, 1228687083, 'panza', 'NOTICE', 'runtime: 0.352587938309; totalqueries: 5; totalqueriestime: 0.000739097595215', '127.0.0.1'), +(9, 1228687087, 'tester', 'NOTICE', 'runtime: 0.35676407814; totalqueries: 5; totalqueriestime: 0.000777006149292', '127.0.0.1'), +(10, 1228687681, 'tester', 'NOTICE', 'runtime: 0.251905918121; totalqueries: 5; totalqueriestime: 0.000739097595215', '127.0.0.1'), +(11, 1228687683, 'tester', 'NOTICE', 'runtime: 0.451593875885; totalqueries: 6; totalqueriestime: 0.00546813011169', '127.0.0.1'), +(12, 1228688210, 'tester', 'NOTICE', 'runtime: 0.375689983368; totalqueries: 5; totalqueriestime: 0.000783920288086', '127.0.0.1'), +(13, 1228688221, 'tester', 'NOTICE', 'runtime: 0.354820966721; totalqueries: 5; totalqueriestime: 0.000791072845459', '127.0.0.1'), +(14, 1228688276, 'guest', 'NOTICE', 'runtime: 0.353997945786; totalqueries: 5; totalqueriestime: 0.000945568084717', '127.0.0.1'), +(15, 1228688289, 'guest', 'NOTICE', 'runtime: 0.363173961639; totalqueries: 5; totalqueriestime: 0.00074315071106', '127.0.0.1'), +(16, 1228688308, 'guest', 'NOTICE', 'runtime: 0.364115953445; totalqueries: 5; totalqueriestime: 0.000854730606079', '127.0.0.1'), +(17, 1228741301, 'guest', 'NOTICE', 'runtime: 1.43999099731; totalqueries: 6; totalqueriestime: 0.0433101654053', '127.0.0.1'), +(18, 1228741346, 'guest', 'ERR', 'Type:EXCEPTION_NO_CONTROLLER\nTrace:#0 D:\\server\\library\\Zend\\Controller\\Plugin\\Broker.php(309): Ostacium_Controller_Plugin_ErrorHandler->preDispatch(Object(Ostacium_Controller_Request_Http))\n#1 D:\\server\\library\\Zend\\Controller\\Front.php(921): Zend_Controller_Plugin_Broker->preDispatch(Object(Ostacium_Controller_Request_Http))\n#2 D:\\server\\library\\Application.php(51): Zend_Controller_Front->dispatch()\n#3 D:\\server\\httpdocs\\index.php(13): Application->bootstrap()\n#4 {main}', '127.0.0.1'), +(19, 1228741346, 'guest', 'NOTICE', 'runtime: 0.302864074707; totalqueries: 6; totalqueriestime: 0.000945806503296', '127.0.0.1'), +(20, 1228741349, 'guest', 'ERR', 'Type:EXCEPTION_NO_CONTROLLER\nTrace:#0 D:\\server\\library\\Zend\\Controller\\Plugin\\Broker.php(309): Ostacium_Controller_Plugin_ErrorHandler->preDispatch(Object(Ostacium_Controller_Request_Http))\n#1 D:\\server\\library\\Zend\\Controller\\Front.php(921): Zend_Controller_Plugin_Broker->preDispatch(Object(Ostacium_Controller_Request_Http))\n#2 D:\\server\\library\\Application.php(51): Zend_Controller_Front->dispatch()\n#3 D:\\server\\httpdocs\\index.php(13): Application->bootstrap()\n#4 {main}', '127.0.0.1'), +(21, 1228741349, 'guest', 'NOTICE', 'runtime: 0.254481077194; totalqueries: 6; totalqueriestime: 0.000924110412598', '127.0.0.1'), +(22, 1228741719, 'guest', 'NOTICE', 'runtime: 0.322642087936; totalqueries: 6; totalqueriestime: 0.00111651420593', '127.0.0.1'), +(23, 1228745567, 'guest', 'NOTICE', 'runtime: 1.22641611099; totalqueries: 6; totalqueriestime: 0.000978708267212', '127.0.0.1'), +(24, 1228745669, 'guest', 'NOTICE', 'runtime: 0.473080158234; totalqueries: 6; totalqueriestime: 0.00102496147156', '127.0.0.1'), +(25, 1228766766, 'guest', 'NOTICE', 'runtime: 0.910779953003; totalqueries: 5; totalqueriestime: 0.000758409500122', '127.0.0.1'), +(26, 1228766773, 'guest', 'NOTICE', 'runtime: 0.377062082291; totalqueries: 5; totalqueriestime: 0.000734090805054', '127.0.0.1'), +(27, 1228766780, 'admin', 'NOTICE', 'runtime: 0.344890117645; totalqueries: 5; totalqueriestime: 0.000730991363525', '127.0.0.1'), +(28, 1228766909, 'admin', 'NOTICE', 'runtime: 0.286052942276; totalqueries: 6; totalqueriestime: 0.00117993354797', '127.0.0.1'), +(29, 1228767005, 'admin', 'NOTICE', 'runtime: 0.249300956726; totalqueries: 6; totalqueriestime: 0.00116324424744', '127.0.0.1'), +(30, 1228767091, 'admin', 'NOTICE', 'runtime: 0.268568992615; totalqueries: 6; totalqueriestime: 0.00105500221252', '127.0.0.1'), +(31, 1228767258, 'admin', 'NOTICE', 'runtime: 0.26207113266; totalqueries: 6; totalqueriestime: 0.00106501579285', '127.0.0.1'), +(32, 1228767334, 'admin', 'NOTICE', 'runtime: 0.275465011597; totalqueries: 6; totalqueriestime: 0.00116205215454', '127.0.0.1'), +(33, 1228767360, 'admin', 'NOTICE', 'runtime: 0.423779964447; totalqueries: 6; totalqueriestime: 0.00103998184204', '127.0.0.1'), +(34, 1228767377, 'admin', 'NOTICE', 'runtime: 0.297820091248; totalqueries: 6; totalqueriestime: 0.00109577178955', '127.0.0.1'), +(35, 1228767424, 'admin', 'NOTICE', 'runtime: 0.332688093185; totalqueries: 6; totalqueriestime: 0.00102591514587', '127.0.0.1'), +(36, 1228767434, 'admin', 'NOTICE', 'runtime: 0.297483921051; totalqueries: 6; totalqueriestime: 0.00101661682129', '127.0.0.1'), +(37, 1228767933, 'admin', 'NOTICE', 'runtime: 0.311790943146; totalqueries: 6; totalqueriestime: 0.00101613998413', '127.0.0.1'), +(38, 1228767948, 'admin', 'NOTICE', 'runtime: 0.275632143021; totalqueries: 6; totalqueriestime: 0.000970840454102', '127.0.0.1'), +(39, 1228767974, 'admin', 'NOTICE', 'runtime: 0.283143997192; totalqueries: 6; totalqueriestime: 0.000986099243164', '127.0.0.1'), +(40, 1228768018, 'admin', 'NOTICE', 'runtime: 0.272602081299; totalqueries: 6; totalqueriestime: 0.00103712081909', '127.0.0.1'), +(41, 1228768043, 'admin', 'NOTICE', 'runtime: 0.257270097733; totalqueries: 6; totalqueriestime: 0.00101089477539', '127.0.0.1'), +(42, 1228768049, 'admin', 'ERR', 'Type:EXCEPTION_NO_ACTION\nTrace:#0 D:\\server\\library\\Zend\\Controller\\Plugin\\Broker.php(309): Ostacium_Controller_Plugin_ErrorHandler->preDispatch(Object(Ostacium_Controller_Request_Http))\n#1 D:\\server\\library\\Zend\\Controller\\Front.php(921): Zend_Controller_Plugin_Broker->preDispatch(Object(Ostacium_Controller_Request_Http))\n#2 D:\\server\\library\\Application.php(51): Zend_Controller_Front->dispatch()\n#3 D:\\server\\httpdocs\\index.php(13): Application->bootstrap()\n#4 {main}', '127.0.0.1'), +(43, 1228768049, 'admin', 'NOTICE', 'runtime: 0.269228935242; totalqueries: 6; totalqueriestime: 0.000887870788574', '127.0.0.1'), +(44, 1228768867, 'admin', 'NOTICE', 'runtime: 0.231039047241; totalqueries: 6; totalqueriestime: 0.000965118408203', '127.0.0.1'), +(45, 1228768896, 'admin', 'NOTICE', 'runtime: 0.437469005585; totalqueries: 6; totalqueriestime: 0.00623726844788', '127.0.0.1'), +(46, 1228768902, 'admin', 'NOTICE', 'runtime: 0.251997947693; totalqueries: 6; totalqueriestime: 0.00103378295898', '127.0.0.1'), +(47, 1228770333, 'admin', 'NOTICE', 'runtime: 0.264349937439; totalqueries: 6; totalqueriestime: 0.00107169151306', '127.0.0.1'), +(48, 1228770367, 'admin', 'NOTICE', 'runtime: 0.241730928421; totalqueries: 6; totalqueriestime: 0.00105619430542', '127.0.0.1'), +(49, 1228770407, 'admin', 'NOTICE', 'runtime: 0.25093793869; totalqueries: 6; totalqueriestime: 0.00124430656433', '127.0.0.1'), +(50, 1228770465, 'admin', 'NOTICE', 'runtime: 0.269231081009; totalqueries: 6; totalqueriestime: 0.00140309333801', '127.0.0.1'), +(51, 1228770715, 'admin', 'NOTICE', 'runtime: 0.262792110443; totalqueries: 6; totalqueriestime: 0.00123476982117', '127.0.0.1'), +(52, 1228771020, 'admin', 'NOTICE', 'runtime: 0.300353050232; totalqueries: 6; totalqueriestime: 0.00111222267151', '127.0.0.1'), +(53, 1228771033, 'admin', 'ERR', 'Type:EXCEPTION_NO_ACTION\nTrace:#0 D:\\server\\library\\Zend\\Controller\\Plugin\\Broker.php(309): Ostacium_Controller_Plugin_ErrorHandler->preDispatch(Object(Ostacium_Controller_Request_Http))\n#1 D:\\server\\library\\Zend\\Controller\\Front.php(921): Zend_Controller_Plugin_Broker->preDispatch(Object(Ostacium_Controller_Request_Http))\n#2 D:\\server\\library\\Application.php(51): Zend_Controller_Front->dispatch()\n#3 D:\\server\\httpdocs\\index.php(13): Application->bootstrap()\n#4 {main}', '127.0.0.1'), +(54, 1228771033, 'admin', 'NOTICE', 'runtime: 0.234899997711; totalqueries: 6; totalqueriestime: 0.00088906288147', '127.0.0.1'), +(55, 1228771053, 'admin', 'NOTICE', 'runtime: 0.714066982269; totalqueries: 6; totalqueriestime: 0.00090503692627', '127.0.0.1'), +(56, 1228771484, 'admin', 'NOTICE', 'runtime: 0.465132951736; totalqueries: 7; totalqueriestime: 0.00111651420593', '127.0.0.1'), +(57, 1228771529, 'admin', 'NOTICE', 'runtime: 0.298429965973; totalqueries: 6; totalqueriestime: 0.00111413002014', '127.0.0.1'), +(58, 1228771563, 'admin', 'NOTICE', 'runtime: 0.302327156067; totalqueries: 6; totalqueriestime: 0.00112509727478', '127.0.0.1'), +(59, 1228771785, 'admin', 'NOTICE', 'runtime: 0.284492015839; totalqueries: 6; totalqueriestime: 0.0012526512146', '127.0.0.1'), +(60, 1228826180, 'admin', 'NOTICE', 'runtime: 13.5730581284; totalqueries: 6; totalqueriestime: 0.00137305259705', '127.0.0.1'), +(61, 1228826199, 'admin', 'ERR', 'Type:EXCEPTION_NO_CONTROLLER\nTrace:#0 D:\\server\\library\\Zend\\Controller\\Plugin\\Broker.php(309): Ostacium_Controller_Plugin_ErrorHandler->preDispatch(Object(Ostacium_Controller_Request_Http))\n#1 D:\\server\\library\\Zend\\Controller\\Front.php(921): Zend_Controller_Plugin_Broker->preDispatch(Object(Ostacium_Controller_Request_Http))\n#2 D:\\server\\library\\Application.php(51): Zend_Controller_Front->dispatch()\n#3 D:\\server\\httpdocs\\index.php(13): Application->bootstrap()\n#4 {main}', '127.0.0.1'), +(62, 1228826199, 'admin', 'NOTICE', 'runtime: 0.783575057983; totalqueries: 6; totalqueriestime: 0.000910758972168', '127.0.0.1'), +(63, 1228826201, 'admin', 'ERR', 'Type:EXCEPTION_NO_CONTROLLER\nTrace:#0 D:\\server\\library\\Zend\\Controller\\Plugin\\Broker.php(309): Ostacium_Controller_Plugin_ErrorHandler->preDispatch(Object(Ostacium_Controller_Request_Http))\n#1 D:\\server\\library\\Zend\\Controller\\Front.php(921): Zend_Controller_Plugin_Broker->preDispatch(Object(Ostacium_Controller_Request_Http))\n#2 D:\\server\\library\\Application.php(51): Zend_Controller_Front->dispatch()\n#3 D:\\server\\httpdocs\\index.php(13): Application->bootstrap()\n#4 {main}', '127.0.0.1'), +(64, 1228826201, 'admin', 'NOTICE', 'runtime: 0.235674142838; totalqueries: 6; totalqueriestime: 0.00092077255249', '127.0.0.1'), +(65, 1228843063, 'admin', 'NOTICE', 'runtime: 0.402568101883; totalqueries: 6; totalqueriestime: 0.00116920471191', '127.0.0.1'), +(66, 1228843086, 'admin', 'NOTICE', 'runtime: 0.260549068451; totalqueries: 6; totalqueriestime: 0.00125503540039', '127.0.0.1'), +(67, 1228843598, 'admin', 'NOTICE', 'runtime: 0.280871152878; totalqueries: 6; totalqueriestime: 0.00107192993164', '127.0.0.1'), +(68, 1228843602, 'admin', 'NOTICE', 'runtime: 0.274296045303; totalqueries: 6; totalqueriestime: 0.00107288360596', '127.0.0.1'), +(69, 1228843606, 'admin', 'NOTICE', 'runtime: 0.405455112457; totalqueries: 6; totalqueriestime: 0.00119829177856', '127.0.0.1'), +(70, 1228843619, 'admin', 'NOTICE', 'runtime: 0.31596493721; totalqueries: 6; totalqueriestime: 0.00110936164856', '127.0.0.1'), +(71, 1228844705, 'admin', 'NOTICE', 'runtime: 0.395545959473; totalqueries: 6; totalqueriestime: 0.00116276741028', '127.0.0.1'), +(72, 1228844717, 'admin', 'NOTICE', 'runtime: 0.314126968384; totalqueries: 6; totalqueriestime: 0.00121402740479', '127.0.0.1'), +(73, 1228844720, 'admin', 'NOTICE', 'runtime: 0.27409696579; totalqueries: 6; totalqueriestime: 0.00108957290649', '127.0.0.1'), +(74, 1228844724, 'admin', 'NOTICE', 'runtime: 0.29937005043; totalqueries: 6; totalqueriestime: 0.00117301940918', '127.0.0.1'), +(75, 1228849580, 'admin', 'NOTICE', 'runtime: 0.350373983383; totalqueries: 6; totalqueriestime: 0.00121092796326', '127.0.0.1'), +(76, 1228849582, 'admin', 'NOTICE', 'runtime: 0.32250213623; totalqueries: 6; totalqueriestime: 0.00111365318298', '127.0.0.1'), +(77, 1228849585, 'admin', 'NOTICE', 'runtime: 0.283563137054; totalqueries: 6; totalqueriestime: 0.00141477584839', '127.0.0.1'), +(78, 1228849587, 'admin', 'NOTICE', 'runtime: 1.00412106514; totalqueries: 6; totalqueriestime: 0.00116395950317', '127.0.0.1'), +(79, 1228849587, 'admin', 'NOTICE', 'runtime: 1.16452503204; totalqueries: 6; totalqueriestime: 0.000949621200562', '127.0.0.1'), +(80, 1228849594, 'admin', 'NOTICE', 'runtime: 0.435815095901; totalqueries: 7; totalqueriestime: 0.00116896629333', '127.0.0.1'), +(81, 1228849677, 'admin', 'NOTICE', 'runtime: 0.318450927734; totalqueries: 6; totalqueriestime: 0.00130677223206', '127.0.0.1'), +(82, 1228849750, 'admin', 'NOTICE', 'runtime: 0.407657146454; totalqueries: 7; totalqueriestime: 0.00122785568237', '127.0.0.1'), +(83, 1228849778, 'admin', 'NOTICE', 'runtime: 0.414417028427; totalqueries: 7; totalqueriestime: 0.00116395950317', '127.0.0.1'), +(84, 1228849789, 'admin', 'NOTICE', 'runtime: 0.319971084595; totalqueries: 6; totalqueriestime: 0.00115609169006', '127.0.0.1'), +(85, 1228849961, 'admin', 'NOTICE', 'runtime: 0.32728600502; totalqueries: 6; totalqueriestime: 0.00110483169556', '127.0.0.1'), +(86, 1228850462, 'admin', 'NOTICE', 'runtime: 0.33651804924; totalqueries: 6; totalqueriestime: 0.00116801261902', '127.0.0.1'), +(87, 1228850649, 'admin', 'NOTICE', 'runtime: 0.328559160233; totalqueries: 6; totalqueriestime: 0.00132656097412', '127.0.0.1'), +(88, 1228850917, 'admin', 'NOTICE', 'runtime: 0.306250095367; totalqueries: 6; totalqueriestime: 0.00110626220703', '127.0.0.1'), +(89, 1228857665, 'admin', 'NOTICE', 'runtime: 1.30937600136; totalqueries: 6; totalqueriestime: 0.00122904777527', '127.0.0.1'), +(90, 1228857669, 'admin', 'NOTICE', 'runtime: 0.324778079987; totalqueries: 6; totalqueriestime: 0.00106501579285', '127.0.0.1'), +(91, 1228922920, 'guest', 'NOTICE', 'runtime: 4.43998098373; totalqueries: 5; totalqueriestime: 0.0010986328125', '127.0.0.1'), +(92, 1228927133, 'guest', 'ERR', 'Type:EXCEPTION_NO_ACTION\nTrace:#0 D:\\server\\library\\Zend\\Controller\\Plugin\\Broker.php(309): Ostacium_Controller_Plugin_ErrorHandler->preDispatch(Object(Ostacium_Controller_Request_Http))\n#1 D:\\server\\library\\Zend\\Controller\\Front.php(921): Zend_Controller_Plugin_Broker->preDispatch(Object(Ostacium_Controller_Request_Http))\n#2 D:\\server\\library\\Application.php(51): Zend_Controller_Front->dispatch()\n#3 D:\\server\\httpdocs\\index.php(13): Application->bootstrap()\n#4 {main}', '127.0.0.1'), +(93, 1228927133, 'guest', 'NOTICE', 'runtime: 0.472977161407; totalqueries: 6; totalqueriestime: 0.00107407569885', '127.0.0.1'), +(94, 1228927141, 'guest', 'NOTICE', 'runtime: 0.385906934738; totalqueries: 5; totalqueriestime: 0.000811100006104', '127.0.0.1'), +(95, 1228927146, 'guest', 'NOTICE', 'runtime: 0.364606142044; totalqueries: 5; totalqueriestime: 0.000753879547119', '127.0.0.1'), +(96, 1228927151, 'guest', 'ERR', 'Type:EXCEPTION_NO_ACTION\nTrace:#0 D:\\server\\library\\Zend\\Controller\\Plugin\\Broker.php(309): Ostacium_Controller_Plugin_ErrorHandler->preDispatch(Object(Ostacium_Controller_Request_Http))\n#1 D:\\server\\library\\Zend\\Controller\\Front.php(921): Zend_Controller_Plugin_Broker->preDispatch(Object(Ostacium_Controller_Request_Http))\n#2 D:\\server\\library\\Application.php(51): Zend_Controller_Front->dispatch()\n#3 D:\\server\\httpdocs\\index.php(13): Application->bootstrap()\n#4 {main}', '127.0.0.1'), +(97, 1228927151, 'guest', 'NOTICE', 'runtime: 0.259967088699; totalqueries: 6; totalqueriestime: 0.000933170318604', '127.0.0.1'), +(98, 1228927190, 'guest', 'NOTICE', 'runtime: 0.358453035355; totalqueries: 5; totalqueriestime: 0.000750780105591', '127.0.0.1'), +(99, 1228927196, 'panza', 'NOTICE', 'runtime: 0.361056089401; totalqueries: 5; totalqueriestime: 0.00078010559082', '127.0.0.1'), +(100, 1228927202, 'panza', 'NOTICE', 'runtime: 0.644073009491; totalqueries: 6; totalqueriestime: 0.0622811317444', '127.0.0.1'), +(101, 1228927206, 'panza', 'NOTICE', 'runtime: 0.314320087433; totalqueries: 6; totalqueriestime: 0.00124430656433', '127.0.0.1'), +(102, 1228927213, 'panza', 'NOTICE', 'runtime: 0.276901006699; totalqueries: 6; totalqueriestime: 0.00113844871521', '127.0.0.1'), +(103, 1228927238, 'panza', 'NOTICE', 'runtime: 0.278286933899; totalqueries: 6; totalqueriestime: 0.00106000900269', '127.0.0.1'), +(104, 1228928996, 'panza', 'NOTICE', 'runtime: 0.269110202789; totalqueries: 7; totalqueriestime: 0.00115633010864', '127.0.0.1'); -- -------------------------------------------------------- @@ -614,6 +777,7 @@ (1, 5), (1, 6), (1, 8), +(2, 9), (4, 7); -- -------------------------------------------------------- @@ -627,7 +791,7 @@ `controller` varchar(50) NOT NULL, `action` varchar(50) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=9 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=10 ; -- -- Dumping data for table `resources` @@ -641,7 +805,8 @@ (5, 'acm:index', '*'), (6, 'acm:archieve', '*'), (7, 'acm:tester', '*'), -(8, 'acm:user', '*'); +(8, 'acm:user', '*'), +(9, 'acm:contest', '*'); -- -------------------------------------------------------- @@ -686,6 +851,76 @@ -- -------------------------------------------------------- -- +-- Table structure for table `submits` +-- + +CREATE TABLE IF NOT EXISTS `submits` ( + `id` int(11) NOT NULL auto_increment, + `contestid` int(11) NOT NULL default '0', + `username` varchar(50) NOT NULL, + `challengeid` int(11) NOT NULL, + `codelangid` int(11) NOT NULL, + `state` int(11) NOT NULL default '0', + `tests` int(11) NOT NULL default '0', + `firsttest` tinyint(1) NOT NULL, + `runtime` double NOT NULL default '0', + `memory` int(11) NOT NULL default '0', + `when` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=10 ; + +-- +-- Dumping data for table `submits` +-- + +INSERT INTO `submits` (`id`, `contestid`, `username`, `challengeid`, `codelangid`, `state`, `tests`, `firsttest`, `runtime`, `memory`, `when`) VALUES +(3, 0, 'tester', 1000, 1, 1, 100, 0, 1002, 1001, 1228664380), +(5, 0, 'panza', 1000, 1, 1, 100, 1, 1000, 1000, 1228685834), +(6, 1, 'admin', 1000, 1, 0, 0, 0, 0, 0, 1228771484), +(9, 1, 'admin', 1000, 1, 0, 0, 0, 0, 0, 1228849778); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `teams` +-- + +CREATE TABLE IF NOT EXISTS `teams` ( + `id` int(11) NOT NULL, + `name` varchar(100) NOT NULL, + `captain` varchar(50) NOT NULL, + `trainer` varchar(100) NOT NULL, + `contests` int(11) NOT NULL, + `tries` int(11) NOT NULL, + `accepted` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `teams` +-- + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `teams_members` +-- + +CREATE TABLE IF NOT EXISTS `teams_members` ( + `teamid` int(11) NOT NULL, + `username` varchar(50) NOT NULL, + PRIMARY KEY (`teamid`,`username`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `teams_members` +-- + + +-- -------------------------------------------------------- + +-- -- Table structure for table `users` -- @@ -710,7 +945,7 @@ INSERT INTO `users` (`username`, `password`, `email`, `registered`, `online`, `posts`, `roleid`, `activated`, `banned`, `ip`) VALUES ('admin', 'e2a7106f1cc8bb1e1318df70aa0a3540', 'ad...@os...', 1223066421, 1223066447, 0, 2, NULL, 0, '192.168.1.7'), -('tester', 'e2a7106f1cc8bb1e1318df70aa0a3540', 'te...@os...', 1228663658, 0, 0, 4, NULL, 0, ''), +('tester', 'e2a7106f1cc8bb1e1318df70aa0a3540', 'te...@os...', 1228663658, 1228927008, 0, 4, NULL, 0, ''), ('panza', 'e2a7106f1cc8bb1e1318df70aa0a3540', 'pa...@os...', 1228684723, 1228684723, 0, 2, NULL, 0, '127.0.0.1'); -- -------------------------------------------------------- @@ -723,7 +958,7 @@ `username` varchar(50) NOT NULL, `name` varchar(50) NOT NULL, `surname` varchar(50) NOT NULL, - `study` varchar(50) NOT NULL, + `study` varchar(50) default NULL, `birthday` int(11) NOT NULL, `aim` varchar(50) default NULL, `icq` varchar(50) default NULL, @@ -747,8 +982,8 @@ INSERT INTO `usersdetails` (`username`, `name`, `surname`, `study`, `birthday`, `aim`, `icq`, `msn`, `skype`, `yahoo`, `web`, `topcoder`, `timus`, `timeoffset`, `codelangid`, `language`, `tshirtsize`, `hideemail`) VALUES ('admin', 'Igor', 'Petrovich', 'LNU PMI-21', 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '+2', 1, 'en', 'small', 0), -('tester', 'Tester', 'Tester', '', 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', 1, 'en', '', 1), -('panza', 'Igor', 'Petrovich', 'LNU', 1988, '', '', 'pan...@ho...', '', '', 'http://www.panzaboi.com/', '', '', '+2', 1, 'uk', 'L', 0); +('tester', 'Tester', 'Tester', NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', 1, 'en', '', 1), +('panza', 'Igor', 'Petrovich', 'LNU', 1988, NULL, NULL, 'pan...@ho...', NULL, NULL, 'http://www.panzaboi.com/', NULL, NULL, '+2', 1, 'uk', 'L', 0); -- -------------------------------------------------------- @@ -760,6 +995,8 @@ `username` varchar(50) NOT NULL, `archieve_tries` int(11) NOT NULL default '0', `archieve_accepts` int(11) NOT NULL default '0', + `contest_tries` int(11) NOT NULL default '0', + `contest_accepts` int(11) NOT NULL default '0', PRIMARY KEY (`username`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; @@ -767,7 +1004,7 @@ -- Dumping data for table `usersstats` -- -INSERT INTO `usersstats` (`username`, `archieve_tries`, `archieve_accepts`) VALUES -('admin', 0, 0), -('tester', 0, 0), -('panza', 0, 0); +INSERT INTO `usersstats` (`username`, `archieve_tries`, `archieve_accepts`, `contest_tries`, `contest_accepts`) VALUES +('admin', 0, 0, 0, 0), +('tester', 0, 0, 0, 0), +('panza', 0, 0, 0, 0); Added: website/other/submits/6 =================================================================== --- website/other/submits/6 (rev 0) +++ website/other/submits/6 2008-12-10 17:34:11 UTC (rev 442) @@ -0,0 +1,33 @@ +#include "fuel.h" +#include <algorithm> + +void saveHighest(vector<Fuel>& v) +{ + Fuel::FUELTYPE current = Fuel::FUELTYPE::LOW; + fstream f("out.txt"); + + f << *(v.begin()) << endl; + + for (vector<Fuel>::iterator i = v.begin(); i != v.end(); i++) + { + if ((*i).getType() != current) + { + current = (*i).getType(); + f << (*i) << endl; + } + } +} + +int main() +{ + vector<Fuel> v; + fstream f("in.txt"); + + f >> v; + + sort(v.begin(), v.end()); + + saveHighest(v); + + return 0; +} \ No newline at end of file Added: website/other/submits/7 =================================================================== --- website/other/submits/7 (rev 0) +++ website/other/submits/7 2008-12-10 17:34:11 UTC (rev 442) @@ -0,0 +1,33 @@ +#include "fuel.h" +#include <algorithm> + +void saveHighest(vector<Fuel>& v) +{ + Fuel::FUELTYPE current = Fuel::FUELTYPE::LOW; + fstream f("out.txt"); + + f << *(v.begin()) << endl; + + for (vector<Fuel>::iterator i = v.begin(); i != v.end(); i++) + { + if ((*i).getType() != current) + { + current = (*i).getType(); + f << (*i) << endl; + } + } +} + +int main() +{ + vector<Fuel> v; + fstream f("in.txt"); + + f >> v; + + sort(v.begin(), v.end()); + + saveHighest(v); + + return 0; +} \ No newline at end of file Added: website/other/submits/8 =================================================================== --- website/other/submits/8 (rev 0) +++ website/other/submits/8 2008-12-10 17:34:11 UTC (rev 442) @@ -0,0 +1,33 @@ +#include "fuel.h" +#include <algorithm> + +void saveHighest(vector<Fuel>& v) +{ + Fuel::FUELTYPE current = Fuel::FUELTYPE::LOW; + fstream f("out.txt"); + + f << *(v.begin()) << endl; + + for (vector<Fuel>::iterator i = v.begin(); i != v.end(); i++) + { + if ((*i).getType() != current) + { + current = (*i).getType(); + f << (*i) << endl; + } + } +} + +int main() +{ + vector<Fuel> v; + fstream f("in.txt"); + + f >> v; + + sort(v.begin(), v.end()); + + saveHighest(v); + + return 0; +} \ No newline at end of file Added: website/other/submits/9 =================================================================== --- website/other/submits/9 (rev 0) +++ website/other/submits/9 2008-12-10 17:34:11 UTC (rev 442) @@ -0,0 +1,33 @@ +#include "fuel.h" +#include <algorithm> + +void saveHighest(vector<Fuel>& v) +{ + Fuel::FUELTYPE current = Fuel::FUELTYPE::LOW; + fstream f("out.txt"); + + f << *(v.begin()) << endl; + + for (vector<Fuel>::iterator i = v.begin(); i != v.end(); i++) + { + if ((*i).getType() != current) + { + current = (*i).getType(); + f << (*i) << endl; + } + } +} + +int main() +{ + vector<Fuel> v; + fstream f("in.txt"); + + f >> v; + + sort(v.begin(), v.end()); + + saveHighest(v); + + return 0; +} \ No newline at end of file Modified: website/other/todo.txt =================================================================== --- website/other/todo.txt 2008-12-10 00:41:43 UTC (rev 441) +++ website/other/todo.txt 2008-12-10 17:34:11 UTC (rev 442) @@ -1,3 +1,7 @@ +1. Virtual Contests +2. Teams +3. Team Contests +------------------------------------------------ +/-1. Add Zend_Log, write - undecided, FILE? DB? 2. Design Change 3. Ostacium_CrudAction redesign @@ -5,7 +9,7 @@ 5. Front_Controller => catch Exception => go to Error Controller 6. Caching for DB, VIEW, etc. -7. Table Prefix - відложено -8. Custom Admin Email ++8. Custom From Email 9. Add mb_ support to everything 10!. _authenticateCreateSelect - quote the reference! how? 11. Extend Profiler - getLongestQuery \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pan...@us...> - 2009-01-31 18:14:19
|
Revision: 464 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=464&view=rev Author: panzaboi Date: 2009-01-31 18:14:16 +0000 (Sat, 31 Jan 2009) Log Message: ----------- 1) New layout 2) Spell error corrected - archieve to archive 3) Updated language files 4) Removed unneeded Ostacium library files (DB_Field, DB_Table_Rowset) 5) Added Prettify to highlight C++ Code 6) Added configurations to config.ini 7) Added Admin Modified Paths: -------------- website/application/layouts/layout.phtml website/application/modules/acm/views/scripts/contest/index.phtml website/application/modules/acm/views/scripts/contest/results.phtml website/application/modules/acm/views/scripts/index/index.phtml website/application/modules/acm/views/scripts/tester/entry.phtml website/config/config.ini website/httpdocs/scripts/main.js website/httpdocs/styles/style.css website/lang/en.csv website/lang/uk.csv Added Paths: ----------- website/application/layouts/old_layout.phtml website/application/modules/acm/controllers/ArchiveController.php website/application/modules/acm/models/Archive.php website/application/modules/acm/views/scripts/contest/notincontest.phtml website/application/modules/acm/views/scripts/logedin.phtml website/application/modules/acm/views/scripts/paginator.phtml website/application/modules/acm/views/scripts/user/view.phtml website/application/modules/admin/ website/application/modules/admin/views/ website/application/modules/admin/views/helpers/ website/application/modules/admin/views/scripts/ website/application/modules/admin/views/scripts/crud/ website/application/modules/admin/views/scripts/crud/list.phtml website/application/modules/admin/views/scripts/paginator.phtml website/httpdocs/images/acm/ website/httpdocs/images/acm/status.png website/httpdocs/images/acm/submit.png website/httpdocs/images/box_header.jpg website/httpdocs/images/header_bg.gif website/httpdocs/images/leftmenu.gif website/httpdocs/images/leftmenu_bg.jpg website/httpdocs/images/logo.png website/httpdocs/images/noavatar.png website/httpdocs/images/topmenu_bg.gif website/httpdocs/scripts/prettify.js website/httpdocs/styles/prettify.css website/httpdocs/styles/style_.css Removed Paths: ------------- website/application/modules/acm/controllers/ArchieveController.php website/httpdocs/images/0.gif website/httpdocs/images/arrow.gif website/httpdocs/images/arrow2.gif website/httpdocs/images/b_find.gif website/httpdocs/images/bg_menu.gif website/httpdocs/images/blok.png website/httpdocs/images/del.png website/httpdocs/images/disable.png website/httpdocs/images/enable.png website/httpdocs/images/fromarhive.jpg website/httpdocs/images/hide.jpg website/httpdocs/images/logo.gif website/httpdocs/images/logod.gif website/httpdocs/images/mail.jpg website/httpdocs/images/menu.gif website/httpdocs/images/menu_.gif website/httpdocs/images/pic1.jpg website/httpdocs/images/pixel.gif website/httpdocs/images/probstatus.png website/httpdocs/images/props.png website/httpdocs/images/reset.png website/httpdocs/images/rpic.gif website/httpdocs/images/show.jpg website/httpdocs/images/toarhive.jpg website/httpdocs/images/trash.gif website/httpdocs/images/unblok.png website/httpdocs/images/view.png website/httpdocs/images/visible.jpg website/httpdocs/styles/ie6.css website/library/Ostacium/Db/Field.php website/library/Ostacium/Db/Table/Rowset.php Property Changed: ---------------- website/httpdocs/images/ Modified: website/application/layouts/layout.phtml =================================================================== --- website/application/layouts/layout.phtml 2009-01-31 18:11:05 UTC (rev 463) +++ website/application/layouts/layout.phtml 2009-01-31 18:14:16 UTC (rev 464) @@ -1,87 +1,135 @@ -<?= $this->doctype() ?> -<? $this->dojo()->enable() - ->setDjConfigOption('parseOnLoad', true) - ->registerModulePath('custom', '../custom/') - ->requireModule('dijit.form.FilteringSelect') ?> -<html> - <head> - <base href="<?= 'http://' . $_SERVER["HTTP_HOST"] . $this->baseUrl() ?>/" /> - <?= $this->headTitle($this->placeholder('title')->toString()) ?> - <?= $this->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8') ?> - - <?= $this->headLink()->appendStylesheet('styles/style.css') ?> - <?= /*$this->headLink()->appendStylesheet('styles/ie6.css', 'screen', 'IE 6')*/'' ?> - <?= /*$this->headLink()->appendStylesheet('styles/ie7.css', 'screen', 'IE 7')*/'' ?> - <?= $this->headScript()->appendFile('/scripts/main.js') ?> - - <? if ($this->dojo()->isEnabled()): - $this->dojo()->setLocalPath('/scripts/dojo/dojo.js') - ->addStyleSheetModule('dijit.themes.tundra'); - - echo $this->dojo(); - endif; ?> - </head> - <body class="tundra"> - <table border="0" cellpadding="0" cellspacing="0" width="100%"> - <tr bgcolor="#122a5b"> - <td><img height="43" src="images/logo.gif" width="490"></td> - </tr> - <tr bgcolor="#e1e1e1"> - <td><img height=26 src="images/logod.gif" width="490"></td> - </tr> - <tr> - <td bgcolor=#122a5b colspan=2><img height=2 src="images/0.gif" width=1></td> - </tr> - </table> - <table border=0 cellpadding=0 cellspacing=0 width="100%" summary="" height="20%"> - <tr> - <td bgcolor=#e1e1e1 valign=top width="200"> - <table width="100%" border="0" cellpadding="0" cellspacing="5"> - <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="index/about">Що це за проект</a></td></tr> - <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="index/rule">Правила</a></td></tr> - <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="/acm/archieve/index">Набір завдань</a></td></tr> - <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="/acm/archieve/submit">Протестувати Розв'язок</a></td></tr> - <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="/acm/archieve/results">Результати Тестувань</a></td></tr> - <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="/acm/archieve/ranks">Рейтинг Учасників</a></td></tr> - <tr><td><hr></td></tr> - </table> - - <table border=0 cellpadding=4 cellspacing=0 width="100%" summary=""> - <tr><td align=middle bgcolor=#122a5b><font color=#d4d0e2><b><small>вхід</small></b></font></td></tr> - <tr><td> - <form onsubmit="return checkform(this);" method="post" action="login.php?rid=45fed5d9b297f" style="margin:0"> - <input type="hidden" name="path" value="/"> - <table border=0 cellPadding=1 cellSpacing=0 summary="" width=100%> - <tr> - <td class=name nowrap><small><font color=#122a5b> логін:</font></small></td> - <td><input name=lgn style="height: 18px; width: 100px"></td> - <td> </td> - </tr> - <tr> - <td class=name nowrap><small><font color=#122a5b> пароль:</font></small></td> - <td><input name=pswd type=password style="height: 18px; width: 100px"></td> - <td><input name="login" src="images/b_find.gif" type="image"> - </tr> - </table> - </form> - -<CENTER><A href="register.php">Зареєструватись</a><BR><a href=createteam.php>Створити команду</a></CENTER> -</TABLE><TABLE border=0 cellPadding=4 cellSpacing=0 width="100%"> -<TR><TD align=middle bgColor=#122a5b> -<FONT color=#d4d0e2><B><SMALL>F.A.Q.</SMALL></B></FONT> -<TR><TD><TABLE border=0 cellPadding=0 cellSpacing=2 width="100%"><TR><TD><P>Мені здається що програма написана правильно, але система видає "Помилка під час виконання"... -<P>Якщо Ви використовуєте С++, і описали функцію void main(){...} - навіть якщо програма видасть -правильний результат, то система видасть "помилка під час виконання". Це пов'язано з тим, що -в такому випадку код завершення програми непердбачуваний, і практично ніколи небуває нульовим. -<BR>Для того, щоб програму Вам зарахувало (якщо все правильно), необхідно описувати основну -функцію як int main(){...} і обов'язково завершувати програму через return 0. -<TR><TD align=right><P><SMALL><A href="allfaq.php">[ Всі питання ]</p></SMALL></TABLE><TR><TD align=middle bgColor=#122a5b> -<FONT color=#d4d0e2> </FONT> -<TR><TD><TABLE border=0 cellPadding=0 cellSpacing=2 width="100%"><TR><TD align=center> - -</TABLE></TABLE><TD bgColor=#f4f3f8 vAlign=top height=100%><?= $this->placeholder('message') ?><br /><?= $this->layout()->content ?></table></table> -<TABLE> -<TR vAlign=Bottom><TABLE border=0 cellPadding=0 cellSpacing=0 width="100%" summary=""><TR bgColor=#122a5b><TD colSpan=3><IMG alt="" height=5 src="images/pixel.gif" width=1><TR bgColor=#122a5b><TD class=copyright>© 2004-2005, <a class=copyrightlink href="mailto: ac...@ia..."><B><FONT COLOR="#d1d1d1">A-S</FONT>tudio</B></A><TD align=middle><TD align=right class=copyright><A class=copyrightlink href="http://www.acm.lviv.ua">ACM Контестер</A><TR bgColor=#122a5b><TD colSpan=3><IMG alt="" height=5 src="images/pixel.gif" width=1></TABLE> - <?= $this->debugInfo(true) ?> - </body> +<?php +$loggedin = Zend_Auth::getInstance()->getIdentity(); + +if ($loggedin) +{ + $form = $this->partial('logedin.phtml'); +} +elseif (!$this->dojo()->hasDijit('loginform')) +{ + $form = (new Form_SmallLogin()); + $form = $form->render(); +} +else $form = ''; +?> + +<?= $this->doctype() ?> +<? $this->dojo()->enable() + ->setDjConfigOption('parseOnLoad', true) + ->registerModulePath('custom', '../custom/') + ->requireModule('dijit.form.FilteringSelect') + ->addOnLoad('init'); +?> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <meta name="description" content="Site description" /> + <meta name="keywords" content="key, words" /> + + <?= $this->headTitle($this->placeholder('title')->toString()) ?> + <?= $this->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8') ?> + <?= $this->headLink()->appendStylesheet('/styles/style.css') ?> + <?= $this->headLink()->appendStylesheet('/styles/prettify.css') ?> + <?= $this->headScript()->appendFile('/scripts/main.js') ?> + <?= $this->headScript()->appendFile('/scripts/prettify.js') ?> + + <? + if ($this->dojo()->isEnabled()): + $this->dojo()->setLocalPath('/scripts/dojo/dojo.js') + ->addStyleSheetModule('dijit.themes.tundra'); + + echo $this->dojo(); + endif; + ?> + + <base href="<?= 'http://' . $_SERVER["HTTP_HOST"] . $this->baseUrl() ?>/" /> +</head> + +<body class="tundra"> + <div id="wrapper"> + <div id="header"> + <a href="<?= $this->url(array('module' => 'acm'), null, true) ?>"><img src="images/logo.png" id="logo" /></a> + + <div id="topmenu"> + <ul> + <li><a href="#" class="current">home</a></li> + <li><a href="#">news</a></li> + <li><a href="#">forum</a></li> + <li><a href="#">links</a></li> + <li><a href="#">search</a></li> + <li><a href="#">contacts</a></li> + </ul> + </div> + </div> + + <div id="container"> + <div id="right"> + <div id="content"> + <?= ($this->placeholder('message') ? $this->placeholder('message') : '') ?> + <?= $this->layout()->content ?> + </div> + </div> + + <div id="left"> + <ul id="nav"> + <li> + <a href="#" onclick="return toggle('sub1');">Архів</a> + <ul id="sub1"> + <li><a href="<?= $this->url(array('module' => 'acm', 'controller' => 'archive'), null, true) ?>">Набір Завдань</a></li> + <li><a href="<?= $this->url(array('module' => 'acm', 'controller' => 'archive', 'action' => 'results'), null, true) ?>">Результати</a></li> + </ul> + </li> + <li> + <a href="#Archieve" onclick="return toggle('sub2');">Контести</a> + <ul id="sub2"> + <li><a href="<?= $this->url(array('module' => 'acm', 'controller' => 'contest', 'action' => 'index'), null, true) ?>">Зареєструватись</a></li> + <li><a href="#Problems">Набір Завдань</a></li> + <li><a href="#Results">Результати</a></li> + </ul> + </li> + <li> + <a href="#Archieve" onclick="return toggle('sub3');">Віртуальні Контести</a> + <ul id="sub3"> + <li><a href="#Problems">Створити</a></li> + <li><a href="#Problems">Зареєструватись</a></li> + <li><a href="#Problems">Набір Завдань</a></li> + <li><a href="#Results">Результати</a></li> + </ul> + </li> + <li><a href="#contact">Contact</a></li> + </ul> + + <!--<div class="box2 c"> + <form name="login" action="" method="post" class="form"> + <div class="line"> + <label for="username" class="label">Username:</label> + <input class="text" type="text" name="username" title="Username" value="" tabindex="1" /> + </div> + <div class="line"> + <label for="password" class="label">Password:</label> + <input class="text" type="password" name="password" title="Password" value="" tabindex="2" /> + + <input class="submit2" type="submit" name="submit" value=">" tabindex="3" /> + </div> + </form> + </div>--> + + <?= $form ?> + + <!--<div id="clear"></div>--> + </div> + </div> + + <div id="clear"></div> + + + </div> + + <div id="footer"> + <p> + Copyright 2009 ACM. Designed by <a href="#" rel="external">panza</a>. Valid <a href="http://jigsaw.w3.org/css-validator/check/referer" rel="external">CSS</a> & <a href="http://validator.w3.org/check?uri=referer" rel="external">XHTML</a> + <br /> + <!--<?= $this->debugInfo(true) ?>--> + </p> + </div> +</body> </html> \ No newline at end of file Added: website/application/layouts/old_layout.phtml =================================================================== --- website/application/layouts/old_layout.phtml (rev 0) +++ website/application/layouts/old_layout.phtml 2009-01-31 18:14:16 UTC (rev 464) @@ -0,0 +1,87 @@ +<?= $this->doctype() ?> +<? $this->dojo()->enable() + ->setDjConfigOption('parseOnLoad', true) + ->registerModulePath('custom', '../custom/') + ->requireModule('dijit.form.FilteringSelect') ?> +<html> + <head> + <base href="<?= 'http://' . $_SERVER["HTTP_HOST"] . $this->baseUrl() ?>/" /> + <?= $this->headTitle($this->placeholder('title')->toString()) ?> + <?= $this->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8') ?> + + <?= $this->headLink()->appendStylesheet('styles/style.css') ?> + <?= /*$this->headLink()->appendStylesheet('styles/ie6.css', 'screen', 'IE 6')*/'' ?> + <?= /*$this->headLink()->appendStylesheet('styles/ie7.css', 'screen', 'IE 7')*/'' ?> + <?= $this->headScript()->appendFile('/scripts/main.js') ?> + + <? if ($this->dojo()->isEnabled()): + $this->dojo()->setLocalPath('/scripts/dojo/dojo.js') + ->addStyleSheetModule('dijit.themes.tundra'); + + echo $this->dojo(); + endif; ?> + </head> + <body class="tundra"> + <table border="0" cellpadding="0" cellspacing="0" width="100%"> + <tr bgcolor="#122a5b"> + <td><img height="43" src="images/logo.gif" width="490"></td> + </tr> + <tr bgcolor="#e1e1e1"> + <td><img height=26 src="images/logod.gif" width="490"></td> + </tr> + <tr> + <td bgcolor=#122a5b colspan=2><img height=2 src="images/0.gif" width=1></td> + </tr> + </table> + <table border=0 cellpadding=0 cellspacing=0 width="100%" summary="" height="20%"> + <tr> + <td bgcolor=#e1e1e1 valign=top width="200"> + <table width="100%" border="0" cellpadding="0" cellspacing="5"> + <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="index/about">Що це за проект</a></td></tr> + <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="index/rule">Правила</a></td></tr> + <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="/acm/archive/index">Набір завдань</a></td></tr> + <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="/acm/archive/submit">Протестувати Розв'язок</a></td></tr> + <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="/acm/archive/results">Результати Тестувань</a></td></tr> + <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="/acm/archive/ranks">Рейтинг Учасників</a></td></tr> + <tr><td><hr></td></tr> + </table> + + <table border=0 cellpadding=4 cellspacing=0 width="100%" summary=""> + <tr><td align=middle bgcolor=#122a5b><font color=#d4d0e2><b><small>вхід</small></b></font></td></tr> + <tr><td> + <form onsubmit="return checkform(this);" method="post" action="login.php?rid=45fed5d9b297f" style="margin:0"> + <input type="hidden" name="path" value="/"> + <table border=0 cellPadding=1 cellSpacing=0 summary="" width=100%> + <tr> + <td class=name nowrap><small><font color=#122a5b> логін:</font></small></td> + <td><input name=lgn style="height: 18px; width: 100px"></td> + <td> </td> + </tr> + <tr> + <td class=name nowrap><small><font color=#122a5b> пароль:</font></small></td> + <td><input name=pswd type=password style="height: 18px; width: 100px"></td> + <td><input name="login" src="images/b_find.gif" type="image"> + </tr> + </table> + </form> + +<CENTER><A href="register.php">Зареєструватись</a><BR><a href=createteam.php>Створити команду</a></CENTER> +</TABLE><TABLE border=0 cellPadding=4 cellSpacing=0 width="100%"> +<TR><TD align=middle bgColor=#122a5b> +<FONT color=#d4d0e2><B><SMALL>F.A.Q.</SMALL></B></FONT> +<TR><TD><TABLE border=0 cellPadding=0 cellSpacing=2 width="100%"><TR><TD><P>Мені здається що програма написана правильно, але система видає "Помилка під час виконання"... +<P>Якщо Ви використовуєте С++, і описали функцію void main(){...} - навіть якщо програма видасть +правильний результат, то система видасть "помилка під час виконання". Це пов'язано з тим, що +в такому випадку код завершення програми непердбачуваний, і практично ніколи небуває нульовим. +<BR>Для того, щоб програму Вам зарахувало (якщо все правильно), необхідно описувати основну +функцію як int main(){...} і обов'язково завершувати програму через return 0. +<TR><TD align=right><P><SMALL><A href="allfaq.php">[ Всі питання ]</p></SMALL></TABLE><TR><TD align=middle bgColor=#122a5b> +<FONT color=#d4d0e2> </FONT> +<TR><TD><TABLE border=0 cellPadding=0 cellSpacing=2 width="100%"><TR><TD align=center> + +</TABLE></TABLE><TD bgColor=#f4f3f8 vAlign=top height=100%><?= $this->placeholder('message') ?><br /><?= $this->layout()->content ?></table></table> +<TABLE> +<TR vAlign=Bottom><TABLE border=0 cellPadding=0 cellSpacing=0 width="100%" summary=""><TR bgColor=#122a5b><TD colSpan=3><IMG alt="" height=5 src="images/pixel.gif" width=1><TR bgColor=#122a5b><TD class=copyright>© 2004-2005, <a class=copyrightlink href="mailto: ac...@ia..."><B><FONT COLOR="#d1d1d1">A-S</FONT>tudio</B></A><TD align=middle><TD align=right class=copyright><A class=copyrightlink href="http://www.acm.lviv.ua">ACM Контестер</A><TR bgColor=#122a5b><TD colSpan=3><IMG alt="" height=5 src="images/pixel.gif" width=1></TABLE> + <?= $this->debugInfo(true) ?> + </body> +</html> \ No newline at end of file Deleted: website/application/modules/acm/controllers/ArchieveController.php =================================================================== --- website/application/modules/acm/controllers/ArchieveController.php 2009-01-31 18:11:05 UTC (rev 463) +++ website/application/modules/acm/controllers/ArchieveController.php 2009-01-31 18:14:16 UTC (rev 464) @@ -1,87 +0,0 @@ -<?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->getChallenge($id); - - if (!$problem) - return $this->_forward('index', null, null, $this->_getAllParams() + array('message' => 'noProblem')); - - $this->view->assign($problem); - } - - public function submitAction() - { - $this->_helper->getHelper('viewRenderer')->setNoRender(true); - - $form = new Form_Submit(); - - $this->view->dojo()->addOnLoad('function(){ changeEditor('.$form->type->getValue().'); }'); - - echo $form; - } - - public function uploadAction() - { - $this->_helper->getHelper('viewRenderer')->setNoRender(true); - $form = new Form_Submit(); - - if (!$this->getRequest()->isPost()) - { - return $this->_forward('submit', null, null, $this->_getAllParams()); - } - - if ($_POST['type'] == 0) - { - $form->code->setRequired(true); - } - elseif ($_POST['type'] == 1) - { - $form->codefile->setRequired(true); - } - - $result = $form->isValid($this->getRequest()->getPost()); - $this->view->dojo()->addOnLoad('function(){ changeEditor('.$form->type->getValue().'); }'); - - if ($form->type->getValue() == 0) - { - $form->code->setRequired(false); - } - elseif ($form->type->getValue() == 1) - { - $form->codefile->setRequired(false); - } - - if (!$result) - { - echo $form; - return; - } - - $values = $form->getValues(); - $values += $this->_getAllParams(); - $id = $this->_model->addSubmit($values); - - if ($values['type'] == 0) - { - file_put_contents(Application::getDocRoot().'/other/submits/'.$id, $values['code']); - } - elseif ($values['type'] == 1) - { - rename($form->codefile->getFileName(), Application::getDocRoot().'/other/submits/'.$id); - } - } - - public function resultsAction() - { - $this->view->submits = $this->_model->getSubmits(); - } -} \ No newline at end of file Added: website/application/modules/acm/controllers/ArchiveController.php =================================================================== --- website/application/modules/acm/controllers/ArchiveController.php (rev 0) +++ website/application/modules/acm/controllers/ArchiveController.php 2009-01-31 18:14:16 UTC (rev 464) @@ -0,0 +1,126 @@ +<?php + +class Acm_ArchiveController extends Ostacium_Controller_Action +{ + public function indexAction() + { + $challenges = $this->_model->getChallenges(); + $paginator = Zend_Paginator::factory($challenges); + $paginator->setItemCountPerPage($this->_config->table->perpage); + $paginator->setCurrentPageNumber($this->_getParam('page')); + + $this->view->challenges = $paginator; + } + + public function viewAction() + { + $id = $this->_getParam('id'); + $problem = $this->_model->getChallenge($id); + + if (!$problem) + return $this->_forward('index', null, null, $this->_getAllParams() + array('message' => 'noProblem')); + + $this->view->assign($problem); + } + + public function sourceAction() + { + $id = $this->_getParam('id'); + $source = $this->_model->getSubmit($id); + + if (!$source) + return $this->_forward('index', null, null, $this->_getAllParams() + array('message' => 'noProblem')); + + $this->view->assign($source->toArray()); + } + + public function submitAction() + { + //$this->_helper->getHelper('viewRenderer')->setNoRender(true); + + if (!$this->_getParam('id')) + return $this->_redirect($this->view->url(array('action' => 'index'))); + + $form = new Form_Submit(); + $this->view->dojo()->addOnLoad('function(){ changeEditor('.$form->type->getValue().'); }'); + + $this->view->form = $form; + + //echo $form; + } + + public function uploadAction() + { + $this->_helper->getHelper('viewRenderer')->setNoRender(true); + $form = new Form_Submit(); + + if (!$this->getRequest()->isPost()) + { + return $this->_forward('submit', null, null, $this->_getAllParams()); + } + + if ($_POST['type'] == 0) + { + $form->code->setRequired(true); + } + elseif ($_POST['type'] == 1) + { + $form->codefile->setRequired(true); + } + + $result = $form->isValid($this->getRequest()->getPost()); + $this->view->dojo()->addOnLoad('function(){ changeEditor('.$form->type->getValue().'); }'); + + if ($form->type->getValue() == 0) + { + $form->code->setRequired(false); + } + elseif ($form->type->getValue() == 1) + { + $form->codefile->setRequired(false); + } + + if (!$result) + { + echo $form; + return; + } + + $values = $form->getValues(); + $values += $this->_getAllParams(); + $id = $this->_model->addSubmit($values); + + if ($values['type'] == 0) + { + file_put_contents(Application::getDocRoot().'/other/submits/'.$id, $values['code']); + } + elseif ($values['type'] == 1) + { + rename($form->codefile->getFileName(), Application::getDocRoot().'/other/submits/'.$id); + } + } + + public function resultsAction() + { + $submits = $this->_model->getSubmits(); + + $paginator = Zend_Paginator::factory($submits); + $paginator->setItemCountPerPage($this->_config->table->perpage); + $paginator->setCurrentPageNumber($this->_getParam('page')); + + $this->view->submits = $paginator; + } + + public function statusAction() + { + $this->_helper->getHelper('viewRenderer')->setNoRender(true); + $id = $this->_getParam('id'); + + $challenge = $this->_model->getStatus($id); + + if ($challenge) + $challenge = $challenge->toArray(); + + var_dump($challenge); + } +} \ No newline at end of file Added: website/application/modules/acm/models/Archive.php =================================================================== --- website/application/modules/acm/models/Archive.php (rev 0) +++ website/application/modules/acm/models/Archive.php 2009-01-31 18:14:16 UTC (rev 464) @@ -0,0 +1,92 @@ +<?php + +class Archive extends Ostacium_Model +{ + public function getChallenges() + { + $challenges = new Table_Challenges(); + return $challenges->getAll(); + } + + public function getSubmit($id) + { + $submits = new Table_Submits(); + return $submits->get($id); + } + + public function getSubmits() + { + $submits = new Table_Submits(); + return $submits->getAll(); + } + + public function getChallenge($id) + { + $challenges = new Table_Challenges(); + return $challenges->get($id); + } + + public function getStatus($id) + { + $username = Zend_Auth::getInstance()->getStorage()->read()->username; + + $archresults = new Table_ArchiveResults(); + return $archresults->get(array($username, $id)); + } + + public function addSubmit($values) + { + $data = array( + 'contestid' => 0, + 'username' => Zend_Auth::getInstance()->getStorage()->read()->username, + 'challengeid' => (int)$values['id'], + 'codelangid' => $values['languageid'], + 'firsttest' => $values['firsttest'], + 'when' => time() + ); + + $submits = new Table_Submits(); + return $submits->insert($data); + } + + public function updateResults($submit) + { + if ($submit['firsttest'] == 1) return; + + $results = new Table_ArchiveResults(); + $result = $results->get(array($submit['username'], $submit['challengeid'])); + + if ($result) + $result = $result->toArray(); + else + $result = array( + 'username' => $submit['username'], + 'challengeid' => $submit['challengeid'], + 'tries' => 0, + 'accepted' => 0 + ); + + if ($result['accepted']) + return false; + + $result['tries']++; + + if ($submit['state'] == 1) + $result['accepted'] = 1; + + if ($result['tries'] > 1) + { + $where = array( + $this->_db->quoteInto('username = ?', $result['username']), + $this->_db->quoteInto('challengeid = ?', $result['challengeid']), + ); + + $results->update($result, $where); + } + else + { + $results->insert($result); + } + + } +} \ No newline at end of file Modified: website/application/modules/acm/views/scripts/contest/index.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/index.phtml 2009-01-31 18:11:05 UTC (rev 463) +++ website/application/modules/acm/views/scripts/contest/index.phtml 2009-01-31 18:14:16 UTC (rev 464) @@ -1,10 +1,21 @@ -<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 width="60%" cellspacing="0" cellpadding="0" border="0" summary="" align="center"><tbody><tr><td bgcolor="#f4f3f8" align="middle" colspan="14"><b>Архів контестів</b></td></tr><tr bgcolor="#e1e1e1" align="middle"> -<th>Номер</th><th>Назва</th><th>Початок</th><th>Кінець</th><th>Зареєструватись</th></tr> -<?= $this->partialLoop('contest/contest.phtml', $this->contests) ?> -</table><br/></td></tr></table> \ No newline at end of file +<h2><?= $this->translate('contests_list') ?></h2> +<br /> +<table class="table"> + <tr> + <th>Номер</th> + <th>Назва</th> + <th>Початок</th> + <th>Кінець</th> + <th>Зареєструватись</th> + </tr> + <? if (count($this->contests)): ?> + <?= $this->partialLoop('contest/contest.phtml', $this->contests) ?> + <? else: ?> + <tr> + <td colspan="5" class="tc error"><?= $this->translate('no_results') ?></td> + </tr> + <? endif; ?> + <tr> + <td colspan="5" class="footer tc"><?= $this->contests ?></td> + </tr> +</table> \ No newline at end of file Added: website/application/modules/acm/views/scripts/contest/notincontest.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/notincontest.phtml (rev 0) +++ website/application/modules/acm/views/scripts/contest/notincontest.phtml 2009-01-31 18:14:16 UTC (rev 464) @@ -0,0 +1 @@ +You are not taking part in this contest \ No newline at end of file Modified: website/application/modules/acm/views/scripts/contest/results.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/results.phtml 2009-01-31 18:11:05 UTC (rev 463) +++ website/application/modules/acm/views/scripts/contest/results.phtml 2009-01-31 18:14:16 UTC (rev 464) @@ -27,7 +27,7 @@ <th>Час/Пам'ять</th> </tr> -<?= $this->partialLoop('archieve/result.phtml', $this->submits) ?> +<?= $this->partialLoop('ontest/result.phtml', $this->submits) ?> </table> </td></tr></table> \ No newline at end of file Modified: website/application/modules/acm/views/scripts/index/index.phtml =================================================================== --- website/application/modules/acm/views/scripts/index/index.phtml 2009-01-31 18:11:05 UTC (rev 463) +++ website/application/modules/acm/views/scripts/index/index.phtml 2009-01-31 18:14:16 UTC (rev 464) @@ -1,9 +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 + \ No newline at end of file Added: website/application/modules/acm/views/scripts/logedin.phtml =================================================================== --- website/application/modules/acm/views/scripts/logedin.phtml (rev 0) +++ website/application/modules/acm/views/scripts/logedin.phtml 2009-01-31 18:14:16 UTC (rev 464) @@ -0,0 +1,4 @@ +<div class="box2 c"> + <h2><?= $this->translate('user_menu') ?></h2> + <a href="<?= $this->url(array('module' => 'acm', 'controller' => 'index', 'action' => 'logout'), null, true) ?>"><?= $this->translate('log_out') ?></a> +</div> \ No newline at end of file Added: website/application/modules/acm/views/scripts/paginator.phtml =================================================================== --- website/application/modules/acm/views/scripts/paginator.phtml (rev 0) +++ website/application/modules/acm/views/scripts/paginator.phtml 2009-01-31 18:14:16 UTC (rev 464) @@ -0,0 +1,30 @@ +<?php if ($this->pageCount): ?> +<div class="paginationControl"> +<!-- Previous page link --> +<?php if (isset($this->previous)): ?> + <a href="<?= $this->url(array('page' => $this->previous)); ?>"> + < Previous + </a> | +<?php else: ?> + <span class="disabled">< Previous</span> | +<?php endif; ?> + +<!-- Numbered page links --> +<?php foreach ($this->pagesInRange as $page): ?> + <?php if ($page != $this->current): ?> + <a href="<?= $this->url(array('page' => $page)); ?>"><?= $page; ?></a> | + <?php else: ?> + <?= $page; ?> | + <?php endif; ?> +<?php endforeach; ?> + +<!-- Next page link --> +<?php if (isset($this->next)): ?> + <a href="<?= $this->url(array('page' => $this->next)); ?>"> + Next > + </a> +<?php else: ?> + <span class="disabled">Next ></span> +<?php endif; ?> +</div> +<?php endif; ?> \ No newline at end of file Modified: website/application/modules/acm/views/scripts/tester/entry.phtml =================================================================== --- website/application/modules/acm/views/scripts/tester/entry.phtml 2009-01-31 18:11:05 UTC (rev 463) +++ website/application/modules/acm/views/scripts/tester/entry.phtml 2009-01-31 18:14:16 UTC (rev 464) @@ -1,6 +1,6 @@ <submit> <id><?= $this->id ?></id> - <sourceCode><?= htmlentities(file_get_contents(Application::getDocRoot().'/other/submits/'.$this->id)) ?></sourceCode> + <sourceCode><?= htmlspecialchars(file_get_contents(Application::getDocRoot().'/other/submits/'.$this->id)) ?></sourceCode> <language><?= $this->codelangid ?></language> <problem><?= $this->challengeid ?></problem> </submit> \ No newline at end of file Added: website/application/modules/acm/views/scripts/user/view.phtml =================================================================== --- website/application/modules/acm/views/scripts/user/view.phtml (rev 0) +++ website/application/modules/acm/views/scripts/user/view.phtml 2009-01-31 18:14:16 UTC (rev 464) @@ -0,0 +1,62 @@ +<table class="user c"> + <tr> + <td style="border-right: none;"><?= $this->username ?></td> + <td style="border-left: none;" colspan="2" align="right"><?= $this->translate($this->role) ?></td> + </tr> + <tr> + <td rowspan="7" width="151" valign="top"> + <img src="images/noavatar.png" /> + </td> + <td class="b"><?= $this->translate('firstname') ?></td> + <td><?= $this->name ?></td> + </tr> + <tr> + <td class="b"><?= $this->translate('surname') ?></td> + <td><?= $this->surname ?></td> + </tr> + <tr> + <td class="b"><?= $this->translate('edu_place') ?></td> + <td><?= ($this->study ? $this->study : '<span class="na">'.$this->translate('not_specified').'</span>') ?></td> + </tr> + <tr> + <td class="b"><?= $this->translate('birthday') ?></td> + <td><?= ($this->birthday ? $this->date($this->birthday, "j F Y") : '<span class="na">'.$this->translate('not_specified').'</span>') ?></td> + </tr> + <tr> + <td class="b"><?= $this->translate('icq_handle') ?></td> + <td><?= ($this->topcoder ? $this->topcoder : '<span class="na">'.$this->translate('not_specified').'</span>') ?></td> + </tr> + <tr> + <td class="b"><?= $this->translate('msn_handle') ?></td> + <td><?= ($this->topcoder ? $this->topcoder : '<span class="na">'.$this->translate('not_specified').'</span>') ?></td> + </tr> + <tr> + <td class="b"><?= $this->translate('skype_handle') ?></td> + <td><?= ($this->skype ? $this->skype : '<span class="na">'.$this->translate('not_specified').'</span>') ?></td> + </tr> + <tr> + <td rowspan="6"></td> + <td class="b"><?= $this->translate('yahoo_handle') ?></td> + <td><?= ($this->yahoo ? $this->yahoo : '<span class="na">'.$this->translate('not_specified').'</span>') ?></td> + </tr> + <tr> + <td class="b"><?= $this->translate('skype_handle') ?></td> + <td><?= ($this->skype ? $this->skype : '<span class="na">'.$this->translate('not_specified').'</span>') ?></td> + </tr> + <tr> + <td class="b"><?= $this->translate('aim_handle') ?></td> + <td><?= ($this->aim ? $this->aim : '<span class="na">'.$this->translate('not_specified').'</span>') ?></td> + </tr> + <tr> + <td class="b"><?= $this->translate('website') ?></td> + <td><?= ($this->web ? '<a href="'.$this->web.'">'.$this->web.'</a>' : '<span class="na">'.$this->translate('not_specified').'</span>') ?></td> + </tr> + <tr> + <td class="b"><?= $this->translate('timus_handle') ?></td> + <td><?= ($this->timus ? '<a href="http://acm.timus.ru/search.aspx?Str='.$this->timus.'">'.$this->timus.'</a>' : $this->translate('not_specified')) ?></a></td> + </tr> + <tr> + <td class="b"><?= $this->translate('tc_handle') ?></td> + <td><?= ($this->topcoder ? '<a href="http://www.topcoder.com/tc?module=SimpleSearch&ha='.$this->topcoder.'">'.$this->topcoder.'</a>' : '<span class="na">'.$this->translate('not_specified').'</span>') ?></td> + </tr> +</table> \ No newline at end of file Property changes on: website/application/modules/admin ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/modules/admin/views ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/modules/admin/views/helpers ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/modules/admin/views/scripts ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/modules/admin/views/scripts/crud ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/admin/views/scripts/crud/list.phtml =================================================================== --- website/application/modules/admin/views/scripts/crud/list.phtml (rev 0) +++ website/application/modules/admin/views/scripts/crud/list.phtml 2009-01-31 18:14:16 UTC (rev 464) @@ -0,0 +1,47 @@ +<? if (count($this->paginator)): ?> +<form action="<?= $this->url(array('action' => 'action')) ?>" method="POST" class="crudlistform"> +<table class="crudlisttable" width="60%" border="1" align="center" style="border-collapse: collapse; border: 1px solid #000000;"> +<tr> + <? if (count($this->multiactions)): ?> + <th><?= $this->formCheckbox('selectall', 'all', array('onclick' => 'toggleCheck(this.checked);')) ?></th> + <? endif; ?> + + <? foreach ($this->headers as $name => $options): ?> + <th><?= $options['label'] ?></th> + <? endforeach; ?> + + <? foreach ($this->actions as $name => $action): ?> + <th><?= $this->translate($name) ?></th> + <? endforeach; ?> +</tr> +<? foreach ($this->paginator as $item): ?> +<? +$values = array(); +foreach ($this->primary as $key) { + $values[$key] = $item[$key]; +} +?> +<tr> + <? if (count($this->multiactions)): ?> + <td align="center"><?= $this->formCheckbox(implode('-', array_keys($values)).'[]', implode('-', array_values($values)), array('class' => 'crudlistselect', 'id' => 'cruditems-'.implode('-', array_values($values)))) ?></td> + <? endif; ?> + <? foreach ($this->headers as $name => $options): ?> + <td><?= (isset($options['as']) ? $item[$options['as']] : $item[$name]) ?></td> + <? endforeach; ?> + + <? foreach ($this->actions as $name => $action): ?> + <? if (is_array($action)) $values += $action[1] ?> + <td align="center"><a href="<?= $this->url(array('action' => (is_array($action) ? $action[0] : $action)) + $values) ?>"><?= $this->translate($name) ?></a></td> + <? endforeach; ?> +</tr> +<? endforeach; ?> +</table> +<? if (count($this->multiactions)): ?> + <? foreach ($this->multiactions as $name => $action): ?> + <?= $this->formSubmit('multiaction', $name, array('onclick' => 'setAction("crudlistform", "'.$action.'");')) ?> + <? endforeach; ?> +<? endif; ?> +</form> +<? else: ?> +<div>No items to display</div> +<? endif; ?> \ No newline at end of file Added: website/application/modules/admin/views/scripts/paginator.phtml =================================================================== --- website/application/modules/admin/views/scripts/paginator.phtml (rev 0) +++ website/application/modules/admin/views/scripts/paginator.phtml 2009-01-31 18:14:16 UTC (rev 464) @@ -0,0 +1,43 @@ +<?php if ($this->pageCount): ?> +<div class="paginationControl"> +<?= $this->firstItemNumber; ?> - <?= $this->lastItemNumber; ?> +of <?= $this->totalItemCount; ?> + +<!-- First page link --> +<?php if (isset($this->previous)): ?> + <a href="<?= $this->url(array('page' => $this->first)); ?>"> + First + </a> | +<?php else: ?> + <span class="disabled">First</span> | +<?php endif; ?> + +<!-- Previous page link --> +<?php if (isset($this->previous)): ?> + <a href="<?= $this->url(array('page' => $this->previous)); ?>"> + < Previous + </a> | +<?php else: ?> + <span class="disabled">< Previous</span> | +<?php endif; ?> + +<!-- Next page link --> +<?php if (isset($this->next)): ?> + <a href="<?= $this->url(array('page' => $this->next)); ?>"> + Next > + </a> | +<?php else: ?> + <span class="disabled">Next ></span> | +<?php endif; ?> + +<!-- Last page link --> +<?php if (isset($this->next)): ?> + <a href="<?= $this->url(array('page' => $this->last)); ?>"> + Last + </a> +<?php else: ?> + <span class="disabled">Last</span> +<?php endif; ?> + +</div> +<?php endif; ?> \ No newline at end of file Modified: website/config/config.ini =================================================================== --- website/config/config.ini 2009-01-31 18:11:05 UTC (rev 463) +++ website/config/config.ini 2009-01-31 18:14:16 UTC (rev 464) @@ -11,13 +11,13 @@ truncate.exact = "0" truncate.considerHtml = "1" -table.perpage = "10" +table.perpage = "25" date.format_type = "php" #auth.noauth.module = "default" auth.noauth.controller = "index" -auth.noauth.action = "index" +auth.noauth.action = "login" auth.noacl.module = "default" auth.noacl.controller = "error" @@ -28,34 +28,34 @@ auth.user = "username" auth.pass = "password" auth.passtreat = "MD5(?) AND activated IS NULL" -auth.referenceMap.0.table = "usersdetails"; -auth.referenceMap.0.reference = "usersdetails.username=users.username"; -auth.referenceMap.0.columns = "*"; -auth.referenceMap.1.table = "roles"; -auth.referenceMap.1.reference = "roles.id=users.roleid"; -auth.referenceMap.1.columns = "roles.name as role"; +auth.referenceMap.0.table = "usersdetails" +auth.referenceMap.0.reference = "usersdetails.username=users.username" +auth.referenceMap.0.columns = "*" +auth.referenceMap.1.table = "roles" +auth.referenceMap.1.reference = "roles.id=users.roleid" +auth.referenceMap.1.columns = "roles.name as role" -lang.languageKey = "language"; -lang.path = "lang/"; -lang.default = "uk"; -lang.langs[] = "uk"; -lang.langs[] = "en"; +lang.languageKey = "language" +lang.path = "lang/" +lang.default = "uk" +lang.langs[] = "uk" +lang.langs[] = "en" -layout.layoutpath = "application/layouts"; -layout.layout = "layout"; -layout.contentKey = "content"; -layout.pluginclass = "Ostacium_Controller_Plugin_Layout"; +layout.layoutpath = "application/layouts" +layout.layout = "layout" +layout.contentKey = "content" +layout.pluginclass = "Ostacium_Controller_Plugin_Layout" -view.encoding = "UTF-8"; -view.helperPathPrefix = "Ostacium_View_Helper"; -view.helperPath = "/library/Ostacium/View/Helper"; +view.encoding = "UTF-8" +view.helperPathPrefix = "Ostacium_View_Helper" +view.helperPath = "/library/Ostacium/View/Helper" -log.table = "log"; -log.columnMap.type = "priorityName"; -log.columnMap.message = "message"; -log.columnMap.username = "username"; -log.columnMap.when = "timestamp"; -log.columnMap.ip = "ip"; +log.table = "log" +log.columnMap.type = "priorityName" +log.columnMap.message = "message" +log.columnMap.username = "username" +log.columnMap.when = "timestamp" +log.columnMap.ip = "ip" email.from = "admin" @@ -70,6 +70,13 @@ general.extention = "html" general.roleid = "2" +paginator.file = "paginator.phtml" +paginator.style = "Sliding" + +crud.perpage = "25" + +calc.acm.penalty = "20" + [development: general] db.adapter = "Mysqli" Property changes on: website/httpdocs/images ___________________________________________________________________ Added: svn:ignore + *.db Deleted: website/httpdocs/images/0.gif =================================================================== (Binary files differ) Property changes on: website/httpdocs/images/acm ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/httpdocs/images/acm/status.png =================================================================== (Binary files differ) Property changes on: website/httpdocs/images/acm/status.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: website/httpdocs/images/acm/submit.png =================================================================== (Binary files differ) Property changes on: website/httpdocs/images/acm/submit.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Deleted: website/httpdocs/images/arrow.gif =================================================================== (Binary files differ) Deleted: website/httpdocs/images/arrow2.gif =================================================================== (Binary files differ) Deleted: website/httpdocs/images/b_find.gif =================================================================== (Binary files differ) Deleted: website/httpdocs/images/bg_menu.gif =================================================================== (Binary files differ) Deleted: website/httpdocs/images/blok.png =================================================================== (Binary files differ) Added: website/httpdocs/images/box_header.jpg =================================================================== (Binary files differ) Property changes on: website/httpdocs/images/box_header.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Deleted: website/httpdocs/images/del.png =================================================================== (Binary files differ) Deleted: website/httpdocs/images/disable.png =================================================================== (Binary files differ) Deleted: website/httpdocs/images/enable.png =================================================================== (Binary files differ) Deleted: website/httpdocs/images/fromarhive.jpg =================================================================== (Binary files differ) Added: website/httpdocs/images/header_bg.gif =================================================================== (Binary files differ) Property changes on: website/httpdocs/images/header_bg.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Deleted: website/httpdocs/images/hide.jpg =================================================================== (Binary files differ) Added: website/httpdocs/images/leftmenu.gif =================================================================== (Binary files differ) Property changes on: website/httpdocs/images/leftmenu.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: website/httpdocs/images/leftmenu_bg.jpg =================================================================== (Binary files differ) Property changes on: website/httpdocs/images/leftmenu_bg.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Deleted: website/httpdocs/images/logo.gif =================================================================== (Binary files differ) Added: website/httpdocs/images/logo.png =================================================================== (Binary files differ) Property changes on: website/httpdocs/images/logo.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Deleted: website/httpdocs/images/logod.gif =================================================================== (Binary files differ) Deleted: website/httpdocs/images/mail.jpg =================================================================== (Binary files differ) Deleted: website/httpdocs/images/menu.gif =================================================================== (Binary files differ) Deleted: website/httpdocs/images/menu_.gif =================================================================== (Binary files differ) Added: website/httpdocs/images/noavatar.png =================================================================== (Binary files differ) Property changes on: website/httpdocs/images/noavatar.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Deleted: website/httpdocs/images/pic1.jpg =================================================================== (Binary files differ) Deleted: website/httpdocs/images/pixel.gif =================================================================== (Binary files differ) Deleted: website/httpdocs/images/probstatus.png =================================================================== (Binary files differ) Deleted: website/httpdocs/images/props.png =================================================================== (Binary files differ) Deleted: website/httpdocs/images/reset.png =================================================================== (Binary files differ) Deleted: website/httpdocs/images/rpic.gif =================================================================== (Binary files differ) Deleted: website/httpdocs/images/show.jpg =================================================================== (Binary files differ) Deleted: website/httpdocs/images/toarhive.jpg =================================================================== (Binary files differ) Added: website/httpdocs/images/topmenu_bg.gif =================================================================== (Binary files differ) Property changes on: website/httpdocs/images/topmenu_bg.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Deleted: website/httpdocs/images/trash.gif =================================================================== (Binary files differ) Deleted: website/httpdocs/images/unblok.png =================================================================== (Binary files differ) Deleted: website/httpdocs/images/view.png =================================================================== (Binary files differ) Deleted: website/httpdocs/images/visible.jpg =================================================================== (Binary files differ) Modified: website/httpdocs/scripts/main.js =================================================================== --- website/httpdocs/scripts/main.js 2009-01-31 18:11:05 UTC (rev 463) +++ website/httpdocs/scripts/main.js 2009-01-31 18:14:16 UTC (rev 464) @@ -16,4 +16,43 @@ return false; } -function checkForm(form){if(form.lgn.value.length<3){alert('Логін повинен мати як мінімум 3 символи!');return false;}} \ No newline at end of file +function toggleCheck(value) +{ + dojo.query(".crudlistform input[type='checkbox'].crudlistselect").attr('checked', value); +} + +function setAction(form, value) +{ + form = dojo.query('.'+form); + action = form.attr('action').toString().replace('action', value); + form.attr('action', action); +} + +function toggle(id) +{ + var el = dojo.byId(id); + + if ( el.className != 'show' ) { + dojo.query("#nav .show").removeClass('show'); + + dojo.addClass(el, 'show'); + } + else { + dojo.removeClass(el, 'show'); + } + + return false; +} + +function goToUrl(url) +{ + document.location = url; + + return false; +} + +function init() +{ + if(typeof prettyPrint == 'function') + prettyPrint(); +} \ No newline at end of file Added: website/httpdocs/scripts/prettify.js =================================================================== --- website/httpdocs/scripts/prettify.js (rev 0) +++ website/httpdocs/scripts/prettify.js 2009-01-31 18:14:16 UTC (rev 464) @@ -0,0 +1,1330 @@ +// Copyright (C) 2006 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +/** + * @fileoverview + * some functions for browser-side pretty printing of code contained in html. + * + * The lexer should work on a number of languages including C and friends, + * Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, and Makefiles. + * It works passably on Ruby, PHP and Awk and a decent subset of Perl, but, + * because of commenting conventions, doesn't work on Smalltalk, Lisp-like, or + * CAML-like languages. + * + * If there's a language not mentioned here, then I don't know it, and don't + * know whether it works. If it has a C-like, Bash-like, or XML-like syntax + * then it should work passably. + * + * Usage: + * 1) include this source file in an html page via + * <script type="text/javascript" src="/path/to/prettify.js"></script> + * 2) define style rules. See the example page for examples. + * 3) mark the <pre> and <code> tags in your source with class=prettyprint. + * You can also use the (html deprecated) <xmp> tag, but the pretty printer + * needs to do more substantial DOM manipulations to support that, so some + * css styles may not be preserved. + * That's it. I wanted to keep the API as simple as possible, so there's no + * need to specify which language the code is in. + * + * Change log: + * cbeust, 2006/08/22 + * Java annotations (start with "@") are now captured as literals ("lit") + */ + +// JSLint declarations +/*global console, document, navigator, setTimeout, window */ + +/** + * Split {@code prettyPrint} into multiple timeouts so as not to interfere with + * UI events. + * If set to {@code false}, {@code prettyPrint()} is synchronous. + */ +window['PR_SHOULD_USE_CONTINUATION'] = true; + +/** the number of characters between tab columns */ +window['PR_TAB_WIDTH'] = 8; + +/** Walks the DOM returning a properly escaped version of innerHTML. + * @param {Node} node + * @param {Array.<string>} out output buffer that receives chunks of HTML. + */ +window['PR_normalizedHtml'] + +/** Contains functions for creating and registering new language handlers. + * @type {Object} + */ + = window['PR'] + +/** Pretty print a chunk of code. + * + * @param {string} sourceCodeHtml code as html + * @return {string} code as html, but prettier + */ + = window['prettyPrintOne'] +/** find all the < pre > and < code > tags in the DOM with class=prettyprint + * and prettify them. + * @param {Function} opt_whenDone if specified, called when the last entry + * has been finished. + */ + = window['prettyPrint'] = void 0; + +/** browser detection. @extern */ +window['_pr_isIE6'] = function () { + var isIE6 = navigator && navigator.userAgent && + /\bMSIE 6\./.test(navigator.userAgent); + window['_pr_isIE6'] = function () { return isIE6; }; + return isIE6; +}; + + +(function () { + /** Splits input on space and returns an Object mapping each non-empty part to + * true. + */ + function wordSet(words) { + words = words.split(/ /g); + var set = {}; + for (var i = words.length; --i >= 0;) { + var w = words[i]; + if (w) { set[w] = null; } + } + return set; + } + + // Keyword lists for various languages. + var FLOW_CONTROL_KEYWORDS = + "break continue do else for if return while "; + var C_KEYWORDS = FLOW_CONTROL_KEYWORDS + "auto case char const default " + + "double enum extern float goto int long register short signed sizeof " + + "static struct switch typedef union unsigned void volatile "; + var COMMON_KEYWORDS = C_KEYWORDS + "catch class delete false import " + + "new operator private protected public this throw true try "; + var CPP_KEYWORDS = COMMON_KEYWORDS + "alignof align_union asm axiom bool " + + "concept concept_map const_cast constexpr decltype " + + "dynamic_cast explicit export friend inline late_check " + + "mutable namespace nullptr reinterpret_cast static_assert static_cast " + + "template typeid typename typeof using virtual wchar_t where "; + var JAVA_KEYWORDS = COMMON_KEYWORDS + + "boolean byte extends final finally implements import instanceof null " + + "native package strictfp super synchronized throws transient "; + var CSHARP_KEYWORDS = JAVA_KEYWORDS + + "as base by checked decimal delegate descending event " + + "fixed foreach from group implicit in interface internal into is lock " + + "object out override orderby params readonly ref sbyte sealed " + + "stackalloc string select uint ulong unchecked unsafe ushort var "; + var JSCRIPT_KEYWORDS = COMMON_KEYWORDS + + "debugger eval export function get null set undefined var with " + + "Infinity NaN "; + var PERL_KEYWORDS = "caller delete die do dump elsif eval exit foreach for " + + "goto if import last local my next no our print package redo require " + + "sub undef unless until use wantarra... [truncated message content] |
From: <pan...@us...> - 2009-01-31 20:38:20
|
Revision: 465 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=465&view=rev Author: panzaboi Date: 2009-01-31 20:38:09 +0000 (Sat, 31 Jan 2009) Log Message: ----------- 1) Added Zend_Paginator, to split data across pages. 2) Changed login action, to work with new design. 3) Added view user action. 4) Implemented Action pattern to calculate score of submitted problem. 5) Changed structure. Tables are in models/Table/ and Forms in models/Form 6) Layout changes in Forms 7) Implemeneted multilanguage support in Forms and etc 8) Added Tester module, to transport data between tester and site. 9) Fixed small redirect issue 10) Fixed Db_Table::get with different primary keys 11) Improved Measure helper 12) Added Admin module, including crud action + table to the library. 13) Changed forms to Dojo Forms. 14) Modified HtmlTag to library, to contain markup Modified Paths: -------------- website/application/modules/acm/controllers/ContestController.php website/application/modules/acm/controllers/IndexController.php website/application/modules/acm/controllers/UserController.php website/application/modules/acm/models/Contest.php website/application/modules/acm/models/Form/Login.php website/application/modules/acm/models/Form/Register.php website/application/modules/acm/models/Form/Submit.php website/application/modules/acm/models/Tester.php website/application/modules/acm/models/User.php website/library/Application.php website/library/Ostacium/Acl.php website/library/Ostacium/Controller/Action.php website/library/Ostacium/Controller/CrudAction.php website/library/Ostacium/Controller/Plugin/ErrorHandler.php website/library/Ostacium/Date.php website/library/Ostacium/Db/Table.php website/library/Ostacium/View/Helper/Measure.php Added Paths: ----------- website/application/modules/acm/models/Calc/ website/application/modules/acm/models/Calc/ACM.php website/application/modules/acm/models/Calc.php website/application/modules/acm/models/Form/SmallLogin.php website/application/modules/acm/models/Table/ website/application/modules/acm/models/Table/ArchiveResults.php website/application/modules/acm/models/Table/Challenges.php website/application/modules/acm/models/Table/Contests.php website/application/modules/acm/models/Table/ContestsApplicants.php website/application/modules/acm/models/Table/ContestsResults.php website/application/modules/acm/models/Table/Submits.php website/application/modules/acm/models/Table/Users.php website/application/modules/acm/models/Table/UsersDetails.php website/application/modules/acm/models/Table/UsersStats.php website/application/modules/admin/controllers/ website/application/modules/admin/controllers/IndexController.php website/application/modules/admin/controllers/SettingsController.php website/application/modules/admin/models/ website/application/modules/admin/models/Form/ website/application/modules/admin/models/Form/Settings.php website/application/modules/admin/models/Table/ website/application/modules/admin/models/Table/Settings.php website/library/Ostacium/Controller/Action/ website/library/Ostacium/Controller/Action/Crud.php website/library/Ostacium/Db/Table/Crud.php website/library/Ostacium/Dojo/ website/library/Ostacium/Dojo/Form/ website/library/Ostacium/Dojo/Form/Crud.php website/library/Ostacium/Form/Decorator/HtmlTag.php website/library/Ostacium/View/Helper/CrudList.php Modified: website/application/modules/acm/controllers/ContestController.php =================================================================== --- website/application/modules/acm/controllers/ContestController.php 2009-01-31 18:14:16 UTC (rev 464) +++ website/application/modules/acm/controllers/ContestController.php 2009-01-31 20:38:09 UTC (rev 465) @@ -1,12 +1,27 @@ <?php class Acm_ContestController extends Ostacium_Controller_Action -{ +{ public function indexAction() { - $this->view->contests = $this->_model->getContests(); + $contests = $this->_model->getContests(); + $paginator = Zend_Paginator::factory($contests); + $paginator->setItemCountPerPage($this->_config->table->perpage); + $paginator->setCurrentPageNumber($this->_getParam('page')); + + $this->view->contests = $paginator; } + public function newAction() + { + + } + + public function addAction() + { + + } + public function registerAction() { $contestid = $this->_getParam('contestid'); @@ -43,7 +58,10 @@ { $contestid = $this->_getParam('contestid'); - // check if user is in this contest + if (!$this->_model->isInContest($contestid)) + { + return $this->render('notincontest'); + } $this->view->challenges = $this->_model->getChallenges($contestid); } Modified: website/application/modules/acm/controllers/IndexController.php =================================================================== --- website/application/modules/acm/controllers/IndexController.php 2009-01-31 18:14:16 UTC (rev 464) +++ website/application/modules/acm/controllers/IndexController.php 2009-01-31 20:38:09 UTC (rev 465) @@ -4,24 +4,32 @@ { public function indexAction() { - $form = new Form_Login(); - echo $form; + var_dump('sadfasdf'); } public function loginAction() { + $this->_helper->getHelper('viewRenderer')->setNoRender(true); + $form = new Form_Login(); + if ($this->_getParam('message')) + { + $form->setDescription($this->view->translate($this->_getParam('message'))); + $this->view->message = null; + } if (!$this->getRequest()->isPost()) { - return $this->_forward('index', null, null, $this->_getAllParams()); + echo $form; + + return; } if (!$form->isValid($this->getRequest()->getPost())) { - $this->view->form = $form; - $this->renderScript('layout/loginform.phtml', 'login'); - return $this->_forward('index'); + echo $form; + + return; } $values = $form->getValues(); @@ -30,11 +38,10 @@ if (!$result) { - $form->setDescription($this->view->translate('wrongEmailPwd')); - $this->view->form = $form; - //$this->renderScript('layout/loginform.phtml', 'login'); + $form->setDescription($this->view->translate('error_bad_login')); + echo $form; - return $this->_forward('index'); + return; } $redirect = new Zend_Session_Namespace('Redirect'); @@ -47,12 +54,12 @@ { return $this->_redirect('/acm/index/index'); } - - $this->_helper->getHelper('viewRenderer')->setNoRender(true); } public function logoutAction() { Zend_Auth::getInstance()->clearIdentity(); + + $this->_redirect('/acm/index/index'); } } \ No newline at end of file Modified: website/application/modules/acm/controllers/UserController.php =================================================================== --- website/application/modules/acm/controllers/UserController.php 2009-01-31 18:14:16 UTC (rev 464) +++ website/application/modules/acm/controllers/UserController.php 2009-01-31 20:38:09 UTC (rev 465) @@ -71,6 +71,10 @@ public function viewAction() { + $username = $this->_getParam('username'); + $this->view->assign($this->_model->getUser($username)); + var_dump($this->_model->getUser($username)); + //var_dump($this->view->user); } } \ No newline at end of file Property changes on: website/application/modules/acm/models/Calc ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/acm/models/Calc/ACM.php =================================================================== --- website/application/modules/acm/models/Calc/ACM.php (rev 0) +++ website/application/modules/acm/models/Calc/ACM.php 2009-01-31 20:38:09 UTC (rev 465) @@ -0,0 +1,39 @@ +<?php + +class Calc_ACM implements Calc +{ + public function calcCost(array $submit, array $result, array $contest) + { + if ($submit['firsttest'] == 1) return false; + + $_config = Zend_Registry::get('config'); + + if (!count($result)) + { + $result = array( + 'contestid' => $submit['contestid'], + 'username' => $submit['username'], + 'challengeid' => $submit['challengeid'], + 'tries' => 0, + 'penalty' => 0, + 'accepted' => 0, + ); + } + + if ($result['accepted']) return false; + + $result['tries']++; + + if ($submit['state'] == 1) + { + $result['accepted'] = 1; + $result['penalty'] += floor((time() - $contest['start'])/60); + } + elseif ($submit['state'] > 1) + { + $result['penalty'] += $_config->calc->acm->penalty; + } + + return $result; + } +} \ No newline at end of file Added: website/application/modules/acm/models/Calc.php =================================================================== --- website/application/modules/acm/models/Calc.php (rev 0) +++ website/application/modules/acm/models/Calc.php 2009-01-31 20:38:09 UTC (rev 465) @@ -0,0 +1,6 @@ +<?php + +interface Calc +{ + public function calcCost(array $submit, array $result, array $contest); +} \ No newline at end of file Modified: website/application/modules/acm/models/Contest.php =================================================================== --- website/application/modules/acm/models/Contest.php 2009-01-31 18:14:16 UTC (rev 464) +++ website/application/modules/acm/models/Contest.php 2009-01-31 20:38:09 UTC (rev 465) @@ -2,9 +2,22 @@ class Contest extends Ostacium_Model { + protected $calc = null; + + public function __construct(Calc $calc = null) + { + parent::__construct(); + if ($calc) $this->calc = $calc; + } + + public function setCalc(Calc $calc) + { + $this->calc = $calc; + } + public function getContests() { - $contests = new Contests(); + $contests = new Table_Contests(); return $contests->getAll(); } @@ -12,7 +25,7 @@ { $username = Zend_Auth::getInstance()->getStorage()->read()->username; - $ca = new ContestsApplicants(); + $ca = new Table_ContestsApplicants(); $ca->insert(array('username' => $username, 'contestid' => $id)); return true; @@ -20,28 +33,28 @@ public function isContestRunning($contestid) { - $contest = new Contests(); + $contest = new Table_Contests(); return $contest->isRunning($contestid); } public function isInContest($contestid) { $username = Zend_Auth::getInstance()->getStorage()->read()->username; - $contest = new Contests(); + $contest = new Table_Contests(); return $contest->isInContest($contestid, $username); } public function getChallenges($contestid) { - $challenges = new Challenges(); - return $challenges->getAll($contestid); + $challenges = new Table_Challenges(); + return $challenges->getAllFromContest($contestid); } public function getChallenge($id, $contestid) { - $challenges = new Challenges(); - return $challenges->get($id, $contestid); + $challenges = new Table_Challenges(); + return $challenges->getFromContest($id, $contestid); } public function addSubmit($values) @@ -55,11 +68,11 @@ 'when' => time() ); - $contest = new Contests(); + $contest = new Table_Contests(); if ($contest->isRunning($values['contestid'])) { - $submits = new Submits(); + $submits = new Table_Submits(); return $submits->insert($data); } else @@ -68,98 +81,43 @@ public function getSubmits($contestid) { - $submits = new Submits(); - return $submits->getAll($contestid); + $submits = new Table_Submits(); + return $submits->getAllFromContest($contestid); } -} - -class Challenges extends Ostacium_Db_Table -{ - protected $_name = 'challenges'; - protected $_primary = 'id'; - public function getAll($contestid) - { - return $this->selectLang(array('name', 'description')) - ->joinLeft(array('c' => 'contests'), $this->getAdapter()->quoteInto('c.id = ? AND c.start <= UNIX_TIMESTAMP() AND c.end > UNIX_TIMESTAMP()', $contestid), array()) - ->joinLeft(array('cc' => 'contests_challenges'), 'cc.contestid = c.id', 'contestid') - ->where('challenges.id = cc.challengeid') - ->query()->fetchAll(); - } - - public function get($id, $contestid) + public function updateResults($submit) { - return $this->selectLang(array('name', 'description')) - ->joinLeft(array('c' => 'contests'), $this->getAdapter()->quoteInto('c.id = ? AND c.start <= UNIX_TIMESTAMP() AND c.end > UNIX_TIMESTAMP()', $contestid), array()) - ->joinLeft(array('cc' => 'contests_challenges'), $this->getAdapter()->quoteInto('cc.contestid = c.id AND cc.challengeid = ?', $id), 'contestid') - ->where('challenges.id = cc.challengeid') - ->query()->fetch(); - } -} - -class Submits extends Ostacium_Db_Table -{ - protected $_name = 'submits'; - protected $_primary = 'id'; - - public function getAll($contestid) - { - return $this->select()->setIntegrityCheck(false) - ->from($this) - ->joinLeft('code_languages', 'code_languages.id = submits.codelangid', array('codelang' => 'name')) - ->joinLeft(array('c' => 'contests'), $this->getAdapter()->quoteInto('c.id = ?', $contestid), array()) - ->where('submits.contestid = c.id')->order('submits.id DESC') - ->query()->fetchAll(); - } -} - -class Contests extends Ostacium_Db_Table -{ - protected $_name = 'contests'; - protected $_primary = 'id'; - - public function isRunning($contestid) - { - $id = $this->select()->from($this, 'id') - ->where('id = ? AND start <= UNIX_TIMESTAMP() AND end >= UNIX_TIMESTAMP() AND enabled = 1', $contestid) - ->query()->fetchColumn('id'); + // LOG THIS/FAIL! + if (!$this->calc) return false; - if ($id && $id == $contestid) - return true; + $contests = new Table_Contests(); + $contest = $contests->get($submit['contestid'])->toArray(); + + $results = new Table_ContestsResults(); + $result = $results->get(array($submit['contestid'], $submit['username'], $submit['challengeid'])); + + if ($result) + $result = $result->toArray(); else - return false; + $result = array(); + + $newresult = $this->calc->calcCost($submit, $result, $contest); + + if (!count($result) && $newresult !== false) + { + $results->insert($newresult); + } + elseif ($newresult != $result && $newresult !== false) + { + $where = array( + $this->_db->quoteInto('contestid = ?', $newresult['contestid']), + $this->_db->quoteInto('username = ?', $newresult['username']), + $this->_db->quoteInto('challengeid = ?', $newresult['challengeid']), + ); + + $results->update($newresult, $where); + } } - - public function getAll() - { - return $this->selectLang(array('name', 'description')) - ->where('enabled = 1 AND start <= UNIX_TIMESTAMP() AND end > UNIX_TIMESTAMP()') - ->query()->fetchAll(); - } - - public function isInContest($contestid, $username) - { - $id = $this->select()->setIntegrityCheck(false) - ->from(array('c' => $this->_name), 'id') - ->joinInner(array('a' => 'contests_applicants'), 'c.id=a.contestid', array()) - ->where('c.id = ?', $contestid) - ->where('a.username = ?', $username) - ->query()->fetchColumn('username'); - - if ($id && $id == $contestid) return true; - else return false; - } } -class ContestsApplicants extends Ostacium_Db_Table -{ - protected $_name = 'contests_applicants'; - protected $_primary = array('contestid', 'username'); -} - -class Users extends Ostacium_Db_Table -{ - protected $_name = 'users'; - protected $_primaty = 'username'; -} \ No newline at end of file Modified: website/application/modules/acm/models/Form/Login.php =================================================================== --- website/application/modules/acm/models/Form/Login.php 2009-01-31 18:14:16 UTC (rev 464) +++ website/application/modules/acm/models/Form/Login.php 2009-01-31 20:38:09 UTC (rev 465) @@ -5,12 +5,13 @@ public $elementDecorators = array( 'DijitElement', 'Errors', - array('Label', array('class' => 'overlabel')), - array('HtmlTag', array('tag' => 'div', 'class' => 'elcontainer')) + array('Label', array('class' => 'label')), + array('HtmlTag', array('tag' => 'div', 'class' => 'line')) ); public $buttonDecorators = array( 'DijitElement', + array('HtmlTag', array('tag' => 'div', 'class' => 'line tr')) ); public function init() @@ -21,6 +22,7 @@ $this->setAction($router->assemble(array('action' => 'login', 'controller' => 'index'), null)); $this->setMethod('post'); $this->setName('loginform'); + $this->setAttrib('class', 'form'); $this->addElement('ValidationTextBox', 'username', array( 'decorators' => $this->elementDecorators, @@ -32,11 +34,11 @@ 'maxlength' => 50, 'trim' => true, 'lowercase' => true, - 'style' => 'height: 18px; width: 100px;', 'regExp' => '[\w]{5,50}', 'invalidMessage' => sprintf($translate->_('wordErrorBetween'), 5, 50), - 'title' => 'Username', - 'label' => 'Username:', + 'title' => $translate->_('username'), + 'label' => $translate->_('username').':', + 'class' => 'text', )); $this->addElement('PasswordTextBox', 'password', array( @@ -48,35 +50,34 @@ ), 'required' => true, 'trim' => true, - 'style' => 'height: 18px; width: 100px;', 'regExp' => '[\S]{5,32}', 'invalidMessage' => sprintf($translate->_('errorBetween'), 5, 32), - 'title' => 'Password', - 'label' => 'Password:', + 'title' => $translate->_('password'), + 'label' => $translate->_('password').':', + 'class' => 'text', )); - - $this->addElement('SubmitButton', 'loginbutton', array( 'decorators' => $this->buttonDecorators, 'required' => false, 'ignore' => true, - 'label' => 'Login', + 'label' => $translate->_('login'), + 'class' => 'submit' )); } public function loadDefaultDecorators() { -// $this->setDecorators(array( -// 'FormElements', -// 'Form', -// array('Description', array('placement' => 'prepend', 'tag' => 'div', 'class' => 'error')), -// )); - + //$this->addElementPrefixPath('Ostacium/Form/Decorator', 'Ostacium_Form_Decorator', 'Decorator'); + $this->addPrefixPath('Ostacium_Form_Decorator', 'Ostacium/Form/Decorator', 'Decorator'); + $translate = Zend_Registry::get('Zend_Translate'); + $this->setDecorators(array( 'FormElements', 'DijitForm', array('Description', array('placement' => 'prepend', 'tag' => 'div', 'class' => 'error')), + array(array('h2' => 'HtmlTag'), array('tag' => 'h2', 'placement' => 'prepend', 'markup' => $translate->_('login'))), + array(array('div' => 'HtmlTag'), array('tag' => 'div', 'class' => 'box c')) )); } } \ No newline at end of file Modified: website/application/modules/acm/models/Form/Register.php =================================================================== --- website/application/modules/acm/models/Form/Register.php 2009-01-31 18:14:16 UTC (rev 464) +++ website/application/modules/acm/models/Form/Register.php 2009-01-31 20:38:09 UTC (rev 465) @@ -5,18 +5,19 @@ public $elementDecorators = array( 'DijitElement', 'Errors', - array('Label', array('class' => 'overlabel')), + array('Label', array('class' => 'label')), array('HtmlTag', array('tag' => 'div', 'class' => 'elcontainer')) ); public $simpleDecorators = array( 'Errors', - array('Label', array('class' => 'overlabel')), + array('Label', array('class' => 'label')), array('HtmlTag', array('tag' => 'div', 'class' => 'elcontainer')) ); public $buttonDecorators = array( 'DijitElement', + array('HtmlTag', array('tag' => 'div', 'class' => 'elcontainer tc')) ); public function init() @@ -28,6 +29,7 @@ $this->setAction($router->assemble(array('action' => 'register'), null)); $this->setMethod('post'); $this->setName('registerform'); + $this->setAttrib('class', 'registerform c'); $this->addElement('ValidationTextBox', 'username', array( 'decorators' => $this->elementDecorators, @@ -41,6 +43,7 @@ 'invalidMessage' => sprintf($translate->_('errorBetween'), 5, 50), 'title' => $translate->_('username'), 'label' => $translate->_('username').': ', + 'id' => 'username_reg' )); $this->addElement('PasswordTextBox', 'password', array( @@ -55,6 +58,7 @@ 'invalidMessage' => sprintf($translate->_('errorBetween'), 5, 32), 'title' => $translate->_('password'), 'label' => $translate->_('password').': ', + 'id' => 'password_reg' )); $this->addElement('PasswordTextBox', 'cpassword', array( @@ -91,8 +95,8 @@ $this->addElement('Checkbox', 'hideemail', array( 'decorators' => $this->elementDecorators, 'required' => true, - 'title' => $translate->_('hideemail'), - 'label' => $translate->_('hideemail').': ', + 'title' => $translate->_('hide_email'), + 'label' => $translate->_('hide_email').': ', 'multiOptions' => array($translate->_('no'), $translate->_('yes')), )); @@ -134,8 +138,8 @@ 'required' => false, 'regExp' => '[\w ]{0,50}', 'invalidMessage' => sprintf($translate->_('errorMore'), 50), - 'title' => $translate->_('study'), - 'label' => $translate->_('study').': ', + 'title' => $translate->_('edu_place'), + 'label' => $translate->_('edu_place').': ', )); $this->addElement('DateTextBox', 'birthday', array( @@ -171,8 +175,8 @@ 'required' => false, 'regExp' => '[\S]{0,50}', 'invalidMessage' => sprintf($translate->_('errorMore'), 50), - 'title' => $translate->_('icq'), - 'label' => $translate->_('icq').': ', + 'title' => $translate->_('icq_handle'), + 'label' => $translate->_('icq_handle').': ', )); $this->addElement('ValidationTextBox', 'msn', array( @@ -185,8 +189,8 @@ 'required' => false, 'regExp' => '[\S]{0,100}', 'invalidMessage' => sprintf($translate->_('errorMore'), 100), - 'title' => $translate->_('msn'), - 'label' => $translate->_('msn').': ', + 'title' => $translate->_('msn_handle'), + 'label' => $translate->_('msn_handle').': ', )); $this->addElement('ValidationTextBox', 'skype', array( @@ -199,8 +203,8 @@ 'required' => false, 'regExp' => '[\S]{0,50}', 'invalidMessage' => sprintf($translate->_('errorMore'), 50), - 'title' => $translate->_('skype'), - 'label' => $translate->_('skype').': ', + 'title' => $translate->_('skype_handle'), + 'label' => $translate->_('skype_handle').': ', )); $this->addElement('ValidationTextBox', 'yahoo', array( @@ -213,8 +217,8 @@ 'required' => false, 'regExp' => '[\S]{0,50}', 'invalidMessage' => sprintf($translate->_('errorMore'), 50), - 'title' => $translate->_('yahoo'), - 'label' => $translate->_('yahoo').': ', + 'title' => $translate->_('yahoo_handle'), + 'label' => $translate->_('yahoo_handle').': ', )); $this->addElement('ValidationTextBox', 'web', array( @@ -227,8 +231,8 @@ 'required' => false, 'regExp' => '[\S]{0,100}', 'invalidMessage' => sprintf($translate->_('errorMore'), 100), - 'title' => $translate->_('web'), - 'label' => $translate->_('web').': ', + 'title' => $translate->_('website'), + 'label' => $translate->_('website').': ', )); $this->addElement('ValidationTextBox', 'topcoder', array( @@ -241,8 +245,8 @@ 'required' => false, 'regExp' => '[\S]{0,50}', 'invalidMessage' => sprintf($translate->_('errorMore'), 50), - 'title' => $translate->_('topcoder'), - 'label' => $translate->_('topcoder').': ', + 'title' => $translate->_('tc_handle'), + 'label' => $translate->_('tc_handle').': ', )); $this->addElement('ValidationTextBox', 'timus', array( @@ -255,8 +259,8 @@ 'required' => false, 'regExp' => '[\S]{0,50}', 'invalidMessage' => sprintf($translate->_('errorMore'), 50), - 'title' => $translate->_('timus'), - 'label' => $translate->_('timus').': ', + 'title' => $translate->_('timus_handle'), + 'label' => $translate->_('timus_handle').': ', )); $offset = array(-12 => -12, -11 => -11, -10 => -10, -9 => -9, -8 => -8, -7 => -7, -6 => -6, -5 => -5, -4 => -4, -3 => -3, -2 => -2, -1 => -1, 0 => 0, '+1' => '+1', '+2' => '+2', '+3' => '+3', '+4' => '+4', '+5' => '+5', '+6' => '+6', '+7' => '+7', '+8' => '+8', '+9' => '+9', '+10' => '+10', '+11' => '+11', '+12' => '+12', '+13' => '+13'); Added: website/application/modules/acm/models/Form/SmallLogin.php =================================================================== --- website/application/modules/acm/models/Form/SmallLogin.php (rev 0) +++ website/application/modules/acm/models/Form/SmallLogin.php 2009-01-31 20:38:09 UTC (rev 465) @@ -0,0 +1,85 @@ +<?php + +class Form_SmallLogin extends Zend_Dojo_Form +{ + public $elementDecorators = array( + 'DijitElement', + array('Label', array('class' => 'label2')), + array('HtmlTag', array('tag' => 'div', 'class' => 'line')) + ); + + public $buttonDecorators = array( + 'DijitElement', + array('HtmlTag', array('tag' => 'div', 'class' => 'line tr')) + ); + + public function init() + { + $translate = Zend_Registry::get('Zend_Translate'); + $router = Zend_Controller_Front::getInstance()->getRouter(); + + $this->setAction($router->assemble(array('action' => 'login', 'controller' => 'index'), null)); + $this->setMethod('post'); + $this->setName('loginform'); + $this->setAttrib('class', '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, + 'regExp' => '[\w]{5,50}', + 'invalidMessage' => sprintf($translate->_('enter_username_between'), 5, 50), + 'title' => $translate->_('username'), + 'label' => $translate->_('username').':', + 'class' => 'text', + )); + + $this->addElement('PasswordTextBox', 'password', array( + 'decorators' => $this->elementDecorators, + 'filters' => array('StringTrim'), + 'validators' => array( + 'Alnum', + array('StringLength', false, array(5, 32)), + ), + 'required' => true, + 'trim' => true, + 'regExp' => '[\S]{5,32}', + 'invalidMessage' => sprintf($translate->_('enter_password_between'), 5, 32), + 'title' => $translate->_('password'), + 'label' => $translate->_('password').':', + 'class' => 'text', + )); + + $this->addElement('Button', 'signupbutton', array( + 'decorators' => $this->buttonDecorators, + 'required' => false, + 'ignore' => true, + 'label' => $translate->_('signup'), + 'class' => 'signup2', + 'onclick' => 'return goToUrl("'.$router->assemble(array('action' => 'register', 'controller' => 'user'), null).'")' + )); + + $this->addElement('SubmitButton', 'loginbutton', array( + 'decorators' => $this->buttonDecorators, + 'required' => false, + 'ignore' => true, + 'label' => $translate->_('login'), + 'class' => 'submit2' + )); + } + + public function loadDefaultDecorators() + { + $this->setDecorators(array( + 'FormElements', + 'DijitForm', + array('HtmlTag', array('tag' => 'div', 'class' => 'box2 c')) + )); + } +} \ No newline at end of file Modified: website/application/modules/acm/models/Form/Submit.php =================================================================== --- website/application/modules/acm/models/Form/Submit.php 2009-01-31 18:14:16 UTC (rev 464) +++ website/application/modules/acm/models/Form/Submit.php 2009-01-31 20:38:09 UTC (rev 465) @@ -5,18 +5,19 @@ public $elementDecorators = array( 'DijitElement', 'Errors', - array('Label', array('class' => 'overlabel')), + array('Label', array('class' => 'label')), array('HtmlTag', array('tag' => 'div', 'class' => 'elcontainer')) ); public $simpleDecorators = array( 'Errors', - array('Label', array('class' => 'overlabel')), + array('Label', array('class' => 'label')), array('HtmlTag', array('tag' => 'div', 'class' => 'elcontainer')) ); public $buttonDecorators = array( 'DijitElement', + array('HtmlTag', array('tag' => 'div', 'class' => 'elcontainer')) ); public function init() @@ -27,16 +28,19 @@ $request = Zend_Controller_Front::getInstance()->getRequest(); $this->setAttrib('enctype', 'multipart/form-data'); + $this->setAttrib('class', 'submitform'); $this->setAction($router->assemble(array('action' => 'upload', 'id' => $request->getParam('id')), null)); $this->setMethod('post'); $this->setName('submitform'); + $this->getView()->addHelperPath('Ostacium/Dojo/View/Helper', 'Ostacium_Dojo_View_Helper'); + $this->addElement('FilteringSelect', 'languageid', array( 'decorators' => $this->elementDecorators, 'required' => true, - 'style' => 'height: 18px; width: 100px;', - 'title' => $translate->_('code_language'), - 'label' => $translate->_('code_language').': ', + 'style' => 'width: 100px;', + 'title' => $translate->_('language'), + 'label' => $translate->_('language').': ', 'multiOptions' => $db->fetchPairs($db->select()->from('code_languages', array('id', 'name'))), 'value' => (Zend_Auth::getInstance()->getStorage()->read()->codelangid) )); @@ -44,45 +48,46 @@ $this->addElement('RadioButton', 'type', array( 'decorators' => $this->elementDecorators, 'required' => true, - 'title' => $translate->_('upload_type'), - 'label' => $translate->_('upload_type ').': ', - 'multiOptions' => array($translate->_('editor'), $translate->_('file_upload')), + 'title' => $translate->_('submit_type'), + 'label' => $translate->_('submit_type').': ', + 'multiOptions' => array($translate->_('source_code'), $translate->_('file')), 'onclick' => 'changeEditor(this.value);', + 'separator' => "\n", 'value' => 0 )); $this->addElement('SimpleTextarea', 'code', array( 'decorators' => $this->elementDecorators, 'style' => 'height: 400px; width: 500px;', - 'title' => $translate->_('enter_code'), - 'label' => $translate->_('enter_code'), + 'title' => $translate->_('source_code'), + 'label' => $translate->_('source_code').': ', )); $this->addElement('File', 'codefile', array( 'decorators' => array_merge(array('File'), $this->simpleDecorators), 'validators' => array(array('Count', false, 1)), 'destination' => Application::getDocRoot().'/other/uploads/', - 'label' => $translate->_('enter_code'), + 'label' => $translate->_('choose_file').': ', )); $this->addElement('Checkbox', 'firsttest', array( 'decorators' => $this->elementDecorators, 'title' => $translate->_('first_test'), - 'label' => $translate->_('first_test ').': ' + 'label' => $translate->_('first_test').': ' )); $this->addElement('SubmitButton', 'submitbutton', array( 'decorators' => $this->buttonDecorators, 'required' => false, 'ignore' => true, - 'label' => $translate->_('submit'), + 'label' => $translate->_('submit_solution'), )); } public function loadDefaultDecorators() { $this->setDecorators(array( - 'FormElements', + 'FormElements', 'DijitForm', array('Description', array('placement' => 'prepend', 'tag' => 'div', 'class' => 'error')), )); Property changes on: website/application/modules/acm/models/Table ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/acm/models/Table/ArchiveResults.php =================================================================== --- website/application/modules/acm/models/Table/ArchiveResults.php (rev 0) +++ website/application/modules/acm/models/Table/ArchiveResults.php 2009-01-31 20:38:09 UTC (rev 465) @@ -0,0 +1,7 @@ +<?php + +class Table_ArchiveResults extends Ostacium_Db_Table +{ + protected $_name = 'archive_results'; + protected $_primary = array('username', 'challengeid'); +} \ No newline at end of file Added: website/application/modules/acm/models/Table/Challenges.php =================================================================== --- website/application/modules/acm/models/Table/Challenges.php (rev 0) +++ website/application/modules/acm/models/Table/Challenges.php 2009-01-31 20:38:09 UTC (rev 465) @@ -0,0 +1,50 @@ +<?php + +class Table_Challenges extends Ostacium_Db_Table +{ + protected $_name = 'challenges'; + protected $_primary = 'id'; + + public function getAllFromContest($contestid) + { + return $this->selectLang(array('name', 'description')) + ->joinLeft(array('c' => 'contests'), $this->getAdapter()->quoteInto('c.id = ? AND c.start <= UNIX_TIMESTAMP() AND c.end > UNIX_TIMESTAMP()', $contestid), array()) + ->joinLeft(array('cc' => 'contests_challenges'), 'cc.contestid = c.id', 'contestid') + ->where('challenges.id = cc.challengeid') + ->query()->fetchAll(); + } + + public function getFromContest($id, $contestid) + { + return $this->selectLang(array('name', 'description')) + ->joinLeft(array('c' => 'contests'), $this->getAdapter()->quoteInto('c.id = ? AND c.start <= UNIX_TIMESTAMP() AND c.end > UNIX_TIMESTAMP()', $contestid), array()) + ->joinLeft(array('cc' => 'contests_challenges'), $this->getAdapter()->quoteInto('cc.contestid = c.id AND cc.challengeid = ?', $id), 'contestid') + ->where('challenges.id = cc.challengeid') + ->query()->fetch(); + } + + /*public function getSubmitsFromContest($contestid, $username, $ignore_id) + { + return $this->select()->from(array('c' => $this->_name), array('*', 'COUNT(s.id) as tries', 'IF(sac.state,1,0) AS accepted', 'MIN(sac.when) AS actime')) + ->joinLeft(array('cc' => 'contests_challenges'), $this->getAdapter()->quoteInto('cc.contestid = ?', $contestid), array()) + ->joinLeft(array('s' => 'submits'), $this->getAdapter()->quoteInto('s.contestid = cc.contestid AND s.challengeid = cc.challengeid AND s.state > 1 AND s.username = ?', $username), array()) + ->joinLeft(array('sac' => 'submits'), $this->getAdapter()->quoteInto('sac.contestid = cc.contestid AND sac.challengeid = cc.challengeid AND sac.state = 1 AND s.username = ?', $username), array()) + ->where('s.id <> ?', $ignore_id) + ->where('sac.id <> ?', $ignore_id) + ->group(array('s.challengeid', 'sac.challengeid'))->query()->fetchAll(); + }*/ + + public function get($id) + { + return $this->selectLang(array('name', 'description')) + ->where('challenges.id = ? AND enabled = 1', $id) + ->query()->fetch(); + } + + public function getAll() + { + return $this->selectLang(array('name', 'description')) + ->where('challenges.enabled = 1') + ->query()->fetchAll(); + } +} \ No newline at end of file Added: website/application/modules/acm/models/Table/Contests.php =================================================================== --- website/application/modules/acm/models/Table/Contests.php (rev 0) +++ website/application/modules/acm/models/Table/Contests.php 2009-01-31 20:38:09 UTC (rev 465) @@ -0,0 +1,39 @@ +<?php + +class Table_Contests extends Ostacium_Db_Table +{ + protected $_name = 'contests'; + protected $_primary = 'id'; + + public function isRunning($contestid) + { + $id = $this->select()->from($this, 'id') + ->where('id = ? AND start <= UNIX_TIMESTAMP() AND end >= UNIX_TIMESTAMP() AND enabled = 1', $contestid) + ->query()->fetchColumn('id'); + + if ($id && $id == $contestid) + return true; + else + return false; + } + + public function getAll() + { + return $this->selectLang(array('name', 'description')) + ->where('enabled = 1 AND start <= UNIX_TIMESTAMP() AND end > UNIX_TIMESTAMP()') + ->query()->fetchAll(); + } + + public function isInContest($contestid, $username) + { + $id = $this->select()->setIntegrityCheck(false) + ->from(array('c' => $this->_name), 'id') + ->joinInner(array('a' => 'contests_applicants'), 'c.id=a.contestid', array()) + ->where('c.id = ?', $contestid) + ->where('a.username = ?', $username) + ->query()->fetchColumn('username'); + + if ($id && $id == $contestid) return true; + else return false; + } +} \ No newline at end of file Added: website/application/modules/acm/models/Table/ContestsApplicants.php =================================================================== --- website/application/modules/acm/models/Table/ContestsApplicants.php (rev 0) +++ website/application/modules/acm/models/Table/ContestsApplicants.php 2009-01-31 20:38:09 UTC (rev 465) @@ -0,0 +1,7 @@ +<?php + +class Table_ContestsApplicants extends Ostacium_Db_Table +{ + protected $_name = 'contests_applicants'; + protected $_primary = array('contestid', 'username'); +} \ No newline at end of file Added: website/application/modules/acm/models/Table/ContestsResults.php =================================================================== --- website/application/modules/acm/models/Table/ContestsResults.php (rev 0) +++ website/application/modules/acm/models/Table/ContestsResults.php 2009-01-31 20:38:09 UTC (rev 465) @@ -0,0 +1,7 @@ +<?php + +class Table_ContestsResults extends Ostacium_Db_Table +{ + protected $_name = 'contests_results'; + protected $_primary = array('contestid', 'username', 'challengeid'); +} \ No newline at end of file Added: website/application/modules/acm/models/Table/Submits.php =================================================================== --- website/application/modules/acm/models/Table/Submits.php (rev 0) +++ website/application/modules/acm/models/Table/Submits.php 2009-01-31 20:38:09 UTC (rev 465) @@ -0,0 +1,47 @@ +<?php + +class Table_Submits extends Ostacium_Db_Table +{ + protected $_name = 'submits'; + protected $_primary = 'id'; + + public function getAllFromContest($contestid) + { + return $this->select()->setIntegrityCheck(false) + ->from($this) + ->joinLeft('code_languages', 'code_languages.id = submits.codelangid', array('codelang' => 'name')) + ->joinLeft(array('c' => 'contests'), $this->getAdapter()->quoteInto('c.id = ?', $contestid), array()) + ->where('submits.contestid = c.id') + ->order('submits.id DESC') + ->query()->fetchAll(); + } + + public function getAll() + { + return $this->select()->setIntegrityCheck(false) + ->from($this) + ->joinLeft('code_languages', 'code_languages.id = submits.codelangid', array('codelang' => 'name')) + ->where('contestid = 0') + ->order('submits.id DESC') + ->query()->fetchAll(); + } + + public function getUntested() + { + return $this->select()->setIntegrityCheck(false) + ->from($this) + ->joinLeft('code_languages', 'code_languages.id = submits.codelangid', array('codelang' => 'name')) + ->where('state = 0') + ->order('id ASC') + ->query()->fetchAll(); + } + + public function getNotAccepted($id) + { + return $this->select()->setIntegrityCheck(false) + ->from(array('s' => $this->_name)) + ->joinLeft(array('ss' => 'submits'), 'ss.challengeid = s.challengeid AND ss.contestid = s.contestid AND ss.username = s.username AND ss.state = 1', array('IF(ss.id,1,0) AS aced')) + ->where('s.id = ?', $id) + ->query()->fetch(); + } +} \ No newline at end of file Added: website/application/modules/acm/models/Table/Users.php =================================================================== --- website/application/modules/acm/models/Table/Users.php (rev 0) +++ website/application/modules/acm/models/Table/Users.php 2009-01-31 20:38:09 UTC (rev 465) @@ -0,0 +1,16 @@ +<?php + +class Table_Users extends Ostacium_Db_Table +{ + protected $_name = 'users'; + protected $_primaty = 'username'; + + function getUser($username) + { + return $this->select()->setIntegrityCheck(false)->from($this) + ->joinLeft(array('r' => 'roles'), 'r.id=users.roleid', array('role' => 'name')) + ->joinLeft(array('d' => 'usersdetails'), 'd.username=users.username') + ->where('users.username = ?', $username) + ->query()->fetch(); + } +} \ No newline at end of file Added: website/application/modules/acm/models/Table/UsersDetails.php =================================================================== --- website/application/modules/acm/models/Table/UsersDetails.php (rev 0) +++ website/application/modules/acm/models/Table/UsersDetails.php 2009-01-31 20:38:09 UTC (rev 465) @@ -0,0 +1,7 @@ +<?php + +class Table_UsersDetails extends Ostacium_Db_Table +{ + protected $_name = 'usersdetails'; + protected $_primaty = 'username'; +} \ No newline at end of file Added: website/application/modules/acm/models/Table/UsersStats.php =================================================================== --- website/application/modules/acm/models/Table/UsersStats.php (rev 0) +++ website/application/modules/acm/models/Table/UsersStats.php 2009-01-31 20:38:09 UTC (rev 465) @@ -0,0 +1,7 @@ +<?php + +class Table_UsersStats extends Ostacium_Db_Table +{ + protected $_name = 'usersstats'; + protected $_primaty = 'username'; +} \ No newline at end of file Modified: website/application/modules/acm/models/Tester.php =================================================================== --- website/application/modules/acm/models/Tester.php 2009-01-31 18:14:16 UTC (rev 464) +++ website/application/modules/acm/models/Tester.php 2009-01-31 20:38:09 UTC (rev 465) @@ -4,24 +4,35 @@ { public function getSubmits() { - $submits = new Submits(); + $submits = new Table_Submits(); return $submits->getUntested(); } public function updateSubmit($id, $data) { - $submits = new Submits(); - return $submits->update($data, $this->_db->quoteInto('id = ? AND state = 0', $id)); + $submits = new Table_Submits(); + $submit = $submits->getNotAccepted($id); + + if ($submit['state'] != 0) + return false; + + $submit = $data + $submit; + $submits->update($data, $this->_db->quoteInto('id = ? AND state = 0', $id)); + + if ($submit['aced'] == 1) + return false; + + if ($submit['contestid'] != 0) + { + $contest = new Contest(new Calc_ACM()); + $contest->updateResults($submit); + } + else + { + $archive = new Archive(); + $archive->updateResults($submit); + } + + return true; } -} - -class Submits extends Ostacium_Db_Table -{ - protected $_name = 'archieve_submits'; - protected $_primary = 'id'; - - public function getUntested() - { - return $this->select()->from($this)->setIntegrityCheck(false)->joinLeft('code_languages', 'code_languages.id = archieve_submits.codelangid', array('codelang' => 'name'))->where('state = 0')->order('id ASC')->query()->fetchAll(); - } } \ No newline at end of file Modified: website/application/modules/acm/models/User.php =================================================================== --- website/application/modules/acm/models/User.php 2009-01-31 18:14:16 UTC (rev 464) +++ website/application/modules/acm/models/User.php 2009-01-31 20:38:09 UTC (rev 465) @@ -10,13 +10,13 @@ $data['activated'] = $code; $data['password'] = md5($data['password']); - $users = new Users(); + $users = new Table_Users(); $users->insert($data); - $usersdetails = new UsersDetails(); + $usersdetails = new Table_UsersDetails(); $usersdetails->insert($data); - $usersstats = new UsersStats(); + $usersstats = new Table_UsersStats(); $usersstats->insert($data); return true; @@ -27,25 +27,13 @@ $where = $this->_db->quoteInto('username = ?', $username).' AND activated = ?'; $where = $this->_db->quoteInto($where, $code); - $users = new Users(); + $users = new Table_Users(); return $users->update(array('activated' => null), $where); } -} - -class Users extends Ostacium_Db_Table -{ - protected $_name = 'users'; - protected $_primaty = 'username'; -} - -class UsersDetails extends Ostacium_Db_Table -{ - protected $_name = 'usersdetails'; - protected $_primaty = 'username'; -} - -class UsersStats extends Ostacium_Db_Table -{ - protected $_name = 'usersstats'; - protected $_primaty = 'username'; + + public function getUser($username) + { + $users = new Table_Users(); + return $users->getUser($username); + } } \ No newline at end of file Property changes on: website/application/modules/admin/controllers ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/admin/controllers/IndexController.php =================================================================== --- website/application/modules/admin/controllers/IndexController.php (rev 0) +++ website/application/modules/admin/controllers/IndexController.php 2009-01-31 20:38:09 UTC (rev 465) @@ -0,0 +1,10 @@ +<?php + +class Admin_IndexController extends Ostacium_Controller_Action +{ + public function indexAction() + { + $this->_helper->getHelper('viewRenderer')->setNoRender(true); + echo "WORKED!"; + } +} \ No newline at end of file Added: website/application/modules/admin/controllers/SettingsController.php =================================================================== --- website/application/modules/admin/controllers/SettingsController.php (rev 0) +++ website/application/modules/admin/controllers/SettingsController.php 2009-01-31 20:38:09 UTC (rev 465) @@ -0,0 +1,18 @@ +<?php + +class Admin_SettingsController extends Ostacium_Controller_Action_Crud +{ + protected function _load() + { + $this->_list = array( + 'name' => array('label' => 'name', 'sort' => true, 'helper' => false, 'align' => 'center'), + 'value' => array('label' => 'value', 'sort' => true, 'helper' => false, 'align' => 'center') + ); + + /*$this->_reference = array( + array('tablename', 'tablename.field = thisname.field', array('field1', 'field2')) + );*/ + + $this->_sort = array('name' => 'ASC'); + } +} \ No newline at end of file Property changes on: website/application/modules/admin/models ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/modules/admin/models/Form ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/admin/models/Form/Settings.php =================================================================== --- website/application/modules/admin/models/Form/Settings.php (rev 0) +++ website/application/modules/admin/models/Form/Settings.php 2009-01-31 20:38:09 UTC (rev 465) @@ -0,0 +1,56 @@ +<?php + +class Form_Settings extends Ostacium_Dojo_Form_Crud +{ + protected function fillNewFields() + { + $this->addElement('ValidationTextBox', 'name', array( + 'decorators' => $this->elementDecorators, + 'filters' => array('StringTrim', 'StringToLower'), + 'validators' => array( + array('StringLength', false, array(5, 30)), + ), + 'required' => true, + 'maxlength' => 50, + 'trim' => true, + 'lowercase' => true, + 'regExp' => '[\w]{5,50}', + 'invalidMessage' => sprintf($this->_translate->_('wordErrorBetween'), 5, 30), + 'title' => 'Name', + 'label' => 'Name:', + )); + + $this->addElement('ValidationTextBox', 'value', array( + 'decorators' => $this->elementDecorators, + 'filters' => array('StringTrim'), + 'validators' => array( + 'Alnum', + array('StringLength', false, array(0, 200)), + ), + 'required' => true, + 'trim' => true, + 'regExp' => '.{0,200}', + 'invalidMessage' => sprintf($this->_translate->_('errorBetween'), 0, 200), + 'title' => 'Value', + 'label' => 'Value:', + )); + } + + protected function fillEditFields() + { + $this->addElement('ValidationTextBox', 'value', array( + 'decorators' => $this->elementDecorators, + 'filters' => array('StringTrim'), + 'validators' => array( + 'Alnum', + array('StringLength', false, array(0, 200)), + ), + 'required' => true, + 'trim' => true, + 'regExp' => '.{0,200}', + 'invalidMessage' => sprintf($this->_translate->_('errorBetween'), 0, 200), + 'title' => 'Value', + 'label' => 'Value:', + )); + } +} \ No newline at end of file Property changes on: website/application/modules/admin/models/Table ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/admin/models/Table/Settings.php =================================================================== --- website/application/modules/admin/models/Table/Settings.php (rev 0) +++ website/application/modules/admin/models/Table/Settings.php 2009-01-31 20:38:09 UTC (rev 465) @@ -0,0 +1,6 @@ +<?php + +class Table_Settings extends Ostacium_Db_Table_Crud +{ + protected $_name = 'settings'; +} \ No newline at end of file Modified: website/library/Application.php =================================================================== --- website/library/Application.php 2009-01-31 18:14:16 UTC (rev 464) +++ website/library/Application.php 2009-01-31 20:38:09 UTC (rev 465) @@ -92,6 +92,10 @@ // Setup Helpers Ostacium_View_Helper_Truncate::setDefault($_config->truncate->toArray()); Ostacium_View_Helper_listTable::setDefaultAttribs($_config->listtable->toArray()); + Zend_View_Helper_PaginationControl::setDefaultViewPartial($_config->paginator->file); + + // Paginator + Zend_Paginator::setDefaultScrollingStyle($_config->paginator->style); // Setup Log $this->_setupLog(); Modified: website/library/Ostacium/Acl.php =================================================================== --- website/library/Ostacium/Acl.php 2009-01-31 18:14:16 UTC (rev 464) +++ website/library/Ostacium/Acl.php 2009-01-31 20:38:09 UTC (rev 465) @@ -2,9 +2,9 @@ class Ostacium_Acl extends Zend_Acl { - protected $_resources; - protected $_roles; - protected $_rolesxresources; + protected $resources; + protected $roles; + protected $rolesxresources; protected $_idtorole; @@ -34,7 +34,7 @@ $this->addRole($r); } - $roles[$role['id']] = $role['name'] == '*' ? null : $role['name']; + $roles[$role['id']] = ($role['name'] == '*' ? null : $role['name']); $this->_idtorole[(int)$role['id']] = $role['name']; } @@ -67,5 +67,4 @@ { return (isset($this->_idtorole[$id]) ? $this->_idtorole[$id] : 'guest' ); } - } \ No newline at end of file Property changes on: website/library/Ostacium/Controller/Action ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/library/Ostacium/Controller/Action/Crud.php =================================================================== --- website/library/Ostacium/Controller/Action/Crud.php (rev 0) +++ website/library/Ostacium/Controller/Action/Crud.php 2009-01-31 20:38:09 UTC (rev 465) @@ -0,0 +1,235 @@ +<?php + +abstract class Ostacium_Controller_Action_Crud extends Ostacium_Controller_Action +{ + protected $_table; + protected $_form; + + protected $_list = array(); + protected $_reference = array(); + protected $_sort = array(); + protected $_actions = array('edit' => 'edit', 'delete' => array('set', array('field' => 'delete', 'value' => 1))); + protected $_multiactions = array('deleteSelected' => 'delete'); + protected $_newaction = true; + + public function init() + { + parent::init(false); + + $name = ucfirst($this->getRequest()->getControllerName()); + + $this->_helper->getHelper('viewRenderer')->setNoController(true); + $scriptPath = $this->_helper->getHelper('viewRenderer')->getModuleDirectory() . '/views/scripts/crud'; + $this->view->addScriptPath($scriptPath); + + $table = 'Table_' . $name; + $form = 'Form_' . $name; + + $this->_table = new $table(); + $this->_form = new $form(); + + $this->_load(); + } + + protected function _load() {} + + protected function getSinglePrimaryKeys() + { + $primaries = (array)$this->_table->getPrimaryKeys(); + $values = array(); + + foreach ($primaries as $primary) + { + $values[$primary] = $this->_getParam($primary); + + $this->_setParam($primary, null); + if ($values[$primary] === null) return false; + } + + return array($values); + } + + protected function getMultiPrimaryKeys() + { + $post = $this->getRequest()->getPost(); + $primaries = (array)$this->_table->getPrimaryKeys(); + $primary = implode('-', $primaries); + $values = array(); + + $this->_setParam($primary, null); + + foreach ($post[$primary] as $key => $value) + { + $value = explode('-', $value); + + foreach ($primaries as $primary) + { + $values[$key][$primary] = array_shift($value); + + if ($values[$key][$primary] === null) return false; + } + } + + return $values; + } + + protected function getPrimaryKeys() + { + if ($this->getRequest()->isPost()) + { + if ($this->getRequest()->getParam('multiaction', null)) + { + $ids = $this->getMultiPrimaryKeys(); + } + else + return false; + } + else + { + $ids = $this->getSinglePrimaryKeys(); + } + } + + /************************************************************************************/ + + public function indexAction() + { + return $this->_forward('list', null, null, $this->_getAllParams()); + } + + public function listAction() + { + $sort = array($this->_getParam('sort') => $this->_getParam('by')); + if (!$sort) $sort = $this->_sort; + + $data = $this->_table->getData(array_keys($this->_list), $this->_reference, $sort); + + $paginator = Zend_Paginator::factory($data->toArray()); + $paginator->setItemCountPerPage($this->_config->crud->perpage); + $paginator->setCurrentPageNumber($this->_getParam('page')); + + $this->view->paginator = $paginator; + $this->view->sort = $sort; + $this->view->headers = $this->_list; + $this->view->actions = $this->_actions; + $this->view->multiactions = $this->_multiactions; + $this->view->newaction = $this->_newaction; + $this->view->primary = $this->_table->getPrimaryKeys(); + } + + public function newAction() + { + $this->_form->fillFields('new'); + + echo $this->_form; + } + + public function addAction() + { + $this->_form->fillFields('new'); + + if (!$this->getRequest()->isPost()) + { + return $this->_forward('new', null, null, $this->_getAllParams()); + } + + if ($this->_form->isValid($this->getRequest()->getPost())) + { + echo $this->_form; + + return; + } + + $values = $this->_form->getValues(); + $result = $this->_model->addData($values); + + if (!$result) + { + $this->_form->setDescription($this->_('crudAddError')); + echo $form; + + return; + } + else + { + return $this->_redirect($this->view->url(array('action' => 'list', 'message' => 'crudAddSuccess'))); + } + } + + public function editAction() + { + $this->_form->fillFields('edit'); + + echo $this->_form; + } + + public function updateAction() + { + $this->_form->fillFields('edit'); + $ids = $this->getSinglePrimaryKeys(); + + if (!$this->getRequest()->isPost()) + { + return $this->_forward('edit', null, null, $this->_getAllParams()); + } + + if ($this->_form->isValid($this->getRequest()->getPost())) + { + echo $this->_form; + + return; + } + + $values = $this->_form->getValues(); + $result = $this->_model->updateData($values, $ids); + + if (!$result) + { + $this->_form->setDescription($this->_('crudEditError')); + echo $form; + + return; + } + else + { + return $this->_redirect($this->view->url(array('action' => 'list', 'message' => 'crudEditSuccess'))); + } + } + + public function deleteAction() + { + $this->_helper->getHelper('viewRenderer')->setNoRender(true); + $ids = $this->getPrimaryKeys(); + + if (!$ids) + return $this->_forward('list', null, null, $this->_getAllParams()); + + $result = $this->_table->deleteData($ids); + + if (!$result) + $msg = $translate->_('crudDeleteError'); + else + $msg = sprintf($translate->_('deletedOverall'), $result, count($ids)); + + return $this->_redirect($this->view->url(array('action' => 'list', 'message' => $msg))); + } + + public function setAction() + { + $this->_helper->getHelper('viewRenderer')->setNoRender(true); + $ids = $this->getPrimaryKeys(); + +... [truncated message content] |
From: <pan...@us...> - 2009-02-12 16:36:58
|
Revision: 499 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=499&view=rev Author: panzaboi Date: 2009-02-12 16:36:55 +0000 (Thu, 12 Feb 2009) Log Message: ----------- New Configuration Modified Paths: -------------- website/config/config.ini website/library/Application.php Modified: website/config/config.ini =================================================================== --- website/config/config.ini 2009-02-12 16:27:14 UTC (rev 498) +++ website/config/config.ini 2009-02-12 16:36:55 UTC (rev 499) @@ -70,6 +70,8 @@ general.extention = "html" general.roleid = "2" +front.defaultmodule = "default" + paginator.file = "paginator.phtml" paginator.style = "Sliding" Modified: website/library/Application.php =================================================================== --- website/library/Application.php 2009-02-12 16:27:14 UTC (rev 498) +++ website/library/Application.php 2009-02-12 16:36:55 UTC (rev 499) @@ -171,6 +171,7 @@ $frontController->setModuleControllerDirectoryName('controllers'); $frontController->addModuleDirectory(self::$_docroot . '/application/modules/'); $frontController->setRequest('Ostacium_Controller_Request_Http'); + $frontController->setDefaultModule($_config->front->defaultmodule); // Setup Authorication $acl = $this->_setupAuth(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pan...@us...> - 2009-02-14 10:38:24
|
Revision: 506 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=506&view=rev Author: panzaboi Date: 2009-02-14 10:38:19 +0000 (Sat, 14 Feb 2009) Log Message: ----------- 1) Added News 2) Moved Users out of ACM module to default 3) Changed contest to not include registration 4) Added Rank Table for contests 5) Added application/view path to include general views there. (Should consider the same for models) Modified Paths: -------------- website/application/layouts/layout.phtml website/application/modules/acm/controllers/ContestController.php website/application/modules/acm/models/Calc/ACM.php website/application/modules/acm/models/Contest.php website/application/modules/acm/models/Table/Contests.php website/application/modules/acm/models/Table/ContestsResults.php website/application/modules/acm/models/Table/Submits.php website/application/modules/acm/models/Table/UsersDetails.php website/application/modules/acm/models/Table/UsersStats.php website/application/modules/acm/views/scripts/archive/entry.phtml website/application/modules/acm/views/scripts/archive/index.phtml website/application/modules/acm/views/scripts/contest/contest.phtml website/application/modules/acm/views/scripts/contest/entry.phtml website/application/modules/acm/views/scripts/contest/index.phtml website/application/modules/acm/views/scripts/contest/problemset.phtml website/application/modules/acm/views/scripts/contest/result.phtml website/application/modules/acm/views/scripts/contest/results.phtml website/config/config.ini website/httpdocs/index.php website/lang/uk.csv website/library/Application.php website/library/Ostacium/Controller/Router/Route/Language.php Added Paths: ----------- website/application/modules/acm/views/scripts/contest/source.phtml website/application/modules/acm/views/scripts/contest/table.phtml website/application/modules/default/controllers/NewsController.php website/application/modules/default/controllers/UserController.php website/application/modules/default/models/ website/application/modules/default/models/Form/ website/application/modules/default/models/News.php website/application/modules/default/models/Table/ website/application/modules/default/models/Table/News.php website/application/modules/default/models/Table/Users.php website/application/modules/default/models/User.php website/application/modules/default/views/scripts/news/ website/application/modules/default/views/scripts/news/entry.phtml website/application/modules/default/views/scripts/news/index.phtml website/application/modules/default/views/scripts/news/view.phtml website/application/view/ website/application/view/helpers/ website/application/view/scripts/ website/application/view/scripts/logedin.phtml website/application/view/scripts/paginator.phtml Removed Paths: ------------- website/application/layouts/old_layout.phtml website/application/modules/acm/controllers/UserController.php website/application/modules/acm/models/Archieve.php website/application/modules/acm/models/Table/Users.php website/application/modules/acm/models/User.php website/application/modules/acm/views/scripts/contest/incontest.phtml website/application/modules/acm/views/scripts/contest/notincontest.phtml website/application/modules/acm/views/scripts/error/ website/application/modules/acm/views/scripts/logedin.phtml website/application/modules/acm/views/scripts/paginator.phtml website/application/modules/acm/views/scripts/user/ website/application/modules/default/views/scripts/error/ Modified: website/application/layouts/layout.phtml =================================================================== --- website/application/layouts/layout.phtml 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/layouts/layout.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -51,8 +51,8 @@ <div id="topmenu"> <ul> - <li><a href="#" class="current">home</a></li> - <li><a href="#">news</a></li> + <li><a href="<?= $this->url(array(), null, true) ?>" class="current">home</a></li> + <li><a href="<?= $this->url(array('module' => 'default', 'controller' => 'news'), null, true) ?>">news</a></li> <li><a href="#">forum</a></li> <li><a href="#">links</a></li> <li><a href="#">search</a></li> @@ -79,12 +79,7 @@ </ul> </li> <li> - <a href="#Archieve" onclick="return toggle('sub2');">Контести</a> - <ul id="sub2"> - <li><a href="<?= $this->url(array('module' => 'acm', 'controller' => 'contest', 'action' => 'index'), null, true) ?>">Зареєструватись</a></li> - <li><a href="#Problems">Набір Завдань</a></li> - <li><a href="#Results">Результати</a></li> - </ul> + <a href="<?= $this->url(array('module' => 'acm', 'controller' => 'contest', 'action' => 'index'), null, true) ?>">Контести</a> </li> <li> <a href="#Archieve" onclick="return toggle('sub3');">Віртуальні Контести</a> Deleted: website/application/layouts/old_layout.phtml =================================================================== --- website/application/layouts/old_layout.phtml 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/layouts/old_layout.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -1,87 +0,0 @@ -<?= $this->doctype() ?> -<? $this->dojo()->enable() - ->setDjConfigOption('parseOnLoad', true) - ->registerModulePath('custom', '../custom/') - ->requireModule('dijit.form.FilteringSelect') ?> -<html> - <head> - <base href="<?= 'http://' . $_SERVER["HTTP_HOST"] . $this->baseUrl() ?>/" /> - <?= $this->headTitle($this->placeholder('title')->toString()) ?> - <?= $this->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8') ?> - - <?= $this->headLink()->appendStylesheet('styles/style.css') ?> - <?= /*$this->headLink()->appendStylesheet('styles/ie6.css', 'screen', 'IE 6')*/'' ?> - <?= /*$this->headLink()->appendStylesheet('styles/ie7.css', 'screen', 'IE 7')*/'' ?> - <?= $this->headScript()->appendFile('/scripts/main.js') ?> - - <? if ($this->dojo()->isEnabled()): - $this->dojo()->setLocalPath('/scripts/dojo/dojo.js') - ->addStyleSheetModule('dijit.themes.tundra'); - - echo $this->dojo(); - endif; ?> - </head> - <body class="tundra"> - <table border="0" cellpadding="0" cellspacing="0" width="100%"> - <tr bgcolor="#122a5b"> - <td><img height="43" src="images/logo.gif" width="490"></td> - </tr> - <tr bgcolor="#e1e1e1"> - <td><img height=26 src="images/logod.gif" width="490"></td> - </tr> - <tr> - <td bgcolor=#122a5b colspan=2><img height=2 src="images/0.gif" width=1></td> - </tr> - </table> - <table border=0 cellpadding=0 cellspacing=0 width="100%" summary="" height="20%"> - <tr> - <td bgcolor=#e1e1e1 valign=top width="200"> - <table width="100%" border="0" cellpadding="0" cellspacing="5"> - <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="index/about">Що це за проект</a></td></tr> - <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="index/rule">Правила</a></td></tr> - <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="/acm/archive/index">Набір завдань</a></td></tr> - <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="/acm/archive/submit">Протестувати Розв'язок</a></td></tr> - <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="/acm/archive/results">Результати Тестувань</a></td></tr> - <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="/acm/archive/ranks">Рейтинг Учасників</a></td></tr> - <tr><td><hr></td></tr> - </table> - - <table border=0 cellpadding=4 cellspacing=0 width="100%" summary=""> - <tr><td align=middle bgcolor=#122a5b><font color=#d4d0e2><b><small>вхід</small></b></font></td></tr> - <tr><td> - <form onsubmit="return checkform(this);" method="post" action="login.php?rid=45fed5d9b297f" style="margin:0"> - <input type="hidden" name="path" value="/"> - <table border=0 cellPadding=1 cellSpacing=0 summary="" width=100%> - <tr> - <td class=name nowrap><small><font color=#122a5b> логін:</font></small></td> - <td><input name=lgn style="height: 18px; width: 100px"></td> - <td> </td> - </tr> - <tr> - <td class=name nowrap><small><font color=#122a5b> пароль:</font></small></td> - <td><input name=pswd type=password style="height: 18px; width: 100px"></td> - <td><input name="login" src="images/b_find.gif" type="image"> - </tr> - </table> - </form> - -<CENTER><A href="register.php">Зареєструватись</a><BR><a href=createteam.php>Створити команду</a></CENTER> -</TABLE><TABLE border=0 cellPadding=4 cellSpacing=0 width="100%"> -<TR><TD align=middle bgColor=#122a5b> -<FONT color=#d4d0e2><B><SMALL>F.A.Q.</SMALL></B></FONT> -<TR><TD><TABLE border=0 cellPadding=0 cellSpacing=2 width="100%"><TR><TD><P>Мені здається що програма написана правильно, але система видає "Помилка під час виконання"... -<P>Якщо Ви використовуєте С++, і описали функцію void main(){...} - навіть якщо програма видасть -правильний результат, то система видасть "помилка під час виконання". Це пов'язано з тим, що -в такому випадку код завершення програми непердбачуваний, і практично ніколи небуває нульовим. -<BR>Для того, щоб програму Вам зарахувало (якщо все правильно), необхідно описувати основну -функцію як int main(){...} і обов'язково завершувати програму через return 0. -<TR><TD align=right><P><SMALL><A href="allfaq.php">[ Всі питання ]</p></SMALL></TABLE><TR><TD align=middle bgColor=#122a5b> -<FONT color=#d4d0e2> </FONT> -<TR><TD><TABLE border=0 cellPadding=0 cellSpacing=2 width="100%"><TR><TD align=center> - -</TABLE></TABLE><TD bgColor=#f4f3f8 vAlign=top height=100%><?= $this->placeholder('message') ?><br /><?= $this->layout()->content ?></table></table> -<TABLE> -<TR vAlign=Bottom><TABLE border=0 cellPadding=0 cellSpacing=0 width="100%" summary=""><TR bgColor=#122a5b><TD colSpan=3><IMG alt="" height=5 src="images/pixel.gif" width=1><TR bgColor=#122a5b><TD class=copyright>© 2004-2005, <a class=copyrightlink href="mailto: ac...@ia..."><B><FONT COLOR="#d1d1d1">A-S</FONT>tudio</B></A><TD align=middle><TD align=right class=copyright><A class=copyrightlink href="http://www.acm.lviv.ua">ACM Контестер</A><TR bgColor=#122a5b><TD colSpan=3><IMG alt="" height=5 src="images/pixel.gif" width=1></TABLE> - <?= $this->debugInfo(true) ?> - </body> -</html> \ No newline at end of file Modified: website/application/modules/acm/controllers/ContestController.php =================================================================== --- website/application/modules/acm/controllers/ContestController.php 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/controllers/ContestController.php 2009-02-14 10:38:19 UTC (rev 506) @@ -21,7 +21,7 @@ { } - + /* public function registerAction() { $contestid = $this->_getParam('contestid'); @@ -40,7 +40,7 @@ return $this->render('registered'); } - + */ public function viewAction() { $id = $this->_getParam('id'); @@ -54,14 +54,27 @@ $this->view->assign($problem); } + public function sourceAction() + { + $id = $this->_getParam('id'); + $contestid = $this->_getParam('contestid'); + + $source = $this->_model->getSubmit($id, $contestid); + + if (!$source) + return $this->_forward('index', null, null, $this->_getAllParams() + array('message' => 'noProblem')); + + $this->view->assign($source); + } + public function problemsetAction() { $contestid = $this->_getParam('contestid'); - if (!$this->_model->isInContest($contestid)) + /*if (!$this->_model->isInContest($contestid)) { return $this->render('notincontest'); - } + }*/ $this->view->challenges = $this->_model->getChallenges($contestid); } @@ -149,4 +162,12 @@ $this->view->submits = $this->_model->getSubmits($contestid); } + + public function tableAction() + { + $contestid = $this->_getParam('contestid'); + + $this->view->challenges = $this->_model->getChallenges($contestid); + $this->view->table = $this->_model->getTable($contestid); + } } \ No newline at end of file Deleted: website/application/modules/acm/controllers/UserController.php =================================================================== --- website/application/modules/acm/controllers/UserController.php 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/controllers/UserController.php 2009-02-14 10:38:19 UTC (rev 506) @@ -1,80 +0,0 @@ -<?php - -class Acm_UserController extends Ostacium_Controller_Action -{ - public function registerAction() - { - $this->_helper->getHelper('viewRenderer')->setNoRender(true); - - $form = new Form_Register(); - - if (!$this->getRequest()->isPost()) - { - echo $form; - return; - } - - if (!$form->isValid($this->getRequest()->getPost())) - { - echo $form; - return; - } - - // check cpassword == password - - $values = $form->getValues(); - $values['ip'] = $this->getRequest()->getIp(); - $code = substr(md5(time()), mt_rand(0, 27), 5); - $result = $this->_model->registerUser($values, $code); - - if (!$result) - { - $form->setDescription($this->view->translate('wrongEmailPwd')); - - echo $form; - } - else - { - $arguments = array('code' => $code, 'fullname' => $values['name'].' '.$values['surname'], 'username' => $values['username']); - $mail = new Ostacium_Mail(); - $mail->setFrom($this->_config->email->from.'@'.$_SERVER["SERVER_NAME"], $this->_config->general->title.' Staff') - ->addTo($values['email'], $values['name'].' '.$values['surname']) - ->setSubject($this->_('registration_email')) - ->setBodyTemplate(array('template' => 'register.phtml', 'arguments' => $arguments)) - ->send(); - - return $this->_redirect($this->view->url(array('action' => 'registered'))); - } - } - - public function registeredAction() - { - - } - - public function activateAction() - { - $username = $this->_getParam('username'); - $code = $this->_getParam('code'); - - $result = $this->_model->activateUser($username, $code); - - if ($result) - { - return $this->render('activated'); - } - else - { - return $this->render('notactivated'); - } - } - - public function viewAction() - { - $username = $this->_getParam('username'); - $this->view->assign($this->_model->getUser($username)); - var_dump($this->_model->getUser($username)); - - //var_dump($this->view->user); - } -} \ No newline at end of file Deleted: website/application/modules/acm/models/Archieve.php =================================================================== --- website/application/modules/acm/models/Archieve.php 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/models/Archieve.php 2009-02-14 10:38:19 UTC (rev 506) @@ -1,68 +0,0 @@ -<?php - -class Archieve extends Ostacium_Model -{ - public function getChallenges() - { - $challenges = new Challenges(); - return $challenges->getAll(); - } - - public function getSubmits() - { - $submits = new Submits(); - return $submits->getAll(); - } - - public function getChallenge($id) - { - $challenges = new Challenges(); - return $challenges->get($id); - } - - public function addSubmit($values) - { - $data = array( - 'contestid' => 0, - 'username' => Zend_Auth::getInstance()->getStorage()->read()->username, - 'challengeid' => (int)$values['id'], - 'codelangid' => $values['languageid'], - 'firsttest' => $values['firsttest'], - 'when' => time() - ); - - //$challenges = new Challenges(); - //$challenges->update(array('tries' => 'tries + 1'), $this->_db->quoteInto('id = ?', $data['challengeid'])); - // move this to the page, where we recieve data from Tester, add tries and accepts there. - - $submits = new Submits(); - return $submits->insert($data); - } -} - -class Challenges extends Ostacium_Db_Table -{ - protected $_name = 'challenges'; - protected $_primary = 'id'; - - public function get($id) - { - return $this->selectLang(array('name', 'description'))->where('challenges.id = ? AND enabled = 1', $id)->query()->fetch(); - } - - public function getAll() - { - return $this->selectLang(array('name', 'description'))->where('challenges.enabled = 1')->query()->fetchAll(); - } -} - -class Submits extends Ostacium_Db_Table -{ - protected $_name = 'submits'; - protected $_primary = 'id'; - - public function getAll() - { - return $this->select()->from($this)->setIntegrityCheck(false)->joinLeft('code_languages', 'code_languages.id = submits.codelangid', array('codelang' => 'name'))->where('contestid = 0')->order('submits.id DESC')->query()->fetchAll(); - } -} \ No newline at end of file Modified: website/application/modules/acm/models/Calc/ACM.php =================================================================== --- website/application/modules/acm/models/Calc/ACM.php 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/models/Calc/ACM.php 2009-02-14 10:38:19 UTC (rev 506) @@ -31,7 +31,7 @@ } elseif ($submit['state'] > 1) { - $result['penalty'] += $_config->calc->acm->penalty; + $result['penalty'] += $_config->acm->calc->penalty; } return $result; Modified: website/application/modules/acm/models/Contest.php =================================================================== --- website/application/modules/acm/models/Contest.php 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/models/Contest.php 2009-02-14 10:38:19 UTC (rev 506) @@ -20,7 +20,7 @@ $contests = new Table_Contests(); return $contests->getAll(); } - + /* public function registerUser($id) { $username = Zend_Auth::getInstance()->getStorage()->read()->username; @@ -30,13 +30,13 @@ return true; } - + */ public function isContestRunning($contestid) { $contest = new Table_Contests(); return $contest->isRunning($contestid); } - + /* public function isInContest($contestid) { $username = Zend_Auth::getInstance()->getStorage()->read()->username; @@ -44,7 +44,7 @@ return $contest->isInContest($contestid, $username); } - + */ public function getChallenges($contestid) { $challenges = new Table_Challenges(); @@ -57,6 +57,12 @@ return $challenges->getFromContest($id, $contestid); } + public function getSubmit($id, $contestid) + { + $submits = new Table_Submits(); + return $submits->getFromContest($id, $contestid); + } + public function addSubmit($values) { $data = array( @@ -87,7 +93,7 @@ public function updateResults($submit) { - // LOG THIS/FAIL! + //TODO: LOG THIS/FAIL! if (!$this->calc) return false; $contests = new Table_Contests(); @@ -118,6 +124,17 @@ $results->update($newresult, $where); } } + + public function getTable($contestid) + { + $results = new Table_ContestsResults(); + return $results->getResults($contestid); + + /*if ($results) + return $results->toArray(); + else + return false;*/ + } } Modified: website/application/modules/acm/models/Table/Contests.php =================================================================== --- website/application/modules/acm/models/Table/Contests.php 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/models/Table/Contests.php 2009-02-14 10:38:19 UTC (rev 506) @@ -23,7 +23,7 @@ ->where('enabled = 1 AND start <= UNIX_TIMESTAMP() AND end > UNIX_TIMESTAMP()') ->query()->fetchAll(); } - +/* public function isInContest($contestid, $username) { $id = $this->select()->setIntegrityCheck(false) @@ -36,4 +36,5 @@ if ($id && $id == $contestid) return true; else return false; } +*/ } \ No newline at end of file Modified: website/application/modules/acm/models/Table/ContestsResults.php =================================================================== --- website/application/modules/acm/models/Table/ContestsResults.php 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/models/Table/ContestsResults.php 2009-02-14 10:38:19 UTC (rev 506) @@ -4,4 +4,17 @@ { protected $_name = 'contests_results'; protected $_primary = array('contestid', 'username', 'challengeid'); + + public function getResults($contestid) + { + return $this->select()->setIntegrityCheck(false) + ->from($this, array('*', 'SUM(penalty) as total_penalty', 'SUM(accepted) AS total_accepts', 'GROUP_CONCAT(challengeid) as challenges', 'GROUP_CONCAT(accepted) as accepts', 'GROUP_CONCAT(tries) as alltries', 'GROUP_CONCAT(created-contests.start) as allcreated')) + ->joinLeft('contests', 'contests.id=contests_results.contestid', array()) + ->order('total_accepts DESC') + ->order('total_penalty ASC') + ->order('accepted DESC') + ->where('contestid = ?', $contestid) + ->group('username') + ->query()->fetchAll(); + } } \ No newline at end of file Modified: website/application/modules/acm/models/Table/Submits.php =================================================================== --- website/application/modules/acm/models/Table/Submits.php 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/models/Table/Submits.php 2009-02-14 10:38:19 UTC (rev 506) @@ -16,6 +16,17 @@ ->query()->fetchAll(); } + public function getFromContest($id, $contestid) + { + return $this->select()->setIntegrityCheck(false) + ->from($this) + ->joinLeft('code_languages', 'code_languages.id = submits.codelangid', array('codelang' => 'name')) + ->joinLeft(array('c' => 'contests'), 'submits.contestid = c.id', array()) + ->where('submits.id = ?', $id) + ->where('submits.contestid = ?', $contestid) + ->query()->fetch(); + } + public function getAll() { return $this->select()->setIntegrityCheck(false) Deleted: website/application/modules/acm/models/Table/Users.php =================================================================== --- website/application/modules/acm/models/Table/Users.php 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/models/Table/Users.php 2009-02-14 10:38:19 UTC (rev 506) @@ -1,16 +0,0 @@ -<?php - -class Table_Users extends Ostacium_Db_Table -{ - protected $_name = 'users'; - protected $_primaty = 'username'; - - function getUser($username) - { - return $this->select()->setIntegrityCheck(false)->from($this) - ->joinLeft(array('r' => 'roles'), 'r.id=users.roleid', array('role' => 'name')) - ->joinLeft(array('d' => 'usersdetails'), 'd.username=users.username') - ->where('users.username = ?', $username) - ->query()->fetch(); - } -} \ No newline at end of file Modified: website/application/modules/acm/models/Table/UsersDetails.php =================================================================== --- website/application/modules/acm/models/Table/UsersDetails.php 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/models/Table/UsersDetails.php 2009-02-14 10:38:19 UTC (rev 506) @@ -3,5 +3,5 @@ class Table_UsersDetails extends Ostacium_Db_Table { protected $_name = 'usersdetails'; - protected $_primaty = 'username'; + protected $_primary = 'username'; } \ No newline at end of file Modified: website/application/modules/acm/models/Table/UsersStats.php =================================================================== --- website/application/modules/acm/models/Table/UsersStats.php 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/models/Table/UsersStats.php 2009-02-14 10:38:19 UTC (rev 506) @@ -3,5 +3,5 @@ class Table_UsersStats extends Ostacium_Db_Table { protected $_name = 'usersstats'; - protected $_primaty = 'username'; + protected $_primary = 'username'; } \ No newline at end of file Deleted: website/application/modules/acm/models/User.php =================================================================== --- website/application/modules/acm/models/User.php 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/models/User.php 2009-02-14 10:38:19 UTC (rev 506) @@ -1,39 +0,0 @@ -<?php - -class User extends Ostacium_Model -{ - public function registerUser($data, $code) - { - $data['registered'] = time(); - $data['online'] = $data['registered']; - $data['roleid'] = Zend_Registry::get('config')->general->roleid; - $data['activated'] = $code; - $data['password'] = md5($data['password']); - - $users = new Table_Users(); - $users->insert($data); - - $usersdetails = new Table_UsersDetails(); - $usersdetails->insert($data); - - $usersstats = new Table_UsersStats(); - $usersstats->insert($data); - - return true; - } - - public function activateUser($username, $code) - { - $where = $this->_db->quoteInto('username = ?', $username).' AND activated = ?'; - $where = $this->_db->quoteInto($where, $code); - - $users = new Table_Users(); - return $users->update(array('activated' => null), $where); - } - - public function getUser($username) - { - $users = new Table_Users(); - return $users->getUser($username); - } -} \ No newline at end of file Modified: website/application/modules/acm/views/scripts/archive/entry.phtml =================================================================== --- website/application/modules/acm/views/scripts/archive/entry.phtml 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/views/scripts/archive/entry.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -7,4 +7,4 @@ <a href="<?= $this->url( array('action' => 'submit', 'id' => $this->id), null) ?>"><img height="20" width="20" alt="<?= $this->translate('submit_solution') ?>" src="images/acm/submit.png"/></a> <a href="<?= $this->url( array('action' => 'status', 'id' => $this->id), null) ?>"><img height="20" width="20" alt="<?= $this->translate('solution_status') ?>" src="images/acm/status.png"/> </td> -</tr> +</tr> \ No newline at end of file Modified: website/application/modules/acm/views/scripts/archive/index.phtml =================================================================== --- website/application/modules/acm/views/scripts/archive/index.phtml 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/views/scripts/archive/index.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -18,4 +18,4 @@ <tr> <td colspan="5" class="footer tc"><?= $this->challenges ?></td> </tr> -</table> +</table> \ No newline at end of file Modified: website/application/modules/acm/views/scripts/contest/contest.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/contest.phtml 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/views/scripts/contest/contest.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -3,5 +3,9 @@ <td align="center"><?= $this->name ?></td> <td align="center"><?= $this->date($this->start, "d.m.Y H:i:s") ?></td> <td align="center"><?= $this->date($this->end, "d.m.Y H:i:s") ?></td> - <td align="center"><a href="<?= $this->url(array('action' => 'register', 'contestid' => $this->id), null) ?>"><?= $this->translate('register') ?></a></td> + <td align="center"> + <a href="<?= $this->url(array('action' => 'problemset', 'contestid' => $this->id), null) ?>"><?= $this->translate('problem_set') ?></a> + <a href="<?= $this->url(array('action' => 'results', 'contestid' => $this->id), null) ?>"><?= $this->translate('results') ?></a> + <a href="<?= $this->url(array('action' => 'table', 'contestid' => $this->id), null) ?>"><?= $this->translate('table') ?></a> + </td> </tr> \ No newline at end of file Modified: website/application/modules/acm/views/scripts/contest/entry.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/entry.phtml 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/views/scripts/contest/entry.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -1,14 +1,10 @@ -<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', 'contest' => $this->contestid, 'id' => $this->id), null) ?>"><?= $this->id ?></a> +<tr class="tc"> + <td width="10%"><a href="<?= $this->url( array('action' => 'view', 'id' => $this->id), null) ?>"><?= $this->id ?></a></td> + <td width="60%" class="tl"><a href="<?= $this->url( array('action' => 'view', 'id' => $this->id), null) ?>"><?= $this->name ?></a></td> + <td width="10%"><?= $this->tries ?></td> + <td width="10%"><?= $this->accepts ?></td> + <td width="10%"> + <a href="<?= $this->url( array('action' => 'submit', 'id' => $this->id), null) ?>"><img height="20" width="20" alt="<?= $this->translate('submit_solution') ?>" src="images/acm/submit.png"/></a> + <a href="<?= $this->url( array('action' => 'status', 'id' => $this->id), null) ?>"><img height="20" width="20" alt="<?= $this->translate('solution_status') ?>" src="images/acm/status.png"/> </td> - - <td align="left" style="border-left: 0px none; border-right: 1px solid rgb(196, 196, 219);"> - <a href="<?= $this->url( array('action' => 'view', 'contest' => $this->contestid, 'id' => $this->id), null) ?>"><?= $this->name ?></a> - </td> - - <td style="border-left: 0px none; border-right: 0px solid rgb(196, 196, 219);"> - <a href="<?= $this->url( array('action' => 'submit', 'contest' => $this->contestid, 'id' => $this->id), null) ?>"><img height="17" width="22" alt="Здати" title="Здати" src="images/b_find.gif"/></a> - <a href="<?= $this->url( array('action' => 'status', 'contest' => $this->contestid, 'id' => $this->id), null) ?>"><img height="17" width="22" alt="Показати як здають" src="images/probstatus.png"/> - </td> </tr> \ No newline at end of file Deleted: website/application/modules/acm/views/scripts/contest/incontest.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/incontest.phtml 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/views/scripts/contest/incontest.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -1 +0,0 @@ -You are already in this contest \ No newline at end of file Modified: website/application/modules/acm/views/scripts/contest/index.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/index.phtml 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/views/scripts/contest/index.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -2,11 +2,11 @@ <br /> <table class="table"> <tr> - <th>Номер</th> - <th>Назва</th> - <th>Початок</th> - <th>Кінець</th> - <th>Зареєструватись</th> + <th><?= $this->translate('id') ?></th> + <th><?= $this->translate('name') ?></th> + <th><?= $this->translate('start') ?></th> + <th><?= $this->translate('end') ?></th> + <th><?= $this->translate('options') ?></th> </tr> <? if (count($this->contests)): ?> <?= $this->partialLoop('contest/contest.phtml', $this->contests) ?> Deleted: website/application/modules/acm/views/scripts/contest/notincontest.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/notincontest.phtml 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/views/scripts/contest/notincontest.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -1 +0,0 @@ -You are not taking part in this contest \ No newline at end of file Modified: website/application/modules/acm/views/scripts/contest/problemset.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/problemset.phtml 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/views/scripts/contest/problemset.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -1,10 +1,21 @@ -<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" summary="" align="center"><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="270"> Назва</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('contest/entry.phtml', $this->challenges) ?> -</table><br/></td></tr></table> \ No newline at end of file +<h2><?= $this->translate('problem_set') ?></h2> +<br /> +<table class="table"> + <tr> + <th><?= $this->translate('problem') ?></th> + <th><?= $this->translate('name') ?></th> + <th><?= $this->translate('tries') ?></th> + <th><?= $this->translate('accepts') ?></th> + <th><?= $this->translate('actions') ?></th> + </tr> + <? if (count($this->challenges)): ?> + <?= $this->partialLoop('contest/entry.phtml', $this->challenges) ?> + <? else: ?> + <tr> + <td colspan="5" class="tc error"><?= $this->translate('no_problems') ?></td> + </tr> + <? endif; ?> + <tr> + <td colspan="5" class="footer tc"><?= $this->challenges ?></td> + </tr> +</table> \ No newline at end of file Modified: website/application/modules/acm/views/scripts/contest/result.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/result.phtml 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/views/scripts/contest/result.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -1,10 +1,10 @@ -<tr> - <td align="center"><?= $this->id ?></td> - <td align="center"><?= $this->date($this->when) ?></td> - <td align="center"><?= $this->username ?></td> - <td align="center"><a href="<?= $this->url( array('action' => 'view', 'id' => $this->challengeid), null) ?>"><?= $this->challengeid ?></a></td> - <td align="center"><?= $this->codelang ?></td> - <td align="center"><?= $this->state($this->state) ?></td> - <td align="center"><?= ($this->tests == 0 ? '-' : $this->tests) ?></td> - <td align="center"><?= ($this->runtime == 0 ? '-' : $this->runtime) ?>/<?= ($this->memory == 0 ? '-' : $this->memory) ?></td> +<tr class="tc"> + <td><a href="<?= $this->url( array('controller' => 'contest','action' => 'source', 'id' => $this->id), null) ?>"><?= $this->id ?></a></td> + <td><?= $this->date($this->when) ?></td> + <td><a href="<?= $this->url( array('module' => 'acm', 'controller' => 'user','action' => 'view', 'username' => $this->username), null, true) ?>"><?= $this->username ?></a></td> + <td><a href="<?= $this->url( array('action' => 'view', 'id' => $this->challengeid), null) ?>"><?= $this->challengeid ?></a></td> + <td><?= $this->codelang ?></td> + <td><?= $this->state($this->state) ?></td> + <td><?= ($this->tests == 0 ? '-' : $this->tests) ?></td> + <td><?= ($this->runtime == 0 ? '-' : $this->runtime) ?>/<?= ($this->memory == 0 ? '-' : $this->memory) ?></td> </tr> \ No newline at end of file Modified: website/application/modules/acm/views/scripts/contest/results.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/results.phtml 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/views/scripts/contest/results.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -1,33 +1,24 @@ -<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 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" summary="" align="center" width="80%"> -<tbody> -<tr><td bgcolor="#f4f3f8" align="middle" colspan="14"><b>Архів задач</b></td></tr> -<tr bgcolor="#e1e1e1" align="middle"> -<th>ID</th> -<th>Дата</th> -<th>Логін</th> -<th>Задача</th> -<th>Мова</th> -<th>Стан</th> -<th>Тест</th> -<th>Час/Пам'ять</th> -</tr> - -<?= $this->partialLoop('ontest/result.phtml', $this->submits) ?> -</table> - -</td></tr></table> \ No newline at end of file +<h2><?= $this->translate('results') ?></h2> +<br /> +<table class="table"> + <tr> + <th>ID</th> + <th><?= $this->translate('date') ?></th> + <th><?= $this->translate('username') ?></th> + <th><?= $this->translate('problem') ?></th> + <th><?= $this->translate('language') ?></th> + <th><?= $this->translate('state') ?></th> + <th><?= $this->translate('tests') ?></th> + <th><?= $this->translate('runtime') ?></th> + </tr> + <? if (count($this->submits)): ?> + <?= $this->partialLoop('contest/result.phtml', $this->submits) ?> + <? else: ?> + <tr> + <td colspan="8" class="tc error"><?= $this->translate('no_results') ?></td> + </tr> + <? endif; ?> + <tr> + <td colspan="8" class="footer tc"><?= $this->submits ?></td> + </tr> +</table> \ No newline at end of file Added: website/application/modules/acm/views/scripts/contest/source.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/source.phtml (rev 0) +++ website/application/modules/acm/views/scripts/contest/source.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -0,0 +1,2 @@ +<a href="<?= $this->url( array('controller' => 'contest', 'action' => 'results', 'id' => null), null) ?>">Назад</a><br /><br /> +<code class="prettyprint"><?= htmlspecialchars(file_get_contents(Application::getDocRoot().'/other/submits/'.$this->id)) ?></code> \ No newline at end of file Added: website/application/modules/acm/views/scripts/contest/table.phtml =================================================================== --- website/application/modules/acm/views/scripts/contest/table.phtml (rev 0) +++ website/application/modules/acm/views/scripts/contest/table.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -0,0 +1,49 @@ +<h2><?= $this->translate('contests_list') ?></h2> +<br /> +<table class="table"> + <tr> + <th><?= $this->translate('rank') ?></th> + <th><?= $this->translate('name') ?></th> + <? foreach ($this->challenges as $challenge): ?> + <th><?= $challenge['id'] ?></th> + <? endforeach; ?> + <th><?= $this->translate('AC') ?></th> + <th><?= $this->translate('penalty') ?></th> + </tr> + <? $i = 1; ?> + <? if (count($this->table)): ?> + <? foreach ($this->table as $item):?> + <? + $ch = explode(',', $item['challenges']); + $ac = explode(',', $item['accepts']); + $tr = explode(',', $item['alltries']); + $tm = explode(',', $item['allcreated']); + ?> + <tr> + <td class="tc"><?= ($i++) ?></th> + <td class="tc"><?= $item['username'] ?></th> + <? foreach ($this->challenges as $challenge): ?> + <td class="tc"> + <? + if (($key = array_search($challenge['id'], $ch)) !== false): + if ($ac[$key] == 1): + echo "+" . ($tr[$key] > 1 ? ($tr[$key]-1) : '') . '<br />' . $this->date($tm[$key], "H:i"); + else: + echo "-" . $tr[$key]; + endif; + else: + echo "-"; + endif; + ?> + </td> + <? endforeach; ?> + <td class="tc"><?= $item['total_accepts'] ?></td> + <td class="tc"><?= $item['total_penalty'] ?></td> + </tr> + <? endforeach; ?> + <? else: ?> + <tr> + <td colspan="5" class="tc error"><?= $this->translate('no_results') ?></td> + </tr> + <? endif; ?> +</table> Deleted: website/application/modules/acm/views/scripts/logedin.phtml =================================================================== --- website/application/modules/acm/views/scripts/logedin.phtml 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/views/scripts/logedin.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -1,4 +0,0 @@ -<div class="box2 c"> - <h2><?= $this->translate('user_menu') ?></h2> - <a href="<?= $this->url(array('module' => 'acm', 'controller' => 'index', 'action' => 'logout'), null, true) ?>"><?= $this->translate('log_out') ?></a> -</div> \ No newline at end of file Deleted: website/application/modules/acm/views/scripts/paginator.phtml =================================================================== --- website/application/modules/acm/views/scripts/paginator.phtml 2009-02-14 01:29:23 UTC (rev 505) +++ website/application/modules/acm/views/scripts/paginator.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -1,30 +0,0 @@ -<?php if ($this->pageCount): ?> -<div class="paginationControl"> -<!-- Previous page link --> -<?php if (isset($this->previous)): ?> - <a href="<?= $this->url(array('page' => $this->previous)); ?>"> - < Previous - </a> | -<?php else: ?> - <span class="disabled">< Previous</span> | -<?php endif; ?> - -<!-- Numbered page links --> -<?php foreach ($this->pagesInRange as $page): ?> - <?php if ($page != $this->current): ?> - <a href="<?= $this->url(array('page' => $page)); ?>"><?= $page; ?></a> | - <?php else: ?> - <?= $page; ?> | - <?php endif; ?> -<?php endforeach; ?> - -<!-- Next page link --> -<?php if (isset($this->next)): ?> - <a href="<?= $this->url(array('page' => $this->next)); ?>"> - Next > - </a> -<?php else: ?> - <span class="disabled">Next ></span> -<?php endif; ?> -</div> -<?php endif; ?> \ No newline at end of file Added: website/application/modules/default/controllers/NewsController.php =================================================================== --- website/application/modules/default/controllers/NewsController.php (rev 0) +++ website/application/modules/default/controllers/NewsController.php 2009-02-14 10:38:19 UTC (rev 506) @@ -0,0 +1,25 @@ +<?php + +class NewsController extends Ostacium_Controller_Action +{ + public function indexAction() + { + $news = $this->_model->getNews(); + $paginator = Zend_Paginator::factory($news); + $paginator->setItemCountPerPage($this->_config->table->perpage); + $paginator->setCurrentPageNumber($this->_getParam('page')); + + $this->view->news = $paginator; + } + + public function viewAction() + { + $id = $this->_getParam('id'); + $entry = $this->_model->getNewsItem($id); + + if ($entry) + $this->view->assign($entry); + else + return $this->_redirect($this->view->url(array(), null, true)); + } +} \ No newline at end of file Added: website/application/modules/default/controllers/UserController.php =================================================================== --- website/application/modules/default/controllers/UserController.php (rev 0) +++ website/application/modules/default/controllers/UserController.php 2009-02-14 10:38:19 UTC (rev 506) @@ -0,0 +1,81 @@ +<?php + +class UserController extends Ostacium_Controller_Action +{ + public function registerAction() + { + $this->_helper->getHelper('viewRenderer')->setNoRender(true); + + $form = new Form_Register(); + + if (!$this->getRequest()->isPost()) + { + echo $form; + return; + } + + if (!$form->isValid($this->getRequest()->getPost())) + { + echo $form; + return; + } + + // check cpassword == password + + $values = $form->getValues(); + $values['ip'] = $this->getRequest()->getIp(); + $code = substr(md5(time()), mt_rand(0, 27), 5); + $result = $this->_model->registerUser($values, $code); + + if (!$result) + { + $form->setDescription($this->view->translate('wrongEmailPwd')); + + echo $form; + } + else + { + $arguments = array('code' => $code, 'fullname' => $values['name'].' '.$values['surname'], 'username' => $values['username']); + $mail = new Ostacium_Mail(); + $mail->setFrom($this->_config->email->from.'@'.$_SERVER["SERVER_NAME"], $this->_config->general->title.' Staff') + ->addTo($values['email'], $values['name'].' '.$values['surname']) + ->setSubject($this->_('registration_email')) + ->setBodyTemplate(array('template' => 'register.phtml', 'arguments' => $arguments)) + ->send(); + + return $this->_redirect($this->view->url(array('action' => 'registered'))); + } + } + + public function registeredAction() + { + + } + + public function activateAction() + { + $username = $this->_getParam('username'); + $code = $this->_getParam('code'); + + $result = $this->_model->activateUser($username, $code); + + if ($result) + { + return $this->render('activated'); + } + else + { + return $this->render('notactivated'); + } + } + + public function viewAction() + { + $username = $this->_getParam('username'); + + if ($username) + $this->view->assign($this->_model->getUser($username)); + else + return $this->_redirect($this->view->url(array(), null, true)); + } +} \ No newline at end of file Property changes on: website/application/modules/default/models ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/modules/default/models/Form ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/default/models/News.php =================================================================== --- website/application/modules/default/models/News.php (rev 0) +++ website/application/modules/default/models/News.php 2009-02-14 10:38:19 UTC (rev 506) @@ -0,0 +1,15 @@ +<?php + +class News extends Ostacium_Model +{ + public function getNews() + { + $news = new Table_News(); + return $news->getAll(); + } + + public function getNewsItem($id) + { + + } +} \ No newline at end of file Property changes on: website/application/modules/default/models/Table ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/default/models/Table/News.php =================================================================== --- website/application/modules/default/models/Table/News.php (rev 0) +++ website/application/modules/default/models/Table/News.php 2009-02-14 10:38:19 UTC (rev 506) @@ -0,0 +1,16 @@ +<?php + +class Table_News extends Ostacium_Db_Table +{ + protected $_name = 'news'; + protected $_primary = 'id'; + + function getAll() + { + return $this->selectLang(array('title', 'teaser')) + ->where('enabled = 1') + ->order('created DESC') + ->query() + ->fetchAll(); + } +} \ No newline at end of file Added: website/application/modules/default/models/Table/Users.php =================================================================== --- website/application/modules/default/models/Table/Users.php (rev 0) +++ website/application/modules/default/models/Table/Users.php 2009-02-14 10:38:19 UTC (rev 506) @@ -0,0 +1,16 @@ +<?php + +class Table_Users extends Ostacium_Db_Table +{ + protected $_name = 'users'; + protected $_primary = 'username'; + + function getUser($username) + { + return $this->select()->setIntegrityCheck(false)->from($this) + ->joinLeft(array('r' => 'roles'), 'r.id=users.roleid', array('role' => 'name')) + ->joinLeft(array('d' => 'usersdetails'), 'd.username=users.username') + ->where('users.username = ?', $username) + ->query()->fetch(); + } +} \ No newline at end of file Added: website/application/modules/default/models/User.php =================================================================== --- website/application/modules/default/models/User.php (rev 0) +++ website/application/modules/default/models/User.php 2009-02-14 10:38:19 UTC (rev 506) @@ -0,0 +1,39 @@ +<?php + +class User extends Ostacium_Model +{ + public function registerUser($data, $code) + { + $data['registered'] = time(); + $data['online'] = $data['registered']; + $data['roleid'] = Zend_Registry::get('config')->general->roleid; + $data['activated'] = $code; + $data['password'] = md5($data['password']); + + $users = new Table_Users(); + $users->insert($data); + + $usersdetails = new Table_UsersDetails(); + $usersdetails->insert($data); + + $usersstats = new Table_UsersStats(); + $usersstats->insert($data); + + return true; + } + + public function activateUser($username, $code) + { + $where = $this->_db->quoteInto('username = ?', $username).' AND activated = ?'; + $where = $this->_db->quoteInto($where, $code); + + $users = new Table_Users(); + return $users->update(array('activated' => null), $where); + } + + public function getUser($username) + { + $users = new Table_Users(); + return $users->getUser($username); + } +} \ No newline at end of file Property changes on: website/application/modules/default/views/scripts/news ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/modules/default/views/scripts/news/entry.phtml =================================================================== --- website/application/modules/default/views/scripts/news/entry.phtml (rev 0) +++ website/application/modules/default/views/scripts/news/entry.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -0,0 +1,5 @@ +<div class="news"> + <div class="title"><a href="<?= $this->url(array('action' => 'view', 'id' => $this->id), null) ?>"><?= $this->title ?></a></div> + <div class="image"><img src="" /></div> + <div class="entry"><?= $this->teaser ?></div> +</div> \ No newline at end of file Added: website/application/modules/default/views/scripts/news/index.phtml =================================================================== --- website/application/modules/default/views/scripts/news/index.phtml (rev 0) +++ website/application/modules/default/views/scripts/news/index.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -0,0 +1,7 @@ +<h2><?= $this->translate('news') ?></h2> +<br /> +<? if (count($this->news)): ?> +<?= $this->partialLoop('news/entry.phtml', $this->news) ?> +<? else: ?> +<div class="error"><?= $this->translate('no_news') ?></div> +<? endif; ?> \ No newline at end of file Added: website/application/modules/default/views/scripts/news/view.phtml =================================================================== --- website/application/modules/default/views/scripts/news/view.phtml (rev 0) +++ website/application/modules/default/views/scripts/news/view.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -0,0 +1,2 @@ +<div> +</div> \ No newline at end of file Property changes on: website/application/view ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/view/helpers ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/view/scripts ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/view/scripts/logedin.phtml =================================================================== --- website/application/view/scripts/logedin.phtml (rev 0) +++ website/application/view/scripts/logedin.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -0,0 +1,4 @@ +<div class="box2 c"> + <h2><?= $this->translate('user_menu') ?></h2> + <a href="<?= $this->url(array('module' => 'acm', 'controller' => 'index', 'action' => 'logout'), null, true) ?>"><?= $this->translate('log_out') ?></a> +</div> \ No newline at end of file Added: website/application/view/scripts/paginator.phtml =================================================================== --- website/application/view/scripts/paginator.phtml (rev 0) +++ website/application/view/scripts/paginator.phtml 2009-02-14 10:38:19 UTC (rev 506) @@ -0,0 +1,30 @@ +<?php if ($this->pageCount): ?> +<div class="paginationControl"> +<!-- Previous page link --> +<?php if (isset($this->previous)): ?> + <a href="<?= $this->url(array('page' => $this->previous)); ?>"> + < Previous + </a> | +<?php else: ?> + <span class="disabled">< Previous</span> | +<?php endif; ?> + +<!-- Numbered page links --> +<?php foreach ($this->pagesInRange as $page): ?> + <?php if ($page != $this->current): ?> + <a href="<?= $this->url(array('page' => $page)); ?>"><?= $page; ?></a> | + <?php else: ?> + <?= $page; ?> | + <?php endif; ?> +<?php endforeach; ?> + +<!-- Next page link --> +<?php if (isset($this->next)): ?> + <a href="<?= $this->url(array('page' => $this->next)); ?>"> + Next > + </a> +<?php else: ?> + <span class="disabled">Next ></span> +<?php endif; ?> +</div> +<?php endif; ?> \ No newline at end of file Modified: website/config/config.ini =================================================================== --- website/config/config.ini 2009-02-14 01:29:23 UTC (rev 505) +++ website/config/config.ini 2009-02-14 10:38:19 UTC (rev 506) @@ -48,7 +48,8 @@ view.encoding = "UTF-8" view.helperPathPrefix = "Ostacium_View_Helper" -view.helperPath = "/library/Ostacium/View/Helper" +view.helperPath = "Ostacium/View/Helper" +view.scriptPath = "application/view/scripts/" log.table = "log" log.columnMap.type = "priorityName" @@ -77,7 +78,8 @@ crud.perpage = "25" -calc.acm.penalty = "20" +acm.calc.penalty = "20" +acm, [development: general] Modified: website/httpdocs/index.php =================================================================== --- website/httpdocs/index.php 2009-02-14 01:29:23 UTC (rev 505) +++ website/httpdocs/index.php 2009-02-14 10:38:19 UTC (rev 506) @@ -3,10 +3,10 @@ error_reporting(E_ALL); ini_set('display_errors', 1); -$_docroot = dirname($_SERVER["DOCUMENT_ROOT"]); +//$_docroot = dirname($_SERVER["DOCUMENT_ROOT"]); $_approot = dirname(__FILE__); -require_once $_docroot . '/library/Application.php'; +require_once 'Application.php'; $app = new Application($_approot); $app->setEnvironment('development'); Modified: website/lang/uk.csv =================================================================== --- website/lang/uk.csv 2009-02-14 01:29:23 UTC (rev 505) +++ website/lang/uk.csv 2009-02-14 10:38:19 UTC (rev 506) @@ -58,6 +58,15 @@ timus_handle;Timus handle not_specified;Не вказано +id;ID +start;Початок +end;Кінець +options;Опції +rank;Ранк + +news;Новини +no_news;Немає Новин + # Errors error_other;There was unknow error, please contact administrator Modified: website/library/Application.php =================================================================== --- website/library/Application.php 2009-02-14 01:29:23 UTC (rev 505) +++ website/library/Application.php 2009-02-14 10:38:19 UTC (rev 506) @@ -188,7 +188,8 @@ $_config = Zend_Registry::get('config'); $options = $_config->view->toArray(); - $options['helperPath'] = self::$_docroot . '/' . $options['helperPath']; + //$options['helperPath'] = self::$_docroot . '/' . $options['helperPath']; + $options['scriptPath'] = self::$_docroot . '/' . $options['scriptPath']; $view = new Zend_View($options); // Setup DocType Modified: website/library/Ostacium/Controller/Router/Route/Language.php =================================================================== --- website/library/Ostacium/Controller/Router/Route/Language.php 2009-02-14 01:29:23 UTC (rev 505) +++ website/library/Ostacium/Controller/Router/Route/Language.php 2009-02-14 10:38:19 UTC (rev 506) @@ -16,7 +16,7 @@ parent::__construct($defaults, $dispatcher, $request); $this->translate = Zend_Registry::get('Zend_Translate'); - $this->locale = Zend_Registry::get('Zend_Locale'); + $this->locale =& Zend_Registry::get('Zend_Locale'); $this->config = Zend_Registry::get('config'); $this->extention = $extention; } @@ -90,7 +90,7 @@ $this->_setRequestKeys(); } - $params = (!$reset) ? $this->_values : array(); + $params = (!$reset) ? $this->_values : array($this->_languageKey => $this->locale->toString()); foreach ($data as $key => $value) { if ($value !== null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pan...@us...> - 2009-02-14 17:20:54
|
Revision: 510 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=510&view=rev Author: panzaboi Date: 2009-02-14 17:20:44 +0000 (Sat, 14 Feb 2009) Log Message: ----------- Updates Modified Paths: -------------- website/config/config.ini website/library/Application.php Added Paths: ----------- website/application/models/ website/application/models/Form/ website/application/models/Form/SmallLogin.php Property changes on: website/application/models ___________________________________________________________________ Added: tsvn:logminsize + 5 Property changes on: website/application/models/Form ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: website/application/models/Form/SmallLogin.php =================================================================== --- website/application/models/Form/SmallLogin.php (rev 0) +++ website/application/models/Form/SmallLogin.php 2009-02-14 17:20:44 UTC (rev 510) @@ -0,0 +1,85 @@ +<?php + +class Form_SmallLogin extends Zend_Dojo_Form +{ + public $elementDecorators = array( + 'DijitElement', + array('Label', array('class' => 'label2')), + array('HtmlTag', array('tag' => 'div', 'class' => 'line')) + ); + + public $buttonDecorators = array( + 'DijitElement', + array('HtmlTag', array('tag' => 'div', 'class' => 'line tr')) + ); + + public function init() + { + $translate = Zend_Registry::get('Zend_Translate'); + $router = Zend_Controller_Front::getInstance()->getRouter(); + + $this->setAction($router->assemble(array('action' => 'login', 'controller' => 'index'), null)); + $this->setMethod('post'); + $this->setName('loginform'); + $this->setAttrib('class', '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, + 'regExp' => '[\w]{5,50}', + 'invalidMessage' => sprintf($translate->_('enter_username_between'), 5, 50), + 'title' => $translate->_('username'), + 'label' => $translate->_('username').':', + 'class' => 'text', + )); + + $this->addElement('PasswordTextBox', 'password', array( + 'decorators' => $this->elementDecorators, + 'filters' => array('StringTrim'), + 'validators' => array( + 'Alnum', + array('StringLength', false, array(5, 32)), + ), + 'required' => true, + 'trim' => true, + 'regExp' => '[\S]{5,32}', + 'invalidMessage' => sprintf($translate->_('enter_password_between'), 5, 32), + 'title' => $translate->_('password'), + 'label' => $translate->_('password').':', + 'class' => 'text', + )); + + $this->addElement('Button', 'signupbutton', array( + 'decorators' => $this->buttonDecorators, + 'required' => false, + 'ignore' => true, + 'label' => $translate->_('signup'), + 'class' => 'signup2', + 'onclick' => 'return goToUrl("'.$router->assemble(array('action' => 'register', 'controller' => 'user'), null).'")' + )); + + $this->addElement('SubmitButton', 'loginbutton', array( + 'decorators' => $this->buttonDecorators, + 'required' => false, + 'ignore' => true, + 'label' => $translate->_('login'), + 'class' => 'submit2' + )); + } + + public function loadDefaultDecorators() + { + $this->setDecorators(array( + 'FormElements', + 'DijitForm', + array('HtmlTag', array('tag' => 'div', 'class' => 'box2 c')) + )); + } +} \ No newline at end of file Modified: website/config/config.ini =================================================================== --- website/config/config.ini 2009-02-14 11:04:36 UTC (rev 509) +++ website/config/config.ini 2009-02-14 17:20:44 UTC (rev 510) @@ -70,6 +70,7 @@ general.titlesep = " - " general.extention = "html" general.roleid = "2" +general.defaultmodelspath = "/application/models/"; front.defaultmodule = "default" Modified: website/library/Application.php =================================================================== --- website/library/Application.php 2009-02-14 11:04:36 UTC (rev 509) +++ website/library/Application.php 2009-02-14 17:20:44 UTC (rev 510) @@ -61,13 +61,6 @@ protected function _initialize() { - // Set Include paths - set_include_path( - self::$_docroot . PATH_SEPARATOR - . self::$_docroot . '/application' . PATH_SEPARATOR - . get_include_path() - ); - // Auto-loader require_once 'Zend/Loader.php'; Zend_Loader::registerAutoload(); @@ -78,6 +71,12 @@ // Setup Config $_config = $this->_setupConfig(); + // Set Include paths + set_include_path( + self::$_docroot . $_config->general->defaultmodelspath . PATH_SEPARATOR . + get_include_path() + ); + // Setup DB $this->_setupDB(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pan...@us...> - 2009-03-01 10:02:35
|
Revision: 513 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=513&view=rev Author: panzaboi Date: 2009-03-01 10:02:26 +0000 (Sun, 01 Mar 2009) Log Message: ----------- 1) Move from Dojo to JQuery 2) Basic functionality of Contest 3) Moved authorication out of ACM module into Default 4) Added Virtual Contest basic functionality 5) Admin Structure (proposal) 6) Configuration possibility to add helper paths 7) Added View Helpers for Text and TextArea to support languages tab. Modified Paths: -------------- website/application/layouts/layout.phtml website/application/models/Form/SmallLogin.php website/application/modules/acm/controllers/ContestController.php website/application/modules/acm/controllers/IndexController.php website/application/modules/acm/models/Archive.php website/application/modules/acm/models/Contest.php website/application/modules/acm/models/Form/Submit.php website/application/modules/acm/models/Table/Challenges.php website/application/modules/acm/models/Table/Contests.php website/application/modules/acm/views/scripts/contest/contest.phtml website/application/modules/acm/views/scripts/contest/index.phtml website/application/modules/admin/layouts/layout.phtml website/application/modules/admin/models/Form/Settings.php website/application/modules/admin/views/scripts/crud/list.phtml website/application/modules/default/controllers/IndexController.php website/application/modules/default/controllers/NewsController.php website/config/config.ini website/httpdocs/index.php website/httpdocs/scripts/main.js website/httpdocs/styles/style.css website/lang/en.csv website/lang/uk.csv website/library/Application.php website/library/Ostacium/Controller/Action/Crud.php website/library/Ostacium/Controller/Action.php website/library/Ostacium/Controller/Plugin/ErrorHandler.php website/library/Ostacium/Db/Table/Crud.php website/library/Ostacium/Db/Table.php Added Paths: ----------- website/application/models/Form/Login.php website/application/modules/acm/models/Form/Contest.php website/application/modules/acm/models/Form/ContestProblems.php website/application/modules/acm/models/Table/ContestsChallenges.php website/application/modules/acm/models/Table/ContestsLang.php website/application/modules/acm/views/scripts/contest/add.phtml website/application/modules/acm/views/scripts/contest/addproblems.phtml website/application/modules/acm/views/scripts/contest/problementry.phtml website/application/modules/admin/controllers/ProblemsController.php website/application/modules/admin/models/Form/Problems.php website/application/modules/admin/models/Table/Problems.php website/application/modules/admin/views/scripts/crud/new.phtml website/application/modules/default/models/Form/Register.php website/application/modules/default/models/Index.php website/httpdocs/images/acm/calendar.png website/httpdocs/styles/theme/ website/httpdocs/styles/theme/images/ website/httpdocs/styles/theme/images/ui-bg_diagonals-small_0_aaaaaa_40x40.png website/httpdocs/styles/theme/images/ui-bg_diagonals-thick_15_444444_40x40.png website/httpdocs/styles/theme/images/ui-bg_glass_100_f0f0f0_1x400.png website/httpdocs/styles/theme/images/ui-bg_glass_50_99c2ff_1x400.png website/httpdocs/styles/theme/images/ui-bg_glass_55_fbf5d0_1x400.png website/httpdocs/styles/theme/images/ui-bg_glass_80_e6e6e6_1x400.png website/httpdocs/styles/theme/images/ui-bg_glass_95_fef1ec_1x400.png website/httpdocs/styles/theme/images/ui-bg_highlight-hard_100_f9f9f9_1x100.png website/httpdocs/styles/theme/images/ui-bg_highlight-soft_100_e7eef3_1x100.png website/httpdocs/styles/theme/images/ui-icons_222222_256x240.png website/httpdocs/styles/theme/images/ui-icons_2694e8_256x240.png website/httpdocs/styles/theme/images/ui-icons_2e83ff_256x240.png website/httpdocs/styles/theme/images/ui-icons_72a7cf_256x240.png website/httpdocs/styles/theme/images/ui-icons_888888_256x240.png website/httpdocs/styles/theme/images/ui-icons_cd0a0a_256x240.png website/httpdocs/styles/theme/images/ui-icons_ffffff_256x240.png website/httpdocs/styles/theme/ui.accordion.css website/httpdocs/styles/theme/ui.all.css website/httpdocs/styles/theme/ui.base.css website/httpdocs/styles/theme/ui.core.css website/httpdocs/styles/theme/ui.datepicker.css website/httpdocs/styles/theme/ui.dialog.css website/httpdocs/styles/theme/ui.progressbar.css website/httpdocs/styles/theme/ui.resizable.css website/httpdocs/styles/theme/ui.slider.css website/httpdocs/styles/theme/ui.tabs.css website/httpdocs/styles/theme/ui.theme.css website/library/Ostacium/Form/Crud.php website/library/Ostacium/Form/Element/ website/library/Ostacium/Form/Element/Text.php website/library/Ostacium/Form/Element/Textarea.php website/library/Ostacium/View/Helper/FormText.php website/library/Ostacium/View/Helper/FormTextarea.php Removed Paths: ------------- website/application/modules/acm/models/Form/Login.php website/application/modules/acm/models/Form/Register.php website/application/modules/acm/models/Form/SmallLogin.php website/application/modules/acm/models/Index.php website/application/view/ website/library/Ostacium/Dojo/ Property Changed: ---------------- website/httpdocs/scripts/ Modified: website/application/layouts/layout.phtml =================================================================== --- website/application/layouts/layout.phtml 2009-02-27 23:53:06 UTC (rev 512) +++ website/application/layouts/layout.phtml 2009-03-01 10:02:26 UTC (rev 513) @@ -1,26 +1,22 @@ <?php -$loggedin = Zend_Auth::getInstance()->getIdentity(); - -if ($loggedin) +if ($this->isLoggedIn()) { $form = $this->partial('logedin.phtml'); } -elseif (!$this->dojo()->hasDijit('loginform')) +else { $form = (new Form_SmallLogin()); $form = $form->render(); } -else $form = ''; ?> - <?= $this->doctype() ?> -<? $this->dojo()->enable() - ->setDjConfigOption('parseOnLoad', true) - ->registerModulePath('custom', '../custom/') - ->requireModule('dijit.form.FilteringSelect') +<? $this->jquery()->enable() + //->setDjConfigOption('parseOnLoad', true) + //->registerModulePath('custom', '../custom/') + //->requireModule('dijit.form.FilteringSelect') ->addOnLoad('init'); ?> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="description" content="Site description" /> <meta name="keywords" content="key, words" /> @@ -29,22 +25,26 @@ <?= $this->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8') ?> <?= $this->headLink()->appendStylesheet('/styles/style.css') ?> <?= $this->headLink()->appendStylesheet('/styles/prettify.css') ?> - <?= $this->headScript()->appendFile('/scripts/main.js') ?> + <? $this->headScript()->appendFile('/scripts/main.js') ?> <?= $this->headScript()->appendFile('/scripts/prettify.js') ?> <? - if ($this->dojo()->isEnabled()): - $this->dojo()->setLocalPath('/scripts/dojo/dojo.js') - ->addStyleSheetModule('dijit.themes.tundra'); + if ($this->jquery()->isEnabled()): + $this->jquery()->setLocalPath('/scripts/jquery/jquery-1.3.2.min.js') + ->setUiLocalPath('/scripts/jquery/jquery-ui-1.6rc6.min.js') + ->addStylesheet('/styles/theme/ui.all.css'); + //$this->dojo()->setLocalPath('/scripts/dojo/dojo/dojo.js') + /*$this->dojo()->setCdnBase(Zend_Dojo::CDN_BASE_GOOGLE) + ->setCdnVersion("1.2")*/ + // ->addStyleSheetModule('dijit.themes.nihilo'); - echo $this->dojo(); + echo $this->jquery(); endif; ?> - <base href="<?= 'http://' . $_SERVER["HTTP_HOST"] . $this->baseUrl() ?>/" /> </head> -<body class="tundra"> +<body> <div id="wrapper"> <div id="header"> <a href="<?= $this->url(array('module' => 'acm'), null, true) ?>"><img src="images/logo.png" id="logo" /></a> @@ -78,19 +78,9 @@ <li><a href="<?= $this->url(array('module' => 'acm', 'controller' => 'archive', 'action' => 'results'), null, true) ?>">Результати</a></li> </ul> </li> - <li> - <a href="<?= $this->url(array('module' => 'acm', 'controller' => 'contest', 'action' => 'index'), null, true) ?>">Контести</a> - </li> - <li> - <a href="#Archieve" onclick="return toggle('sub3');">Віртуальні Контести</a> - <ul id="sub3"> - <li><a href="#Problems">Створити</a></li> - <li><a href="#Problems">Зареєструватись</a></li> - <li><a href="#Problems">Набір Завдань</a></li> - <li><a href="#Results">Результати</a></li> - </ul> - </li> - <li><a href="#contact">Contact</a></li> + <li><a href="<?= $this->url(array('module' => 'acm', 'controller' => 'contest', 'action' => 'index'), null, true) ?>">Контести</a></li> + <li><a href="<?= $this->url(array('module' => 'acm', 'controller' => 'contest', 'action' => 'index', 'virtual' => '1'), null, true) ?>">Віртуальні Контести</a></li> + <li><a href="#contact">Контакти</a></li> </ul> <!--<div class="box2 c"> @@ -114,14 +104,14 @@ </div> </div> - <div id="clear"></div> + <div class="clear"></div> </div> <div id="footer"> <p> - Copyright 2009 ACM. Designed by <a href="#" rel="external">panza</a>. Valid <a href="http://jigsaw.w3.org/css-validator/check/referer" rel="external">CSS</a> & <a href="http://validator.w3.org/check?uri=referer" rel="external">XHTML</a> + Copyright 2009 ACM. Developed by <a href="http://panzaboi.com/">panza</a>. Valid <a href="http://jigsaw.w3.org/css-validator/check/referer" rel="external">CSS</a> & <a href="http://validator.w3.org/check?uri=referer" rel="external">XHTML</a> <br /> <!--<?= $this->debugInfo(true) ?>--> </p> Added: website/application/models/Form/Login.php =================================================================== --- website/application/models/Form/Login.php (rev 0) +++ website/application/models/Form/Login.php 2009-03-01 10:02:26 UTC (rev 513) @@ -0,0 +1,75 @@ +<?php + +class Form_Login extends ZendX_JQuery_Form +{ + public $elementDecorators = array( + 'ViewHelper', + 'Errors', + array('Label', array('class' => 'label')), + array('HtmlTag', array('tag' => 'div', 'class' => 'line')) + ); + + public $buttonDecorators = array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'div', 'class' => 'line tr')) + ); + + public function init() + { + $translate = Zend_Registry::get('Zend_Translate'); + $router = Zend_Controller_Front::getInstance()->getRouter(); + + $this->setAction($router->assemble(array('module' => 'default', 'controller' => 'index', 'action' => 'login'), null, true)); + $this->setMethod('post'); + $this->setName('loginform'); + $this->setAttrib('class', 'form'); + + $this->addElement('text', 'username', array( + 'decorators' => $this->elementDecorators, + 'filters' => array('StringTrim', 'StringToLower'), + 'validators' => array( + 'Alnum', + array('StringLength', false, array(5, 50)), + ), + 'required' => true, + 'title' => $translate->_('username'), + 'label' => $translate->_('username').':', + 'class' => 'text', + )); + + $this->addElement('password', 'password', array( + 'decorators' => $this->elementDecorators, + 'filters' => array('StringTrim'), + 'validators' => array( + 'Alnum', + array('StringLength', false, array(5, 32)), + ), + 'required' => true, + 'title' => $translate->_('password'), + 'label' => $translate->_('password').':', + 'class' => 'text', + )); + + $this->addElement('submit', 'loginbutton', array( + 'decorators' => $this->buttonDecorators, + 'required' => false, + 'ignore' => true, + 'label' => $translate->_('login'), + 'class' => 'submit' + )); + } + + public function loadDefaultDecorators() + { + $this->addPrefixPath('Ostacium_Form_Decorator', 'Ostacium/Form/Decorator', 'Decorator'); + $translate = Zend_Registry::get('Zend_Translate'); + + $this->setDecorators(array( + 'FormElements', + 'Form', + array('Description', array('placement' => 'prepend', 'tag' => 'div', 'class' => 'error')), + array(array('h2' => 'HtmlTag'), array('tag' => 'h2', 'placement' => 'prepend', 'markup' => $translate->_('login'))), + array(array('div' => 'HtmlTag'), array('tag' => 'div', 'class' => 'box c')) + )); + } +} \ No newline at end of file Modified: website/application/models/Form/SmallLogin.php =================================================================== --- website/application/models/Form/SmallLogin.php 2009-02-27 23:53:06 UTC (rev 512) +++ website/application/models/Form/SmallLogin.php 2009-03-01 10:02:26 UTC (rev 513) @@ -1,15 +1,15 @@ <?php -class Form_SmallLogin extends Zend_Dojo_Form +class Form_SmallLogin extends ZendX_JQuery_Form { public $elementDecorators = array( - 'DijitElement', + 'ViewHelper', array('Label', array('class' => 'label2')), array('HtmlTag', array('tag' => 'div', 'class' => 'line')) ); public $buttonDecorators = array( - 'DijitElement', + 'ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'line tr')) ); @@ -18,29 +18,25 @@ $translate = Zend_Registry::get('Zend_Translate'); $router = Zend_Controller_Front::getInstance()->getRouter(); - $this->setAction($router->assemble(array('action' => 'login', 'controller' => 'index'), null)); + $this->setAction($router->assemble(array('module' => 'default', 'controller' => 'index', 'action' => 'login'), null, true)); $this->setMethod('post'); $this->setName('loginform'); $this->setAttrib('class', 'form'); - $this->addElement('ValidationTextBox', 'username', array( + $this->addElement('text', 'username', array( 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim', 'StringToLower'), 'validators' => array( - array('StringLength', false, array(5, 50)), + 'Alnum', + array('StringLength', false, array(5, 50)) ), 'required' => true, - 'maxlength' => 50, - 'trim' => true, - 'lowercase' => true, - 'regExp' => '[\w]{5,50}', - 'invalidMessage' => sprintf($translate->_('enter_username_between'), 5, 50), 'title' => $translate->_('username'), 'label' => $translate->_('username').':', 'class' => 'text', )); - $this->addElement('PasswordTextBox', 'password', array( + $this->addElement('password', 'password', array( 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'validators' => array( @@ -48,24 +44,21 @@ array('StringLength', false, array(5, 32)), ), 'required' => true, - 'trim' => true, - 'regExp' => '[\S]{5,32}', - 'invalidMessage' => sprintf($translate->_('enter_password_between'), 5, 32), 'title' => $translate->_('password'), 'label' => $translate->_('password').':', 'class' => 'text', )); - $this->addElement('Button', 'signupbutton', array( + $this->addElement('button', 'signupbutton', array( 'decorators' => $this->buttonDecorators, 'required' => false, 'ignore' => true, 'label' => $translate->_('signup'), 'class' => 'signup2', - 'onclick' => 'return goToUrl("'.$router->assemble(array('action' => 'register', 'controller' => 'user'), null).'")' + 'onclick' => 'return goToUrl("'.$router->assemble(array('module' => 'default', 'controller' => 'user', 'action' => 'register'), null, true).'")' )); - $this->addElement('SubmitButton', 'loginbutton', array( + $this->addElement('submit', 'loginbutton', array( 'decorators' => $this->buttonDecorators, 'required' => false, 'ignore' => true, @@ -78,7 +71,7 @@ { $this->setDecorators(array( 'FormElements', - 'DijitForm', + 'Form', array('HtmlTag', array('tag' => 'div', 'class' => 'box2 c')) )); } Modified: website/application/modules/acm/controllers/ContestController.php =================================================================== --- website/application/modules/acm/controllers/ContestController.php 2009-02-27 23:53:06 UTC (rev 512) +++ website/application/modules/acm/controllers/ContestController.php 2009-03-01 10:02:26 UTC (rev 513) @@ -1,46 +1,123 @@ <?php class Acm_ContestController extends Ostacium_Controller_Action -{ +{ + public function init($loadModel = true) + { + parent::init($loadModel); + + $ajaxContext = $this->_helper->getHelper('AjaxContext'); + $ajaxContext->addActionContext('addproblemAction', 'html') + ->addActionContext('delproblemAction', 'html') + ->initContext(); + } + public function indexAction() { - $contests = $this->_model->getContests(); + $virtual = (bool)$this->_getParam('virtual', false); + + $contests = $this->_model->getContests($virtual); + $paginator = Zend_Paginator::factory($contests); $paginator->setItemCountPerPage($this->_config->table->perpage); $paginator->setCurrentPageNumber($this->_getParam('page')); $this->view->contests = $paginator; + $this->view->virtual = $virtual; } - public function newAction() - { + public function addAction() + { + if (!$this->isAdminOrVirtual()) + return $this->_redirect($this->view->url(array('action' => 'index'), null)); + $this->view->form = new Form_Contest(); + + if (!$this->getRequest()->isPost()) + { + return; + } + + if (!$this->view->form->isValid($this->getRequest()->getPost())) + { + return; + } + + $values = $this->view->form->getValues(); + $values['virtual'] = (bool)$this->_getParam('virtual', false); + + $id = $this->_model->addContest($values); + return $this->_redirect($this->view->url(array('action' => 'addproblems', 'contestid' => $id, 'message' => 'successfully_added'), null)); } - public function addAction() + public function addproblemsAction() + { + $virtual = (bool)$this->_getParam('virtual', false); + $contestid = $this->_getParam('contestid'); + + if (!$this->isAdminOrVirtual() || !$contestid || !$this->_model->existsContest($contestid, $virtual)) + return $this->_redirect($this->view->url(array('action' => 'index'), null)); + + $this->view->form = new Form_ContestProblems(); + $this->view->problems = $this->_model->getChallenges($contestid, $virtual); + $this->view->contestid = $contestid; + $this->view->virtual = $virtual; + + if (!$this->getRequest()->isPost()) + return; + + if (!$this->view->form->isValid($this->getRequest()->getPost())) + return; + + $values = $this->view->form->getValues(); + } + + public function addproblemAction() { + $this->_helper->getHelper('viewRenderer')->setNoRender(true); + $id = $this->_getParam('id'); + $contestid = $this->_getParam('contestid'); + $virtual = $this->_getParam('virtual'); + + if (!$this->isAdminOrVirtual() || !$contestid || !$this->_model->existsContest($contestid, $virtual)) + return $this->_redirect($this->view->url(array('action' => 'index'), null)); + + if ($this->getRequest()->isXmlHttpRequest() || 1) + { + $add = $this->_model->addProblemToContest($id, $contestid); + + echo (int)$add; + exit; + } + else + { + + } } - /* - public function registerAction() + + public function delproblemAction() { - $contestid = $this->_getParam('contestid'); - - if (!$this->_model->isContestRunning($contestid)) - { - return $this->render('notrun'); - } + $id = $this->_getParam('id'); + $contestid = $this->_getParam('contestid'); + $virtual = $this->_getParam('virtual'); + + if (!$this->isAdminOrVirtual() || !$contestid || !$this->_model->existsContest($contestid, $virtual)) + return $this->_redirect($this->view->url(array('action' => 'index'), null)); + + if ($this->getRequest()->isXmlHttpRequest()) + { + $remove = $this->_model->removeProblemFromContest($id, $contestid); + + echo (int)$remove; + exit; + } + else + { + + } + } - if ($this->_model->isInContest($contestid)) - { - return $this->render('incontest'); - } - - $this->_model->registerUser($contestid); - - return $this->render('registered'); - } - */ public function viewAction() { $id = $this->_getParam('id'); @@ -69,14 +146,20 @@ public function problemsetAction() { + $virtual = (bool)$this->_getParam('virtual', false); $contestid = $this->_getParam('contestid'); - /*if (!$this->_model->isInContest($contestid)) - { - return $this->render('notincontest'); - }*/ - - $this->view->challenges = $this->_model->getChallenges($contestid); + $challenges = $this->_model->getChallenges($contestid, $virtual); + + if (!$challenges) + return $this->_forward('index', null, null, $this->_getAllParams() + array('message' => 'noProblem')); + + $paginator = Zend_Paginator::factory($challenges); + $paginator->setItemCountPerPage($this->_config->table->perpage); + $paginator->setCurrentPageNumber($this->_getParam('page')); + + $this->view->challenges = $paginator; + $this->view->virtual = $virtual; } public function submitAction() @@ -170,4 +253,12 @@ $this->view->challenges = $this->_model->getChallenges($contestid); $this->view->table = $this->_model->getTable($contestid); } + + protected function isAdminOrVirtual() + { + $virtual = (bool)$this->_getParam('virtual', false); + $user = Zend_Auth::getInstance()->getIdentity(); + + return ($user->role == 'admin' || $virtual == true); + } } \ No newline at end of file Modified: website/application/modules/acm/controllers/IndexController.php =================================================================== --- website/application/modules/acm/controllers/IndexController.php 2009-02-27 23:53:06 UTC (rev 512) +++ website/application/modules/acm/controllers/IndexController.php 2009-03-01 10:02:26 UTC (rev 513) @@ -6,60 +6,4 @@ { var_dump('sadfasdf'); } - - public function loginAction() - { - $this->_helper->getHelper('viewRenderer')->setNoRender(true); - - $form = new Form_Login(); - if ($this->_getParam('message')) - { - $form->setDescription($this->view->translate($this->_getParam('message'))); - $this->view->message = null; - } - - if (!$this->getRequest()->isPost()) - { - echo $form; - - return; - } - - if (!$form->isValid($this->getRequest()->getPost())) - { - echo $form; - - return; - } - - $values = $form->getValues(); - - $result = $this->_model->authoricate($values); - - if (!$result) - { - $form->setDescription($this->view->translate('error_bad_login')); - echo $form; - - return; - } - - $redirect = new Zend_Session_Namespace('Redirect'); - if ($redirect->to) - { - $this->getRequest()->setParam('redirect', $redirect->to); - $redirect->unsetAll(); - } - else - { - return $this->_redirect('/acm/index/index'); - } - } - - public function logoutAction() - { - Zend_Auth::getInstance()->clearIdentity(); - - $this->_redirect('/acm/index/index'); - } } \ No newline at end of file Modified: website/application/modules/acm/models/Archive.php =================================================================== --- website/application/modules/acm/models/Archive.php 2009-02-27 23:53:06 UTC (rev 512) +++ website/application/modules/acm/models/Archive.php 2009-03-01 10:02:26 UTC (rev 513) @@ -28,7 +28,7 @@ public function getStatus($id) { - $username = Zend_Auth::getInstance()->getStorage()->read()->username; + $username = Zend_Auth::getInstance()->getIdentity()->username; $archresults = new Table_ArchiveResults(); return $archresults->get(array($username, $id)); @@ -38,7 +38,7 @@ { $data = array( 'contestid' => 0, - 'username' => Zend_Auth::getInstance()->getStorage()->read()->username, + 'username' => Zend_Auth::getInstance()->getIdentity()->username, 'challengeid' => (int)$values['id'], 'codelangid' => $values['languageid'], 'firsttest' => $values['firsttest'], Modified: website/application/modules/acm/models/Contest.php =================================================================== --- website/application/modules/acm/models/Contest.php 2009-02-27 23:53:06 UTC (rev 512) +++ website/application/modules/acm/models/Contest.php 2009-03-01 10:02:26 UTC (rev 513) @@ -15,40 +15,28 @@ $this->calc = $calc; } - public function getContests() + public function getContests($virtual) { $contests = new Table_Contests(); - return $contests->getAll(); + return $contests->getAll($virtual); } - /* - public function registerUser($id) - { - $username = Zend_Auth::getInstance()->getStorage()->read()->username; - - $ca = new Table_ContestsApplicants(); - $ca->insert(array('username' => $username, 'contestid' => $id)); - - return true; - } - */ + public function isContestRunning($contestid) { $contest = new Table_Contests(); return $contest->isRunning($contestid); } - /* - public function isInContest($contestid) + + public function existsContest($contestid, $virtual) { - $username = Zend_Auth::getInstance()->getStorage()->read()->username; $contest = new Table_Contests(); - - return $contest->isInContest($contestid, $username); + return $contest->exists($contestid, $virtual); } - */ - public function getChallenges($contestid) + + public function getChallenges($contestid, $virtual) { $challenges = new Table_Challenges(); - return $challenges->getAllFromContest($contestid); + return $challenges->getAllFromContest($contestid, $virtual); } public function getChallenge($id, $contestid) @@ -63,11 +51,54 @@ return $submits->getFromContest($id, $contestid); } + public function addContest($values) + { + $data = array( + 'start' => strtotime($values['start_date'].$values['start_time'].(Zend_Auth::getInstance()->getIdentity()->timeoffset)), + 'end' => strtotime($values['end_date'].$values['end_time'].(Zend_Auth::getInstance()->getIdentity()->timeoffset)), + 'enabled' => (int)$values['enabled'], + 'virtual' => (int)$values['virtual'], + 'author' => Zend_Auth::getInstance()->getIdentity()->username + ); + + $contest = new Table_Contests(); + $contestlang = new Table_ContestsLang(); + + $id = $contest->insert($data); + $languages = Zend_Registry::get('Zend_Translate')->getList(); + + foreach ($languages as $lang) + { + $langdata = array( + 'id' => $id, + 'langcode' => $lang, + 'name' => $values['name'][$lang], + 'description' => $values['description'][$lang] + ); + + $contestlang->insert($langdata); + } + + return $id; + } + + public function addProblemToContest($id, $contestid) + { + $contestsch = new Table_ContestsChallenges(); + return $contestsch->insert(array('contestid' => $contestid, 'challengeid' => $id)); + } + + public function removeProblemFromContest($id, $contestid) + { + $contestsch = new Table_ContestsChallenges(); + return $contestsch->delete(array('contestid' => $contestid, 'challengeid' => $id)); + } + public function addSubmit($values) { $data = array( 'contestid' => $values['contestid'], - 'username' => Zend_Auth::getInstance()->getStorage()->read()->username, + 'username' => Zend_Auth::getInstance()->getIdentity()->username, 'challengeid' => (int)$values['id'], 'codelangid' => $values['languageid'], 'firsttest' => $values['firsttest'], Added: website/application/modules/acm/models/Form/Contest.php =================================================================== --- website/application/modules/acm/models/Form/Contest.php (rev 0) +++ website/application/modules/acm/models/Form/Contest.php 2009-03-01 10:02:26 UTC (rev 513) @@ -0,0 +1,133 @@ +<?php + +class Form_Contest extends ZendX_JQuery_Form +{ + public $elementDecorators = array( + 'ViewHelper', + 'Errors', + array('Label', array('class' => 'label')), + array('HtmlTag', array('tag' => 'div', 'class' => 'elcontainer')) + ); + + public $buttonDecorators = array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'div', 'class' => 'elcontainer tc')) + ); + + public function init() + { + $translate = Zend_Registry::get('Zend_Translate'); + $db = Zend_Registry::get('db'); + $router = Zend_Controller_Front::getInstance()->getRouter(); + + $this->setAction($router->assemble(array('action' => 'add'), null)); + $this->setMethod('post'); + $this->setName('registerform'); + $this->setAttrib('class', 'registerform c'); + + $this->addPrefixPath('Ostacium_Form_Element', 'Ostacium/Form/Element', Zend_Form::ELEMENT); + + $this->addElement('text', 'name', array( + 'decorators' => $this->elementDecorators, + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(5, 50)), + ), + 'required' => true, + //'invalidMessage' => sprintf($translate->_('enter_username_between'), 5, 50), + 'title' => $translate->_('username'), + 'label' => $translate->_('username').':', + 'class' => 'text', + 'useLanguages' => true, + )); + + $this->addElement('textarea', 'description', array( + 'decorators' => $this->elementDecorators, + 'filters' => array('StringTrim'), + 'required' => true, + 'title' => $translate->_('username'), + 'label' => $translate->_('username').':', + 'class' => 'text', + 'rows' => '10', + 'useLanguages' => true, + )); + + $this->addElement('DatePicker', 'start_date', array( + 'decorators' => $this->elementDecorators, + 'required' => true, + //'invalidMessage' => $translate->_('invalidDate'), + 'title' => $translate->_('start_date'), + 'label' => $translate->_('start_date').': ', + 'dateFormat' => 'dd.mm.yy', + 'jQueryParams' => array( + 'appendText' => '(dd.mm.yyyy)', + 'showAnim' => 'slideDown', + 'speed' => 'fast', + 'minDate' => 0, + 'beforeShow' => 'customRange' + ) + //'locale' => Zend_Registry::get('Zend_Locale'), + )); + + $this->addElement('text', 'start_time', array( + 'decorators' => $this->elementDecorators, + 'required' => true, + /*'invalidMessage' => $translate->_('invalidTime'), + 'visibleRange' => 'T10:00:00', + 'visibleIncrement' => 'T01:00:00', + 'clickableIncrement' => 'T01:00:00',*/ + 'title' => $translate->_('start_time'), + 'label' => $translate->_('start_time').': ', + )); + + $this->addElement('DatePicker', 'end_date', array( + 'decorators' => $this->elementDecorators, + 'required' => true, + //'invalidMessage' => $translate->_('invalidDate'), + 'title' => $translate->_('end_date'), + 'label' => $translate->_('end_date').': ', + 'dateFormat' => 'dd.mm.yy', + 'jQueryParams' => array( + 'appendText' => '(dd.mm.yyyy)', + 'showAnim' => 'slideDown', + 'speed' => 'fast', + 'minDate' => 0, + 'beforeShow' => 'customRange' + ) + )); + + $this->addElement('text', 'end_time', array( + 'decorators' => $this->elementDecorators, + 'required' => true, + /*'invalidMessage' => $translate->_('invalidTime'), + 'visibleRange' => 'T10:00:00', + 'visibleIncrement' => 'T01:00:00', + 'clickableIncrement' => 'T01:00:00',*/ + 'title' => $translate->_('end_time'), + 'label' => $translate->_('end_time').': ', + )); + + $this->addElement('checkbox', 'enabled', array( + 'decorators' => $this->elementDecorators, + 'title' => $translate->_('enabled'), + 'label' => $translate->_('enabled').': ', + 'multiOptions' => array($translate->_('no'), $translate->_('yes')), + )); + + $this->addElement('submit', 'createbutton', array( + 'decorators' => $this->buttonDecorators, + 'required' => false, + 'ignore' => true, + 'label' => $translate->_('add_contest'), + )); + } + + public function loadDefaultDecorators() + { + $this->setDecorators(array( + 'FormElements', + 'Form', + array('Description', array('placement' => 'prepend', 'tag' => 'div', 'class' => 'error')), + )); + } +} \ No newline at end of file Added: website/application/modules/acm/models/Form/ContestProblems.php =================================================================== --- website/application/modules/acm/models/Form/ContestProblems.php (rev 0) +++ website/application/modules/acm/models/Form/ContestProblems.php 2009-03-01 10:02:26 UTC (rev 513) @@ -0,0 +1,72 @@ +<?php + +class Form_ContestProblems extends ZendX_JQuery_Form +{ + public $elementDecorators = array( + 'ViewHelper', + 'Errors', + array('Label', array('class' => 'label')), + array('HtmlTag', array('tag' => 'div', 'class' => 'elcontainer')) + ); + + public $buttonDecorators = array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'div', 'class' => 'elcontainer tc')) + ); + + public function init() + { + $translate = Zend_Registry::get('Zend_Translate'); + $db = Zend_Registry::get('db'); + $router = Zend_Controller_Front::getInstance()->getRouter(); + + $this->setAction($router->assemble(array('action' => 'index'), null)); + $this->setMethod('post'); + $this->setName('problemform'); + $this->setAttrib('class', 'problemform c'); + + $this->getView()->addHelperPath('Ostacium/Dojo/View/Helper', 'Ostacium_Dojo_View_Helper'); + $this->addPrefixPath('Ostacium_Dojo_Form_Element', 'Ostacium/Dojo/Form/Element', Zend_Form::ELEMENT); + + $table = new Table_Challenges(); + $virtual = (bool)$router->getParam('virtual'); + $challenges = $db->fetchPairs($table->getAllSelect($virtual)); + + $this->addElement('select', 'problem', array( + 'decorators' => $this->elementDecorators, + 'required' => true, + 'title' => $translate->_('problem'), + 'label' => $translate->_('problem').': ', + 'multiOptions' => $challenges, + )); + + $this->addElement('button', 'createbutton', array( + 'decorators' => $this->buttonDecorators, + 'required' => false, + 'ignore' => true, + 'label' => $translate->_('add_contest'), + 'onclick' => 'return addProblem();' + )); + + $this->addElement('submit', 'finishbutton', array( + 'decorators' => $this->buttonDecorators, + 'required' => false, + 'ignore' => true, + 'label' => $translate->_('finish_editing'), + )); + } + + public function loadDefaultDecorators() + { + $this->setDecorators(array( + 'FormElements', + 'Form', + array('Description', array('placement' => 'prepend', 'tag' => 'div', 'class' => 'error')), + )); + } + + /*protected function addIds(&$item, $key) + { + $item = $key . '. ' . $item; + }*/ +} \ No newline at end of file Deleted: website/application/modules/acm/models/Form/Login.php =================================================================== --- website/application/modules/acm/models/Form/Login.php 2009-02-27 23:53:06 UTC (rev 512) +++ website/application/modules/acm/models/Form/Login.php 2009-03-01 10:02:26 UTC (rev 513) @@ -1,83 +0,0 @@ -<?php - -class Form_Login extends Zend_Dojo_Form -{ - public $elementDecorators = array( - 'DijitElement', - 'Errors', - array('Label', array('class' => 'label')), - array('HtmlTag', array('tag' => 'div', 'class' => 'line')) - ); - - public $buttonDecorators = array( - 'DijitElement', - array('HtmlTag', array('tag' => 'div', 'class' => 'line tr')) - ); - - public function init() - { - $translate = Zend_Registry::get('Zend_Translate'); - $router = Zend_Controller_Front::getInstance()->getRouter(); - - $this->setAction($router->assemble(array('action' => 'login', 'controller' => 'index'), null)); - $this->setMethod('post'); - $this->setName('loginform'); - $this->setAttrib('class', '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, - 'regExp' => '[\w]{5,50}', - 'invalidMessage' => sprintf($translate->_('wordErrorBetween'), 5, 50), - 'title' => $translate->_('username'), - 'label' => $translate->_('username').':', - 'class' => 'text', - )); - - $this->addElement('PasswordTextBox', 'password', array( - 'decorators' => $this->elementDecorators, - 'filters' => array('StringTrim'), - 'validators' => array( - 'Alnum', - array('StringLength', false, array(5, 32)), - ), - 'required' => true, - 'trim' => true, - 'regExp' => '[\S]{5,32}', - 'invalidMessage' => sprintf($translate->_('errorBetween'), 5, 32), - 'title' => $translate->_('password'), - 'label' => $translate->_('password').':', - 'class' => 'text', - )); - - $this->addElement('SubmitButton', 'loginbutton', array( - 'decorators' => $this->buttonDecorators, - 'required' => false, - 'ignore' => true, - 'label' => $translate->_('login'), - 'class' => 'submit' - )); - } - - public function loadDefaultDecorators() - { - //$this->addElementPrefixPath('Ostacium/Form/Decorator', 'Ostacium_Form_Decorator', 'Decorator'); - $this->addPrefixPath('Ostacium_Form_Decorator', 'Ostacium/Form/Decorator', 'Decorator'); - $translate = Zend_Registry::get('Zend_Translate'); - - $this->setDecorators(array( - 'FormElements', - 'DijitForm', - array('Description', array('placement' => 'prepend', 'tag' => 'div', 'class' => 'error')), - array(array('h2' => 'HtmlTag'), array('tag' => 'h2', 'placement' => 'prepend', 'markup' => $translate->_('login'))), - array(array('div' => 'HtmlTag'), array('tag' => 'div', 'class' => 'box c')) - )); - } -} \ No newline at end of file Deleted: website/application/modules/acm/models/Form/Register.php =================================================================== --- website/application/modules/acm/models/Form/Register.php 2009-02-27 23:53:06 UTC (rev 512) +++ website/application/modules/acm/models/Form/Register.php 2009-03-01 10:02:26 UTC (rev 513) @@ -1,318 +0,0 @@ -<?php - -class Form_Register extends Zend_Dojo_Form -{ - public $elementDecorators = array( - 'DijitElement', - 'Errors', - array('Label', array('class' => 'label')), - array('HtmlTag', array('tag' => 'div', 'class' => 'elcontainer')) - ); - - public $simpleDecorators = array( - 'Errors', - array('Label', array('class' => 'label')), - array('HtmlTag', array('tag' => 'div', 'class' => 'elcontainer')) - ); - - public $buttonDecorators = array( - 'DijitElement', - array('HtmlTag', array('tag' => 'div', 'class' => 'elcontainer tc')) - ); - - public function init() - { - $translate = Zend_Registry::get('Zend_Translate'); - $db = Zend_Registry::get('db'); - $router = Zend_Controller_Front::getInstance()->getRouter(); - - $this->setAction($router->assemble(array('action' => 'register'), null)); - $this->setMethod('post'); - $this->setName('registerform'); - $this->setAttrib('class', 'registerform c'); - - $this->addElement('ValidationTextBox', 'username', array( - 'decorators' => $this->elementDecorators, - 'validators' => array( - array('StringLength', false, array(5, 50)), - ), - 'maxlength' => 50, - 'trim' => true, - 'required' => true, - 'regExp' => '[\w]{5,50}', - 'invalidMessage' => sprintf($translate->_('errorBetween'), 5, 50), - 'title' => $translate->_('username'), - 'label' => $translate->_('username').': ', - 'id' => 'username_reg' - )); - - $this->addElement('PasswordTextBox', 'password', array( - 'decorators' => $this->elementDecorators, - 'validators' => array( - array('StringLength', false, array(5, 32)), - ), - 'maxlength' => 32, - 'trim' => true, - 'required' => true, - 'regExp' => '[\S]{5,32}', - 'invalidMessage' => sprintf($translate->_('errorBetween'), 5, 32), - 'title' => $translate->_('password'), - 'label' => $translate->_('password').': ', - 'id' => 'password_reg' - )); - - $this->addElement('PasswordTextBox', 'cpassword', array( - 'decorators' => $this->elementDecorators, - 'validators' => array( - array('StringLength', false, array(5, 32)), - ), - 'maxlength' => 32, - 'trim' => true, - 'propercase' => true, - 'required' => true, - 'regExp' => '[\S]{5,32}', - 'invalidMessage' => sprintf($translate->_('errorBetween'), 5, 32), - 'title' => $translate->_('confirm_password'), - 'label' => $translate->_('confirm_password').': ', - )); - - $this->addElement('ValidationTextBox', 'email', array( - 'decorators' => $this->elementDecorators, - 'validators' => array( - 'EmailAddress', - array('StringLength', false, 1) - ), - 'filters' => array('StringToLower'), - 'trim' => true, - 'lowercase' => true, - 'required' => true, - 'regExp' => '.{1,}', - 'invalidMessage' => $translate->_('errorEmpty'), - 'title' => $translate->_('email'), - 'label' => $translate->_('email').': ', - )); - - $this->addElement('Checkbox', 'hideemail', array( - 'decorators' => $this->elementDecorators, - 'required' => true, - 'title' => $translate->_('hide_email'), - 'label' => $translate->_('hide_email').': ', - 'multiOptions' => array($translate->_('no'), $translate->_('yes')), - )); - - $this->addElement('ValidationTextBox', 'name', array( - 'decorators' => $this->elementDecorators, - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'maxlength' => 50, - 'trim' => true, - 'required' => false, - 'regExp' => '[\w ]{0,50}', - 'invalidMessage' => sprintf($translate->_('errorMore'), 50), - 'title' => $translate->_('name'), - 'label' => $translate->_('name').': ', - )); - - $this->addElement('ValidationTextBox', 'surname', array( - 'decorators' => $this->elementDecorators, - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'maxlength' => 50, - 'trim' => true, - 'required' => false, - 'regExp' => '[\w ]{0,50}', - 'invalidMessage' => sprintf($translate->_('errorMore'), 50), - 'title' => $translate->_('surname'), - 'label' => $translate->_('surname').': ', - )); - - $this->addElement('ValidationTextBox', 'study', array( - 'decorators' => $this->elementDecorators, - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'maxlength' => 50, - 'trim' => true, - 'required' => false, - 'regExp' => '[\w ]{0,50}', - 'invalidMessage' => sprintf($translate->_('errorMore'), 50), - 'title' => $translate->_('edu_place'), - 'label' => $translate->_('edu_place').': ', - )); - - $this->addElement('DateTextBox', 'birthday', array( - 'decorators' => $this->elementDecorators, - 'required' => false, - 'invalidMessage' => $translate->_('invalidDate'), - 'title' => $translate->_('birthday'), - 'label' => $translate->_('birthday').': ', - 'formatLength' => 'short' - )); - - $this->addElement('ValidationTextBox', 'aim', array( - 'decorators' => $this->elementDecorators, - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'maxlength' => 50, - 'trim' => true, - 'required' => false, - 'regExp' => '[\S]{0,50}', - 'invalidMessage' => sprintf($translate->_('errorMore'), 50), - 'title' => $translate->_('aim'), - 'label' => $translate->_('aim').': ', - )); - - $this->addElement('ValidationTextBox', 'icq', array( - 'decorators' => $this->elementDecorators, - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'maxlength' => 50, - 'trim' => true, - 'required' => false, - 'regExp' => '[\S]{0,50}', - 'invalidMessage' => sprintf($translate->_('errorMore'), 50), - 'title' => $translate->_('icq_handle'), - 'label' => $translate->_('icq_handle').': ', - )); - - $this->addElement('ValidationTextBox', 'msn', array( - 'decorators' => $this->elementDecorators, - 'validators' => array( - array('StringLength', false, array(0, 100)), - ), - 'maxlength' => 100, - 'trim' => true, - 'required' => false, - 'regExp' => '[\S]{0,100}', - 'invalidMessage' => sprintf($translate->_('errorMore'), 100), - 'title' => $translate->_('msn_handle'), - 'label' => $translate->_('msn_handle').': ', - )); - - $this->addElement('ValidationTextBox', 'skype', array( - 'decorators' => $this->elementDecorators, - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'maxlength' => 50, - 'trim' => true, - 'required' => false, - 'regExp' => '[\S]{0,50}', - 'invalidMessage' => sprintf($translate->_('errorMore'), 50), - 'title' => $translate->_('skype_handle'), - 'label' => $translate->_('skype_handle').': ', - )); - - $this->addElement('ValidationTextBox', 'yahoo', array( - 'decorators' => $this->elementDecorators, - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'maxlength' => 50, - 'trim' => true, - 'required' => false, - 'regExp' => '[\S]{0,50}', - 'invalidMessage' => sprintf($translate->_('errorMore'), 50), - 'title' => $translate->_('yahoo_handle'), - 'label' => $translate->_('yahoo_handle').': ', - )); - - $this->addElement('ValidationTextBox', 'web', array( - 'decorators' => $this->elementDecorators, - 'validators' => array( - array('StringLength', false, array(0, 100)), - ), - 'maxlength' => 200, - 'trim' => true, - 'required' => false, - 'regExp' => '[\S]{0,100}', - 'invalidMessage' => sprintf($translate->_('errorMore'), 100), - 'title' => $translate->_('website'), - 'label' => $translate->_('website').': ', - )); - - $this->addElement('ValidationTextBox', 'topcoder', array( - 'decorators' => $this->elementDecorators, - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'maxlength' => 50, - 'trim' => true, - 'required' => false, - 'regExp' => '[\S]{0,50}', - 'invalidMessage' => sprintf($translate->_('errorMore'), 50), - 'title' => $translate->_('tc_handle'), - 'label' => $translate->_('tc_handle').': ', - )); - - $this->addElement('ValidationTextBox', 'timus', array( - 'decorators' => $this->elementDecorators, - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'maxlength' => 50, - 'trim' => true, - 'required' => false, - 'regExp' => '[\S]{0,50}', - 'invalidMessage' => sprintf($translate->_('errorMore'), 50), - 'title' => $translate->_('timus_handle'), - 'label' => $translate->_('timus_handle').': ', - )); - - $offset = array(-12 => -12, -11 => -11, -10 => -10, -9 => -9, -8 => -8, -7 => -7, -6 => -6, -5 => -5, -4 => -4, -3 => -3, -2 => -2, -1 => -1, 0 => 0, '+1' => '+1', '+2' => '+2', '+3' => '+3', '+4' => '+4', '+5' => '+5', '+6' => '+6', '+7' => '+7', '+8' => '+8', '+9' => '+9', '+10' => '+10', '+11' => '+11', '+12' => '+12', '+13' => '+13'); - - $this->addElement('FilteringSelect', 'timeoffset', array( - 'decorators' => $this->elementDecorators, - 'required' => true, - 'title' => $translate->_('timeoffset'), - 'label' => $translate->_('timeoffset').': ', - 'multiOptions' => $offset, - 'value' => 0 - )); - - $this->addElement('FilteringSelect', 'codelangid', array( - 'decorators' => $this->elementDecorators, - 'required' => true, - 'title' => $translate->_('code_language'), - 'label' => $translate->_('code_language').': ', - 'multiOptions' => $db->fetchPairs($db->select()->from('code_languages', array('id', 'name'))), - )); - - $this->addElement('FilteringSelect', 'language', array( - 'decorators' => $this->elementDecorators, - 'required' => true, - 'title' => $translate->_('language'), - 'label' => $translate->_('language').': ', - 'multiOptions' => $db->fetchPairs($db->select()->from('languages', array('code', 'name'))), - 'value' => Zend_Registry::get('config')->lang->default - )); - - $this->addElement('FilteringSelect', 'tshirtsize', array( - 'decorators' => $this->elementDecorators, - 'required' => true, - 'title' => $translate->_('tshirtsize'), - 'label' => $translate->_('tshirtsize').': ', - 'multiOptions' => array('S' => 'Small', 'M' => 'Medium', 'L' => 'Large'), - )); - - $this->addElement('SubmitButton', 'registerbutton', array( - 'decorators' => $this->buttonDecorators, - 'required' => false, - 'ignore' => true, - 'label' => $translate->_('register'), - )); - } - - public function loadDefaultDecorators() - { - $this->setDecorators(array( - 'FormElements', - 'DijitForm', - array('Description', array('placement' => 'prepend', 'tag' => 'div', 'class' => 'error')), - )); - } -} \ No newline at end of file Deleted: website/application/modules/acm/models/Form/SmallLogin.php =================================================================== --- website/application/modules/acm/models/Form/SmallLogin.php 2009-02-27 23:53:06 UTC (rev 512) +++ website/application/modules/acm/models/Form/SmallLogin.php 2009-03-01 10:02:26 UTC (rev 513) @@ -1,85 +0,0 @@ -<?php - -class Form_SmallLogin extends Zend_Dojo_Form -{ - public $elementDecorators = array( - 'DijitElement', - array('Label', array('class' => 'label2')), - array('HtmlTag', array('tag' => 'div', 'class' => 'line')) - ); - - public $buttonDecorators = array( - 'DijitElement', - array('HtmlTag', array('tag' => 'div', 'class' => 'line tr')) - ); - - public function init() - { - $translate = Zend_Registry::get('Zend_Translate'); - $router = Zend_Controller_Front::getInstance()->getRouter(); - - $this->setAction($router->assemble(array('action' => 'login', 'controller' => 'index'), null)); - $this->setMethod('post'); - $this->setName('loginform'); - $this->setAttrib('class', '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, - 'regExp' => '[\w]{5,50}', - 'invalidMessage' => sprintf($translate->_('enter_username_between'), 5, 50), - 'title' => $translate->_('username'), - 'label' => $translate->_('username').':', - 'class' => 'text', - )); - - $this->addElement('PasswordTextBox', 'password', array( - 'decorators' => $this->elementDecorators, - 'filters' => array('StringTrim'), - 'validators' => array( - 'Alnum', - array('StringLength', false, array(5, 32)), - ), - 'required' => true, - 'trim' => true, - 'regExp' => '[\S]{5,32}', - 'invalidMessage' => sprintf($translate->_('enter_password_between'), 5, 32), - 'title' => $translate->_('password'), - 'label' => $translate->_('password').':', - 'class' => 'text', - )); - - $this->addElement('Button', 'signupbutton', array( - 'decorators' => $this->buttonDecorators, - 'required' => false, - 'ignore' => true, - 'label' => $translate->_('signup'), - 'class' => 'signup2', - 'onclick' => 'return goToUrl("'.$router->assemble(array('action' => 'register', 'controller' => 'user'), null).'")' - )); - - $this->addElement('SubmitButton', 'loginbutton', array( - 'decorators' => $this->buttonDecorators, - 'required' => false, - 'ignore' => true, - 'label' => $translate->_('login'), - 'class' => 'submit2' - )); - } - - public function loadDefaultDecorators() - { - $this->setDecorators(array( - 'FormElements', - 'DijitForm', - array('HtmlTag', array('tag' => 'div', 'class' => 'box2 c')) - )); - } -} \ No newline at end of file Modified: website/application/modules/acm/models/Form/Submit.php =================================================================== --- website/application/modules/acm/models/Form/Submit.php 2009-02-27 23:53:06 UTC (rev 512) +++ website/application/modules/acm/models/Form/Submit.php 2009-03-01 10:02:26 UTC (rev 513) @@ -42,7 +42,7 @@ 'title' => $translate->_('language'), 'label' => $translate->_('language').': ', 'multiOptions' => $db->fetchPairs($db->select()->from('code_languages', array('id', 'name'))), - 'value' => (Zend_Auth::getInstance()->getStorage()->read()->codelangid) + 'value' => (Zend_Auth::getInstance()->getIdentity()->codelangid) )); $this->addElement('RadioButton', 'type', array( @@ -66,7 +66,7 @@ $this->addElement('File', 'codefile', array( 'decorators' => array_merge(array('File'), $this->simpleDecorators), 'validators' => array(array('Count', false, 1)), - 'destination' => Application::getDocRoot().'/other/uploads/', + 'destination' => Application::getDocRoot().'/other/uploads', 'label' => $translate->_('choose_file').': ', )); Deleted: website/application/modules/acm/models/Index.php =================================================================== --- website/application/modules/acm/models/Index.php 2009-02-27 23:53:06 UTC (rev 512) +++ website/application/modules/acm/models/Index.php 2009-03-01 10:02:26 UTC (rev 513) @@ -1,24 +0,0 @@ -<?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($ro... [truncated message content] |
From: <pan...@us...> - 2009-03-01 18:22:57
|
Revision: 515 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=515&view=rev Author: panzaboi Date: 2009-03-01 18:22:55 +0000 (Sun, 01 Mar 2009) Log Message: ----------- Set Enviroment path for library and application Modified Paths: -------------- website/httpdocs/.htaccess website/httpdocs/index.php website/library/Application.php Modified: website/httpdocs/.htaccess =================================================================== --- website/httpdocs/.htaccess 2009-03-01 16:23:15 UTC (rev 514) +++ website/httpdocs/.htaccess 2009-03-01 18:22:55 UTC (rev 515) @@ -3,4 +3,7 @@ RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] -RewriteRule ^.*$ /index.php [NC,L] \ No newline at end of file +RewriteRule ^.*$ /index.php [NC,L] + +SetEnv LIBRARY_PATH D:/server/library/ +SetEnv APPLICATION_PATH D:/server/ \ No newline at end of file Modified: website/httpdocs/index.php =================================================================== --- website/httpdocs/index.php 2009-03-01 16:23:15 UTC (rev 514) +++ website/httpdocs/index.php 2009-03-01 18:22:55 UTC (rev 515) @@ -6,7 +6,7 @@ //$_docroot = dirname($_SERVER["DOCUMENT_ROOT"]); $_approot = dirname(__FILE__); -set_include_path("D:/server/library/;D:/server/httpdocs/;D:/server/config/;D:/server/lang/;D:/server/application/" . get_include_path()); +set_include_path($_SERVER['LIBRARY_PATH'] . ';' . $_SERVER['APPLICATION_PATH'] . 'httpdocs/;' . $_SERVER['APPLICATION_PATH'] . 'config/;' . $_SERVER['APPLICATION_PATH'] . 'lang/;' . $_SERVER['APPLICATION_PATH'] . 'application/;' . get_include_path()); require_once 'Application.php'; Modified: website/library/Application.php =================================================================== --- website/library/Application.php 2009-03-01 16:23:15 UTC (rev 514) +++ website/library/Application.php 2009-03-01 18:22:55 UTC (rev 515) @@ -208,7 +208,7 @@ } // Setup Dojo - Zend_Dojo::enableView($view); + //Zend_Dojo::enableView($view); // Setup JQuery ZendX_JQuery::enableView($view); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |