createOption("lbtns", "Codes (Before default toolbars)", "textarea",''."\n"); $this->createOption("rbtns", "Codes (After default toolbars)", "textarea",''."\n"); $this->createOption("addscripts", "Optional Javascripts Codes ", "textarea",''."\n"); } function event_PrePluginOptionsEdit(&$data) { global $CONF; // $aurl = $CONF['ActionURL'] . '?action=plugin&name=ToolbarButtons&type=redirect'; // $extra = '
Button Maker'; $maker = '
ボタンの種類
前に挿入するコード(AB共)
後ろに挿入するコード(Aのみ)
ツールバーチップ
ボタン表示

'; foreach($data['options'] as $tmp){ if($tmp['name'] == 'lbtns' || $tmp['name'] == 'rbtns'){ /* $oid = $tmp['oid']; $data['options'][$oid]['extra'] = $extra; */ $name = $tmp['name']; $$tmp['name'] = 'plugoption['.$tmp['oid'].']['.$tmp['contextid'].']'; } if($tmp['name'] == 'rbtns'){ $oid = $tmp['oid']; $data['options'][$oid]['extra'] .= << //\\n\\t\\t\\t"; tag = tag + document.getElementById('buttoncode').value; tag = tag + "\\n\\t\\t\\t\\n"; document.getElementById('inputcodes').value += tag; } function reflectButtons(lr) { elName = ['$lbtns','$rbtns']; data = document.getElementById('inputcodes').value; ElementsList = document.getElementsByName(elName[lr]); for (i = 0; i < ElementsList.length; i++) { ElementsList[i].value += data; } document.getElementById('inputcodes').value = ''; } function helperinit() { var htitle = document.getElementsByTagName("h2"); subhtitle=document.createElement("div"); subhtitle.style.fontWeight="normal"; subhtitle.innerHTML = '$maker'; htitle[0].appendChild(subhtitle); htitle[0].style.styleFloat = "left"; htitle[1].style.clear = "left"; var tables = document.getElementsByTagName("table"); for (i = 0; i < tables.length; i++) { tables[i].style.width = "auto"; } } window.onload = helperinit; //]]> EOD; } } } /* function doAction($type){ global $CONF; switch ($type) { case 'redirect': $file = $this->getDirectory().'buttonmaker.html'; ob_start(); include($file); $contents = ob_get_contents(); ob_end_clean(); echo $contents; break; default: break; } exit; } */ function event_PrepareItemForEdit(&$data){ $this->before(); } function event_PreAddItemForm(&$data){ $this->before(); } var $usefoot; function event_AdminPrePageHead(&$data){ $this->usefoot=true; } function event_AdminPrePageFoot(&$data){ $this->after(); } function event_AddItemFormExtras(&$data){ if (!$this->usefoot) $this->after(); } function event_EditItemFormExtras(&$data){ if (!$this->usefoot) $this->after(); } var $ob_ok; function before() { $this->ob_ok=ob_start(); } function after() { global $manager; if (!$this->ob_ok) return; $buff=ob_get_contents(); ob_end_clean(); $lbutton=''; $rbutton=''; $script=''; $pattern='/]*?)class="jsbuttonbar"([^>]*?)>/'; if (preg_match($pattern,$buff,$matches)){ $manager->notify('PreToolbarParse',array('lbutton' => &$lbutton, 'rbutton' => &$rbutton, 'script' => &$script)); $buff=str_replace($matches[0],$matches[0].$lbutton,$buff); $pattern=array('/<\/div>([^<]*?)]*?)id="inputbody"([^>]*?)>/', '/<\/div>([^<]*?)]*?)id="inputmore"([^>]*?)>/'); $replace=array('', ''); $buff=preg_replace($pattern,$replace,$buff); $pattern='/<\/div>]*?)id="inputbody"([^>]*?)>/'; if (preg_match($pattern,$buff,$matches)){ $buff=str_replace($matches[0],$rbutton.$matches[0],$buff); } $pattern='/<\/div>]*?)id="inputmore"([^>]*?)>/'; if (preg_match($pattern,$buff,$matches)){ $buff=str_replace($matches[0],$rbutton.$matches[0],$buff); } } echo $buff.$script; } function event_PreToolbarParse(&$data) { global $CONF; $lbutton=&$data['lbutton']; $rbutton=&$data['rbutton']; $script=&$data['script']; $setOptionURL = $CONF['AdminURL'] . 'index.php?action=pluginoptions&plugid=' . $this->getID(); $lbutton.="
\n"; $lbutton.= $this->getOption('lbtns'); $lbutton.= << heii EOD; */ $lbutton.="
\n"; // $lbutton.="
\n"; $lbutton.="
\n"; $rbutton.="
\n"; // $rbutton.="
\n"; $rbutton.="
\n"; $rbutton.= $this->getOption('rbtns'); $rbutton.=<< &lt; Edit Buttons EOD; $rbutton.="
\n"; $script.= << //getOption('addscripts'); $script.= <</g, '>').replace(/\"/g, '"'); } else if (!document.all && document.getElementById) { newText = mozSelectedText().replace(/&/g, '&').replace(//g, '>').replace(/\"/g, '"'); mozReplace(document.getElementById('input' + nonie_FormType), newText); } updAllPreviews(); } EOD; $script.= << EOD; } } ?>