You can subscribe to this list here.
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(84) |
Oct
(70) |
Nov
(164) |
Dec
(71) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2012 |
Jan
(52) |
Feb
(77) |
Mar
(70) |
Apr
(58) |
May
(81) |
Jun
(74) |
Jul
(87) |
Aug
(30) |
Sep
(45) |
Oct
(37) |
Nov
(51) |
Dec
(31) |
2013 |
Jan
(47) |
Feb
(29) |
Mar
(40) |
Apr
(33) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <gem...@li...> - 2012-02-21 15:08:17
|
Revision: 505 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=505&view=rev Author: michieltcs Date: 2012-02-21 15:08:06 +0000 (Tue, 21 Feb 2012) Log Message: ----------- Fix fatal error: Can't inherit abstract function Gems_Task_TaskInterface::execute() (see http://goo.gl/lriCn for details) Modified Paths: -------------- trunk/library/classes/Gems/Task/TaskAbstract.php Modified: trunk/library/classes/Gems/Task/TaskAbstract.php =================================================================== --- trunk/library/classes/Gems/Task/TaskAbstract.php 2012-02-21 15:06:33 UTC (rev 504) +++ trunk/library/classes/Gems/Task/TaskAbstract.php 2012-02-21 15:08:06 UTC (rev 505) @@ -72,5 +72,8 @@ * The parameters should be optional and failing to provide them should be handled by * the task */ - abstract public function execute(); + public function execute() + { + + } } \ 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: <gem...@li...> - 2012-02-21 15:06:39
|
Revision: 504 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=504&view=rev Author: michieltcs Date: 2012-02-21 15:06:33 +0000 (Tue, 21 Feb 2012) Log Message: ----------- Don't echo the exception (this causes memory problems with large contexts) Modified Paths: -------------- trunk/library/classes/MUtil/Batch/BatchAbstract.php Modified: trunk/library/classes/MUtil/Batch/BatchAbstract.php =================================================================== --- trunk/library/classes/MUtil/Batch/BatchAbstract.php 2012-02-20 14:44:29 UTC (rev 503) +++ trunk/library/classes/MUtil/Batch/BatchAbstract.php 2012-02-21 15:06:33 UTC (rev 504) @@ -777,7 +777,7 @@ $this->addMessage('While calling:' . $command['method'] . '(' . implode(',', MUtil_Ra::flatten($command['parameters'])) . ')'); $this->addMessage($e->getMessage()); - MUtil_Echo::r($e); + //MUtil_Echo::r($e); } return true; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-20 14:44:38
|
Revision: 503 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=503&view=rev Author: mennodekker Date: 2012-02-20 14:44:29 +0000 (Mon, 20 Feb 2012) Log Message: ----------- Merged revision(s) 485, 489 from tags/1.5.1: Forgot to include the upgrade :) ........ Fixing padding on #header_bar #login element ........ Modified Paths: -------------- trunk/library/classes/Gems/Upgrades.php trunk/new_project/htdocs/gems/css/gems-new.css Property Changed: ---------------- trunk/ trunk/library/ Property changes on: trunk ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse:306-430,467 /branches/1.5.x:426-455,458-472,475-481 /tags/1.5.0beta1:305 + /branches/1.5.0-pulse:306-430,467 /branches/1.5.x:426-455,458-472,475-481 /tags/1.5.0beta1:305 /tags/1.5.1:485,489 Property changes on: trunk/library ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse/library:306-344,346,467 /branches/1.5.x/library:426-455,458-472,475-481 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 + /branches/1.5.0-pulse/library:306-344,346,467 /branches/1.5.x/library:426-455,458-472,475-481 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 /tags/1.5.1/library:485,489 Modified: trunk/library/classes/Gems/Upgrades.php =================================================================== --- trunk/library/classes/Gems/Upgrades.php 2012-02-20 14:13:20 UTC (rev 502) +++ trunk/library/classes/Gems/Upgrades.php 2012-02-20 14:44:29 UTC (rev 503) @@ -56,6 +56,7 @@ $this->setContext('gems'); //And add our patches $this->register('Upgrade143to15', 'Upgrade from 1.43 to 1.5'); + $this->register('Upgrade15to151', 'Upgrade from 1.5.0. to 1.5.1'); } @@ -99,4 +100,17 @@ return true; } + + /** + * To upgrade to 1.5.1 just execute patchlevel 44 + */ + public function Upgrade15to151() + { + $this->addMessage(sprintf($this->_('Executing patchlevel %d'),44)); + $this->patcher->executePatch(44); + + $this->invalidateCache(); + + return true; + } } \ No newline at end of file Modified: trunk/new_project/htdocs/gems/css/gems-new.css =================================================================== --- trunk/new_project/htdocs/gems/css/gems-new.css 2012-02-20 14:13:20 UTC (rev 502) +++ trunk/new_project/htdocs/gems/css/gems-new.css 2012-02-20 14:44:29 UTC (rev 503) @@ -367,7 +367,7 @@ padding: 0px; } -#header_bar #contact { +#header_bar #contact, #header_bar #login { position: relative; padding: 5px 5px 0 5px; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-20 14:13:27
|
Revision: 502 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=502&view=rev Author: mennodekker Date: 2012-02-20 14:13:20 +0000 (Mon, 20 Feb 2012) Log Message: ----------- Updated docblocks Added keywords Modified Paths: -------------- trunk/library/classes/Gems/Controller/Action/Helper/BatchRunner.php trunk/library/classes/Gems/Event/TrackCompletedEventInterface.php trunk/library/classes/Gems/Task/CheckTokenCompletion.php trunk/library/classes/Gems/Task/CheckTrackTokens.php trunk/library/classes/Gems/Task/ProcessTokenCompletion.php trunk/library/classes/Gems/Task/TaskAbstract.php trunk/library/classes/Gems/Task/TaskInterface.php trunk/library/classes/Gems/Task/TaskRunnerBatch.php trunk/library/classes/Gems/Tracker.php trunk/library/classes/Gems/User/RadiusUserDefinition.php trunk/library/classes/Gems/Util/AccessLogActions.php Property Changed: ---------------- trunk/library/classes/Gems/Controller/Action/Helper/BatchRunner.php trunk/library/classes/Gems/Event/TrackCompletedEventInterface.php trunk/library/classes/Gems/Task/CheckTokenCompletion.php trunk/library/classes/Gems/Task/CheckTrackTokens.php trunk/library/classes/Gems/Task/ProcessTokenCompletion.php trunk/library/classes/Gems/Task/TaskAbstract.php trunk/library/classes/Gems/Task/TaskInterface.php trunk/library/classes/Gems/Task/TaskRunnerBatch.php trunk/library/classes/Gems/Tracker/Batch/ProcessTokensBatch.php trunk/library/classes/Gems/Tracker/Batch/RefreshTokenAttributesBatch.php trunk/library/classes/Gems/Tracker/Batch/SynchronizeSourcesBatch.php trunk/library/classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php trunk/library/classes/Gems/User/RadiusUserDefinition.php trunk/library/classes/Gems/Util/AccessLogActions.php Modified: trunk/library/classes/Gems/Controller/Action/Helper/BatchRunner.php =================================================================== --- trunk/library/classes/Gems/Controller/Action/Helper/BatchRunner.php 2012-02-20 12:19:38 UTC (rev 501) +++ trunk/library/classes/Gems/Controller/Action/Helper/BatchRunner.php 2012-02-20 14:13:20 UTC (rev 502) @@ -32,7 +32,7 @@ * @subpackage * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License - * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $ + * @version $Id$ */ /** Property changes on: trunk/library/classes/Gems/Controller/Action/Helper/BatchRunner.php ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date Author Modified: trunk/library/classes/Gems/Event/TrackCompletedEventInterface.php =================================================================== --- trunk/library/classes/Gems/Event/TrackCompletedEventInterface.php 2012-02-20 12:19:38 UTC (rev 501) +++ trunk/library/classes/Gems/Event/TrackCompletedEventInterface.php 2012-02-20 14:13:20 UTC (rev 502) @@ -29,7 +29,7 @@ * @subpackage Event * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License - * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $ + * @version $Id$ */ /** Property changes on: trunk/library/classes/Gems/Event/TrackCompletedEventInterface.php ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date Author Modified: trunk/library/classes/Gems/Task/CheckTokenCompletion.php =================================================================== --- trunk/library/classes/Gems/Task/CheckTokenCompletion.php 2012-02-20 12:19:38 UTC (rev 501) +++ trunk/library/classes/Gems/Task/CheckTokenCompletion.php 2012-02-20 14:13:20 UTC (rev 502) @@ -24,27 +24,25 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (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 + * @subpackage Task * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License - * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $ + * @version $Id$ */ /** - * Short description for ProcessTokens + * Check token completion in a batch job * - * Long description for class ProcessTokens (if any)... + * This task handles the token completion check, adding tasks to the queue + * when needed. * * @package Gems - * @subpackage Sample + * @subpackage Task * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License - * @since Class available since version 1.0 - * @deprecated Class deprecated since version 2.0 + * @since Class available since version 1.6 */ class Gems_Task_CheckTokenCompletion extends Gems_Task_TaskAbstract { Property changes on: trunk/library/classes/Gems/Task/CheckTokenCompletion.php ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date Author Modified: trunk/library/classes/Gems/Task/CheckTrackTokens.php =================================================================== --- trunk/library/classes/Gems/Task/CheckTrackTokens.php 2012-02-20 12:19:38 UTC (rev 501) +++ trunk/library/classes/Gems/Task/CheckTrackTokens.php 2012-02-20 14:13:20 UTC (rev 502) @@ -25,27 +25,22 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (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 + * @subpackage Task * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License - * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $ + * @version $Id$ */ /** - * Short description for CheckTrackTokens + * Checks a respondentTrack for changes, mostly started by Gems_Task_ProcessTokenCompletion * - * Long description for class CheckTrackTokens (if any)... - * * @package Gems - * @subpackage Sample + * @subpackage Task * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License - * @since Class available since version 1.0 - * @deprecated Class deprecated since version 2.0 + * @since Class available since version 1.6 */ class Gems_Task_CheckTrackTokens extends Gems_Task_TaskAbstract { Property changes on: trunk/library/classes/Gems/Task/CheckTrackTokens.php ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date Author Modified: trunk/library/classes/Gems/Task/ProcessTokenCompletion.php =================================================================== --- trunk/library/classes/Gems/Task/ProcessTokenCompletion.php 2012-02-20 12:19:38 UTC (rev 501) +++ trunk/library/classes/Gems/Task/ProcessTokenCompletion.php 2012-02-20 14:13:20 UTC (rev 502) @@ -25,27 +25,22 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (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 + * @subpackage Task * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License - * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $ + * @version $Id$ */ /** - * Short description for ProcessTokenCompletion + * Handles completion of a token, mostly started by Gems_Task_CheckTokenCompletion * - * Long description for class ProcessTokenCompletion (if any)... - * * @package Gems - * @subpackage Sample + * @subpackage Task * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License - * @since Class available since version 1.0 - * @deprecated Class deprecated since version 2.0 + * @since Class available since version 1.6 */ class Gems_Task_ProcessTokenCompletion extends Gems_Task_TaskAbstract { @@ -54,7 +49,6 @@ */ public $tracker; - public function execute($tokenData = null, $userId = null) { $this->tracker = $this->loader->getTracker(); Property changes on: trunk/library/classes/Gems/Task/ProcessTokenCompletion.php ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date Author Modified: trunk/library/classes/Gems/Task/TaskAbstract.php =================================================================== --- trunk/library/classes/Gems/Task/TaskAbstract.php 2012-02-20 12:19:38 UTC (rev 501) +++ trunk/library/classes/Gems/Task/TaskAbstract.php 2012-02-20 14:13:20 UTC (rev 502) @@ -25,27 +25,24 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (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 + * @subpackage Task * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License - * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $ + * @version $Id$ */ /** - * Short description for TaskAbstract + * Abstract class for easier implementation of the Gems_Task for usage with + * Gems_Task_TaskRunnerBatch providing some convenience methods to loading and + * translation. * - * Long description for class TaskAbstract (if any)... - * * @package Gems - * @subpackage Sample + * @subpackage Task * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License - * @since Class available since version 1.0 - * @deprecated Class deprecated since version 2.0 + * @since Class available since version 1.6 */ abstract class Gems_Task_TaskAbstract extends MUtil_Registry_TargetAbstract implements Gems_Task_TaskInterface { @@ -55,11 +52,6 @@ protected $_batch; /** - * @var array - */ - protected $_params; - - /** * @var Gems_Loader */ public $loader; @@ -73,4 +65,12 @@ { $this->_batch = $batch; } + + /** + * Should handle execution of the task, taking as much (optional) parameters as needed + * + * The parameters should be optional and failing to provide them should be handled by + * the task + */ + abstract public function execute(); } \ No newline at end of file Property changes on: trunk/library/classes/Gems/Task/TaskAbstract.php ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date Author Modified: trunk/library/classes/Gems/Task/TaskInterface.php =================================================================== --- trunk/library/classes/Gems/Task/TaskInterface.php 2012-02-20 12:19:38 UTC (rev 501) +++ trunk/library/classes/Gems/Task/TaskInterface.php 2012-02-20 14:13:20 UTC (rev 502) @@ -26,30 +26,37 @@ * (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 + * @subpackage Task * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License - * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $ + * @version $Id$ */ /** - * Short description for TaskAbstract + * Describes the interface for a Gems_Task * - * Long description for class TaskAbstract (if any)... - * * @package Gems - * @subpackage Sample + * @subpackage Task * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License - * @since Class available since version 1.0 - * @deprecated Class deprecated since version 2.0 + * @since Class available since version 1.6 */ interface Gems_Task_TaskInterface { + /** + * Should handle execution of the task, taking as much (optional) parameters as needed + * + * The parameters should be optional and failing to provide them should be handled by + * the task + */ public function execute(); - + + /** + * Sets the batch this task belongs to + * + * This method will be called from the Gems_Task_TaskRunnerBatch upon execution of the + * task. It allows the task to communicate with the batch queue. + */ public function setBatch(Gems_Task_TaskRunnerBatch $batch); } \ No newline at end of file Property changes on: trunk/library/classes/Gems/Task/TaskInterface.php ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date Author Modified: trunk/library/classes/Gems/Task/TaskRunnerBatch.php =================================================================== --- trunk/library/classes/Gems/Task/TaskRunnerBatch.php 2012-02-20 12:19:38 UTC (rev 501) +++ trunk/library/classes/Gems/Task/TaskRunnerBatch.php 2012-02-20 14:13:20 UTC (rev 502) @@ -25,27 +25,27 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (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 + * @subpackage Task * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License - * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $ + * @version $Id$ */ /** - * Short description for TaskRunnerBatch + * Handles running tasks independent on the kind of task * - * Long description for class TaskRunnerBatch (if any)... + * Continues on the MUtil_Batch_BatchAbstract, exposing some methods to allow the task + * to interact with the batch queue. * + * Tasks added to the queue should be loadable via Gems_Loader and implement the Gems_Task_TaskInterface + * * @package Gems - * @subpackage Sample + * @subpackage Task * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License - * @since Class available since version 1.0 - * @deprecated Class deprecated since version 2.0 + * @since Class available since version 1.6 */ class Gems_Task_TaskRunnerBatch extends MUtil_Batch_BatchAbstract { Property changes on: trunk/library/classes/Gems/Task/TaskRunnerBatch.php ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date Author Property changes on: trunk/library/classes/Gems/Tracker/Batch/ProcessTokensBatch.php ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date Author Property changes on: trunk/library/classes/Gems/Tracker/Batch/RefreshTokenAttributesBatch.php ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date Author Property changes on: trunk/library/classes/Gems/Tracker/Batch/SynchronizeSourcesBatch.php ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date Author Property changes on: trunk/library/classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date Author Modified: trunk/library/classes/Gems/Tracker.php =================================================================== --- trunk/library/classes/Gems/Tracker.php 2012-02-20 12:19:38 UTC (rev 501) +++ trunk/library/classes/Gems/Tracker.php 2012-02-20 14:13:20 UTC (rev 502) @@ -841,13 +841,15 @@ * @param string $batch_id A unique identifier for the current batch * @param Gems_Tracker_Token_TokenSelect Select statements selecting tokens * @param int $userId Id of the user who takes the action (for logging) - * @return Gems_Tracker_Batch_ProcessTokensBatch A batch to process the changes + * @return Gems_Task_TaskRunnerBatch A batch to process the changes */ protected function processTokensBatch($batch_id, Gems_Tracker_Token_TokenSelect $tokenSelect, $userId) { $where = implode(' ', $tokenSelect->getSelect()->getPart(Zend_Db_Select::WHERE)); $batch = $this->loader->getTaskRunnerBatch($batch_id); + //Now set the step duration + $batch->minimalStepDurationMs = 3000; if (! $batch->isLoaded()) { $statement = $tokenSelect->getSelect()->query(); @@ -859,18 +861,6 @@ } } - /* - $batch = $this->_loadClass('Batch_ProcessTokensBatch', true, array($batch_id)); - - if (! $batch->isLoaded()) { - $statement = $tokenSelect->getSelect()->query(); - //Process one row at a time to prevent out of memory errors for really big resultsets - while ($tokenData = $statement->fetch()) { - $batch->addToken($tokenData['gto_id_token'], $userId); - } - } - */ - return $batch; } @@ -917,7 +907,7 @@ * @param string $batch_id A unique identifier for the current batch * @param int $userId Id of the user who takes the action (for logging) * @param string $cond - * @return Gems_Tracker_Batch_ProcessTokensBatch A batch to process the changes + * @return Gems_Task_TaskRunnerBatch A batch to process the changes */ public function recalculateTokensBatch($batch_id, $userId = null, $cond = null) { Modified: trunk/library/classes/Gems/User/RadiusUserDefinition.php =================================================================== --- trunk/library/classes/Gems/User/RadiusUserDefinition.php 2012-02-20 12:19:38 UTC (rev 501) +++ trunk/library/classes/Gems/User/RadiusUserDefinition.php 2012-02-20 14:13:20 UTC (rev 502) @@ -29,7 +29,7 @@ * @subpackage User * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License - * @version $Id: RadiusUserDefinition.php 228 2011-12-21 09:39:34Z 175780 $ + * @version $Id$ */ /** Property changes on: trunk/library/classes/Gems/User/RadiusUserDefinition.php ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date Author Modified: trunk/library/classes/Gems/Util/AccessLogActions.php =================================================================== --- trunk/library/classes/Gems/Util/AccessLogActions.php 2012-02-20 12:19:38 UTC (rev 501) +++ trunk/library/classes/Gems/Util/AccessLogActions.php 2012-02-20 14:13:20 UTC (rev 502) @@ -30,7 +30,7 @@ * @subpackage Util * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License - * @version $Id: ReceptionCode.php 370 2011-12-19 09:27:19Z mennodekker $ + * @version $Id$ */ /** Property changes on: trunk/library/classes/Gems/Util/AccessLogActions.php ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date Author This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-20 12:19:47
|
Revision: 501 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=501&view=rev Author: mennodekker Date: 2012-02-20 12:19:38 +0000 (Mon, 20 Feb 2012) Log Message: ----------- depended n Gems_Tracker_Batch_ProcessTokensBatch so ported too Modified Paths: -------------- trunk/library/classes/Gems/Default/SourceAction.php Modified: trunk/library/classes/Gems/Default/SourceAction.php =================================================================== --- trunk/library/classes/Gems/Default/SourceAction.php 2012-02-20 12:06:25 UTC (rev 500) +++ trunk/library/classes/Gems/Default/SourceAction.php 2012-02-20 12:19:38 UTC (rev 501) @@ -128,26 +128,9 @@ $batch = $this->loader->getTracker()->recalculateTokensBatch('sourceCheck' . $sourceId, $this->loader->getCurrentUser()->getUserId(), $where); - if ($batch->run($this->getRequest())) { - exit; - } else { - $this->html->h3( - sprintf($this->_('Checking survey results for %s source.'), - $this->db->fetchOne("SELECT gso_source_name FROM gems__sources WHERE gso_id_source = ?", $sourceId))); - - if ($batch->isFinished()) { - $this->addMessage($batch->getMessages(true)); - $this->html->pInfo($batch->getRestartButton($this->_('Prepare recheck'), array('class' => 'actionlink'))); - } else { - if ($batch->count()) { - // Batch is loaded by Tracker - $this->html->pInfo($batch->getStartButton(sprintf($this->_('Check %s tokens'), $batch->getTokenCount()))); - $this->html->append($batch->getPanel($this->view, $batch->getProgressPercentage() . '%')); - } else { - $this->html->pInfo($this->_('No tokens to check.')); - } - } - } + $title = sprintf($this->_('Checking survey results for %s source.'), + $this->db->fetchOne("SELECT gso_source_name FROM gems__sources WHERE gso_id_source = ?", $sourceId)); + $this->_helper->BatchRunner($batch, $title); } /** @@ -157,24 +140,8 @@ { $batch = $this->loader->getTracker()->recalculateTokensBatch('surveyCheckAll', $this->loader->getCurrentUser()->getUserId()); - if ($batch->run($this->getRequest())) { - exit; - } else { - $this->html->h3($this->_('Checking survey results for all sources.')); - - if ($batch->isFinished()) { - $this->addMessage($batch->getMessages(true)); - $this->html->pInfo($batch->getRestartButton($this->_('Prepare recheck'), array('class' => 'actionlink'))); - } else { - if ($batch->count()) { - // Batch is loaded by Tracker - $this->html->pInfo($batch->getStartButton(sprintf($this->_('Check %s tokens'), $batch->getTokenCount()))); - $this->html->append($batch->getPanel($this->view, $batch->getProgressPercentage() . '%')); - } else { - $this->html->pInfo($this->_('No tokens to check.')); - } - } - } + $title = $this->_('Checking survey results for all sources.'); + $this->_helper->BatchRunner($batch, $title); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-20 12:06:37
|
Revision: 500 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=500&view=rev Author: mennodekker Date: 2012-02-20 12:06:25 +0000 (Mon, 20 Feb 2012) Log Message: ----------- Introducing the independent TaskRunnerBatch that can execute all kinds of tasks in a single batch and converted Gems_Tracker_Batch_ProcessTokensBatch to the TaskRunner Modified Paths: -------------- trunk/library/classes/Gems/Loader.php trunk/library/classes/Gems/Tracker.php trunk/library/classes/MUtil/Batch/BatchAbstract.php Added Paths: ----------- trunk/library/classes/Gems/Task/ trunk/library/classes/Gems/Task/CheckTokenCompletion.php trunk/library/classes/Gems/Task/CheckTrackTokens.php trunk/library/classes/Gems/Task/ProcessTokenCompletion.php trunk/library/classes/Gems/Task/TaskAbstract.php trunk/library/classes/Gems/Task/TaskInterface.php trunk/library/classes/Gems/Task/TaskRunnerBatch.php Modified: trunk/library/classes/Gems/Loader.php =================================================================== --- trunk/library/classes/Gems/Loader.php 2012-02-16 17:19:44 UTC (rev 499) +++ trunk/library/classes/Gems/Loader.php 2012-02-20 12:06:25 UTC (rev 500) @@ -203,6 +203,24 @@ /** * + * @return Gems_Task_TaskAbstract + */ + public function getTask($name) { + return $this->_getClass('task', 'Task_' . ucfirst($name)); + } + + /** + * + * @param type $id + * @return Gems_Task_TaskRunnerBatch + */ + public function getTaskRunnerBatch($id) + { + return $this->_loadClass('Task_TaskRunnerBatch', true, array($id)); + } + + /** + * * @return Gems_Tracker_TrackerInterface */ public function getTracker() Added: trunk/library/classes/Gems/Task/CheckTokenCompletion.php =================================================================== --- trunk/library/classes/Gems/Task/CheckTokenCompletion.php (rev 0) +++ trunk/library/classes/Gems/Task/CheckTokenCompletion.php 2012-02-20 12:06:25 UTC (rev 500) @@ -0,0 +1,85 @@ +<?php +/** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $ + */ + +/** + * Short description for ProcessTokens + * + * Long description for class ProcessTokens (if any)... + * + * @package Gems + * @subpackage Sample + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.0 + * @deprecated Class deprecated since version 2.0 + */ +class Gems_Task_CheckTokenCompletion extends Gems_Task_TaskAbstract +{ + /** + * @var Gems_Tracker + */ + public $tracker; + + public function execute($tokenData = null, $userId = null) + { + $this->tracker = $this->loader->getTracker(); + $this->_batch->addToCounter('checkedTokens'); + $token = $this->tracker->getToken($tokenData); + + if ($result = $token->checkTokenCompletion($userId)) { + if ($result & Gems_Tracker_Token::COMPLETION_DATACHANGE) { + $this->_batch->addToCounter('resultDataChanges'); + } + if ($result & Gems_Tracker_Token::COMPLETION_EVENTCHANGE) { + $this->_batch->addToCounter('surveyCompletionChanges'); + } + } + + if ($token->isCompleted()) { + $this->_batch->setTask('processTokenCompletion', 'tokproc-' . $token->getTokenId(), $tokenData, $userId); + } + + if ($this->_batch->getCounter('surveyCompletionChanges')) { + $this->_batch->setMessage('surveyCompletionChanges', sprintf($this->translate->_('Answers changed by survey completion event for %d tokens.'), $this->_batch->getCounter('surveyCompletionChanges'))); + } + + if ($this->_batch->getCounter('resultDataChanges')) { + $this->_batch->setMessage('resultDataChanges', sprintf($this->translate->_('Results and timing changed for %d tokens.'), $this->_batch->getCounter('resultDataChanges'))); + } + + $this->_batch->setMessage('checkedTokens', sprintf($this->translate->_('Checked %d tokens.'), $this->_batch->getCounter('checkedTokens'))); + } +} \ No newline at end of file Added: trunk/library/classes/Gems/Task/CheckTrackTokens.php =================================================================== --- trunk/library/classes/Gems/Task/CheckTrackTokens.php (rev 0) +++ trunk/library/classes/Gems/Task/CheckTrackTokens.php 2012-02-20 12:06:25 UTC (rev 500) @@ -0,0 +1,74 @@ +<?php + +/** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $ + */ + +/** + * Short description for CheckTrackTokens + * + * Long description for class CheckTrackTokens (if any)... + * + * @package Gems + * @subpackage Sample + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.0 + * @deprecated Class deprecated since version 2.0 + */ +class Gems_Task_CheckTrackTokens extends Gems_Task_TaskAbstract +{ + /** + * @var Gems_Tracker + */ + public $tracker; + + public function execute($respTrackData = null, $userId = null) + { + $this->tracker = $this->loader->getTracker(); + $respTrack = $this->tracker->getRespondentTrack($respTrackData); + $this->_batch->addToCounter('checkedRespondentTracks'); + + if ($result = $respTrack->checkTrackTokens($userId)) { + $this->_batch->addToCounter('tokenDateCauses'); + $this->_batch->addToCounter('tokenDateChanges', $result); + } + + if ($this->_batch->getCounter('tokenDateChanges')) { + $this->_batch->setMessage('tokenDateChanges', sprintf($this->translate->_('%2$d token date changes in %1$d tracks.'), $this->_batch->getCounter('tokenDateCauses'), $this->_batch->getCounter('tokenDateChanges'))); + } + + $this->_batch->setMessage('checkedRespondentTracks', sprintf($this->translate->_('Checked %d tracks.'), $this->_batch->getCounter('checkedRespondentTracks'))); + } +} \ No newline at end of file Added: trunk/library/classes/Gems/Task/ProcessTokenCompletion.php =================================================================== --- trunk/library/classes/Gems/Task/ProcessTokenCompletion.php (rev 0) +++ trunk/library/classes/Gems/Task/ProcessTokenCompletion.php 2012-02-20 12:06:25 UTC (rev 500) @@ -0,0 +1,79 @@ +<?php + +/** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $ + */ + +/** + * Short description for ProcessTokenCompletion + * + * Long description for class ProcessTokenCompletion (if any)... + * + * @package Gems + * @subpackage Sample + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.0 + * @deprecated Class deprecated since version 2.0 + */ +class Gems_Task_ProcessTokenCompletion extends Gems_Task_TaskAbstract +{ + /** + * @var Gems_Tracker + */ + public $tracker; + + + public function execute($tokenData = null, $userId = null) + { + $this->tracker = $this->loader->getTracker(); + $token = $this->tracker->getToken($tokenData); + + if ($token->isCompleted()) { + $respTrack = $token->getRespondentTrack(); + + if ($result = $respTrack->handleRoundCompletion($token, $userId)) { + $this->_batch->addToCounter('roundCompletionCauses'); + $this->_batch->addToCounter('roundCompletionChanges', $result); + } + + $trackId = $respTrack->getRespondentTrackId(); + $this->_batch->setTask('checkTrackTokens', 'chktrck-' . $trackId, $trackId, $userId); + } + + if ($this->_batch->getCounter('roundCompletionChanges')) { + $this->_batch->setMessage('roundCompletionChanges', sprintf($this->translate->_('%d token round completion events caused changed to %d tokens.'), $this->_batch->getCounter('roundCompletionCauses'), $this->_batch->getCounter('roundCompletionChanges'))); + } + } +} \ No newline at end of file Added: trunk/library/classes/Gems/Task/TaskAbstract.php =================================================================== --- trunk/library/classes/Gems/Task/TaskAbstract.php (rev 0) +++ trunk/library/classes/Gems/Task/TaskAbstract.php 2012-02-20 12:06:25 UTC (rev 500) @@ -0,0 +1,76 @@ +<?php + +/** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $ + */ + +/** + * Short description for TaskAbstract + * + * Long description for class TaskAbstract (if any)... + * + * @package Gems + * @subpackage Sample + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.0 + * @deprecated Class deprecated since version 2.0 + */ +abstract class Gems_Task_TaskAbstract extends MUtil_Registry_TargetAbstract implements Gems_Task_TaskInterface +{ + /** + * @var Gems_Task_TaskRunnerBatch + */ + protected $_batch; + + /** + * @var array + */ + protected $_params; + + /** + * @var Gems_Loader + */ + public $loader; + + /** + * @var Zend_Translate_Adapter + */ + public $translate; + + public function setBatch(Gems_Task_TaskRunnerBatch $batch) + { + $this->_batch = $batch; + } +} \ No newline at end of file Added: trunk/library/classes/Gems/Task/TaskInterface.php =================================================================== --- trunk/library/classes/Gems/Task/TaskInterface.php (rev 0) +++ trunk/library/classes/Gems/Task/TaskInterface.php 2012-02-20 12:06:25 UTC (rev 500) @@ -0,0 +1,55 @@ +<?php + +/** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $ + */ + +/** + * Short description for TaskAbstract + * + * Long description for class TaskAbstract (if any)... + * + * @package Gems + * @subpackage Sample + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.0 + * @deprecated Class deprecated since version 2.0 + */ +interface Gems_Task_TaskInterface +{ + public function execute(); + + public function setBatch(Gems_Task_TaskRunnerBatch $batch); +} \ No newline at end of file Added: trunk/library/classes/Gems/Task/TaskRunnerBatch.php =================================================================== --- trunk/library/classes/Gems/Task/TaskRunnerBatch.php (rev 0) +++ trunk/library/classes/Gems/Task/TaskRunnerBatch.php 2012-02-20 12:06:25 UTC (rev 500) @@ -0,0 +1,137 @@ +<?php + +/** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $ + */ + +/** + * Short description for TaskRunnerBatch + * + * Long description for class TaskRunnerBatch (if any)... + * + * @package Gems + * @subpackage Sample + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.0 + * @deprecated Class deprecated since version 2.0 + */ +class Gems_Task_TaskRunnerBatch extends MUtil_Batch_BatchAbstract +{ + /** + * @var Gems_Loader + */ + public $loader; + + public $minimalStepDurationMs = 1000; + + public function __construct($id = null) + { + parent::__construct($id); + $this->loader = GemsEscort::getInstance()->loader; + } + + /** + * Add a message to the message stack. + * + * @param string $text A message to the user + * @return Gems_Task_TaskRunnerBatch + */ + public function addMessage($text) + { + parent::addMessage($text); + } + + /** + * Increment a named counter + * + * @param string $name + * @param integer $add + * @return integer + */ + public function addToCounter($name, $add = 1) + { + return parent::addToCounter($name, $add); + } + + /** + * Add a task to the stack, optionally adding as much parameters as needed + * + * @param string $task + * @return Gems_Task_TaskRunnerBatch + */ + public function addTask($task, $param1 = null) + { + $params = array_slice(func_get_args(), 1); + $this->addStep('runTask', $task, $params); + + return $this; + } + + public function runTask($task, $params) + { + $params = array_slice(func_get_args(), 1); + $taskClass = $this->loader->getTask($task); + $taskClass->setBatch($this); + call_user_func_array(array($taskClass, 'execute'), $params[0]); + } + + /** + * Add/set a message on the message stack with a specific id. + * + * @param scalar $id + * @param string $text A message to the user + * @return Gems_Task_TaskRunnerBatch + */ + public function setMessage($id, $text) + { + return parent::setMessage($id, $text); + } + + /** + * Add an execution step to the command stack. + * + * @param string $task + * @param mixed $id A unique id to prevent double adding of something to do + * @param mixed $param1 Scalar or array with scalars, as many parameters as needed allowed + * @return Gems_Task_TaskRunnerBatch + */ + public function setTask($task, $id, $param1 = null) + { + $params = array_slice(func_get_args(), 2); + $this->setStep('runTask', $id, $task, $params); + + return $this; + } +} \ No newline at end of file Modified: trunk/library/classes/Gems/Tracker.php =================================================================== --- trunk/library/classes/Gems/Tracker.php 2012-02-16 17:19:44 UTC (rev 499) +++ trunk/library/classes/Gems/Tracker.php 2012-02-20 12:06:25 UTC (rev 500) @@ -128,6 +128,12 @@ /** * + * @var Gems_Loader + */ + protected $loader; + + /** + * * @var Zend_Translate */ protected $translate; @@ -841,6 +847,19 @@ { $where = implode(' ', $tokenSelect->getSelect()->getPart(Zend_Db_Select::WHERE)); + $batch = $this->loader->getTaskRunnerBatch($batch_id); + + if (! $batch->isLoaded()) { + $statement = $tokenSelect->getSelect()->query(); + //Process one row at a time to prevent out of memory errors for really big resultsets + while ($tokenData = $statement->fetch()) { + $tokenId = $tokenData['gto_id_token']; + $batch->setTask('checkTokenCompletion', 'tokchk-' . $tokenId, $tokenId, $userId); + $batch->addToCounter('tokens'); + } + } + + /* $batch = $this->_loadClass('Batch_ProcessTokensBatch', true, array($batch_id)); if (! $batch->isLoaded()) { @@ -850,6 +869,7 @@ $batch->addToken($tokenData['gto_id_token'], $userId); } } + */ return $batch; } Modified: trunk/library/classes/MUtil/Batch/BatchAbstract.php =================================================================== --- trunk/library/classes/MUtil/Batch/BatchAbstract.php 2012-02-16 17:19:44 UTC (rev 499) +++ trunk/library/classes/MUtil/Batch/BatchAbstract.php 2012-02-20 12:06:25 UTC (rev 500) @@ -81,6 +81,13 @@ private $_id; /** + * Holds the last message set by the batch job + * + * @var string + */ + private $_lastMessage = null; + + /** * Stack to keep existing id's. * * @var array @@ -246,6 +253,7 @@ protected function addMessage($text) { $this->_session->messages[] = $text; + $this->_lastMessage = $text; return $this; } @@ -313,6 +321,11 @@ return (string) $this->_functionPrefix; } + protected function getLastMessage() + { + return $this->_lastMessage; + } + /** * String of messages from the batch * @@ -560,7 +573,7 @@ // error_log('Cur: ' . microtime(true) . ' report is '. (microtime(true) > $reportRun ? 'true' : 'false')); if (microtime(true) > $reportRun) { // Communicate progress - $bar->update($this->getProgressPercentage(), end($this->_session->messages)); + $bar->update($this->getProgressPercentage(), $this->getLastMessage()); // INFO: When using PULL $bar->update() should exit the program, // but just let us make sure. @@ -619,6 +632,7 @@ protected function setMessage($id, $text) { $this->_session->messages[$id] = $text; + $this->_lastMessage = $text; return $this; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-16 17:19:55
|
Revision: 499 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=499&view=rev Author: matijsdejong Date: 2012-02-16 17:19:44 +0000 (Thu, 16 Feb 2012) Log Message: ----------- Left joins at end might be faster Modified Paths: -------------- trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php Modified: trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php =================================================================== --- trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php 2012-02-16 17:15:30 UTC (rev 498) +++ trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php 2012-02-16 17:19:44 UTC (rev 499) @@ -96,7 +96,6 @@ } $this->addTable( 'gems__tracks', array('gto_id_track' => 'gtr_id_track')); - $this->addLeftTable('gems__rounds', array('gto_id_round' => 'gro_id_round')); $this->addTable( 'gems__surveys', array('gto_id_survey' => 'gsu_id_survey')); $this->addTable( 'gems__groups', array('gsu_id_primary_group' => 'ggp_id_group')); $this->addTable( 'gems__respondents', array('gto_id_respondent' => 'grs_id_user')); @@ -104,6 +103,7 @@ $this->addTable( 'gems__respondent2track', array('gr2t_id_respondent_track' => 'gto_id_respondent_track'), $this->saveRespondentTracks); $this->addTable( 'gems__organizations', array('gto_id_organization' => 'gor_id_organization')); $this->addTable( 'gems__reception_codes', array('gto_reception_code' => 'grc_id_reception_code')); + $this->addLeftTable('gems__rounds', array('gto_id_round' => 'gro_id_round')); $this->addLeftTable('gems__staff', array('gr2t_created_by' => 'gems__staff.gsf_id_user')); $this->addColumn( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-16 17:15:42
|
Revision: 498 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=498&view=rev Author: matijsdejong Date: 2012-02-16 17:15:30 +0000 (Thu, 16 Feb 2012) Log Message: ----------- refreshTokenAttributesBatch works, but could yet be implemented at other levels than source level LimeSurvey token tables now have token length corrected when needed LimeSurvey 1.91 token tables now get usesleft field when it does not exists Modified Paths: -------------- trunk/library/classes/Gems/Default/SourceAction.php trunk/library/classes/Gems/Menu/MenuAbstract.php trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m91Database.php trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php trunk/library/classes/Gems/Tracker/TrackerInterface.php trunk/library/classes/Gems/Tracker.php trunk/library/configs/db/patches.sql Added Paths: ----------- trunk/library/classes/Gems/Tracker/Batch/RefreshTokenAttributesBatch.php Modified: trunk/library/classes/Gems/Default/SourceAction.php =================================================================== --- trunk/library/classes/Gems/Default/SourceAction.php 2012-02-16 15:22:35 UTC (rev 497) +++ trunk/library/classes/Gems/Default/SourceAction.php 2012-02-16 17:15:30 UTC (rev 498) @@ -103,6 +103,22 @@ } /** + * Check all token attributes for a single source + */ + public function attributesAction() + { + $sourceId = $this->getSourceId(); + $where = $this->db->quoteInto('gsu_id_source = ?', $sourceId); + + $batch = $this->loader->getTracker()->refreshTokenAttributesBatch('sourceCheck' . $sourceId, $where); + + $title = sprintf($this->_('Refreshing token attributes for for %s source.'), + $this->db->fetchOne("SELECT gso_source_name FROM gems__sources WHERE gso_id_source = ?", $sourceId)); + + $this->_helper->BatchRunner($batch, $title); + } + + /** * Check all the tokens for a single source */ public function checkAction() Modified: trunk/library/classes/Gems/Menu/MenuAbstract.php =================================================================== --- trunk/library/classes/Gems/Menu/MenuAbstract.php 2012-02-16 15:22:35 UTC (rev 497) +++ trunk/library/classes/Gems/Menu/MenuAbstract.php 2012-02-16 17:15:30 UTC (rev 498) @@ -412,6 +412,7 @@ $page->addAction($this->_('Check status'), null, 'ping')->addParameters(MUtil_Model::REQUEST_ID); $page->addAction($this->_('Synchronize surveys'), 'pr.source.synchronize', 'synchronize')->addParameters(MUtil_Model::REQUEST_ID); $page->addAction($this->_('Check answers'), 'pr.source.check-answers', 'check')->addParameters(MUtil_Model::REQUEST_ID); + $page->addAction($this->_('Check attributes'), 'pr.source.check-attributes', 'attributes')->addParameters(MUtil_Model::REQUEST_ID); $page->addAction($this->_('Synchronize all surveys'), 'pr.source.synchronize-all', 'synchronize-all'); $page->addAction($this->_('Check all answers'), 'pr.source.check-answers-all', 'check-all'); Added: trunk/library/classes/Gems/Tracker/Batch/RefreshTokenAttributesBatch.php =================================================================== --- trunk/library/classes/Gems/Tracker/Batch/RefreshTokenAttributesBatch.php (rev 0) +++ trunk/library/classes/Gems/Tracker/Batch/RefreshTokenAttributesBatch.php 2012-02-16 17:15:30 UTC (rev 498) @@ -0,0 +1,133 @@ +<?php + +/** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package Gems + * @subpackage Tracker + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id$ + */ + +/** + * Refresh the attributes of all tokens + * + * @package Gems + * @subpackage Tracker + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5 + */ +class Gems_Tracker_Batch_RefreshTokenAttributesBatch extends MUtil_Batch_BatchAbstract +{ + /** + * + * @var Gems_Tracker + */ + protected $tracker; + + /** + * + * @var Zend_Translate + */ + protected $translate; + + /** + * Add a token check step to the batch + * + * @param string $tokenId A token id + * @return Gems_Tracker_Batch_UpdateAttributesBatch (Continuation pattern) + */ + public function addToken($tokenId) + { + $this->addStep('updateAttributes', $tokenId); + + return $this; + } + + /** + * Add token check steps to the batch + * + * @param array $tokenIds An array of token ids + * @return Gems_Tracker_Batch_UpdateAttributesBatch (Continuation pattern) + */ + public function addTokens(array $tokenIds) + { + foreach ($tokenIds as $tokenId) { + $this->addStep('updateAttributes', $tokenId); + } + + return $this; + } + + /** + * String of messages from the batch + * + * Do not forget to reset() the batch if you're done with it after + * displaying the report. + * + * @param boolean $reset When true the batch is reset afterwards + * @return array + */ + public function getMessages($reset = false) + { + + $cAll = $this->count(); + $cTokens = $this->getCounter('changedTokens'); + + $messages = parent::getMessages($reset); + + array_unshift($messages, sprintf($this->translate->_('Checked %d token.'), $cAll)); + if ($cTokens == 0) { + $messages[] = $this->translate->_('No attributes were updated.'); + } else { + $messages[] = sprintf($this->translate->plural('%d token changed.', '%d tokens changed.', $cTokens), $cTokens); + } + + return $messages; + } + + /** + * Update the attributes of a token, if the token is + * already in the source. + * + * @param string $tokenId A token id + */ + protected function updateAttributes($tokenId) + { + $token = $this->tracker->getToken($tokenId); + + if ($token->inSource()) { + $survey = $token->getSurvey(); + if ($survey->copyTokenToSource($token, '')) { + $this->addToCounter('changedTokens'); + } + } + } +} Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m91Database.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m91Database.php 2012-02-16 15:22:35 UTC (rev 497) +++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m91Database.php 2012-02-16 17:15:30 UTC (rev 498) @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2011, Erasmus MC * All rights reserved. @@ -54,4 +55,38 @@ */ protected $_anonymizedField = 'anonymized'; + /** + * Returns a list of field names that should be set in a newly inserted token. + * + * Added the usesleft value. + * + * @param Gems_Tracker_Token $token + * @return array Of fieldname => value type + */ + protected function _fillAttributeMap(Gems_Tracker_Token $token) + { + $values = parent::_fillAttributeMap($token); + + // Not really an attribute, but it is the best place to set this + $values['usesleft'] = $token->isCompleted() ? 0 : 1; + + return $values; + } + + /** + * Check a token table for any changes needed by this version. + * + * @param array $tokenTable + * @return array Fieldname => change field commands + */ + protected function _checkTokenTable(array $tokenTable) + { + $missingFields = parent::_checkTokenTable($tokenTable); + + if (! isset($tokenTable['usesleft'])) { + $missingFields['usesleft'] = "ADD `usesleft` INT( 11 ) NULL DEFAULT '1' AFTER `completed`"; + } + + return $missingFields; + } } \ No newline at end of file Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-02-16 15:22:35 UTC (rev 497) +++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-02-16 17:15:30 UTC (rev 498) @@ -48,8 +48,9 @@ { const CACHE_TOKEN_INFO = 'tokenInfo'; - const LS_DB_DATE_FORMAT = 'yyyy-MM-dd'; - const LS_DB_DATETIME_FORMAT = 'yyyy-MM-dd HH:mm:ss'; + const LS_DB_COMPLETION_FORMAT = 'yyyy-MM-dd HH:mm'; + const LS_DB_DATE_FORMAT = 'yyyy-MM-dd'; + const LS_DB_DATETIME_FORMAT = 'yyyy-MM-dd HH:mm:ss'; const QUESTIONS_TABLE = 'questions'; const SURVEY_TABLE = 'survey_'; @@ -119,9 +120,41 @@ protected $util; /** + * Check a token table for any changes needed by this version. + * + * @param array $tokenTable + * @return array Fieldname => change field commands + */ + protected function _checkTokenTable(array $tokenTable) + { + $missingFields = array(); + + $lengths = array(); + if (preg_match('/\(([^\)]+)\)/', $tokenTable['token']['Type'], $lengths)) { + $tokenLength = $lengths[1]; + } else { + $tokenLength = 0; + } + $token_library = $this->tracker->getTokenLibrary(); + if ($tokenLength < $token_library->getLength()) { + $tokenLength = $token_library->getLength(); + $missingFields['token'] = "CHANGE COLUMN `token` `token` varchar($tokenLength) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NULL"; + } + + foreach ($this->_attributeMap as $name => $field) { + if (! isset($tokenTable[$field])) { + $missingFields[$field] = "ADD $field varchar(255) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'"; + } + } + + return $missingFields; + } + + /** * Returns a list of field names that should be set in a newly inserted token. * * @param Gems_Tracker_Token $token + * @return array Of fieldname => value type */ protected function _fillAttributeMap(Gems_Tracker_Token $token) { @@ -377,7 +410,7 @@ $messages[] = sprintf($this->translate->_('The \'%s\' survey is no longer active. The survey was removed from LimeSurvey!'), $survey->getName()); } } else { - $lsDb = $this->getSourceDatabase(); + $lsDb = $this->getSourceDatabase(); // SELECT sid, surveyls_title AS short_title, surveyls_description AS description, active, datestamp, ' . $this->_anonymizedField . ' $select = $lsDb->select(); @@ -401,7 +434,7 @@ break; default: // This is for the case that $this->_anonymizedField is empty, we show an update statement. - // The answers already in the table can only be linked to the repsonse based on the completion time + // The answers already in the table can only be linked to the response based on the completion time // this requires a manual action as token table only hold minuts while survey table holds seconds // and we might have responses with the same timestamp. $lsDb->query("UPDATE " . $this->_getSurveysTableName() . " SET `" . $this->_anonymizedField . "` = 'N' WHERE sid = ?;", $sourceSurveyId); @@ -425,34 +458,21 @@ } if ($tokenTable) { - $lengths = array(); - if (preg_match('/\(([^\)]+)\)/', $tokenTable['token']['Type'], $lengths)) { - $tokenLength = $lengths[1]; - } else { - $tokenLength = 0; - } - $token_library = $this->tracker->getTokenLibrary(); - if ($tokenLength < $token_library->getLength()) { - $surveyor_status .= 'Token field length is too short. '; - } + $missingFields = $this->_checkTokenTable($tokenTable); - $missingFields = array(); - foreach ($this->_attributeMap as $name => $field) { - if (! isset($tokenTable[$field])) { - $missingFields[$field] = "ADD $field varchar(255) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'"; - } - } if ($missingFields) { - $sql = "ALTER TABLE " . $this->_getTokenTableName($sourceSurveyId) . " " . implode(', ', $missingFields); + $sql = "ALTER TABLE " . $this->_getTokenTableName($sourceSurveyId) . " " . implode(', ', $missingFields); + $fields = implode($this->translate->_(', '), array_keys($missingFields)); + // MUtil_Echo::track($missingFields, $sql); try { $lsDb->query($sql); - $messages[] = sprintf($this->translate->_("Added attribute fields to token table for '%s'"), $surveyor_title); + $messages[] = sprintf($this->translate->_("Added to token table '%s' the field(s): %s"), $surveyor_title, $fields); } catch (Zend_Exception $e) { $surveyor_status .= 'Token attributes could not be created. '; $surveyor_status .= $e->getMessage() . ' '; $messages[] = sprintf($this->translate->_("Attribute fields not created for token table for '%s'"), $surveyor_title); - $messages[] = sprintf($this->translate->_('Required fields: %s', implode($this->translate->_(', '), array_keys($missingFields)))); + $messages[] = sprintf($this->translate->_('Required fields: %s', $fields)); $messages[] = $e->getMessage(); // Maximum reporting for this case @@ -587,7 +607,12 @@ // Get the mapped values $values = $this->_fillAttributeMap($token); - $values['completed'] = 'N'; // Apparently it is possible to have this value filled without a survey questionnaire. + // Apparently it is possible to have this value filled without a survey questionnaire. + if ($token->isCompleted()) { + $values['completed'] = $token->getCompletionTime()->toString(self::LS_DB_COMPLETION_FORMAT); + } else { + $values['completed'] = 'N'; + } $result = 0; if ($oldValues = $lsDb->fetchRow("SELECT * FROM $lsTokens WHERE token = ? LIMIT 1", $tokenId)) { @@ -974,7 +999,7 @@ $result = $token->cacheGet(self::CACHE_TOKEN_INFO); } - if ($fields !== null) $result = array_intersect_key((array) $result, array_flip ($fields)); + if ($fields !== null) $result = array_intersect_key((array) $result, array_flip($fields)); return $result; } Modified: trunk/library/classes/Gems/Tracker/TrackerInterface.php =================================================================== --- trunk/library/classes/Gems/Tracker/TrackerInterface.php 2012-02-16 15:22:35 UTC (rev 497) +++ trunk/library/classes/Gems/Tracker/TrackerInterface.php 2012-02-16 17:15:30 UTC (rev 498) @@ -301,4 +301,13 @@ * @return Gems_Tracker_Batch_ProcessTokensBatch A batch to process the changes */ public function recalculateTokensBatch($batch_id, $userId = null, $cond = null); + + /** + * Refreshes the tokens in the source + * + * @param string $batch_id A unique identifier for the current batch + * @param string $cond An optional where statement + * @return Gems_Tracker_Batch_ProcessTokensBatch A batch to process the changes + */ + public function refreshTokenAttributesBatch($batch_id, $cond = null); } Modified: trunk/library/classes/Gems/Tracker.php =================================================================== --- trunk/library/classes/Gems/Tracker.php 2012-02-16 15:22:35 UTC (rev 497) +++ trunk/library/classes/Gems/Tracker.php 2012-02-16 17:15:30 UTC (rev 498) @@ -887,6 +887,7 @@ return $batch; } + /** * Recalculates all token dates, timing and results * and outputs text messages. @@ -916,4 +917,37 @@ self::$verbose = true; return $this->processTokensBatch($batch_id, $tokenSelect, $userId); } + + /** + * Refreshes the tokens in the source + * + * @param string $batch_id A unique identifier for the current batch + * @param string $cond An optional where statement + * @return Gems_Tracker_Batch_ProcessTokensBatch A batch to process the changes + */ + public function refreshTokenAttributesBatch($batch_id, $cond = null) + { + $batch = $this->_loadClass('Batch_RefreshTokenAttributesBatch', true, array($batch_id)); + + if (! $batch->isLoaded()) { + $tokenSelect = $this->getTokenSelect(array('gto_id_token')); + $tokenSelect->andSurveys(array()) + ->forWhere('gsu_surveyor_active = 1') + ->forWhere('gto_in_source = 1'); + + if ($cond) { + // Add all connections for filtering, but select only surveys that are active in the source + $tokenSelect->andReceptionCodes(array()) + ->andRespondents(array()) + ->andRespondentOrganizations(array()) + ->andConsents(array()) + ->forWhere($cond); + } + + $batch->addTokens($this->db->fetchCol($tokenSelect->getSelect())); + } + self::$verbose = true; + + return $batch; + } } Modified: trunk/library/configs/db/patches.sql =================================================================== --- trunk/library/configs/db/patches.sql 2012-02-16 15:22:35 UTC (rev 497) +++ trunk/library/configs/db/patches.sql 2012-02-16 17:15:30 UTC (rev 498) @@ -375,3 +375,7 @@ -- PATCH: Add track completion event ALTER TABLE `gems__tracks` ADD gtr_completed_event varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' AFTER gtr_track_class; + +-- GEMS VERSION: 45 +-- PATCH: Assign attribute sync to super role +UPDATE gems__roles SET grl_privileges = CONCAT(grl_privileges,',pr.source.check-attributes') WHERE grl_name = 'super' AND grl_privileges NOT LIKE '%pr.source.check-attributes%'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-16 15:22:46
|
Revision: 497 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=497&view=rev Author: mennodekker Date: 2012-02-16 15:22:35 +0000 (Thu, 16 Feb 2012) Log Message: ----------- Action Helper for batches Modified Paths: -------------- trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php trunk/library/classes/GemsEscort.php trunk/library/classes/MUtil/Controller/Action.php Added Paths: ----------- trunk/library/classes/Gems/Controller/Action/ trunk/library/classes/Gems/Controller/Action/Helper/ trunk/library/classes/Gems/Controller/Action/Helper/BatchRunner.php Added: trunk/library/classes/Gems/Controller/Action/Helper/BatchRunner.php =================================================================== --- trunk/library/classes/Gems/Controller/Action/Helper/BatchRunner.php (rev 0) +++ trunk/library/classes/Gems/Controller/Action/Helper/BatchRunner.php 2012-02-16 15:22:35 UTC (rev 497) @@ -0,0 +1,79 @@ +<?php + +/** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $ + */ + +/** + * Short description for BatchRunner + * + * Long description for class BatchRunner (if any)... + * + * @package Gems + * @subpackage Sample + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.0 + * @deprecated Class deprecated since version 2.0 + */ +class Gems_Controller_Action_Helper_BatchRunner extends Zend_Controller_Action_Helper_Abstract +{ + /** + * + * @param MUtil_Batch_BatchAbstract $batch + * @param string $title + */ + public function direct(MUtil_Batch_BatchAbstract $batch, $title) + { + + if ($batch->run($this->getRequest())) { + exit; + } else { + $controller = $this->getActionController(); + $controller->html->h3($title); + + if ($batch->isFinished()) { + $controller->addMessage($batch->getMessages(true)); + $controller->html->pInfo($batch->getRestartButton($controller->_('Prepare recheck'), array('class' => 'actionlink'))); + } else { + if ($batch->count()) { + $controller->html->pInfo($batch->getStartButton(sprintf($controller->_('Start %s jobs'), $batch->count()))); + $controller->html->append($batch->getPanel($controller->view, $batch->getProgressPercentage() . '%')); + } else { + $controller->html->pInfo($controller->_('Nothing to do.')); + } + } + } + } +} Modified: trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php =================================================================== --- trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php 2012-02-16 14:34:19 UTC (rev 496) +++ trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php 2012-02-16 15:22:35 UTC (rev 497) @@ -273,26 +273,9 @@ $batch = $this->loader->getTracker()->recalculateTokensBatch('surveyCheck' . $surveyId, $this->loader->getCurrentUser()->getUserId(), $where); - if ($batch->run($this->getRequest())) { - exit; - } else { - $this->html->h3( - sprintf($this->_('Checking survey results for the %s survey.'), - $this->db->fetchOne("SELECT gsu_survey_name FROM gems__surveys WHERE gsu_id_survey = ?", $surveyId))); - - if ($batch->isFinished()) { - $this->addMessage($batch->getMessages(true)); - $this->html->pInfo($batch->getRestartButton($this->_('Prepare recheck'), array('class' => 'actionlink'))); - } else { - if ($batch->count()) { - // Batch is loaded by Tracker - $this->html->pInfo($batch->getStartButton(sprintf($this->_('Check %s tokens'), $batch->getTokenCount()))); - $this->html->append($batch->getPanel($this->view, $batch->getProgressPercentage() . '%')); - } else { - $this->html->pInfo($this->_('No tokens to check.')); - } - } - } + $title = sprintf($this->_('Checking survey results for the %s survey.'), + $this->db->fetchOne("SELECT gsu_survey_name FROM gems__surveys WHERE gsu_id_survey = ?", $surveyId)); + $this->_helper->BatchRunner($batch, $title); } /** @@ -302,24 +285,8 @@ { $batch = $this->loader->getTracker()->recalculateTokensBatch('surveyCheckAll', $this->loader->getCurrentUser()->getUserId()); - if ($batch->run($this->getRequest())) { - exit; - } else { - $this->html->h3($this->_('Checking survey results for all surveys.')); - - if ($batch->isFinished()) { - $this->addMessage($batch->getMessages(true)); - $this->html->pInfo($batch->getRestartButton($this->_('Prepare recheck'), array('class' => 'actionlink'))); - } else { - if ($batch->count()) { - // Batch is loaded by Tracker - $this->html->pInfo($batch->getStartButton(sprintf($this->_('Check %s tokens'), $batch->getTokenCount()))); - $this->html->append($batch->getPanel($this->view, $batch->getProgressPercentage() . '%')); - } else { - $this->html->pInfo($this->_('No tokens to check.')); - } - } - } + $title = $this->_('Checking survey results for all surveys.'); + $this->_helper->BatchRunner($batch, $title); } /** Modified: trunk/library/classes/GemsEscort.php =================================================================== --- trunk/library/classes/GemsEscort.php 2012-02-16 14:34:19 UTC (rev 496) +++ trunk/library/classes/GemsEscort.php 2012-02-16 15:22:35 UTC (rev 497) @@ -274,6 +274,10 @@ return $acl->getAcl(); } + protected function _initActionHelpers() { + Zend_Controller_Action_HelperBroker::addPrefix('Gems_Controller_Action_Helper'); + } + /** * Initialize the Project or Gems loader. * Modified: trunk/library/classes/MUtil/Controller/Action.php =================================================================== --- trunk/library/classes/MUtil/Controller/Action.php 2012-02-16 14:34:19 UTC (rev 496) +++ trunk/library/classes/MUtil/Controller/Action.php 2012-02-16 15:22:35 UTC (rev 497) @@ -64,7 +64,7 @@ * * @var MUtil_Html_Sequence $html The html object to add content to. */ - protected $html; + public $html; /** * The loader for snippets. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-16 14:34:28
|
Revision: 496 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=496&view=rev Author: matijsdejong Date: 2012-02-16 14:34:19 +0000 (Thu, 16 Feb 2012) Log Message: ----------- Removed batched variables as we no longer use them (no longer using $updateTokens). Synchronize all sources now works Modified Paths: -------------- trunk/library/classes/Gems/Default/SourceAction.php trunk/library/classes/Gems/Tracker/Batch/SynchronizeSourcesBatch.php trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php trunk/library/classes/Gems/Tracker/Source/SourceAbstract.php trunk/library/classes/Gems/Tracker/Source/SourceInterface.php trunk/library/classes/Gems/Tracker/TrackerInterface.php trunk/library/classes/Gems/Tracker.php trunk/library/classes/MUtil/Batch/BatchAbstract.php Modified: trunk/library/classes/Gems/Default/SourceAction.php =================================================================== --- trunk/library/classes/Gems/Default/SourceAction.php 2012-02-16 13:45:27 UTC (rev 495) +++ trunk/library/classes/Gems/Default/SourceAction.php 2012-02-16 14:34:19 UTC (rev 496) @@ -253,7 +253,7 @@ { $sourceId = $this->getSourceId(); - $batch = $this->loader->getTracker()->synchronizeSourcesBatch($sourceId, $this->loader->getCurrentUser()->getUserId(), false); + $batch = $this->loader->getTracker()->synchronizeSourcesBatch($sourceId, $this->loader->getCurrentUser()->getUserId()); if ($batch->run($this->getRequest())) { exit; @@ -275,45 +275,39 @@ } } } - /* - $source = $this->getSourceById(); - - if ($messages = $source->synchronizeSurveys($this->loader->getCurrentUser()->getUserId())) { - $this->addMessage($messages); - } else { - $this->addMessage($this->_('No changes.')); - } - - $this->afterSaveRoute($this->getRequest()); - // */ } + /** + * Synchronize survey status for the surveys in all sources + */ public function synchronizeAllAction() { - $model = $this->getModel(); - $data = $model->load(null, $this->sortKey); + //* + $batch = $this->loader->getTracker()->synchronizeSourcesBatch(null, $this->loader->getCurrentUser()->getUserId()); - if ($this->_getParam('confirmed')) { - foreach ($data as $row) { - $source = $this->getSourceById($row['gso_id_source']); + if ($batch->run($this->getRequest())) { + exit; + } else { + $this->html->h3($this->_('Synchronize all sources.')); - $this->addMessage(sprintf($this->_('Synchronization of source %s:'), $row['gso_source_name'])); - if ($messages = $source->synchronizeSurveys($this->loader->getCurrentUser()->getUserId())) { - $this->addMessage($messages); + if ($batch->isFinished()) { + $this->addMessage($batch->getMessages(true)); + $this->html->pInfo($batch->getRestartButton($this->_('Prepare recheck'), array('class' => 'actionlink'))); + } else { + if ($batch->count()) { + // Batch is loaded by Tracker + $this->html->pInfo($batch->getStartButton(sprintf($this->plural('Check %s source', 'Check %s sources', $batch->getSourceCounter()), $batch->getSourceCounter()))); + $this->html->append($batch->getPanel($this->view, $batch->getProgressPercentage() . '%')); } else { - $this->addMessage($this->_('No changes.')); + $this->html->pInfo($this->_('No sources to check.')); } } + } // */ - $this->afterSaveRoute($this->getRequest()); - } - - $this->html->h3($this->_('Synchronize all sources of surveys')); - $this->html->pInfo($this->_('Synchronization will update the status of all surveys imported into this project to the status at the sources.')); - /* $batch = new MUtil_Batch_WaitBatch(); - // $batch->setMethodPush(5); + $batch->setMethodPush(5); + $batch->progressParameterName = 'waitprogress'; // $batch->autoStart = true; // $batch->minimalStepDurationMs = 2000; if ($batch->run($this->getRequest())) { @@ -325,7 +319,7 @@ } else { // Populate the batch (from scratch). $batch->reset(); - if (! true) { + if (true) { $batch->addWaitsMs(400, 20); $batch->addWaits(2, 1, 'Har har'); $batch->addWaitsMs(20, 50); @@ -344,18 +338,6 @@ } } // */ - if ($data) { - $rdata = MUtil_Lazy::repeat($data); - $table = $this->html->table($rdata, array('class' => 'browser')); - $table->th($this->getTopicTitle()); - $table->td()->a(array('action' => 'show', MUtil_Model::REQUEST_ID => $rdata->gso_id_source), $rdata->gso_source_name); - - $this->html->h4($this->_('Are you sure you want to synchronize all survey sources?')); - $this->html->actionLink(array('confirmed' => 1), $this->_('Yes')); - $this->html->actionLink(array('action' => 'index'), $this->_('No')); - } else { - $this->html->pInfo(sprintf($this->_('No %s found'), $this->getTopic(0))); - } $this->html->actionLink(array('action' => 'index'), $this->_('Cancel')); } } Modified: trunk/library/classes/Gems/Tracker/Batch/SynchronizeSourcesBatch.php =================================================================== --- trunk/library/classes/Gems/Tracker/Batch/SynchronizeSourcesBatch.php 2012-02-16 13:45:27 UTC (rev 495) +++ trunk/library/classes/Gems/Tracker/Batch/SynchronizeSourcesBatch.php 2012-02-16 14:34:19 UTC (rev 496) @@ -72,8 +72,9 @@ public function addSource($sourceData, $userId) { $this->_currentSource = $this->tracker->getSource($sourceData); - $this->_currentSource->addSynchronizeSurveyCommands($this, $userId, $this->getTokenUpdate()); + $this->_currentSource->addSynchronizeSurveyCommands($this, $userId); $this->_currentSource = null; + $this->addToSourceCounter(); } /** @@ -92,6 +93,17 @@ } /** + * Add one to the number of sources checked + * + * @param int $add + * @return int + */ + public function addToSourceCounter($add = 1) + { + return $this->addToCounter('sources', $add); + } + + /** * Add one to the number of surveys checked * * @param int $add @@ -113,46 +125,44 @@ */ public function getMessages($reset = false) { - $scounter = $this->getSurveyCounter(); + $cSources = $this->getSourceCounter(); + $cSurveys = $this->getSurveyCounter(); + $messages = parent::getMessages($reset); if (! $messages) { $messages[] = $this->translate->_('No surveys were changed.'); } - array_unshift($messages, sprintf($this->translate->_('%d surveys checked.'), $scounter)); + array_unshift($messages, sprintf($this->translate->_('%d surveys checked.'), $cSurveys)); + if ($cSources > 1) { + array_unshift($messages, sprintf($this->translate->_('%d sources checked.'), $cSources)); + } return $messages; } + /** - * Get the number of surveys checked + * Get the number of sources checked * * @return int */ - public function getSurveyCounter() + public function getSourceCounter() { - return $this->getCounter('surveys'); + return $this->getCounter('sources'); } /** - * Is tokenUpdate on or off. + * Get the number of surveys checked * - * @return boolean + * @return int */ - public function getTokenUpdate() + public function getSurveyCounter() { - return $this->getVar('tokenUpdate'); + return $this->getCounter('surveys'); } /** - * Set tokenUpdate on or off. - */ - public function setTokenUpdate($value = true) - { - $this->setVar('tokenUpdate', $value); - } - - /** * The basic steps * * @param int $sourceId Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-02-16 13:45:27 UTC (rev 495) +++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-02-16 14:34:19 UTC (rev 496) @@ -300,9 +300,8 @@ * * @param Gems_Tracker_Batch_SynchronizeSourcesBatch $batch * @param int $userId Id of the user who takes the action (for logging) - * @param bool $updateTokens Wether the tokens should be updated or not, default is true */ - public function addSynchronizeSurveyCommands(Gems_Tracker_Batch_SynchronizeSourcesBatch $batch, $userId, $updateTokens = true) + public function addSynchronizeSurveyCommands(Gems_Tracker_Batch_SynchronizeSourcesBatch $batch, $userId) { // Surveys in LS $lsDb = $this->getSourceDatabase(); @@ -317,15 +316,15 @@ foreach ($gemsSurveys as $surveyId => $sourceSurveyId) { if (isset($lsSurveys[$sourceSurveyId])) { - $batch->addSourceFunction('checkSurvey', $sourceSurveyId, $surveyId, $userId, $updateTokens); + $batch->addSourceFunction('checkSurvey', $sourceSurveyId, $surveyId, $userId); } else { - $batch->addSourceFunction('checkSurvey', null, $surveyId, $userId, $updateTokens); + $batch->addSourceFunction('checkSurvey', null, $surveyId, $userId); } $batch->addToSurveyCounter(); } foreach (array_diff($lsSurveys, $gemsSurveys) as $sourceSurveyId) { - $batch->addSourceFunction('checkSurvey', $sourceSurveyId, null, $userId, $updateTokens); + $batch->addSourceFunction('checkSurvey', $sourceSurveyId, null, $userId); $batch->addToSurveyCounter(); } } @@ -362,9 +361,8 @@ * @param int $sourceSurveyId * @param int $surveyId * @param int $userId - * @param boolean $updateTokens */ - public function checkSurvey($sourceSurveyId, $surveyId, $userId, $updateTokens) + public function checkSurvey($sourceSurveyId, $surveyId, $userId) { $messages = array(); $survey = $this->tracker->getSurvey($surveyId); Modified: trunk/library/classes/Gems/Tracker/Source/SourceAbstract.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/SourceAbstract.php 2012-02-16 13:45:27 UTC (rev 495) +++ trunk/library/classes/Gems/Tracker/Source/SourceAbstract.php 2012-02-16 14:34:19 UTC (rev 496) @@ -227,11 +227,13 @@ * * @param Gems_Tracker_Batch_SynchronizeSourcesBatch $batch * @param int $userId Id of the user who takes the action (for logging) - * @param bool $updateTokens Wether the tokens should be updated or not, default is true */ - public function addSynchronizeSurveyCommands(Gems_Tracker_Batch_SynchronizeSourcesBatch $batch, $userId, $updateTokens = true) + public function addSynchronizeSurveyCommands(Gems_Tracker_Batch_SynchronizeSourcesBatch $batch, $userId) { - // Do nothing is default + // Do nothing or add the old method is the default + if (method_exists($this, 'synchronizeSurveys')) { + $batch->addSourceFunction('synchronizeSurveys', $userId); + } } /** Modified: trunk/library/classes/Gems/Tracker/Source/SourceInterface.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/SourceInterface.php 2012-02-16 13:45:27 UTC (rev 495) +++ trunk/library/classes/Gems/Tracker/Source/SourceInterface.php 2012-02-16 14:34:19 UTC (rev 496) @@ -59,9 +59,8 @@ * * @param Gems_Tracker_Batch_SynchronizeSourcesBatch $batch * @param int $userId Id of the user who takes the action (for logging) - * @param bool $updateTokens Wether the tokens should be updated or not, default is true */ - public function addSynchronizeSurveyCommands(Gems_Tracker_Batch_SynchronizeSourcesBatch $batch, $userId, $updateTokens = true); + public function addSynchronizeSurveyCommands(Gems_Tracker_Batch_SynchronizeSourcesBatch $batch, $userId); /** * Inserts the token in the source (if needed) and sets those attributes the source wants to set. Modified: trunk/library/classes/Gems/Tracker/TrackerInterface.php =================================================================== --- trunk/library/classes/Gems/Tracker/TrackerInterface.php 2012-02-16 13:45:27 UTC (rev 495) +++ trunk/library/classes/Gems/Tracker/TrackerInterface.php 2012-02-16 14:34:19 UTC (rev 496) @@ -285,11 +285,10 @@ * * @param int $sourceId A source identifier * @param int $userId Id of the user who takes the action (for logging) - * @param boolean $updateTokens When true each individual token must be synchronized as well * @return Gems_Tracker_Batch_SynchronizeSourcesBatch A batch to process the synchronization */ - public function synchronizeSourcesBatch($sourceId = null, $userId = null, $updateTokens = false); - + public function synchronizeSourcesBatch($sourceId = null, $userId = null); + /** * Recalculates all token dates, timing and results * and outputs text messages. Modified: trunk/library/classes/Gems/Tracker.php =================================================================== --- trunk/library/classes/Gems/Tracker.php 2012-02-16 13:45:27 UTC (rev 495) +++ trunk/library/classes/Gems/Tracker.php 2012-02-16 14:34:19 UTC (rev 496) @@ -862,19 +862,13 @@ * * @param int $sourceId A source identifier * @param int $userId Id of the user who takes the action (for logging) - * @param boolean $updateTokens When true each individual token must be synchronized as well * @return Gems_Tracker_Batch_SynchronizeSourcesBatch A batch to process the synchronization */ - public function synchronizeSourcesBatch($sourceId = null, $userId = null, $updateTokens = false) + public function synchronizeSourcesBatch($sourceId = null, $userId = null) { $batch_id = 'source_synch' . ($sourceId ? '_' . $sourceId : ''); $batch = $this->_loadClass('Batch_SynchronizeSourcesBatch', true, array($batch_id)); - if ($updateTokens != $batch->getTokenUpdate()) { - $batch->reset(); - } - $batch->setTokenUpdate($updateTokens); - if (! $batch->isLoaded()) { if ($sourceId) { $sources = array($sourceId); Modified: trunk/library/classes/MUtil/Batch/BatchAbstract.php =================================================================== --- trunk/library/classes/MUtil/Batch/BatchAbstract.php 2012-02-16 13:45:27 UTC (rev 495) +++ trunk/library/classes/MUtil/Batch/BatchAbstract.php 2012-02-16 14:34:19 UTC (rev 496) @@ -203,7 +203,7 @@ $command['parameters'] = $params; // MUtil_Echo::track($command); - + return $command; } @@ -477,30 +477,6 @@ } /** - * Batch duration variable storage for the process - * - * @param string $name Name - * @return mixed The scalar value, if any - */ - protected function getVar($name) - { - if (isset($this->_session->vars[$name])) { - return $this->_session->vars[$name]; - } - } - - /** - * Batch duration variable storage for the process - * - * @param string $name Name - * @return boolean - */ - protected function hasVar($name) - { - return array_key_exists($name, $this->_session->vars); - } - - /** * Return true after commands all have been ran. * * @return boolean @@ -553,7 +529,6 @@ $this->_session->finished = false; $this->_session->messages = array(); $this->_session->processed = 0; - $this->_session->vars = array(); return $this; } @@ -771,21 +746,6 @@ } /** - * Batch duration variable storage for the process - * - * @param string $name Name - * @param mixed $value Scalar value - */ - protected function setVar($name, $value) - { - if (! MUtil_Ra::isScalar($value)) { - throw new MUtil_Batch_BatchException("Non scalar batch value named '$name'."); - } - - $this->_session->vars[$name] = $value; - } - - /** * Progress a single step on the command stack * * @return boolean @@ -810,14 +770,4 @@ return false; } } - - /** - * Batch duration variable storage for the process - * - * @param string $name Name - */ - protected function unsetVar($name) - { - unset($this->_session->vars[$name]); - } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-16 13:45:34
|
Revision: 495 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=495&view=rev Author: matijsdejong Date: 2012-02-16 13:45:27 +0000 (Thu, 16 Feb 2012) Log Message: ----------- Added improved error reporting to BatchAbstract.php Restarting after failure shows correct starting percentage. (Though bar display still inadequate.) Source synchronization works, but does not yet the update tokens attributes. Modified Paths: -------------- trunk/library/classes/Gems/Default/SourceAction.php trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php trunk/library/classes/Gems/Tracker/Batch/ProcessTokensBatch.php trunk/library/classes/Gems/Tracker/Batch/SynchronizeSourcesBatch.php trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php trunk/library/classes/Gems/Tracker/Source/SourceAbstract.php trunk/library/classes/Gems/Tracker/Source/SourceInterface.php trunk/library/classes/Gems/Tracker/Survey.php trunk/library/classes/Gems/Tracker/TrackerInterface.php trunk/library/classes/Gems/Tracker.php trunk/library/classes/MUtil/Batch/BatchAbstract.php trunk/library/classes/MUtil/Batch/BatchPull.js Modified: trunk/library/classes/Gems/Default/SourceAction.php =================================================================== --- trunk/library/classes/Gems/Default/SourceAction.php 2012-02-16 13:36:44 UTC (rev 494) +++ trunk/library/classes/Gems/Default/SourceAction.php 2012-02-16 13:45:27 UTC (rev 495) @@ -102,6 +102,9 @@ $bridge->addExhibitor('gso_last_synch'); } + /** + * Check all the tokens for a single source + */ public function checkAction() { $sourceId = $this->getSourceId(); @@ -114,7 +117,7 @@ } else { $this->html->h3( sprintf($this->_('Checking survey results for %s source.'), - $this->db->fetchOne("SELECT gso_source_name FROM gems__sources WHERE gso_id_source = ?", $sourceId))); + $this->db->fetchOne("SELECT gso_source_name FROM gems__sources WHERE gso_id_source = ?", $sourceId))); if ($batch->isFinished()) { $this->addMessage($batch->getMessages(true)); @@ -122,8 +125,8 @@ } else { if ($batch->count()) { // Batch is loaded by Tracker - $this->html->pInfo($batch->getStartButton(sprintf($this->_('Check %s tokens'), $batch->count()))); - $this->html->append($batch->getPanel($this->view, '0%')); + $this->html->pInfo($batch->getStartButton(sprintf($this->_('Check %s tokens'), $batch->getTokenCount()))); + $this->html->append($batch->getPanel($this->view, $batch->getProgressPercentage() . '%')); } else { $this->html->pInfo($this->_('No tokens to check.')); } @@ -131,6 +134,9 @@ } } + /** + * Check all the tokens for all sources + */ public function checkAllAction() { $batch = $this->loader->getTracker()->recalculateTokensBatch('surveyCheckAll', $this->loader->getCurrentUser()->getUserId()); @@ -146,8 +152,8 @@ } else { if ($batch->count()) { // Batch is loaded by Tracker - $this->html->pInfo($batch->getStartButton(sprintf($this->_('Check %s tokens'), $batch->count()))); - $this->html->append($batch->getPanel($this->view, '0%')); + $this->html->pInfo($batch->getStartButton(sprintf($this->_('Check %s tokens'), $batch->getTokenCount()))); + $this->html->append($batch->getPanel($this->view, $batch->getProgressPercentage() . '%')); } else { $this->html->pInfo($this->_('No tokens to check.')); } @@ -240,8 +246,36 @@ $this->afterSaveRoute($this->getRequest()); } + /** + * Synchronize survey status for the surveys in a source + */ public function synchronizeAction() { + $sourceId = $this->getSourceId(); + + $batch = $this->loader->getTracker()->synchronizeSourcesBatch($sourceId, $this->loader->getCurrentUser()->getUserId(), false); + + if ($batch->run($this->getRequest())) { + exit; + } else { + $this->html->h3( + sprintf($this->_('Synchronize the %s source.'), + $this->db->fetchOne("SELECT gso_source_name FROM gems__sources WHERE gso_id_source = ?", $sourceId))); + + if ($batch->isFinished()) { + $this->addMessage($batch->getMessages(true)); + $this->html->pInfo($batch->getRestartButton($this->_('Prepare recheck'), array('class' => 'actionlink'))); + } else { + if ($batch->count()) { + // Batch is loaded by Tracker + $this->html->pInfo($batch->getStartButton(sprintf($this->_('Check %s surveys'), $batch->getSurveyCounter()))); + $this->html->append($batch->getPanel($this->view, $batch->getProgressPercentage() . '%')); + } else { + $this->html->pInfo($this->_('No surveys to check.')); + } + } + } + /* $source = $this->getSourceById(); if ($messages = $source->synchronizeSurveys($this->loader->getCurrentUser()->getUserId())) { @@ -251,6 +285,7 @@ } $this->afterSaveRoute($this->getRequest()); + // */ } public function synchronizeAllAction() Modified: trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php =================================================================== --- trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php 2012-02-16 13:36:44 UTC (rev 494) +++ trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php 2012-02-16 13:45:27 UTC (rev 495) @@ -263,6 +263,9 @@ return true; } + /** + * Check the tokens for a single survey + */ public function checkAction() { $surveyId = $this->_getParam(MUtil_Model::REQUEST_ID); @@ -283,8 +286,8 @@ } else { if ($batch->count()) { // Batch is loaded by Tracker - $this->html->pInfo($batch->getStartButton(sprintf($this->_('Check %s tokens'), $batch->count()))); - $this->html->append($batch->getPanel($this->view, '0%')); + $this->html->pInfo($batch->getStartButton(sprintf($this->_('Check %s tokens'), $batch->getTokenCount()))); + $this->html->append($batch->getPanel($this->view, $batch->getProgressPercentage() . '%')); } else { $this->html->pInfo($this->_('No tokens to check.')); } @@ -292,6 +295,9 @@ } } + /** + * Check the tokens for all surveys + */ public function checkAllAction() { $batch = $this->loader->getTracker()->recalculateTokensBatch('surveyCheckAll', $this->loader->getCurrentUser()->getUserId()); @@ -307,8 +313,8 @@ } else { if ($batch->count()) { // Batch is loaded by Tracker - $this->html->pInfo($batch->getStartButton(sprintf($this->_('Check %s tokens'), $batch->count()))); - $this->html->append($batch->getPanel($this->view, '0%')); + $this->html->pInfo($batch->getStartButton(sprintf($this->_('Check %s tokens'), $batch->getTokenCount()))); + $this->html->append($batch->getPanel($this->view, $batch->getProgressPercentage() . '%')); } else { $this->html->pInfo($this->_('No tokens to check.')); } Modified: trunk/library/classes/Gems/Tracker/Batch/ProcessTokensBatch.php =================================================================== --- trunk/library/classes/Gems/Tracker/Batch/ProcessTokensBatch.php 2012-02-16 13:36:44 UTC (rev 494) +++ trunk/library/classes/Gems/Tracker/Batch/ProcessTokensBatch.php 2012-02-16 13:45:27 UTC (rev 495) @@ -63,6 +63,13 @@ */ public $minimalStepDurationMs = 3000; + /** + * Add the check of a single token to the batch. + * + * @param mixed $tokenData Array or token id + * @param int $userId Gems user id + * @return Gems_Tracker_Batch_ProcessTokensBatch (Continuation pattern) + */ public function addToken($tokenData, $userId) { if (is_array($tokenData)) { @@ -75,11 +82,18 @@ } // MUtil_Echo::track($tokenData); - $this->setStep('checkTokenCompletion', 'tokchk-' . $tokenId, $tokenData, $userId); + $this->setStep('checkTokenCompletion', 'tokchk-' . $tokenId, $tokenId, $userId); + $this->addToCounter('tokens'); return $this; } + /** + * Check a single track for the effects of token completion. + * + * @param mixed $respTrackData Data array or a respondent track id + * @param int $userId Gems user id + */ protected function checkTrackTokens($respTrackData, $userId) { $respTrack = $this->tracker->getRespondentTrack($respTrackData); @@ -90,6 +104,18 @@ } } + /** + * Check for token completion and adds the processTokenCompletion + * command when the token is indeed completed. + * + * NOTE: The reasons to add the extra commands in this process are + * (1) that we are not sure in advance for which tokens we should + * process and (2) the processing commands should be executed + * AFTER all tokens have been checked for completion. + * + * @param mixed $tokenData Array or token id + * @param int $userId Gems user id + */ protected function checkTokenCompletion($tokenData, $userId) { $this->addToCounter('checkedTokens'); @@ -109,6 +135,11 @@ } } + /** + * Returns a description of what was changed during this batch. + * + * @return array Of message strings + */ public function getCounterMessages() { if ($this->getCounter('checkedRespondentTracks')) { @@ -161,6 +192,21 @@ return array_merge($this->getCounterMessages(), parent::getMessages($reset)); } + /** + * The number of tokens to check + * + * @return int + */ + public function getTokenCount() + { + return $this->getCounter('tokens'); + } + + /** + * True when the batch changed anything. + * + * @return boolean + */ public function hasChanged() { return $this->getCounter('resultDataChanges') || @@ -171,6 +217,18 @@ $this->getCounter('createdTokens'); } + /** + * Processes token completion and adds the checkTrackTokens + * command when the token is indeed completed. + * + * NOTE: The reasons we add the checkTrackTokens command are + * that (1) we do not know in advance which tracks to check + * and (2) the tracks should be checked AFTER all tokens have + * been processed. + * + * @param mixed $tokenData Array or token id + * @param int $userId Gems user id + */ protected function processTokenCompletion($tokenData, $userId) { $token = $this->tracker->getToken($tokenData); Modified: trunk/library/classes/Gems/Tracker/Batch/SynchronizeSourcesBatch.php =================================================================== --- trunk/library/classes/Gems/Tracker/Batch/SynchronizeSourcesBatch.php 2012-02-16 13:36:44 UTC (rev 494) +++ trunk/library/classes/Gems/Tracker/Batch/SynchronizeSourcesBatch.php 2012-02-16 13:45:27 UTC (rev 495) @@ -44,7 +44,7 @@ * @license New BSD License * @since Class available since version 1.5 */ -class Gems_Tracker_Batch_SynchronizesSourceBatch extends MUtil_Batch_BatchAbstract +class Gems_Tracker_Batch_SynchronizeSourcesBatch extends MUtil_Batch_BatchAbstract { /** * @@ -60,12 +60,19 @@ /** * + * @var Zend_Translate + */ + protected $translate; + + /** + * * @param mixed $sourceData Source Id or array containing source data + * @param int $userId Gems user id */ - public function addSource($sourceData, $userId, $updateTokens = true) + public function addSource($sourceData, $userId) { $this->_currentSource = $this->tracker->getSource($sourceData); - $this->_currentSource->addSynchronizeSurveyCommands($this, $userId, $updateTokens); + $this->_currentSource->addSynchronizeSurveyCommands($this, $userId, $this->getTokenUpdate()); $this->_currentSource = null; } @@ -85,6 +92,67 @@ } /** + * Add one to the number of surveys checked + * + * @param int $add + * @return int + */ + public function addToSurveyCounter($add = 1) + { + return $this->addToCounter('surveys', $add); + } + + /** + * String of messages from the batch + * + * Do not forget to reset() the batch if you're done with it after + * displaying the report. + * + * @param boolean $reset When true the batch is reset afterwards + * @return array + */ + public function getMessages($reset = false) + { + $scounter = $this->getSurveyCounter(); + + $messages = parent::getMessages($reset); + + if (! $messages) { + $messages[] = $this->translate->_('No surveys were changed.'); + } + array_unshift($messages, sprintf($this->translate->_('%d surveys checked.'), $scounter)); + + return $messages; + } + /** + * Get the number of surveys checked + * + * @return int + */ + public function getSurveyCounter() + { + return $this->getCounter('surveys'); + } + + /** + * Is tokenUpdate on or off. + * + * @return boolean + */ + public function getTokenUpdate() + { + return $this->getVar('tokenUpdate'); + } + + /** + * Set tokenUpdate on or off. + */ + public function setTokenUpdate($value = true) + { + $this->setVar('tokenUpdate', $value); + } + + /** * The basic steps * * @param int $sourceId @@ -93,7 +161,7 @@ */ protected function sourceStep($sourceId, $function, array $params) { - $source = $this->tracker->getSource($sourceData); + $source = $this->tracker->getSource($sourceId); $messages = call_user_func_array(array($source, $function), $params); Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-02-16 13:36:44 UTC (rev 494) +++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-02-16 13:45:27 UTC (rev 495) @@ -298,11 +298,11 @@ /** * Add the commands to update this source to a source synchornization batch * - * @param Gems_Tracker_Batch_SynchronizesSourceBatch $batch + * @param Gems_Tracker_Batch_SynchronizeSourcesBatch $batch * @param int $userId Id of the user who takes the action (for logging) * @param bool $updateTokens Wether the tokens should be updated or not, default is true - * / - public function addSynchronizeSurveyCommands(Gems_Tracker_Batch_SynchronizesSourceBatch $batch, $userId, $updateTokens = true) + */ + public function addSynchronizeSurveyCommands(Gems_Tracker_Batch_SynchronizeSourcesBatch $batch, $userId, $updateTokens = true) { // Surveys in LS $lsDb = $this->getSourceDatabase(); @@ -321,10 +321,12 @@ } else { $batch->addSourceFunction('checkSurvey', null, $surveyId, $userId, $updateTokens); } + $batch->addToSurveyCounter(); } foreach (array_diff($lsSurveys, $gemsSurveys) as $sourceSurveyId) { $batch->addSourceFunction('checkSurvey', $sourceSurveyId, null, $userId, $updateTokens); + $batch->addToSurveyCounter(); } } @@ -365,7 +367,7 @@ public function checkSurvey($sourceSurveyId, $surveyId, $userId, $updateTokens) { $messages = array(); - $survey = $this->tracker->getSurveyBySourceId($surveyId, $sourceSurveyId); + $survey = $this->tracker->getSurvey($surveyId); if (null === $sourceSurveyId) { // Was removed @@ -431,6 +433,7 @@ } else { $tokenLength = 0; } + $token_library = $this->tracker->getTokenLibrary(); if ($tokenLength < $token_library->getLength()) { $surveyor_status .= 'Token field length is too short. '; } @@ -442,7 +445,7 @@ } } if ($missingFields) { - $sql = "ALTER TABLE " . $this->_getTokenTableName($sid) . " " . implode(', ', $missingFields); + $sql = "ALTER TABLE " . $this->_getTokenTableName($sourceSurveyId) . " " . implode(', ', $missingFields); try { $lsDb->query($sql); $messages[] = sprintf($this->translate->_("Added attribute fields to token table for '%s'"), $surveyor_title); @@ -451,7 +454,7 @@ $surveyor_status .= $e->getMessage() . ' '; $messages[] = sprintf($this->translate->_("Attribute fields not created for token table for '%s'"), $surveyor_title); - $messages[] = sprintf($this->translate->_('Required fields: %s', implode($this->_(', '), array_keys($missingFields)))); + $messages[] = sprintf($this->translate->_('Required fields: %s', implode($this->translate->_(', '), array_keys($missingFields)))); $messages[] = $e->getMessage(); // Maximum reporting for this case @@ -489,7 +492,7 @@ if ($surveyor_status) { $values['gsu_status'] = substr($surveyor_status, 0, 127); $messages[] = sprintf($this->translate->_('The status of the \'%s\' survey has changed to \'%s\'.'), $survey->getName(), $values['gsu_status']); - } else { + } elseif ($survey->getStatus() != 'OK') { $values['gsu_status'] = 'OK'; $messages[] = sprintf($this->translate->_('The status warning for the \'%s\' survey was removed.'), $survey->getName()); } @@ -508,9 +511,11 @@ $messages[] = sprintf($this->translate->_('Imported the \'%s\' survey.'), $surveyor_title); } - $values['gsu_survey_description'] = strtr(substr($surveyor_survey['description'], 0, 100), "\xA0\xC2", ' '); + $values['gsu_survey_description'] = strtr(substr($lsSurvey['surveyls_description'], 0, 100), "\xA0\xC2", ' '); $survey->saveSurvey($values, $userId); } + + return $messages; } /** Modified: trunk/library/classes/Gems/Tracker/Source/SourceAbstract.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/SourceAbstract.php 2012-02-16 13:36:44 UTC (rev 494) +++ trunk/library/classes/Gems/Tracker/Source/SourceAbstract.php 2012-02-16 13:45:27 UTC (rev 495) @@ -95,7 +95,7 @@ { $select = $this->_gemsDb->select(); $select->from('gems__surveys', array('gsu_id_survey', 'gsu_surveyor_id')) - ->where('gsu_id_source = ', $this->getId()) + ->where('gsu_id_source = ?', $this->getId()) ->order('gsu_surveyor_id'); return $this->_gemsDb->fetchPairs($select); @@ -225,11 +225,11 @@ /** * Add the commands to update this source to a source synchornization batch * - * @param Gems_Tracker_Batch_SynchronizesSourceBatch $batch + * @param Gems_Tracker_Batch_SynchronizeSourcesBatch $batch * @param int $userId Id of the user who takes the action (for logging) * @param bool $updateTokens Wether the tokens should be updated or not, default is true */ - public function addSynchronizeSurveyCommands(Gems_Tracker_Batch_SynchronizesSourceBatch $batch, $userId, $updateTokens = true) + public function addSynchronizeSurveyCommands(Gems_Tracker_Batch_SynchronizeSourcesBatch $batch, $userId, $updateTokens = true) { // Do nothing is default } Modified: trunk/library/classes/Gems/Tracker/Source/SourceInterface.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/SourceInterface.php 2012-02-16 13:36:44 UTC (rev 494) +++ trunk/library/classes/Gems/Tracker/Source/SourceInterface.php 2012-02-16 13:45:27 UTC (rev 495) @@ -57,11 +57,11 @@ /** * Add the commands to update this source to a source synchornization batch * - * @param Gems_Tracker_Batch_SynchronizesSourceBatch $batch + * @param Gems_Tracker_Batch_SynchronizeSourcesBatch $batch * @param int $userId Id of the user who takes the action (for logging) * @param bool $updateTokens Wether the tokens should be updated or not, default is true */ - public function addSynchronizeSurveyCommands(Gems_Tracker_Batch_SynchronizesSourceBatch $batch, $userId, $updateTokens = true); + public function addSynchronizeSurveyCommands(Gems_Tracker_Batch_SynchronizeSourcesBatch $batch, $userId, $updateTokens = true); /** * Inserts the token in the source (if needed) and sets those attributes the source wants to set. Modified: trunk/library/classes/Gems/Tracker/Survey.php =================================================================== --- trunk/library/classes/Gems/Tracker/Survey.php 2012-02-16 13:36:44 UTC (rev 494) +++ trunk/library/classes/Gems/Tracker/Survey.php 2012-02-16 13:45:27 UTC (rev 495) @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2011, Erasmus MC * All rights reserved. Modified: trunk/library/classes/Gems/Tracker/TrackerInterface.php =================================================================== --- trunk/library/classes/Gems/Tracker/TrackerInterface.php 2012-02-16 13:36:44 UTC (rev 494) +++ trunk/library/classes/Gems/Tracker/TrackerInterface.php 2012-02-16 13:45:27 UTC (rev 495) @@ -54,7 +54,7 @@ * extension) and TokenValidator. * * Other functions are general utility functions, e.g. checkTrackRounds(), createToken(), - * processCompletedTokens() and recalculateTokens(). + * processCompletedTokens() and recalculateTokensBatch(). * * @package Gems * @subpackage Tracker @@ -283,12 +283,13 @@ * * Does not reflect changes to tracks or rounds. * - * @param int $userId Id of the user who takes the action (for logging) - * @param string $cond - * @return array of translated messages + * @param int $sourceId A source identifier + * @param int $userId Id of the user who takes the action (for logging) + * @param boolean $updateTokens When true each individual token must be synchronized as well + * @return Gems_Tracker_Batch_SynchronizeSourcesBatch A batch to process the synchronization */ - public function recalculateTokens($userId = null, $cond = null); - + public function synchronizeSourcesBatch($sourceId = null, $userId = null, $updateTokens = false); + /** * Recalculates all token dates, timing and results * and outputs text messages. Modified: trunk/library/classes/Gems/Tracker.php =================================================================== --- trunk/library/classes/Gems/Tracker.php 2012-02-16 13:36:44 UTC (rev 494) +++ trunk/library/classes/Gems/Tracker.php 2012-02-16 13:45:27 UTC (rev 495) @@ -48,7 +48,7 @@ * extension) and TokenValidator. * * Other functions are general utility functions, e.g. checkTrackRounds(), createToken(), - * processCompletedTokens() and recalculateTokens(). + * processCompletedTokens() and recalculateTokensBatch(). * * @package Gems * @subpackage Tracker @@ -304,13 +304,15 @@ */ public function filterChangesOnly(array $oldValues, array &$newValues) { - if ($newValues) { + if ($newValues && $oldValues) { // MUtil_Echo::track($newValues); // Remove up unchanged values foreach ($newValues as $name => $value) { - // Extra condition for empty time in date values - if (($value === $oldValues[$name]) || ($value === $oldValues[$name] . ' 00:00:00')) { - unset($newValues[$name]); + if (array_key_exists($name, $oldValues)) { + // Extra condition for empty time in date values + if (($value === $oldValues[$name]) || ($value === $oldValues[$name] . ' 00:00:00')) { + unset($newValues[$name]); + } } } } @@ -858,32 +860,39 @@ * * Does not reflect changes to tracks or rounds. * - * @param Zend_Translate $t - * @param int $userId Id of the user who takes the action (for logging) - * @param string $cond - * @return array of translated messages + * @param int $sourceId A source identifier + * @param int $userId Id of the user who takes the action (for logging) + * @param boolean $updateTokens When true each individual token must be synchronized as well + * @return Gems_Tracker_Batch_SynchronizeSourcesBatch A batch to process the synchronization */ - public function recalculateTokens($userId = null, $cond = null) + public function synchronizeSourcesBatch($sourceId = null, $userId = null, $updateTokens = false) { - $userId = $this->_checkUserId($userId); - $tokenSelect = $this->getTokenSelect(); - $tokenSelect->andReceptionCodes() - ->andRespondents() - ->andRespondentOrganizations() - ->andConsents(); - if ($cond) { - $tokenSelect->forWhere($cond); + $batch_id = 'source_synch' . ($sourceId ? '_' . $sourceId : ''); + $batch = $this->_loadClass('Batch_SynchronizeSourcesBatch', true, array($batch_id)); + + if ($updateTokens != $batch->getTokenUpdate()) { + $batch->reset(); } - //Only select surveys that are active in the source (so we can recalculate inactive in Gems) - $tokenSelect->andSurveys(); - $tokenSelect->forWhere('gsu_surveyor_active = 1'); + $batch->setTokenUpdate($updateTokens); - self::$verbose = true; - $changes = $this->processTokens($tokenSelect, $userId); + if (! $batch->isLoaded()) { + if ($sourceId) { + $sources = array($sourceId); + } else { + $select = $this->db->select(); + $select->from('gems__sources', array('gso_id_source')) + ->where('gso_active = 1'); + $sources = $this->db->fetchCol($select); + } - return $changes->getMessages($this->translate); + foreach ($sources as $source) { + $batch->addSource($source, $userId); + } + } + + return $batch; + } - /** * Recalculates all token dates, timing and results * and outputs text messages. Modified: trunk/library/classes/MUtil/Batch/BatchAbstract.php =================================================================== --- trunk/library/classes/MUtil/Batch/BatchAbstract.php 2012-02-16 13:36:44 UTC (rev 494) +++ trunk/library/classes/MUtil/Batch/BatchAbstract.php 2012-02-16 13:45:27 UTC (rev 495) @@ -202,6 +202,8 @@ $command['method'] = $method; $command['parameters'] = $params; + // MUtil_Echo::track($command); + return $command; } @@ -284,7 +286,7 @@ */ public function getCounter($name) { - MUtil_Echo::track($this->_session->counters); + // MUtil_Echo::track($this->_session->counters); if (isset($this->_session->counters[$name])) { return $this->_session->counters[$name]; } @@ -475,6 +477,30 @@ } /** + * Batch duration variable storage for the process + * + * @param string $name Name + * @return mixed The scalar value, if any + */ + protected function getVar($name) + { + if (isset($this->_session->vars[$name])) { + return $this->_session->vars[$name]; + } + } + + /** + * Batch duration variable storage for the process + * + * @param string $name Name + * @return boolean + */ + protected function hasVar($name) + { + return array_key_exists($name, $this->_session->vars); + } + + /** * Return true after commands all have been ran. * * @return boolean @@ -527,6 +553,7 @@ $this->_session->finished = false; $this->_session->messages = array(); $this->_session->processed = 0; + $this->_session->vars = array(); return $this; } @@ -744,6 +771,21 @@ } /** + * Batch duration variable storage for the process + * + * @param string $name Name + * @param mixed $value Scalar value + */ + protected function setVar($name, $value) + { + if (! MUtil_Ra::isScalar($value)) { + throw new MUtil_Batch_BatchException("Non scalar batch value named '$name'."); + } + + $this->_session->vars[$name] = $value; + } + + /** * Progress a single step on the command stack * * @return boolean @@ -758,12 +800,24 @@ call_user_func_array(array($this, $command['method']), $command['parameters']); } catch (Exception $e) { $this->addMessage('ERROR!!!'); - $this->addMessage('While calling:' . $command['method'] . '(', implode(',', MUtil_Ra::flatten($command['parameters'])), ')'); + $this->addMessage('While calling:' . $command['method'] . '(' . implode(',', MUtil_Ra::flatten($command['parameters'])) . ')'); $this->addMessage($e->getMessage()); + + MUtil_Echo::r($e); } return true; } else { return false; } } + + /** + * Batch duration variable storage for the process + * + * @param string $name Name + */ + protected function unsetVar($name) + { + unset($this->_session->vars[$name]); + } } Modified: trunk/library/classes/MUtil/Batch/BatchPull.js =================================================================== --- trunk/library/classes/MUtil/Batch/BatchPull.js 2012-02-16 13:36:44 UTC (rev 494) +++ trunk/library/classes/MUtil/Batch/BatchPull.js 2012-02-16 13:45:27 UTC (rev 495) @@ -34,6 +34,8 @@ error: function (request, status, error) { alert('Communication error: ' + status); + this.progressTarget.after('<p>' + request.responseText + '</p>'); + // console.log(request); }, progressTarget: null, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-16 13:36:55
|
Revision: 494 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=494&view=rev Author: mennodekker Date: 2012-02-16 13:36:44 +0000 (Thu, 16 Feb 2012) Log Message: ----------- Introducing the build scripts used for SF updates to files and api Added Paths: ----------- trunk/scripts/sf-build.xml Added: trunk/scripts/sf-build.xml =================================================================== --- trunk/scripts/sf-build.xml (rev 0) +++ trunk/scripts/sf-build.xml 2012-02-16 13:36:44 UTC (rev 494) @@ -0,0 +1,112 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<project name="GemsTracker" default="build"> + <property name="repositorybase" value="https://gemstracker.svn.sourceforge.net/svnroot/gemstracker/" /> + <!-- + Below are the config params you can use to prevent user interaction + <property name="repository" value="trunk" /> + <property name="lib.version" value="1.5" /> + --> + + <fileset id="library" dir="./gemstracker/library"> + <include name="**/*.php"/> + <exclude name="classes/ZFDebug/**" /> + <exclude name="docs/**" /> + <exclude name="controllers/**" /> + <!-- <exclude name="snippets/**" /> --> + </fileset> + + <!-- Prepare workspace --> + <target name="prepare"> + <echo msg="Making directory /gemstracker" /> + <mkdir dir="./gemstracker" /> + <echo msg="Making directory /docs" /> + <mkdir dir="./docs"/> + <echo msg="Making directory /zip" /> + <mkdir dir="./zip"/> + </target> + + <!-- Clean up generated files --> + <target name="clean"> + <delete dir="./gemstracker"/> + <delete dir="./docs"/> + <delete dir="./zip"/> + <delete dir="./new_project"/> + </target> + + <!-- ============================================ --> + <!-- Target: checkout --> + <!-- ============================================ --> + <target name="checkout"> + <echo msg="Checking out ${repositorybase}${repository} to /gemstracker" /> + <echo msg="use -Drepository=xxx to change ${repository} to something else" /> + <propertyprompt propertyName="repository" defaultValue="trunk" promptText="Enter the checkout path" useExistingValue="true" /> + <svnexport svnpath="c:\programma\svn\bin\svn.exe" + force="true" + nocache="true" + repositoryurl="${repositorybase}${repository}" + todir="./gemstracker" + /> + </target> + + <!-- Target: newproject, create the 'newproject' zipfile --> + <target name="newproject"> + <delete dir="./new_project"/> + <copy todir="./new_project" > + <fileset dir="./gemstracker/new_project"> + <include name="**" /> + </fileset> + </copy> + <copy todir="./new_project/library/Gems" > + <fileset dir="./gemstracker/library"> + <include name="**" /> + </fileset> + </copy> + <copy todir="./new_project/htdocs" > + <fileset dir="./gemstracker/templates"> + <include name="erasmusmc/**" /> + </fileset> + </copy> + <zip destfile="zip/new_project.zip"> + <fileset dir="./new_project"> + <include name="**/**" /> + </fileset> + </zip> + </target> + + <!-- Target: library, create the 'GemsTracker-xxxx' zipfile iwth just the library --> + <target name="library"> + <propertyprompt propertyName="lib.version" defaultValue="" promptText="Enter the library version" useExistingValue="true" /> + <echo message="Creating GemsTracker-${lib.version}.zip" /> + <zip destfile="zip/GemsTracker-${lib.version}.zip"> + <fileset dir="./gemstracker/library"> + <include name="**/**" /> + </fileset> + </zip> + </target> + + <!-- Build documentation (docblox) --> + <target name="build-docs" depends="prepare"> + <available file="./gemstracker/library/pre_bootstrap.php" property="checkout_exists" value="Yes"/> + <if> + <isset property="checkout_exists" /> + <then> + <docblox title="Gems Code Documentation" + quiet="true" + output="docs"> + <fileset refid="library"/> + </docblox> + </then> + <else> + <echo message="No source available, first do a checkout" /> + </else> + </if> + </target> + + <!-- ============================================ --> + <!-- Target: build --> + <!-- ============================================ --> + <target name="build" depends="clean, prepare, checkout, build-docs, newproject, library"> + <echo msg="All done. Check out the docs, gemstracker, new_project and zip directories!" /> + </target> +</project> \ 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: <gem...@li...> - 2012-02-16 11:10:02
|
Revision: 493 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=493&view=rev Author: mennodekker Date: 2012-02-16 11:09:51 +0000 (Thu, 16 Feb 2012) Log Message: ----------- Merged revision(s) 490-491 from trunk: Added rounds ........ Changed rounds in StandardTokenModel to joinLeft as sometimes there is a token not attached to a round Removed contact from header_bar in new_project ........ Modified Paths: -------------- tags/1.5.1/library/classes/Gems/Tracker/Model/StandardTokenModel.php tags/1.5.1/new_project/application/configs/project.ini Property Changed: ---------------- tags/1.5.1/ tags/1.5.1/library/ Property changes on: tags/1.5.1 ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse:306-430,467 /tags/1.5.0beta1:305 + /branches/1.5.0-pulse:306-430,467 /tags/1.5.0beta1:305 /trunk:490-491 Property changes on: tags/1.5.1/library ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse/library:306-344,346,467 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 + /branches/1.5.0-pulse/library:306-344,346,467 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 /trunk/library:490-491 Modified: tags/1.5.1/library/classes/Gems/Tracker/Model/StandardTokenModel.php =================================================================== --- tags/1.5.1/library/classes/Gems/Tracker/Model/StandardTokenModel.php 2012-02-16 11:00:36 UTC (rev 492) +++ tags/1.5.1/library/classes/Gems/Tracker/Model/StandardTokenModel.php 2012-02-16 11:09:51 UTC (rev 493) @@ -96,6 +96,7 @@ } $this->addTable( 'gems__tracks', array('gto_id_track' => 'gtr_id_track')); + $this->addLeftTable('gems__rounds', array('gto_id_round' => 'gro_id_round')); $this->addTable( 'gems__surveys', array('gto_id_survey' => 'gsu_id_survey')); $this->addTable( 'gems__groups', array('gsu_id_primary_group' => 'ggp_id_group')); $this->addTable( 'gems__respondents', array('gto_id_respondent' => 'grs_id_user')); Modified: tags/1.5.1/new_project/application/configs/project.ini =================================================================== --- tags/1.5.1/new_project/application/configs/project.ini 2012-02-16 11:00:36 UTC (rev 492) +++ tags/1.5.1/new_project/application/configs/project.ini 2012-02-16 11:09:51 UTC (rev 493) @@ -172,7 +172,7 @@ layoutPrepare.title = 1 layoutPrepare.projectName = header layoutPrepare.login = header_bar -layoutPrepare.contact = header_bar +layoutPrepare.contact = 0 layoutPrepare.localeSet = header_bar layoutPrepare.organizationSwitcher = header_bar layoutPrepare.version = footer @@ -187,7 +187,7 @@ layoutPrepare.jQuery = 1 layoutPrepare.login.class = rightFloat -layoutPrepareArgs.contact.class = rightFloat +;layoutPrepareArgs.contact.class = rightFloat layoutPrepareArgs.time.class = rightFloat layoutPrepareArgs.user.class = rightFloat layoutPrepareArgs.version.class = leftFloat This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-16 11:00:45
|
Revision: 492 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=492&view=rev Author: matijsdejong Date: 2012-02-16 11:00:36 +0000 (Thu, 16 Feb 2012) Log Message: ----------- Image tags are rendered only with a source. Added documentation Modified Paths: -------------- trunk/library/classes/MUtil/Html/HtmlElement.php trunk/library/classes/MUtil/Html/ImgElement.php Modified: trunk/library/classes/MUtil/Html/HtmlElement.php =================================================================== --- trunk/library/classes/MUtil/Html/HtmlElement.php 2012-02-16 10:52:09 UTC (rev 491) +++ trunk/library/classes/MUtil/Html/HtmlElement.php 2012-02-16 11:00:36 UTC (rev 492) @@ -553,6 +553,12 @@ return $elem; } + /** + * Make an element with the specified tag name. + * + * @param string $tagName + * @param mixed $arg_array MUtil_Ra::args arguments + */ public function __construct($tagName, $arg_array = null) { $args = MUtil_Ra::args(func_get_args(), 1); Modified: trunk/library/classes/MUtil/Html/ImgElement.php =================================================================== --- trunk/library/classes/MUtil/Html/ImgElement.php 2012-02-16 10:52:09 UTC (rev 491) +++ trunk/library/classes/MUtil/Html/ImgElement.php 2012-02-16 11:00:36 UTC (rev 492) @@ -1,6 +1,5 @@ <?php - /** * Copyright (c) 2011, Erasmus MC * All rights reserved. @@ -74,6 +73,13 @@ protected $_contentToTag = 'alt'; /** + * By default this element is not generated when the 'src' is empty. + * + * @var boolean The element is rendered even without content when true. + */ + public $renderWithoutSrc = false; + + /** * Converts an associative array to a string of tag attributes. * * @access public @@ -219,6 +225,29 @@ } /** + * Function to allow overloading of tag rendering only + * + * Renders the element tag with it's content into a html string + * + * The $view is used to correctly encode and escape the output + * + * @param Zend_View_Abstract $view + * @return string Correctly encoded and escaped html output + */ + protected function renderElement(Zend_View_Abstract $view) + { + if (isset($this->_attribs['src'])) { + $src = MUtil_Html::renderAny($view, $this->_attribs['src']); + } else { + $src = false; + } + + if ($src || $this->renderWithoutSrc) { + return parent::renderElement($view); + } + } + + /** * Sets the list of search directories. The last directory in the list is the first directory searched for the file. * * @param array $dirs Directory names. Slashes added when needed. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-16 10:52:19
|
Revision: 491 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=491&view=rev Author: mennodekker Date: 2012-02-16 10:52:09 +0000 (Thu, 16 Feb 2012) Log Message: ----------- Changed rounds in StandardTokenModel to joinLeft as sometimes there is a token not attached to a round Removed contact from header_bar in new_project Modified Paths: -------------- trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php trunk/new_project/application/configs/project.ini Modified: trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php =================================================================== --- trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php 2012-02-16 10:03:47 UTC (rev 490) +++ trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php 2012-02-16 10:52:09 UTC (rev 491) @@ -96,7 +96,7 @@ } $this->addTable( 'gems__tracks', array('gto_id_track' => 'gtr_id_track')); - $this->addTable( 'gems__rounds', array('gto_id_round' => 'gro_id_round')); + $this->addLeftTable('gems__rounds', array('gto_id_round' => 'gro_id_round')); $this->addTable( 'gems__surveys', array('gto_id_survey' => 'gsu_id_survey')); $this->addTable( 'gems__groups', array('gsu_id_primary_group' => 'ggp_id_group')); $this->addTable( 'gems__respondents', array('gto_id_respondent' => 'grs_id_user')); Modified: trunk/new_project/application/configs/project.ini =================================================================== --- trunk/new_project/application/configs/project.ini 2012-02-16 10:03:47 UTC (rev 490) +++ trunk/new_project/application/configs/project.ini 2012-02-16 10:52:09 UTC (rev 491) @@ -173,7 +173,7 @@ layoutPrepare.title = 1 layoutPrepare.projectName = header layoutPrepare.login = header_bar -layoutPrepare.contact = header_bar +layoutPrepare.contact = 0 layoutPrepare.localeSet = header_bar layoutPrepare.organizationSwitcher = header_bar layoutPrepare.version = footer @@ -188,7 +188,7 @@ layoutPrepare.jQuery = 1 layoutPrepare.login.class = rightFloat -layoutPrepareArgs.contact.class = rightFloat +;layoutPrepareArgs.contact.class = rightFloat layoutPrepareArgs.time.class = rightFloat layoutPrepareArgs.user.class = rightFloat layoutPrepareArgs.version.class = leftFloat This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-16 10:03:57
|
Revision: 490 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=490&view=rev Author: matijsdejong Date: 2012-02-16 10:03:47 +0000 (Thu, 16 Feb 2012) Log Message: ----------- Added rounds Modified Paths: -------------- trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php Modified: trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php =================================================================== --- trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php 2012-02-16 09:49:44 UTC (rev 489) +++ trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php 2012-02-16 10:03:47 UTC (rev 490) @@ -96,6 +96,7 @@ } $this->addTable( 'gems__tracks', array('gto_id_track' => 'gtr_id_track')); + $this->addTable( 'gems__rounds', array('gto_id_round' => 'gro_id_round')); $this->addTable( 'gems__surveys', array('gto_id_survey' => 'gsu_id_survey')); $this->addTable( 'gems__groups', array('gsu_id_primary_group' => 'ggp_id_group')); $this->addTable( 'gems__respondents', array('gto_id_respondent' => 'grs_id_user')); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-16 09:49:54
|
Revision: 489 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=489&view=rev Author: mennodekker Date: 2012-02-16 09:49:44 +0000 (Thu, 16 Feb 2012) Log Message: ----------- Fixing padding on #header_bar #login element Modified Paths: -------------- tags/1.5.1/new_project/htdocs/gems/css/gems-new.css Modified: tags/1.5.1/new_project/htdocs/gems/css/gems-new.css =================================================================== --- tags/1.5.1/new_project/htdocs/gems/css/gems-new.css 2012-02-15 18:25:37 UTC (rev 488) +++ tags/1.5.1/new_project/htdocs/gems/css/gems-new.css 2012-02-16 09:49:44 UTC (rev 489) @@ -367,7 +367,7 @@ padding: 0px; } -#header_bar #contact { +#header_bar #contact, #header_bar #login { position: relative; padding: 5px 5px 0 5px; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-15 18:25:47
|
Revision: 488 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=488&view=rev Author: matijsdejong Date: 2012-02-15 18:25:37 +0000 (Wed, 15 Feb 2012) Log Message: ----------- Starting on source synchronization by batch (does not yet work) Modified Paths: -------------- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php trunk/library/classes/Gems/Tracker/Source/SourceAbstract.php trunk/library/classes/Gems/Tracker/Source/SourceInterface.php trunk/library/classes/MUtil/Batch/BatchAbstract.php Added Paths: ----------- trunk/library/classes/Gems/Tracker/Batch/SynchronizeSourcesBatch.php Removed Paths: ------------- trunk/library/classes/Gems/Tracker/Batch/SynchronizeSourceBatch.php Deleted: trunk/library/classes/Gems/Tracker/Batch/SynchronizeSourceBatch.php =================================================================== --- trunk/library/classes/Gems/Tracker/Batch/SynchronizeSourceBatch.php 2012-02-15 16:24:48 UTC (rev 487) +++ trunk/library/classes/Gems/Tracker/Batch/SynchronizeSourceBatch.php 2012-02-15 18:25:37 UTC (rev 488) @@ -1,61 +0,0 @@ -<?php - -/** - * Copyright (c) 2011, Erasmus MC - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Erasmus MC nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * @package Gems - * @subpackage Tracker - * @author Matijs de Jong <mj...@ma...> - * @copyright Copyright (c) 2011 Erasmus MC - * @license New BSD License - * @version $Id$ - */ - -/** - * - * - * @package Gems - * @subpackage Tracker - * @copyright Copyright (c) 2011 Erasmus MC - * @license New BSD License - * @since Class available since version 1.5 - */ -class Gems_Tracker_Batch_SynchronizeSourceBatch extends MUtil_Batch_BatchAbstract -{ - /** - * Construct as standard batch - */ - public function __construct() - { - parent::__construct(__CLASS__); - } - - public function addSource($sourceId, $sourceName) - { - - } -} Added: trunk/library/classes/Gems/Tracker/Batch/SynchronizeSourcesBatch.php =================================================================== --- trunk/library/classes/Gems/Tracker/Batch/SynchronizeSourcesBatch.php (rev 0) +++ trunk/library/classes/Gems/Tracker/Batch/SynchronizeSourcesBatch.php 2012-02-15 18:25:37 UTC (rev 488) @@ -0,0 +1,106 @@ +<?php + +/** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package Gems + * @subpackage Tracker + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id$ + */ + +/** + * + * + * @package Gems + * @subpackage Tracker + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5 + */ +class Gems_Tracker_Batch_SynchronizesSourceBatch extends MUtil_Batch_BatchAbstract +{ + /** + * + * @var Gems_Tracker_Source_SourceInterface + */ + private $_currentSource; + + /** + * + * @var Gems_Tracker + */ + protected $tracker; + + /** + * + * @param mixed $sourceData Source Id or array containing source data + */ + public function addSource($sourceData, $userId, $updateTokens = true) + { + $this->_currentSource = $this->tracker->getSource($sourceData); + $this->_currentSource->addSynchronizeSurveyCommands($this, $userId, $updateTokens); + $this->_currentSource = null; + } + + /** + * + * @param mixed $sourceData Source Id or array containing source data + */ + public function addSourceFunction($function, $param_args = null) + { + if (null === $this->_currentSource) { + throw new Gems_Exception_Coding('Trying to add a Source Function without a current source.'); + } + + $params = array_slice(func_get_args(), 1); + + $this->addStep('sourceStep', $this->_currentSource->getId(), $function, $params); + } + + /** + * The basic steps + * + * @param int $sourceId + * @param string $function + * @param array $params + */ + protected function sourceStep($sourceId, $function, array $params) + { + $source = $this->tracker->getSource($sourceData); + + $messages = call_user_func_array(array($source, $function), $params); + + if ($messages) { + foreach ((array) $messages as $message) { + $this->addMessage($message); + } + } + } +} Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-02-15 16:24:48 UTC (rev 487) +++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-02-15 18:25:37 UTC (rev 488) @@ -296,6 +296,39 @@ } /** + * Add the commands to update this source to a source synchornization batch + * + * @param Gems_Tracker_Batch_SynchronizesSourceBatch $batch + * @param int $userId Id of the user who takes the action (for logging) + * @param bool $updateTokens Wether the tokens should be updated or not, default is true + * / + public function addSynchronizeSurveyCommands(Gems_Tracker_Batch_SynchronizesSourceBatch $batch, $userId, $updateTokens = true) + { + // Surveys in LS + $lsDb = $this->getSourceDatabase(); + $select = $lsDb->select(); + $select->from($this->_getSurveysTableName(), 'sid') + ->order('sid'); + $lsSurveys = $lsDb->fetchCol($select); + $lsSurveys = array_combine($lsSurveys, $lsSurveys); + + // Surveys in Gems + $gemsSurveys = $this->_getGemsSurveysForSynchronisation(); + + foreach ($gemsSurveys as $surveyId => $sourceSurveyId) { + if (isset($lsSurveys[$sourceSurveyId])) { + $batch->addSourceFunction('checkSurvey', $sourceSurveyId, $surveyId, $userId, $updateTokens); + } else { + $batch->addSourceFunction('checkSurvey', null, $surveyId, $userId, $updateTokens); + } + } + + foreach (array_diff($lsSurveys, $gemsSurveys) as $sourceSurveyId) { + $batch->addSourceFunction('checkSurvey', $sourceSurveyId, null, $userId, $updateTokens); + } + } + + /** * Check if the tableprefix exists in the source database, and change the status of this * adapter in the gems_sources table accordingly * @@ -322,6 +355,165 @@ } /** + * Internal function used for source synchronization + * + * @param int $sourceSurveyId + * @param int $surveyId + * @param int $userId + * @param boolean $updateTokens + */ + public function checkSurvey($sourceSurveyId, $surveyId, $userId, $updateTokens) + { + $messages = array(); + $survey = $this->tracker->getSurveyBySourceId($surveyId, $sourceSurveyId); + + if (null === $sourceSurveyId) { + // Was removed + $values['gsu_active'] = 0; + $values['gsu_surveyor_active'] = 0; + $values['gsu_status'] = 'Survey was removed from source.'; + + if ($survey->saveSurvey($values, $userId)) { + $messages[] = sprintf($this->translate->_('The \'%s\' survey is no longer active. The survey was removed from LimeSurvey!'), $survey->getName()); + } + } else { + $lsDb = $this->getSourceDatabase(); + + // SELECT sid, surveyls_title AS short_title, surveyls_description AS description, active, datestamp, ' . $this->_anonymizedField . ' + $select = $lsDb->select(); + $select->from($this->_getSurveysTableName(), array('active', 'datestamp', $this->_anonymizedField)) + ->joinInner( + $this->_getSurveyLanguagesTableName(), + 'sid = surveyls_survey_id AND language = surveyls_language', + array('surveyls_title', 'surveyls_description')) + ->where('sid = ?', $sourceSurveyId); + $lsSurvey = $lsDb->fetchRow($select); + + $surveyor_title = substr($lsSurvey['surveyls_title'], 0, 100); + $surveyor_status = ''; + + // ANONIMIZATION + switch ($lsSurvey[$this->_anonymizedField]) { + case 'Y': + $surveyor_status .= 'Uses anonymous answers. '; + break; + case 'N': + break; + default: + // This is for the case that $this->_anonymizedField is empty, we show an update statement. + // The answers already in the table can only be linked to the repsonse based on the completion time + // this requires a manual action as token table only hold minuts while survey table holds seconds + // and we might have responses with the same timestamp. + $lsDb->query("UPDATE " . $this->_getSurveysTableName() . " SET `" . $this->_anonymizedField . "` = 'N' WHERE sid = ?;", $sourceSurveyId); + $messages[] = sprintf($this->translate->_("Corrected anonymization for survey '%s'"), $surveyor_title); + + $lsDb->query("ALTER TABLE " . $this->_getSurveyTableName($sourceSurveyId) . " ADD `token` varchar(36) default NULL;"); + } + + // DATESTAMP + if ($lsSurvey['datestamp'] == 'N') { + $surveyor_status .= 'Not date stamped. '; + } + + // IS ACTIVE + if ($lsSurvey['active'] == 'Y') { + $surveyor_active = true; + try { + $tokenTable = $lsDb->fetchAssoc('SHOW COLUMNS FROM ' . $this->_getTokenTableName($sourceSurveyId)); + } catch (Zend_Exception $e) { + $tokenTable = false; + } + + if ($tokenTable) { + $lengths = array(); + if (preg_match('/\(([^\)]+)\)/', $tokenTable['token']['Type'], $lengths)) { + $tokenLength = $lengths[1]; + } else { + $tokenLength = 0; + } + if ($tokenLength < $token_library->getLength()) { + $surveyor_status .= 'Token field length is too short. '; + } + + $missingFields = array(); + foreach ($this->_attributeMap as $name => $field) { + if (! isset($tokenTable[$field])) { + $missingFields[$field] = "ADD $field varchar(255) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'"; + } + } + if ($missingFields) { + $sql = "ALTER TABLE " . $this->_getTokenTableName($sid) . " " . implode(', ', $missingFields); + try { + $lsDb->query($sql); + $messages[] = sprintf($this->translate->_("Added attribute fields to token table for '%s'"), $surveyor_title); + } catch (Zend_Exception $e) { + $surveyor_status .= 'Token attributes could not be created. '; + $surveyor_status .= $e->getMessage() . ' '; + + $messages[] = sprintf($this->translate->_("Attribute fields not created for token table for '%s'"), $surveyor_title); + $messages[] = sprintf($this->translate->_('Required fields: %s', implode($this->_(', '), array_keys($missingFields)))); + $messages[] = $e->getMessage(); + + // Maximum reporting for this case + MUtil_Echo::r($missingFields, 'Missing fields for ' . $surveyor_title); + MUtil_Echo::r($e); + } + } + } else { + $surveyor_status .= 'No token table created. '; + } + + + } else { + $surveyor_active = false; + $surveyor_status .= 'Not active. '; + } + + // Update Gems + $values = array(); + + if ($survey->exists) { // Update + if ($survey->isActiveInSource() != $surveyor_active) { + $values['gsu_surveyor_active'] = $surveyor_active ? 1 : 0; + + $messages[] = sprintf($this->translate->_('The status of the \'%s\' survey has changed.'), $survey->getName()); + } + + // Reset to inactive if the surveyor survey has become inactive. + if ($survey->isActive() && $surveyor_status) { + $values['gsu_active'] = 0; + $messages[] = sprintf($this->translate->_('Survey \'%s\' IS NO LONGER ACTIVE!!!'), $survey->getName()); + } + + if (substr($surveyor_status, 0, 127) != (string) $survey->getStatus()) { + if ($surveyor_status) { + $values['gsu_status'] = substr($surveyor_status, 0, 127); + $messages[] = sprintf($this->translate->_('The status of the \'%s\' survey has changed to \'%s\'.'), $survey->getName(), $values['gsu_status']); + } else { + $values['gsu_status'] = 'OK'; + $messages[] = sprintf($this->translate->_('The status warning for the \'%s\' survey was removed.'), $survey->getName()); + } + } + + if ($survey->getName() != $surveyor_title) { + $values['gsu_survey_name'] = $surveyor_title; + $messages[] = sprintf($this->translate->_('The name of the \'%s\' survey has changed to \'%s\'.'), $survey->getName(), $surveyor_title); + } + + } else { // New record + $values['gsu_survey_name'] = $surveyor_title; + $values['gsu_surveyor_active'] = $surveyor_active ? 1 : 0; + $values['gsu_active'] = 0; + $values['gsu_status'] = $surveyor_status; + + $messages[] = sprintf($this->translate->_('Imported the \'%s\' survey.'), $surveyor_title); + } + $values['gsu_survey_description'] = strtr(substr($surveyor_survey['description'], 0, 100), "\xA0\xC2", ' '); + $survey->saveSurvey($values, $userId); + } + } + + /** * Inserts the token in the source (if needed) and sets those attributes the source wants to set. * * @param Gems_Tracker_Token $token Modified: trunk/library/classes/Gems/Tracker/Source/SourceAbstract.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/SourceAbstract.php 2012-02-15 16:24:48 UTC (rev 487) +++ trunk/library/classes/Gems/Tracker/Source/SourceAbstract.php 2012-02-15 18:25:37 UTC (rev 488) @@ -87,6 +87,21 @@ } /** + * Returns all surveys for synchronization + * + * @return array Pairs if + */ + protected function _getGemsSurveysForSynchronisation() + { + $select = $this->_gemsDb->select(); + $select->from('gems__surveys', array('gsu_id_survey', 'gsu_surveyor_id')) + ->where('gsu_id_source = ', $this->getId()) + ->order('gsu_surveyor_id'); + + return $this->_gemsDb->fetchPairs($select); + } + + /** * Creates a where filter statement for tokens that do not * have a correct name and are in a tokens table * @@ -208,7 +223,19 @@ } /** + * Add the commands to update this source to a source synchornization batch * + * @param Gems_Tracker_Batch_SynchronizesSourceBatch $batch + * @param int $userId Id of the user who takes the action (for logging) + * @param bool $updateTokens Wether the tokens should be updated or not, default is true + */ + public function addSynchronizeSurveyCommands(Gems_Tracker_Batch_SynchronizesSourceBatch $batch, $userId, $updateTokens = true) + { + // Do nothing is default + } + + /** + * * @return string Base url for source */ protected function getBaseUrl() Modified: trunk/library/classes/Gems/Tracker/Source/SourceInterface.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/SourceInterface.php 2012-02-15 16:24:48 UTC (rev 487) +++ trunk/library/classes/Gems/Tracker/Source/SourceInterface.php 2012-02-15 18:25:37 UTC (rev 488) @@ -55,6 +55,15 @@ public function __construct(array $sourceData, Zend_Db_Adapter_Abstract $gemsDb); /** + * Add the commands to update this source to a source synchornization batch + * + * @param Gems_Tracker_Batch_SynchronizesSourceBatch $batch + * @param int $userId Id of the user who takes the action (for logging) + * @param bool $updateTokens Wether the tokens should be updated or not, default is true + */ + public function addSynchronizeSurveyCommands(Gems_Tracker_Batch_SynchronizesSourceBatch $batch, $userId, $updateTokens = true); + + /** * Inserts the token in the source (if needed) and sets those attributes the source wants to set. * * @param Gems_Tracker_Token $token Modified: trunk/library/classes/MUtil/Batch/BatchAbstract.php =================================================================== --- trunk/library/classes/MUtil/Batch/BatchAbstract.php 2012-02-15 16:24:48 UTC (rev 487) +++ trunk/library/classes/MUtil/Batch/BatchAbstract.php 2012-02-15 18:25:37 UTC (rev 488) @@ -754,7 +754,13 @@ $command = array_shift($this->_session->commands); $this->_session->processed++; - call_user_func_array(array($this, $command['method']), $command['parameters']); + try { + call_user_func_array(array($this, $command['method']), $command['parameters']); + } catch (Exception $e) { + $this->addMessage('ERROR!!!'); + $this->addMessage('While calling:' . $command['method'] . '(', implode(',', MUtil_Ra::flatten($command['parameters'])), ')'); + $this->addMessage($e->getMessage()); + } return true; } else { return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-15 16:24:57
|
Revision: 487 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=487&view=rev Author: matijsdejong Date: 2012-02-15 16:24:48 +0000 (Wed, 15 Feb 2012) Log Message: ----------- ExWhoops, echo still on Modified Paths: -------------- tags/1.5.1/library/snippets/ShowTrackTokenSnippet.php Modified: tags/1.5.1/library/snippets/ShowTrackTokenSnippet.php =================================================================== --- tags/1.5.1/library/snippets/ShowTrackTokenSnippet.php 2012-02-15 16:14:51 UTC (rev 486) +++ tags/1.5.1/library/snippets/ShowTrackTokenSnippet.php 2012-02-15 16:24:48 UTC (rev 487) @@ -147,7 +147,7 @@ ->addCurrentChildren() ->showDisabled(); - MUtil_Echo::track($links->count()); + // MUtil_Echo::track($links->count()); return $links; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-15 16:15:02
|
Revision: 486 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=486&view=rev Author: matijsdejong Date: 2012-02-15 16:14:51 +0000 (Wed, 15 Feb 2012) Log Message: ----------- Whoops, echo still on Modified Paths: -------------- trunk/library/snippets/ShowTrackTokenSnippet.php Modified: trunk/library/snippets/ShowTrackTokenSnippet.php =================================================================== --- trunk/library/snippets/ShowTrackTokenSnippet.php 2012-02-15 15:25:20 UTC (rev 485) +++ trunk/library/snippets/ShowTrackTokenSnippet.php 2012-02-15 16:14:51 UTC (rev 486) @@ -147,7 +147,7 @@ ->addCurrentChildren() ->showDisabled(); - MUtil_Echo::track($links->count()); + // MUtil_Echo::track($links->count()); return $links; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-15 15:25:31
|
Revision: 485 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=485&view=rev Author: mennodekker Date: 2012-02-15 15:25:20 +0000 (Wed, 15 Feb 2012) Log Message: ----------- Forgot to include the upgrade :) Modified Paths: -------------- tags/1.5.1/library/classes/Gems/Upgrades.php Modified: tags/1.5.1/library/classes/Gems/Upgrades.php =================================================================== --- tags/1.5.1/library/classes/Gems/Upgrades.php 2012-02-15 15:03:30 UTC (rev 484) +++ tags/1.5.1/library/classes/Gems/Upgrades.php 2012-02-15 15:25:20 UTC (rev 485) @@ -56,6 +56,7 @@ $this->setContext('gems'); //And add our patches $this->register('Upgrade143to15', 'Upgrade from 1.43 to 1.5'); + $this->register('Upgrade15to151', 'Upgrade from 1.5.0. to 1.5.1'); } @@ -99,4 +100,17 @@ return true; } + + /** + * To upgrade to 1.5.1 just execute patchlevel 44 + */ + public function Upgrade15to151() + { + $this->addMessage(sprintf($this->_('Executing patchlevel %d'),44)); + $this->patcher->executePatch(44); + + $this->invalidateCache(); + + return true; + } } \ 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: <gem...@li...> - 2012-02-15 15:03:41
|
Revision: 484 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=484&view=rev Author: matijsdejong Date: 2012-02-15 15:03:30 +0000 (Wed, 15 Feb 2012) Log Message: ----------- Versions updated Modified Paths: -------------- trunk/library/classes/Gems/Versions.php trunk/library/classes/MUtil/Version.php Modified: trunk/library/classes/Gems/Versions.php =================================================================== --- trunk/library/classes/Gems/Versions.php 2012-02-15 14:58:41 UTC (rev 483) +++ trunk/library/classes/Gems/Versions.php 2012-02-15 15:03:30 UTC (rev 484) @@ -43,12 +43,12 @@ { public final function getBuild() { - return 44; + return 45; } public final function getGemsVersion() { - return '1.5.1'; + return '1.5.2'; } public function getProjectVersion() Modified: trunk/library/classes/MUtil/Version.php =================================================================== --- trunk/library/classes/MUtil/Version.php 2012-02-15 14:58:41 UTC (rev 483) +++ trunk/library/classes/MUtil/Version.php 2012-02-15 15:03:30 UTC (rev 484) @@ -34,7 +34,7 @@ { const MAJOR = 1; const MINOR = 0; - const BUILD = 31; + const BUILD = 32; public static function get() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-15 14:58:52
|
Revision: 483 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=483&view=rev Author: matijsdejong Date: 2012-02-15 14:58:41 +0000 (Wed, 15 Feb 2012) Log Message: ----------- Reintegration of tagged version 1.5.1 Modified Paths: -------------- trunk/library/changelog.txt trunk/library/classes/Gems/Events.php trunk/library/classes/Gems/Tracker/Batch/ProcessTokensBatch.php trunk/library/classes/Gems/Tracker/Model/TrackModel.php trunk/library/classes/Gems/Tracker/RespondentTrack.php trunk/library/classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php trunk/library/classes/Gems/Util/Translated.php trunk/library/classes/GemsEscort.php trunk/library/configs/db/patches.sql trunk/library/languages/default-en.mo trunk/library/languages/default-en.po trunk/library/languages/default-nl.mo trunk/library/languages/default-nl.po Added Paths: ----------- trunk/library/classes/Gems/Event/TrackCompletedEventInterface.php Property Changed: ---------------- trunk/ trunk/library/ Property changes on: trunk ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse:306-430,467 /branches/1.5.x:426-455,458-472 /tags/1.5.0beta1:305 + /branches/1.5.0-pulse:306-430,467 /branches/1.5.x:426-455,458-472,475-481 /tags/1.5.0beta1:305 Property changes on: trunk/library ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse/library:306-344,346,467 /branches/1.5.x/library:426-455,458-472 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 + /branches/1.5.0-pulse/library:306-344,346,467 /branches/1.5.x/library:426-455,458-472,475-481 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 Modified: trunk/library/changelog.txt =================================================================== --- trunk/library/changelog.txt 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/changelog.txt 2012-02-15 14:58:41 UTC (rev 483) @@ -1,3 +1,7 @@ +Important changes from 1.5.0 => 1.5.1 +============================================================ +New event introduced: TrackCompletedEvent + Important changes from 1.4.3 => 1.5 ============================================================ Passwords should be set with a project.ini->salt. Salt is now a required project setting! Copied: trunk/library/classes/Gems/Event/TrackCompletedEventInterface.php (from rev 481, branches/1.5.x/library/classes/Gems/Event/TrackCompletedEventInterface.php) =================================================================== --- trunk/library/classes/Gems/Event/TrackCompletedEventInterface.php (rev 0) +++ trunk/library/classes/Gems/Event/TrackCompletedEventInterface.php 2012-02-15 14:58:41 UTC (rev 483) @@ -0,0 +1,59 @@ +<?php +/** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * @package Gems + * @subpackage Event + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $ + */ + +/** + * Track completed event interface + * + * Run on completion of an event + * + * @package Gems + * @subpackage Event + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5.1 + */ +interface Gems_Event_TrackCompletedEventInterface extends Gems_Event_EventInterface +{ + /** + * Process the data and return the answers that should be changed. + * + * Storing the changed $values is handled by the calling function. + * + * @param Gems_Tracker_RespondentTrack $track Gems repsondent track object + * @param array $values The values to update the track with, before they were saved + * @param int $userId The current userId + * @return void + */ + public function processTrackCompletion(Gems_Tracker_RespondentTrack $track, &$values, $userId); +} Modified: trunk/library/classes/Gems/Events.php =================================================================== --- trunk/library/classes/Gems/Events.php 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/classes/Gems/Events.php 2012-02-15 14:58:41 UTC (rev 483) @@ -48,6 +48,7 @@ { const EVENTS_DIR = 'events'; + const TRACK_COMPLETION_EVENT = 'track/completed'; const ROUND_CHANGED_EVENT = 'round/changed'; const SURVEY_BEFORE_ANSWERING_EVENT = 'survey/beforeanswering'; const SURVEY_COMPLETION_EVENT = 'survey/completed'; @@ -61,6 +62,7 @@ * @var array containing eventType => eventClass for all event classes */ protected $_eventClasses = array( + self::TRACK_COMPLETION_EVENT => 'Gems_Event_TrackCompletedEventInterface', self::ROUND_CHANGED_EVENT => 'Gems_Event_RoundChangedEventInterface', self::SURVEY_BEFORE_ANSWERING_EVENT => 'Gems_Event_SurveyBeforeAnsweringEventInterface', self::SURVEY_COMPLETION_EVENT => 'Gems_Event_SurveyCompletedEventInterface', @@ -174,35 +176,44 @@ /** * - * @param string $eventName - * @return Gems_Event_RoundChangedEventInterface + * @return Gems_Event_SurveyCompletedEventInterface */ - public function loadRoundChangedEvent($eventName) + public function listSurveyBeforeAnsweringEvents() { - return $this->_loadEvent($eventName, self::ROUND_CHANGED_EVENT); + return $this->_listEvents(self::SURVEY_BEFORE_ANSWERING_EVENT); } /** * * @return Gems_Event_SurveyCompletedEventInterface */ - public function listSurveyBeforeAnsweringEvents() + public function listSurveyCompletionEvents() { - return $this->_listEvents(self::SURVEY_BEFORE_ANSWERING_EVENT); + return $this->_listEvents(self::SURVEY_COMPLETION_EVENT); } /** * - * @return Gems_Event_SurveyCompletedEventInterface + * @return Gems_Event_TrackCompletedEventInterface */ - public function listSurveyCompletionEvents() + public function listTrackCompletionEvents() { - return $this->_listEvents(self::SURVEY_COMPLETION_EVENT); + return $this->_listEvents(self::TRACK_COMPLETION_EVENT); } /** * * @param string $eventName + * @return Gems_Event_RoundChangedEventInterface + */ + public function loadRoundChangedEvent($eventName) + { + return $this->_loadEvent($eventName, self::ROUND_CHANGED_EVENT); + } + + /** + * + * @param string $eventName * @return Gems_Event_SurveyBeforeAnsweringEventInterface */ public function loadSurveyBeforeAnsweringEvent($eventName) @@ -219,4 +230,14 @@ { return $this->_loadEvent($eventName, self::SURVEY_COMPLETION_EVENT); } + + /** + * + * @param string $eventName + * @return Gems_Event_TrackCompletedEventInterface + */ + public function loadTrackCompletionEvent($eventName) + { + return $this->_loadEvent($eventName, self::TRACK_COMPLETION_EVENT); + } } Modified: trunk/library/classes/Gems/Tracker/Batch/ProcessTokensBatch.php =================================================================== --- trunk/library/classes/Gems/Tracker/Batch/ProcessTokensBatch.php 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/classes/Gems/Tracker/Batch/ProcessTokensBatch.php 2012-02-15 14:58:41 UTC (rev 483) @@ -58,6 +58,11 @@ */ protected $translate; + /** + * Set a little higher, to reduce the effect of the server response time and application startup + */ + public $minimalStepDurationMs = 3000; + public function addToken($tokenData, $userId) { if (is_array($tokenData)) { Modified: trunk/library/classes/Gems/Tracker/Model/TrackModel.php =================================================================== --- trunk/library/classes/Gems/Tracker/Model/TrackModel.php 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/classes/Gems/Tracker/Model/TrackModel.php 2012-02-15 14:58:41 UTC (rev 483) @@ -48,7 +48,18 @@ class Gems_Tracker_Model_TrackModel extends MUtil_Model_TableModel implements MUtil_Registry_TargetInterface { /** - * + * Holds the trackData in array with key trackId, for internal caching use only + * + * @var array + */ + protected $_trackData = array(); + + /** + * @var Gems_Loader + */ + protected $loader; + + /** * @var Gems_Tracker */ protected $tracker; @@ -111,6 +122,12 @@ $this->set('gtr_date_start', 'label', $this->translate->_('From'), 'dateFormat', $translated->dateFormatString, 'formatFunction', $translated->formatDate); $this->set('gtr_date_until', 'label', $this->translate->_('Use until'), 'dateFormat', $translated->dateFormatString, 'formatFunction', $translated->formatDateForever); + if ($detailed) { + $this->setIfExists('gtr_completed_event', + 'label', $this->translate->_('After completion'), + 'multiOptions', $this->loader->getEvents()->listTrackCompletionEvents()); + } + return $this; } @@ -147,4 +164,31 @@ { return array_filter(array_keys(get_object_vars($this)), array($this, 'filterRequestNames')); } + + /** + * Get the TrackCompletedEvent for the given trackId + * + * @param int $trackId + * @return Gems_Event_TrackCompletedEventInterface|null + */ + public function getTrackCompletionEvent($trackId) + { + static $trackData = array(); + + if (array_key_exists($trackId, $trackData)) { + $track = $trackData[$trackId]; + } else { + if ($track = $this->loadFirst(array('gtr_id_track' => $trackId))) { + $trackData[$trackId] = $track; + } else { + $track = array(); + } + } + + if (array_key_exists('gtr_completed_event', $track)) { + if (!empty($track['gtr_completed_event'])) { + return $this->loader->getEvents()->loadTrackCompletionEvent($track['gtr_completed_event']); + } + } + } } Modified: trunk/library/classes/Gems/Tracker/RespondentTrack.php =================================================================== --- trunk/library/classes/Gems/Tracker/RespondentTrack.php 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/classes/Gems/Tracker/RespondentTrack.php 2012-02-15 14:58:41 UTC (rev 483) @@ -126,7 +126,7 @@ */ public function _checkTrackCount($userId) { - $sqlCount = 'SELECT COUNT(*) AS count, COALESCE(SUM(CASE WHEN gto_completion_time IS NULL THEN 0 ELSE 1 END), 0) AS completed + $sqlCount = 'SELECT COUNT(*) AS count, SUM(CASE WHEN gto_completion_time IS NULL THEN 0 ELSE 1 END) AS completed FROM gems__tokens JOIN gems__reception_codes ON gto_reception_code = grc_id_reception_code AND grc_success = 1 WHERE gto_id_respondent_track = ?'; @@ -142,6 +142,10 @@ ->onlySucces(); $values['gr2t_end_date'] = $tokenSelect->fetchOne(); + + //Handle TrackCompletionEvent, send only changed fields in $values array + $this->tracker->filterChangesOnly($this->_respTrackData, $values); + $this->handleTrackCompletion($values, $userId); } else { $values['gr2t_end_date'] = null; } @@ -623,7 +627,25 @@ } /** + * Find out if there are track completion events and delegate to the event if needed * + * @param array $values The values changed before entering this event + * @param int $userId + */ + public function handleTrackCompletion(&$values, $userId) { + // Process any events + $trackModel = $this->tracker->getTrackModel(); + + //to be backward compatible, first check if the engine has a + if (is_callable(array($trackModel, 'getTrackCompletionEvent'))) { + if ($event = $trackModel->getTrackCompletionEvent($this->getTrackId())) { + $event->processTrackCompletion($this, $values, $userId); + } + } + } + + /** + * * @return boolean */ public function hasSuccesCode() Modified: trunk/library/classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php =================================================================== --- trunk/library/classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php 2012-02-15 14:58:41 UTC (rev 483) @@ -134,6 +134,9 @@ if (! $this->createData) { $bridge->addCheckbox('gtr_active'); } + if ($model->has('gtr_completed_event')) { + $bridge->add('gtr_completed_event'); + } $bridge->addMultiCheckbox('gtr_organizations', 'label', $this->_('Organizations'), 'multiOptions', $this->util->getDbLookup()->getOrganizations(), 'required', true); } Modified: trunk/library/classes/Gems/Util/Translated.php =================================================================== --- trunk/library/classes/Gems/Util/Translated.php 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/classes/Gems/Util/Translated.php 2012-02-15 14:58:41 UTC (rev 483) @@ -193,27 +193,27 @@ return self::$emptyDropdownArray; } - public function getGenders() + public function getGenders($locale = null) { - return array('M' => $this->_('Male'), 'F' => $this->_('Female'), 'U' => $this->_('Unknown')); + return array('M' => $this->_('Male', $locale), 'F' => $this->_('Female', $locale), 'U' => $this->_('Unknown', $locale)); } - public function getGenderGreeting() + public function getGenderGreeting($locale = null) { - return array('M' => $this->_('mr.'), 'F' => $this->_('mrs.'), 'U' => $this->_('mr./mrs.')); + return array('M' => $this->_('mr.', $locale), 'F' => $this->_('mrs.', $locale), 'U' => $this->_('mr./mrs.', $locale)); } - public function getGenderHello() + public function getGenderHello($locale = null) { - return array('M' => $this->_('Mr.'), 'F' => $this->_('Mrs.'), 'U' => $this->_('Mr./Mrs.')); + return array('M' => $this->_('Mr.', $locale), 'F' => $this->_('Mrs.', $locale), 'U' => $this->_('Mr./Mrs.', $locale)); } - public function getYesNo() + public function getYesNo($locale = null) { static $data; if (! $data) { - $data = array(1 => $this->_('Yes'), 0 => $this->_('No')); + $data = array(1 => $this->_('Yes', $locale), 0 => $this->_('No', $locale)); } return $data; Modified: trunk/library/classes/GemsEscort.php =================================================================== --- trunk/library/classes/GemsEscort.php 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/classes/GemsEscort.php 2012-02-15 14:58:41 UTC (rev 483) @@ -1650,7 +1650,8 @@ { $locale = isset($tokenData['grs_iso_lang']) ? $tokenData['grs_iso_lang'] : $this->locale; - $genderHello = $this->getUtil()->getTranslated()->getGenderHello(); + // Prepare values + $genderHello = $this->getUtil()->getTranslated()->getGenderHello($locale); $hello[] = $genderHello[$tokenData['grs_gender']]; $hello[] = $tokenData['grs_first_name']; if ($tokenData['grs_surname_prefix']) { @@ -1658,13 +1659,24 @@ } $hello[] = $tokenData['grs_last_name']; - $genderGreeting = $this->getUtil()->getTranslated()->getGenderGreeting(); + $genderGreeting = $this->getUtil()->getTranslated()->getGenderGreeting($locale); $greeting[] = $genderGreeting[$tokenData['grs_gender']]; if ($tokenData['grs_surname_prefix']) { $greeting[] = $tokenData['grs_surname_prefix']; } $greeting[] = $tokenData['grs_last_name']; + // Count todo + $tSelect = $this->getLoader()->getTracker()->getTokenSelect(array( + 'all' => 'COUNT(*)', + 'track' => $this->db->quoteInto('SUM(CASE WHEN gto_id_respondent_track = ? THEN 1 ELSE 0 END)', $tokenData['gto_id_respondent_track']))); + $tSelect->andSurveys(array()) + ->forRespondent($tokenData['gto_id_respondent'], $tokenData['gto_id_organization']) + ->forGroupId($tokenData['gsu_id_primary_group']) + ->onlyValid(); + $todo = $tSelect->fetchRow(); + + // Set the basic fields $result['{email}'] = $tokenData['grs_email']; $result['{first_name}'] = $tokenData['grs_first_name']; $result['{full_name}'] = implode(' ', $hello); @@ -1681,30 +1693,34 @@ $result['{organization_url}'] = $tokenData['gor_url']; $result['{organization_welcome}'] = $tokenData['gor_welcome']; - $result['{physician}'] = ($tokenData['gsf_surname_prefix'] ? $tokenData['grs_surname_prefix'] . ' ' : '') . $tokenData['gsf_last_name']; + $result['{round}'] = $tokenData['gto_round_description']; - $result['{round}'] = $tokenData['gto_round_description']; + $result['{site_ask_url}'] = $this->util->getCurrentURI('ask/'); + // Url's + $url = $this->util->getCurrentURI('ask/forward/' . MUtil_Model::REQUEST_ID . '/' . $tokenData['gto_id_token']); + $url_input = $result['{site_ask_url}'] . 'index/' . MUtil_Model::REQUEST_ID . '/' . $tokenData['gto_id_token']; - $result['{site_ask_url}'] = $this->util->getCurrentURI('ask/'); + $result['{survey}'] = $tokenData['gsu_survey_name']; - $result['{survey}'] = $tokenData['gsu_survey_name']; + $result['{todo_all}'] = sprintf($this->translate->plural('%d survey', '%d surveys', $todo['all'], $locale), $todo['all']); + $result['{todo_all_count}'] = $todo['all']; + $result['{todo_track}'] = sprintf($this->translate->plural('%d survey', '%d surveys', $todo['track'], $locale), $todo['track']); + $result['{todo_track_count}'] = $todo['track']; - $url = $this->util->getCurrentURI('ask/forward/' . MUtil_Model::REQUEST_ID . '/' . $tokenData['gto_id_token']); - $url_input = $result['{site_ask_url}'] . 'index/' . MUtil_Model::REQUEST_ID . '/' . $tokenData['gto_id_token']; + $result['{token}'] = strtoupper($tokenData['gto_id_token']); + $result['{token_from}'] = MUtil_Date::format($tokenData['gto_valid_from'], Zend_Date::DATE_LONG, 'yyyy-MM-dd', $locale); + // $result['{token_input}'] = MUtil_Html::create()->a($url_input, $tokenData['gsu_survey_name']); + // $result['{token_link}'] = MUtil_Html::create()->a($url, $tokenData['gsu_survey_name']); + // $result['{token_link}'] = '<a href="' . $url . '">' . $tokenData['gsu_survey_name'] . '</a>'; + $result['{token_link}'] = '[url=' . $url . ']' . $tokenData['gsu_survey_name'] . '[/url]'; - $result['{token}'] = strtoupper($tokenData['gto_id_token']); - $result['{token_from}'] = MUtil_Date::format($tokenData['gto_valid_from'], Zend_Date::DATE_LONG, 'yyyy-MM-dd', $locale); - // $result['{token_input}'] = MUtil_Html::create()->a($url_input, $tokenData['gsu_survey_name']); - // $result['{token_link}'] = MUtil_Html::create()->a($url, $tokenData['gsu_survey_name']); - // $result['{token_link}'] = '<a href="' . $url . '">' . $tokenData['gsu_survey_name'] . '</a>'; - $result['{token_link}'] = '[url=' . $url . ']' . $tokenData['gsu_survey_name'] . '[/url]'; + $result['{token_until}'] = MUtil_Date::format($tokenData['gto_valid_until'], Zend_Date::DATE_LONG, 'yyyy-MM-dd', $locale); + $result['{token_url}'] = $url; + $result['{token_url_input}'] = $url_input; - $result['{token_until}'] = MUtil_Date::format($tokenData['gto_valid_until'], Zend_Date::DATE_LONG, 'yyyy-MM-dd', $locale); - $result['{token_url}'] = $url; - $result['{token_url_input}'] = $url_input; + $result['{track}'] = $tokenData['gtr_track_name']; - $result['{track}'] = $tokenData['gtr_track_name']; - + // Add the code fields $join = $this->db->quoteInto('gtf_id_field = gr2t2f_id_field AND gr2t2f_id_respondent_track = ?', $tokenData['gto_id_respondent_track']); $select = $this->db->select(); $select->from('gems__track_fields', array(new Zend_Db_Expr("CONCAT('{track.', gtf_field_code, '}')"))) @@ -1721,4 +1737,3 @@ return $result; } } - Modified: trunk/library/configs/db/patches.sql =================================================================== --- trunk/library/configs/db/patches.sql 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/configs/db/patches.sql 2012-02-15 14:58:41 UTC (rev 483) @@ -369,3 +369,9 @@ -- GEMS VERSION: 44 -- PATCH: Add icon field to rounds ALTER TABLE `gems__rounds` ADD gro_icon_file VARCHAR(100) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null AFTER `gro_round_description`; + +-- PATCH: Add index for receptioncode to token table +ALTER TABLE `gems__tokens` ADD INDEX ( `gto_reception_code` ) + +-- PATCH: Add track completion event +ALTER TABLE `gems__tracks` ADD gtr_completed_event varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' AFTER gtr_track_class; Modified: trunk/library/languages/default-en.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-en.po =================================================================== --- trunk/library/languages/default-en.po 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/languages/default-en.po 2012-02-15 14:58:41 UTC (rev 483) @@ -2,9 +2,9 @@ msgstr "" "Project-Id-Version: Pulse EN\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-02-14 10:57+0100\n" +"POT-Creation-Date: 2012-02-15 14:22+0100\n" "PO-Revision-Date: \n" -"Last-Translator: Menno Dekker <men...@er...>\n" +"Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -87,6 +87,14 @@ msgid "You must login to access this page." msgstr "You must login to access this page." +#: classes/GemsEscort.php:1705 +#: classes/GemsEscort.php:1707 +#, php-format +msgid "%d survey" +msgid_plural "%d surveys" +msgstr[0] "%d survey" +msgstr[1] "%d surveys" + #: classes/Gems/AccessLog.php:236 msgid "Database needs to be updated!" msgstr "Database needs to be updated!" @@ -460,94 +468,89 @@ msgid "Cache cleaned" msgstr "Cache cleaned" -#: classes/Gems/Controller/BrowseEditAction.php:352 +#: classes/Gems/Controller/BrowseEditAction.php:354 #, php-format msgid "New %s..." msgstr "New %s..." -#: classes/Gems/Controller/BrowseEditAction.php:385 +#: classes/Gems/Controller/BrowseEditAction.php:387 #, php-format msgid "Delete %s" msgstr "Delete %s" -#: classes/Gems/Controller/BrowseEditAction.php:389 +#: classes/Gems/Controller/BrowseEditAction.php:391 #, php-format msgid "%2$u %1$s deleted" msgstr "%2$u %1$s deleted" -#: classes/Gems/Controller/BrowseEditAction.php:403 +#: classes/Gems/Controller/BrowseEditAction.php:405 #, php-format msgid "Edit %s" msgstr "Edit %s" -#: classes/Gems/Controller/BrowseEditAction.php:500 +#: classes/Gems/Controller/BrowseEditAction.php:502 msgid "Free search text" msgstr "Free search text" -#: classes/Gems/Controller/BrowseEditAction.php:571 +#: classes/Gems/Controller/BrowseEditAction.php:573 msgid "Search" msgstr "Search" -#: classes/Gems/Controller/BrowseEditAction.php:587 +#: classes/Gems/Controller/BrowseEditAction.php:589 #, php-format msgid "No %s found" msgstr "No %s found" -#: classes/Gems/Controller/BrowseEditAction.php:660 -#: classes/Gems/Default/ExportAction.php:234 +#: classes/Gems/Controller/BrowseEditAction.php:662 #, php-format msgid "No %s found." msgstr "No %s found." -#: classes/Gems/Controller/BrowseEditAction.php:778 +#: classes/Gems/Controller/BrowseEditAction.php:780 msgid "Are you sure?" msgstr "Are you sure?" -#: classes/Gems/Controller/BrowseEditAction.php:794 -#: classes/Gems/Default/DatabaseAction.php:171 -#: classes/Gems/Default/DatabaseAction.php:483 +#: classes/Gems/Controller/BrowseEditAction.php:796 msgid "Yes" msgstr "Yes" -#: classes/Gems/Controller/BrowseEditAction.php:795 -#: classes/Gems/Default/DatabaseAction.php:172 -#: classes/Gems/Default/DatabaseAction.php:484 +#: classes/Gems/Controller/BrowseEditAction.php:797 msgid "No" msgstr "No" -#: classes/Gems/Controller/BrowseEditAction.php:848 +#: classes/Gems/Controller/BrowseEditAction.php:850 #, php-format msgid "Unknown %s requested" msgstr "Unknown %s requested" -#: classes/Gems/Controller/BrowseEditAction.php:871 +#: classes/Gems/Controller/BrowseEditAction.php:873 #, php-format msgid "New %1$s..." msgstr "New %1$s..." -#: classes/Gems/Controller/BrowseEditAction.php:879 +#: classes/Gems/Controller/BrowseEditAction.php:881 msgid "Save" msgstr "Save" -#: classes/Gems/Controller/BrowseEditAction.php:915 +#: classes/Gems/Controller/BrowseEditAction.php:917 #, php-format msgid "%2$u %1$s saved" msgstr "%2$u %1$s saved" -#: classes/Gems/Controller/BrowseEditAction.php:918 +#: classes/Gems/Controller/BrowseEditAction.php:920 msgid "No changes to save." msgstr "No changes to save." -#: classes/Gems/Controller/BrowseEditAction.php:927 +#: classes/Gems/Controller/BrowseEditAction.php:929 msgid "Input error! No changes saved!" msgstr "Input error! No changes saved!" -#: classes/Gems/Controller/BrowseEditAction.php:955 +#: classes/Gems/Controller/BrowseEditAction.php:957 #, php-format msgid "Show %s" msgstr "Show %s" -#: classes/Gems/Controller/BrowseEditAction.php:962 +#: classes/Gems/Controller/BrowseEditAction.php:964 #, php-format msgid "Unknown %s." msgstr "Unknown %s." @@ -1001,6 +1004,7 @@ msgstr "Export data" #: classes/Gems/Default/ExportAction.php:153 +#: classes/Gems/Default/MailJobAction.php:121 msgid "Survey" msgstr "Survey" @@ -1012,6 +1016,7 @@ #: classes/Gems/Default/ExportAction.php:172 #: classes/Gems/Default/IndexAction.php:203 #: classes/Gems/Default/LogAction.php:197 +#: classes/Gems/Default/MailJobAction.php:119 msgid "Organization" msgstr "Organization" @@ -1025,6 +1030,7 @@ msgstr "Role" #: classes/Gems/Default/GroupAction.php:92 +#: classes/Gems/Default/MailJobAction.php:104 msgid "Active" msgstr "Active" @@ -1250,7 +1256,6 @@ msgstr "New automatic mail job..." #: classes/Gems/Default/MailJobAction.php:100 -#: classes/Gems/Default/MailLogAction.php:116 msgid "Template" msgstr "Template" @@ -1634,6 +1639,7 @@ #: classes/Gems/Default/OverviewPlanAction.php:115 #: classes/Gems/Default/ProjectSurveysAction.php:88 +#: classes/Gems/Default/SurveyAction.php:203 msgid "survey" msgid_plural "surveys" msgstr[0] "survey" @@ -1743,29 +1749,32 @@ msgid "Server PHP Info" msgstr "Server PHP Info" -#: classes/Gems/Default/ProjectInformationAction.php:208 +#: classes/Gems/Default/ProjectInformationAction.php:212 msgid "Project settings" msgstr "Project settings" -#: classes/Gems/Default/ProjectInformationAction.php:215 +#: classes/Gems/Default/ProjectInformationAction.php:219 msgid "Session content" msgstr "Session content" -#: classes/Gems/Default/ProjectInformationAction.php:216 +#: classes/Gems/Default/ProjectInformationAction.php:220 msgid "Session" msgstr "Session" #: classes/Gems/Default/ProjectSurveysAction.php:68 +#: classes/Gems/Default/SurveyAction.php:192 msgid "By" msgstr "By" #: classes/Gems/Default/ProjectSurveysAction.php:69 #: classes/Gems/Default/ProjectTracksAction.php:67 +#: classes/Gems/Default/SurveyAction.php:193 msgid "From" msgstr "From" #: classes/Gems/Default/ProjectSurveysAction.php:70 #: classes/Gems/Default/ProjectTracksAction.php:68 +#: classes/Gems/Default/SurveyAction.php:195 msgid "Until" msgstr "Until" @@ -1793,6 +1802,7 @@ msgstr "Questions in survey %s" #: classes/Gems/Default/ProjectTracksAction.php:118 +#: classes/Gems/Default/SurveyAction.php:85 #, php-format msgid "Survey %s does not exist." msgstr "Survey %s does not exist." @@ -1968,6 +1978,7 @@ msgstr "Please settle the informed consent form for this patient." #: classes/Gems/Default/RespondentPlanAction.php:67 +#: classes/Gems/Default/SurveyAction.php:171 msgid "Show respondent" msgstr "Show patient" @@ -4071,9 +4082,8 @@ msgid "Can access" msgstr "Can access" -#: views/scripts/index/login.phtml:12 -msgid "The Pulse software was made possible thanks to support from " -msgstr "The Pulse software was made possible thanks to support from " +#~ msgid "The Pulse software was made possible thanks to support from " +#~ msgstr "The Pulse software was made possible thanks to support from " #~ msgid "Physician" #~ msgstr "Physician" Modified: trunk/library/languages/default-nl.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-nl.po =================================================================== --- trunk/library/languages/default-nl.po 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/languages/default-nl.po 2012-02-15 14:58:41 UTC (rev 483) @@ -2,9 +2,9 @@ msgstr "" "Project-Id-Version: Pulse NL\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-02-14 10:56+0100\n" +"POT-Creation-Date: 2012-02-15 14:22+0100\n" "PO-Revision-Date: \n" -"Last-Translator: Menno Dekker <men...@er...>\n" +"Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -87,6 +87,14 @@ msgid "You must login to access this page." msgstr "U moet ingelogd zijn voor toegang tot deze pagina." +#: classes/GemsEscort.php:1705 +#: classes/GemsEscort.php:1707 +#, php-format +msgid "%d survey" +msgid_plural "%d surveys" +msgstr[0] "%d vragenlijst" +msgstr[1] "%d vragenlijsten" + #: classes/Gems/AccessLog.php:236 msgid "Database needs to be updated!" msgstr "Database dient ververst te worden!" @@ -354,7 +362,7 @@ #: classes/Gems/Model.php:206 msgid "Opened" -msgstr "Bekeken" +msgstr "Bekeken op" #: classes/Gems/Model.php:207 msgid "Consent" @@ -460,94 +468,89 @@ msgid "Cache cleaned" msgstr "Cache opgeschoond" -#: classes/Gems/Controller/BrowseEditAction.php:352 +#: classes/Gems/Controller/BrowseEditAction.php:354 #, php-format msgid "New %s..." msgstr "Nieuw %s..." -#: classes/Gems/Controller/BrowseEditAction.php:385 +#: classes/Gems/Controller/BrowseEditAction.php:387 #, php-format msgid "Delete %s" msgstr "Verwijder %s" -#: classes/Gems/Controller/BrowseEditAction.php:389 +#: classes/Gems/Controller/BrowseEditAction.php:391 #, php-format msgid "%2$u %1$s deleted" msgstr "%2$u %1$s verwijderd" -#: classes/Gems/Controller/BrowseEditAction.php:403 +#: classes/Gems/Controller/BrowseEditAction.php:405 #, php-format msgid "Edit %s" msgstr "Bewerk %s" -#: classes/Gems/Controller/BrowseEditAction.php:500 +#: classes/Gems/Controller/BrowseEditAction.php:502 msgid "Free search text" msgstr "Vrije zoek tekst" -#: classes/Gems/Controller/BrowseEditAction.php:571 +#: classes/Gems/Controller/BrowseEditAction.php:573 msgid "Search" msgstr "Zoeken" -#: classes/Gems/Controller/BrowseEditAction.php:587 +#: classes/Gems/Controller/BrowseEditAction.php:589 #, php-format msgid "No %s found" msgstr "Geen %s gevonden" -#: classes/Gems/Controller/BrowseEditAction.php:660 -#: classes/Gems/Default/ExportAction.php:234 +#: classes/Gems/Controller/BrowseEditAction.php:662 #, php-format msgid "No %s found." msgstr "Geen %s gevonden." -#: classes/Gems/Controller/BrowseEditAction.php:778 +#: classes/Gems/Controller/BrowseEditAction.php:780 msgid "Are you sure?" msgstr "Weet u het zeker?" -#: classes/Gems/Controller/BrowseEditAction.php:794 -#: classes/Gems/Default/DatabaseAction.php:171 -#: classes/Gems/Default/DatabaseAction.php:483 +#: classes/Gems/Controller/BrowseEditAction.php:796 msgid "Yes" msgstr "Ja" -#: classes/Gems/Controller/BrowseEditAction.php:795 -#: classes/Gems/Default/DatabaseAction.php:172 -#: classes/Gems/Default/DatabaseAction.php:484 +#: classes/Gems/Controller/BrowseEditAction.php:797 msgid "No" msgstr "Nee" -#: classes/Gems/Controller/BrowseEditAction.php:848 +#: classes/Gems/Controller/BrowseEditAction.php:850 #, php-format msgid "Unknown %s requested" msgstr "Onjuist %s verzoek" -#: classes/Gems/Controller/BrowseEditAction.php:871 +#: classes/Gems/Controller/BrowseEditAction.php:873 #, php-format msgid "New %1$s..." msgstr "Nieuwe %1$s..." -#: classes/Gems/Controller/BrowseEditAction.php:879 +#: classes/Gems/Controller/BrowseEditAction.php:881 msgid "Save" msgstr "Opslaan" -#: classes/Gems/Controller/BrowseEditAction.php:915 +#: classes/Gems/Controller/BrowseEditAction.php:917 #, php-format msgid "%2$u %1$s saved" msgstr "%2$u %1$s opgeslagen" -#: classes/Gems/Controller/BrowseEditAction.php:918 +#: classes/Gems/Controller/BrowseEditAction.php:920 msgid "No changes to save." msgstr "Geen verandering om op te slaan." -#: classes/Gems/Controller/BrowseEditAction.php:927 +#: classes/Gems/Controller/BrowseEditAction.php:929 msgid "Input error! No changes saved!" msgstr "Invoer fout! Veranderingen niet opgeslagen!" -#: classes/Gems/Controller/BrowseEditAction.php:955 +#: classes/Gems/Controller/BrowseEditAction.php:957 #, php-format msgid "Show %s" msgstr "Toon %s" -#: classes/Gems/Controller/BrowseEditAction.php:962 +#: classes/Gems/Controller/BrowseEditAction.php:964 #, php-format msgid "Unknown %s." msgstr "%s is onbekend." @@ -1001,6 +1004,7 @@ msgstr "Exporteer gegevens" #: classes/Gems/Default/ExportAction.php:153 +#: classes/Gems/Default/MailJobAction.php:121 msgid "Survey" msgstr "Vragenlijst" @@ -1012,6 +1016,7 @@ #: classes/Gems/Default/ExportAction.php:172 #: classes/Gems/Default/IndexAction.php:203 #: classes/Gems/Default/LogAction.php:197 +#: classes/Gems/Default/MailJobAction.php:119 msgid "Organization" msgstr "Organisatie" @@ -1025,6 +1030,7 @@ msgstr "Rol" #: classes/Gems/Default/GroupAction.php:92 +#: classes/Gems/Default/MailJobAction.php:104 msgid "Active" msgstr "Actief" @@ -1250,7 +1256,6 @@ msgstr "Nieuwe automatische mail opdracht..." #: classes/Gems/Default/MailJobAction.php:100 -#: classes/Gems/Default/MailLogAction.php:116 msgid "Template" msgstr "Sjabloon" @@ -1634,6 +1639,7 @@ #: classes/Gems/Default/OverviewPlanAction.php:115 #: classes/Gems/Default/ProjectSurveysAction.php:88 +#: classes/Gems/Default/SurveyAction.php:203 msgid "survey" msgid_plural "surveys" msgstr[0] "vragenlijst" @@ -1743,29 +1749,32 @@ msgid "Server PHP Info" msgstr "Server PHP Info" -#: classes/Gems/Default/ProjectInformationAction.php:208 +#: classes/Gems/Default/ProjectInformationAction.php:212 msgid "Project settings" msgstr "Project instellingen" -#: classes/Gems/Default/ProjectInformationAction.php:215 +#: classes/Gems/Default/ProjectInformationAction.php:219 msgid "Session content" msgstr "Sessie inhoud" -#: classes/Gems/Default/ProjectInformationAction.php:216 +#: classes/Gems/Default/ProjectInformationAction.php:220 msgid "Session" msgstr "Sessie" #: classes/Gems/Default/ProjectSurveysAction.php:68 +#: classes/Gems/Default/SurveyAction.php:192 msgid "By" msgstr "Door" #: classes/Gems/Default/ProjectSurveysAction.php:69 #: classes/Gems/Default/ProjectTracksAction.php:67 +#: classes/Gems/Default/SurveyAction.php:193 msgid "From" msgstr "Van" #: classes/Gems/Default/ProjectSurveysAction.php:70 #: classes/Gems/Default/ProjectTracksAction.php:68 +#: classes/Gems/Default/SurveyAction.php:195 msgid "Until" msgstr "Tot" @@ -1793,6 +1802,7 @@ msgstr "Vragen in vragenlijsten %s" #: classes/Gems/Default/ProjectTracksAction.php:118 +#: classes/Gems/Default/SurveyAction.php:85 #, php-format msgid "Survey %s does not exist." msgstr "Vragenlijst %s bestaat niet." @@ -1968,6 +1978,7 @@ msgstr "A.u.b. het informed consent formulier doornemen met deze patiënt" #: classes/Gems/Default/RespondentPlanAction.php:67 +#: classes/Gems/Default/SurveyAction.php:171 msgid "Show respondent" msgstr "Toon patiënt" @@ -4071,9 +4082,8 @@ msgid "Can access" msgstr "Toegang tot" -#: views/scripts/index/login.phtml:12 -msgid "The Pulse software was made possible thanks to support from " -msgstr "De PULSE software is mede mogelijk gemaakt met steun van " +#~ msgid "The Pulse software was made possible thanks to support from " +#~ msgstr "De PULSE software is mede mogelijk gemaakt met steun van " #, fuzzy #~ msgid "Executing patchlevel 43" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-15 14:41:39
|
Revision: 482 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=482&view=rev Author: matijsdejong Date: 2012-02-15 14:41:28 +0000 (Wed, 15 Feb 2012) Log Message: ----------- Added Paths: ----------- tags/1.5.1/ Property changes on: tags/1.5.1 ___________________________________________________________________ Added: svn:ignore + nbproject Added: svn:mergeinfo + /branches/1.5.0-pulse:306-430,467 /tags/1.5.0beta1:305 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-15 14:23:17
|
Revision: 481 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=481&view=rev Author: mennodekker Date: 2012-02-15 14:23:06 +0000 (Wed, 15 Feb 2012) Log Message: ----------- Increase minimal step for tokenbatch, to speed up larger batches Modified Paths: -------------- branches/1.5.x/library/classes/Gems/Tracker/Batch/ProcessTokensBatch.php Modified: branches/1.5.x/library/classes/Gems/Tracker/Batch/ProcessTokensBatch.php =================================================================== --- branches/1.5.x/library/classes/Gems/Tracker/Batch/ProcessTokensBatch.php 2012-02-15 14:10:14 UTC (rev 480) +++ branches/1.5.x/library/classes/Gems/Tracker/Batch/ProcessTokensBatch.php 2012-02-15 14:23:06 UTC (rev 481) @@ -58,6 +58,11 @@ */ protected $translate; + /** + * Set a little higher, to reduce the effect of the server response time and application startup + */ + public $minimalStepDurationMs = 3000; + public function addToken($tokenData, $userId) { if (is_array($tokenData)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |