From: <gem...@li...> - 2011-12-07 16:58:26
|
Revision: 347 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=347&view=rev Author: matijsdejong Date: 2011-12-07 16:58:16 +0000 (Wed, 07 Dec 2011) Log Message: ----------- First changes for batch processing (#45) Modified Paths: -------------- trunk/library/classes/Gems/Default/SourceAction.php trunk/library/classes/MUtil/Html/Creator.php Added Paths: ----------- trunk/library/classes/MUtil/Html/ProgressPanel.js trunk/library/classes/MUtil/Html/ProgressPanel.php Modified: trunk/library/classes/Gems/Default/SourceAction.php =================================================================== --- trunk/library/classes/Gems/Default/SourceAction.php 2011-12-07 14:06:31 UTC (rev 346) +++ trunk/library/classes/Gems/Default/SourceAction.php 2011-12-07 16:58:16 UTC (rev 347) @@ -243,6 +243,8 @@ $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.')); + // $progress = $this->html->progress('0%'); + if ($data) { $rdata = MUtil_Lazy::repeat($data); $table = $this->html->table($rdata, array('class' => 'browser')); Modified: trunk/library/classes/MUtil/Html/Creator.php =================================================================== --- trunk/library/classes/MUtil/Html/Creator.php 2011-12-07 14:06:31 UTC (rev 346) +++ trunk/library/classes/MUtil/Html/Creator.php 2011-12-07 16:58:16 UTC (rev 347) @@ -1,34 +1,34 @@ <?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. - */ - + /** + * 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. + */ + +/** * @author Matijs de Jong * @since 1.0 * @version 1.1 @@ -81,6 +81,8 @@ 'menu' => 'MUtil_Html_ListElement::menu', 'ol' => 'MUtil_Html_ListElement::ol', 'pagePanel' => 'MUtil_Html_PagePanel::pagePanel', + 'progress' => 'MUtil_Html_ProgressPanel::progress', + 'progressPanel' => 'MUtil_Html_ProgressPanel::progress', 'raw' => 'MUtil_Html_Raw::raw', 'seq' => 'MUtil_Html_Sequence::createSequence', 'sequence' => 'MUtil_Html_Sequence::createSequence', // A sequence can contain another sequence, so other function name used Added: trunk/library/classes/MUtil/Html/ProgressPanel.js =================================================================== --- trunk/library/classes/MUtil/Html/ProgressPanel.js (rev 0) +++ trunk/library/classes/MUtil/Html/ProgressPanel.js 2011-12-07 16:58:16 UTC (rev 347) @@ -0,0 +1,24 @@ + +function FUNCTION_PREFIX_Start() +{ + var iFrame = document.createElement('iframe'); + iFrame.setAttribute('style', 'position: absolute; left: -100px; top: -100px; width: 10px; height: 10px; overflow: hidden;'); + document.getElementsByTagName('body')[0].appendChild(iFrame); + iFrame.src = '{URL}'; +} + +function FUNCTION_PREFIX_Update(data) +{ + document.getElementById('pg-percent').style.width = data.percent + '%'; + + document.getElementById('pg-text-1').innerHTML = data.text; + document.getElementById('pg-text-2').innerHTML = data.text; +} + +function FUNCTION_PREFIX_Finish() +{ + document.getElementById('pg-percent').style.width = '100%'; + + document.getElementById('pg-text-1').innerHTML = 'Demo done'; + document.getElementById('pg-text-2').innerHTML = 'Demo done'; +} \ No newline at end of file Added: trunk/library/classes/MUtil/Html/ProgressPanel.php =================================================================== --- trunk/library/classes/MUtil/Html/ProgressPanel.php (rev 0) +++ trunk/library/classes/MUtil/Html/ProgressPanel.php 2011-12-07 16:58:16 UTC (rev 347) @@ -0,0 +1,102 @@ +<?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 MUtil + * @subpackage Html + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $ + */ + +/** + * + * + * @package MUtil + * @subpackage Html + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5 + */ +class MUtil_Html_ProgressPanel extends MUtil_Html_HtmlElement +{ + /** + * Usually no text is appended after an element, but for certain elements we choose + * to add a "\n" newline character instead, to keep the output readable in source + * view. + * + * @var string Content added after the element. + */ + protected $_appendString = "\n"; + + /** + * Default attributes. + * + * @var array The actual storage of the attributes. + */ + protected $_attribs = array( + 'class' => 'progress', + 'id' => 'progress_bar' + ); + + /** + * Usually no text is appended before an element, but for certain elements we choose + * to add a "\n" newline character instead, to keep the output readable in source + * view. + * + * @var string Content added before the element. + */ + protected $_prependString = "\n"; + + /** + * Creates a 'div' progress panel + * + * @param mixed $arg_array A MUtil_Ra::args data collection. + */ + public function __construct($arg_array = null) + { + $args = MUtil_Ra::args(func_get_args()); + + parent::__construct('div', $args); + } + + /** + * Creates a 'div' progress panel + * + * @param mixed $arg_array A MUtil_Ra::args data collection. + * @return self + */ + public static function progress($arg_array = null) + { + $args = func_get_args(); + return new self($args); + } + + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |