Minahito
minah****@users*****
2006年 11月 9日 (木) 19:08:43 JST
Index: xoops2jp/html/class/xoopsform/grouppermform.php diff -u xoops2jp/html/class/xoopsform/grouppermform.php:1.2.8.3.2.2 xoops2jp/html/class/xoopsform/grouppermform.php:1.2.8.3.2.3 --- xoops2jp/html/class/xoopsform/grouppermform.php:1.2.8.3.2.2 Sun Oct 15 00:35:45 2006 +++ xoops2jp/html/class/xoopsform/grouppermform.php Thu Nov 9 19:08:43 2006 @@ -1,5 +1,5 @@ <?php -// $Id: grouppermform.php,v 1.2.8.3.2.2 2006/10/14 15:35:45 minahito Exp $ +// $Id: grouppermform.php,v 1.2.8.3.2.3 2006/11/09 10:08:43 minahito Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000-2003 XOOPS.org // @@ -269,7 +269,12 @@ } } $checkallbtn_id = $this->getName().'[checkallbtn]['.$this->_groupId.']'; + $checkallbtn_id = str_replace(array('[', ']'), array('_', ''), $checkallbtn_id); // Remove injury characters for ID + $option_ids_str = implode(', ', $option_ids); + $option_ids_str = str_replace(array('[', ']'), array('_', ''), $option_ids_str); // Remove injury characters for ID + + $ret .= _ALL." <input id=\"".$checkallbtn_id."\" type=\"checkbox\" value=\"\" onclick=\"var optionids = new Array(".$option_ids_str."); xoopsCheckAllElements(optionids, '".$checkallbtn_id."');\" />"; $ret .= '</td></tr></table>'; return $ret; @@ -286,12 +291,18 @@ */ function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array()) { - $tree .= $prefix . "<input type=\"checkbox\" name=\"" . $this->getName() . "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" id=\"" . $this->getName() . "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" onclick=\""; + // Remove injury characters for ID + $tree .= $prefix . "<input type=\"checkbox\" name=\"" . $this->getName() . + "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" id=\"" . + str_replace(array('[', ']'), array('_', ''), $this->getName() . "[groups][" . $this->_groupId . "][" . $option['id'] . "]") . + "\" onclick=\""; + // If there are parent elements, add javascript that will // make them selecteded when this element is checked to make // sure permissions to parent items are added as well. foreach ($parentIds as $pid) { $parent_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $pid . ']'; + $parent_ele = str_replace(array('[', ']'), array('_', ''), $parent_ele); // Remove injury characters for ID $tree .= "var ele = xoopsGetElementById('" . $parent_ele . "'); if(ele.checked != true) {ele.checked = this.checked;}"; } // If there are child elements, add javascript that will @@ -300,6 +311,7 @@ // is no permission to this item. foreach ($option['allchild'] as $cid) { $child_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $cid . ']'; + $child_ele = str_replace(array('[', ']'), array('_', ''), $child_ele); // Remove injury characters for ID $tree .= "var ele = xoopsGetElementById('" . $child_ele . "'); if(this.checked != true) {ele.checked = false;}"; } $tree .= '" value="1"';