3 This program is free software; you can redistribute it and/or
\r
4 modify it under the terms of the GNU General Public License
\r
5 as published by the Free Software Foundation; either version 2
\r
6 of the License, or (at your option) any later version.
\r
7 (see nucleus/documentation/index.html#license for more info)
\r
11 v0.3 [2008/08/23] Improve javascript code.
\r
16 class NP_ItemFormat extends NucleusPlugin {
\r
18 function getName() { return 'Item Format'; }
\r
19 function getAuthor() { return 'yu'; }
\r
20 function getURL() { return 'http://nucleus.datoka.jp/'; }
\r
21 function getVersion() { return '0.3'; }
\r
22 function getMinNucleusVersion() { return 250; }
\r
23 function getEventList() { return array('AdminPrePageHead','AdminPrePageFoot'); }
\r
25 function getDescription() {
\r
26 return "Prepare item format. Fill form in category option.";
\r
29 function supportsFeature($what) {
\r
31 case 'SqlTablePrefix':
\r
38 function install() {
\r
39 $this->createCategoryOption("title", "title", "text", "");
\r
40 $this->createCategoryOption("body", "body", "textarea", "");
\r
41 $this->createCategoryOption("more", "more", "textarea", "");
\r
44 /*function event_PreAddItemForm(&$data) {
\r
45 $contents =& $data['contents'];
\r
47 if (! $contents['hasBeenSet']) {
\r
48 $contents['title'] = $this->getOption('title');
\r
49 $contents['body'] = $this->getOption('body');
\r
50 $contents['more'] = $this->getOption('more');
\r
51 $contents['hasBeenSet'] = 1;
\r
55 function doAction($type) {
\r
57 if (! $member->isLoggedIn()) return;
\r
61 $cid = intGetVar('cid');
\r
62 if ($cid < 1) return;
\r
65 $data[]= $this->getCategoryOption($cid, 'title');
\r
66 $data[]= $this->getCategoryOption($cid, 'body');
\r
67 $data[]= $this->getCategoryOption($cid, 'more');
\r
68 echo @join("[[[ itemformat_splitter ]]]", $data);
\r
75 function event_AdminPrePageHead(&$data){
\r
77 $path = $CONF['PluginURL'];
\r
79 switch ($data['action']) {
\r
81 $data['extrahead'] .= <<< EOS
\r
82 <script type="text/javascript" src="{$path}itemformat/itemformat_js.php"></script>
\r
90 $this->ob_ok = ob_start();
\r
93 function event_AdminPrePageFoot(){
\r
94 if (!$this->ob_ok) return;
\r
96 $html = ob_get_contents();
\r
100 $target = '<td><select name="catid"';
\r
101 $replace = '<td><select name="catid" onchange="plug_itemf_change(this)"';
\r
102 echo str_replace($target, $replace, $html);
\r