From: <var...@us...> - 2009-02-14 16:39:06
|
Revision: 6500 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6500&view=rev Author: vargenau Date: 2009-02-14 16:39:01 +0000 (Sat, 14 Feb 2009) Log Message: ----------- Put flipAll Javascript function in wikicommon.js Modified Paths: -------------- trunk/lib/PageList.php trunk/lib/WikiTheme.php Added Paths: ----------- trunk/themes/default/wikicommon.js Modified: trunk/lib/PageList.php =================================================================== --- trunk/lib/PageList.php 2009-02-14 16:16:40 UTC (rev 6499) +++ trunk/lib/PageList.php 2009-02-14 16:39:01 UTC (rev 6500) @@ -1417,12 +1417,6 @@ $table->pushContent(HTML::caption(array('align'=>'top'), $caption)); } - //Warning: This is quite fragile. It depends solely on a private variable - // in ->_addColumn() - if (!empty($this->_columns_seen['checkbox'])) { - $table->pushContent($this->_jsFlipAll()); - } - $row = HTML::tr(); $table_summary = array(); $i = 1; // start with 1! @@ -1464,21 +1458,6 @@ } } - function _jsFlipAll() { - return JavaScript(" -function flipAll(formObj) { - var isFirstSet = -1; - for (var i=0; i < formObj.length; i++) { - fldObj = formObj.elements[i]; - if ((fldObj.type == 'checkbox') && (fldObj.name.substring(0,2) == 'p[')) { - if (isFirstSet == -1) - isFirstSet = (fldObj.checked) ? true : false; - fldObj.checked = (isFirstSet) ? false : true; - } - } -}"); - } - /* recursive stack for private sublist options (azhead, cols) */ function _saveOptions($opts) { $stack = array('pages' => $this->_pages); @@ -1682,7 +1661,7 @@ }; /* List pages with checkboxes to select from. - * The [Select] button toggles via _jsFlipAll + * The [Select] button toggles via Javascript flipAll */ class PageList_Selectable Modified: trunk/lib/WikiTheme.php =================================================================== --- trunk/lib/WikiTheme.php 2009-02-14 16:16:40 UTC (rev 6499) +++ trunk/lib/WikiTheme.php 2009-02-14 16:39:01 UTC (rev 6500) @@ -217,6 +217,7 @@ } if ($noinit) return; + $this->addMoreHeaders(JavaScript('',array('src' => $this->_findData("wikicommon.js")))); $script_url = deduce_script_name(); if ((DEBUG & _DEBUG_REMOTE) and isset($_GET['start_debug'])) $script_url .= ("?start_debug=".$_GET['start_debug']); Added: trunk/themes/default/wikicommon.js =================================================================== --- trunk/themes/default/wikicommon.js (rev 0) +++ trunk/themes/default/wikicommon.js 2009-02-14 16:39:01 UTC (rev 6500) @@ -0,0 +1,14 @@ +// Common Javascript support functions. +// $Id: toolbar.js 6204 2008-08-26 15:12:03Z vargenau $ + +function flipAll(formObj) { + var isFirstSet = -1; + for (var i=0; i < formObj.length; i++) { + fldObj = formObj.elements[i]; + if ((fldObj.type == 'checkbox') && (fldObj.name.substring(0,2) == 'p[')) { + if (isFirstSet == -1) + isFirstSet = (fldObj.checked) ? true : false; + fldObj.checked = (isFirstSet) ? false : true; + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |