From: <gem...@li...> - 2011-11-14 12:10:59
|
Revision: 205 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=205&view=rev Author: matijsdejong Date: 2011-11-14 12:10:52 +0000 (Mon, 14 Nov 2011) Log Message: ----------- Merged changes from main branch Modified Paths: -------------- branches/newUser2/classes/Gems/Cookies.php branches/newUser2/classes/Gems/Default/DatabaseAction.php branches/newUser2/classes/Gems/Default/UpgradeAction.php branches/newUser2/classes/Gems/Tracker/Token.php branches/newUser2/classes/Gems/Tracker.php branches/newUser2/classes/Gems/UpgradesAbstract.php branches/newUser2/classes/GemsEscort.php Property Changed: ---------------- branches/newUser2/ Property changes on: branches/newUser2 ___________________________________________________________________ Modified: svn:mergeinfo - /branches/newUser:113-150 /trunk/library:177-190 + /branches/newUser:113-150 /trunk/library:177-190,192-195 Modified: branches/newUser2/classes/Gems/Cookies.php =================================================================== --- branches/newUser2/classes/Gems/Cookies.php 2011-11-14 11:58:57 UTC (rev 204) +++ branches/newUser2/classes/Gems/Cookies.php 2011-11-14 12:10:52 UTC (rev 205) @@ -46,7 +46,7 @@ */ class Gems_Cookies { - const LOCALE_COOKIE = 'gems_locale'; + const LOCALE_COOKIE = 'gems_locale'; const ORGANIZATION_COOKIE = 'gems_organization'; /** Modified: branches/newUser2/classes/Gems/Default/DatabaseAction.php =================================================================== --- branches/newUser2/classes/Gems/Default/DatabaseAction.php 2011-11-14 11:58:57 UTC (rev 204) +++ branches/newUser2/classes/Gems/Default/DatabaseAction.php 2011-11-14 12:10:52 UTC (rev 205) @@ -382,7 +382,7 @@ $table->setAsFormLayout($form, true, true); $table['tbody'][0][0]->class = 'label'; // Is only one row with formLayout, so all in output fields get class. - if ($links = $this->createMenuLinks(10)) { + if ($links = $this->createMenuLinks(1)) { $table->tf(); // Add empty cell, no label $linksCell = $table->tf($links); } Modified: branches/newUser2/classes/Gems/Default/UpgradeAction.php =================================================================== --- branches/newUser2/classes/Gems/Default/UpgradeAction.php 2011-11-14 11:58:57 UTC (rev 204) +++ branches/newUser2/classes/Gems/Default/UpgradeAction.php 2011-11-14 12:10:52 UTC (rev 205) @@ -92,7 +92,7 @@ if ($menuItem = $this->menu->find(array('controller' => $this->_getParam('controller'), 'action' => 'show', 'allowed' => true))) { $this->html->br(); - $this->html[] = $menuItem->toActionLinkLower($this->getRequest(), array('id'=>$context)); + $this->html[] = $menuItem->toActionLinkLower($this->getRequest(), array('id'=>$context), $this->_('Back')); } } @@ -181,6 +181,10 @@ } else { $this->html[] = sprintf($this->_('Context %s not found!'), $context); } + + if ($parentItem = $this->menu->getCurrent()->getParent()) { + $this->html[] = $parentItem->toActionLink($this->getRequest(), $this->_('Cancel')); + } } public function getTopicTitle() { Modified: branches/newUser2/classes/Gems/Tracker/Token.php =================================================================== --- branches/newUser2/classes/Gems/Tracker/Token.php 2011-11-14 11:58:57 UTC (rev 204) +++ branches/newUser2/classes/Gems/Tracker/Token.php 2011-11-14 12:10:52 UTC (rev 205) @@ -119,12 +119,6 @@ /** * - * @var Gems_Tracker_Track - */ - protected $track; - - /** - * * @var Gems_Tracker */ protected $tracker; Modified: branches/newUser2/classes/Gems/Tracker.php =================================================================== --- branches/newUser2/classes/Gems/Tracker.php 2011-11-14 11:58:57 UTC (rev 204) +++ branches/newUser2/classes/Gems/Tracker.php 2011-11-14 12:10:52 UTC (rev 205) @@ -235,7 +235,7 @@ * @param array $trackFieldsData * @return Gems_Tracker_RespondentTrack The newly created track */ - public function createRespondentTrack($patientId, $organizationId, $trackId, $userId, $respTrackData = null, array $trackFieldsData = array()) + public function createRespondentTrack($patientId, $organizationId, $trackId, $userId, $respTrackData = array(), array $trackFieldsData = array()) { $trackEngine = $this->getTrackEngine($trackId); Modified: branches/newUser2/classes/Gems/UpgradesAbstract.php =================================================================== --- branches/newUser2/classes/Gems/UpgradesAbstract.php 2011-11-14 11:58:57 UTC (rev 204) +++ branches/newUser2/classes/Gems/UpgradesAbstract.php 2011-11-14 12:10:52 UTC (rev 205) @@ -25,8 +25,6 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Short description of file - * * @package Gems * @subpackage Upgrades * @copyright Copyright (c) 2011 Erasmus MC @@ -35,10 +33,10 @@ */ /** - * Short description for Upgrades + * This class can take care of handling upgrades that can not be achieved by a + * simple db patch. For example adding an extra attribute to all token tables + * in LimeSurvey needs a simple loop. * - * Long description for class Upgrades (if any)... - * * @package Gems * @subpackage Upgrades * @copyright Copyright (c) 2011 Erasmus MC @@ -142,6 +140,18 @@ $this->_messages = array(); } + /** + * Execute upgrades for the given $context + * + * When no $to or $from are given, the given $context will be upgraded from the current level + * to the max level. Otherwise the $from and/or $to will be used to determine what upgrades + * to execute. + * + * @param string $context The context to execute the upgrades for + * @param int|null $to The level to upgrade to + * @param int|null $from The level to start the upgrade on + * @return false|int The achieved upgrade level or false on failure + */ public function execute($context, $to = null, $from = null) { if(is_null($to)) { @@ -182,21 +192,32 @@ return $success; } + /** + * Retrieve the current context + * + * @return string + */ public function getContext() { return $this->_context; } + /** + * Get the current upgrade level for the given $context + * + * @param string $context + * @return int + */ public function getLevel($context) { if(isset($this->_info->$context)) { - return $this->_info->$context; + return intval($this->_info->$context); } else { return 0; } } /** - * Get the highest level for the given context + * Get the highest level for the given $context * * @param string|null $context * @return int @@ -251,6 +272,11 @@ return ++$level; } + /** + * Get all messages that were recorded during the upgrade process + * + * @return array + */ public function getMessages() { return $this->_messages; @@ -273,6 +299,12 @@ return array(); } + /** + * Retrieve info about the $requestedContext or all contexts when omitted + * + * @param string $requestedContext + * @return array + */ public function getUpgradesInfo($requestedContext = null) { $result = array(); @@ -293,6 +325,19 @@ } } + /** + * Register an upgrade in the stack, it can be executed by using $this->execute + * + * Index and context are optional and will be generated when omitted. For the + * user interface to be clear $info should provide a good description of what + * the upgrade does. + * + * @param array|string $callback A valid callback, either string for a method of the current class or array otherwise + * @param string $info A descriptive message about what this upgrade does + * @param int $index The number of the upgrade + * @param string $context The context to which this upgrade applies + * @return boolean + */ public function register($callback, $info = null, $index = null, $context = null) { if (is_string($callback)) { @@ -325,10 +370,27 @@ return false; } + /** + * Change the active context + * + * Usefull when adding upgrades in the construct to save typing + * + * @param string $context + */ public function setContext($context) { $this->_context = $context; } + /** + * Set the upgrade level for the given $context to a certain level + * + * Will only update when the $level is higher than the achieved level, unless + * when $force = true when it will always update. + * + * @param string $context + * @param int $level + * @param boolean $force + */ protected function setLevel($context, $level = null, $force = false) { if (!is_null($level) && Modified: branches/newUser2/classes/GemsEscort.php =================================================================== --- branches/newUser2/classes/GemsEscort.php 2011-11-14 11:58:57 UTC (rev 204) +++ branches/newUser2/classes/GemsEscort.php 2011-11-14 12:10:52 UTC (rev 205) @@ -1059,6 +1059,7 @@ */ public function getCurrentOrganization() { + /* if ($this instanceof Gems_Project_Organization_MultiOrganizationInterface) { return $this->getUserOrganization(); } @@ -1066,11 +1067,12 @@ if ($this instanceof Gems_Project_Organization_SingleOrganizationInterface) { return $this->getRespondentOrganization(); } + */ if (isset($this->session->user_organization_id)) { return $this->session->user_organization_id; } else { - return 0; + return Gems_Cookies::getOrganization(Zend_Controller_Front::getInstance()->getRequest()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |