OSDN Git Service

FIX: Blogクラスの不正なJavaScriptコードの修正。
[nucleus-jp/nucleus-next.git] / build / testcases / NP_PrePluginOptionsUpdate_TestCase1.php
1 <?php
2 class NP_PrePluginOptionsUpdate_TestCase1 extends NucleusPlugin {
3   
4 // --------- Plug-in Info ---------------------------------
5         // name of plugin
6         function getName() {
7           return 'NP_PrePluginOptionsUpdate_TestCase1';
8         }
9         
10         // author of plugin
11         function getAuthor() {
12           return 'TeRanEX';
13         }
14         // an URL to the plugin website
15         function getURL() {
16           return 'http://budts.be/weblog/';
17         }
18         
19         // version of the plugin
20         function getVersion() {
21           return '0.1';
22         }
23         
24         // a description to be shown on the installed plugins listing
25         function getDescription() {
26           return 'A plugin to test the PrePluginOptionsUpdate event and the enhancement to the PrePluginOptionsEdit event';
27         }
28         
29         function getEventList() { return array('PrePluginOptionsUpdate', 'PrePluginOptionsEdit'); }
30         
31         function install() {
32                 $this->createItemOption('TestValue', 'TestOption', 'text', 'foobar', '');
33                 $this->createMemberOption('MemberTestOptions', 'TestOption', 'text', 'foobar-member', '');
34         }
35   
36         //supported features
37         function supportsFeature($what) {
38           switch($what) {
39                 case 'SqlTablePrefix':
40                   return 1;
41                 default:
42                   return 0;
43           }
44         }
45         
46         function event_PrePluginOptionsUpdate(&$data) {
47                 if ($this->getID() == $data['plugid']) {
48                         //this belongs to us :-)
49                         //echo "PrePluginOptionsUpdate: TestCase-plugin<br/>";
50                         //echo "optionname: ".$data['optionname']."<br/>";
51                         //echo "context: ".$data['context']."<br/>";
52                         //echo "contextid: ".$data['contextid']."<br/>";
53                         //echo "value: ".$data['value']."<br/>";
54                         if ($data['value'] == '') {
55                                 $data['value'] = 'no-value';
56                         } else {
57                                 $data['value'] .= '-TEST';
58                         }
59                         //echo "new value: ".$data['value']."<br /><br/>";
60                 }
61                 
62                 if ($data['optionname'] == 'TestValue') {
63                         $data['value'] .= '|||'.requestVar('np_testcase_item');
64                 }
65         }
66         
67         
68         // function event_PrePluginOptionsEdit(&$data){
69                 // echo 'event: PrePluginOptionsEdit<br/>';
70                 // echo '$data: '.$data.'<br/>';
71                 // echo 'context: '.$data['context'].'<br/>';
72                 // echo 'contextid: '.$data['contextid'].'<br/>';
73                 // for ($i == 0; $i < count($data['options']); $i++) {
74                         // echo 'option-name: '.$data['options'][$i]['name'].' value: '.$data['options'][$i]['value'].'<br/>';
75                         // echo 'extra: '.$data['options'][$i]['extra'].'<br/>';
76                         // // $data['options'][$i]['extra'] .= 'test';
77                         // // echo 'new extra: '.$data['options'][$i]['extra'].'<br/>';
78                 // }
79         // }
80         
81         function event_PrePluginOptionsEdit(&$data) {
82                 //echo 'PrePluginOptionsEdit ';
83                 // if ($data['context'] == 'item') {
84                         //foreach($data['options'] as $option) {
85                         foreach (array_keys($data['options']) as $optionKey) {
86                                 $option = &$data['options'][$optionKey];
87                                 // if (($option['pid'] == $this->getID)&&($option['name'] == 'TestValue')) {
88                                 if (($option['name'] == 'TestValue') && ($option['pid'] == $this->getID())) {
89                                         $option['extra'] .= ' <input type="text" name="np_testcase_item" />';
90                                         //echo 'Extra: '.$option['extra'].'<br/>';
91                                 }
92                         // } 
93                 }
94         }
95 }
96 ?>