3 * NP_OptionMeta_TestCase1.php
\r
4 * Copyright (C) 2004 Jeroen Budts (TeRanEX)
\r
5 * $Id: NP_OptionMeta_TestCase1.php,v 1.1.1.1 2005-02-28 07:13:50 kimitake Exp $
\r
7 * This program is free software; you can redistribute it and/or
\r
8 * modify it under the terms of the GNU General Public License
\r
9 * as published by the Free Software Foundation; either version 2
\r
10 * of the License, or any later version.
\r
12 * This program is distributed in the hope that it will be useful,
\r
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 * GNU General Public License for more details.
\r
17 * see http://nucleuscms.org/license.txt for license
\r
19 class NP_OptionMeta_TestCase1 extends NucleusPlugin {
\r
21 // -- Plug-in Info ------------------------------ {{{
\r
23 function getName() { return 'NP_OptionMeta_TestCase1'; }
\r
26 function getAuthor() {return 'TeRanEX'; }
\r
27 // an URL to the plugin website
\r
28 function getURL() { return 'http://budts.be/weblog/'; }
\r
30 // version of the plugin
\r
31 function getVersion() { return '0.1'; }
\r
33 // a description to be shown on the installed plugins listing
\r
34 function getDescription() { return 'A plugin to test the option meta: numerical, readonly'; }
\r
36 function getEventList() { return array('PrePluginOptionsUpdate'); }
\r
38 //supported features
\r
39 function supportsFeature($what)
\r
42 case 'SqlTablePrefix':
\r
50 // -- install() --------------------------------- {{{
\r
54 $this->createOption('NumericTextOption1', 'Numeric text option', 'text', '', 'datatype=numerical');
\r
55 $this->createOption('ReadonlyTextOption1', 'Readonly text option', 'text', '', 'access=readonly');
\r
56 $this->createOption('ReadonlyNumericalTextOption1', 'Readonly, Numerical text option', 'text', '', 'access=readonly;datatype=numerical');
\r
57 $this->createOption('ReadonlyTextAreaOption1', 'Readonly textarea option', 'textarea', 'This textarea is readonly (at least it should be :-p)', 'access=readonly');
\r
58 $this->createOption('HiddenTextOption1', 'Hidden text option', 'text', 'hidden...', 'access=hidden');
\r
60 $this->createItemOption('NumericTextOption1', 'Numeric text option', 'text', '', 'datatype=numerical');
\r
61 $this->createItemOption('ReadonlyTextOption1', 'Readonly text option', 'text', '', 'access=readonly');
\r
62 $this->createItemOption('ReadonlyNumericalTextOption1', 'Readonly, Numerical text option', 'text', '', 'access=readonly;datatype=numerical');
\r
63 $this->createItemOption('ReadonlyTextAreaOption1', 'Readonly textarea option', 'textarea', 'This textarea is readonly (at least it should be :-p)', 'access=readonly');
\r
67 // -- events ------------------------------------ {{{
\r
68 function event_PrePluginOptionsUpdate(&$data)
\r
71 * this way of saving the date into the readonly option doesn't work anymore
\r
72 * since readonly options aren't saved anymore automatically and thus this event is
\r
73 * not triggered for a readonly option
\r
75 if (($this->getID() == $data['plugid']) && ($data['optionname'] == 'ReadonlyTextOption1')) {
\r
76 $data['value'] = date('Y-m-d H:i:s');
\r
79 * but we can do it by using it while this event is triggered for a non-readonly
\r
80 * option (there are better events that are better suited for this task)
\r
82 if (($this->getID() == $data['plugid']) && ($data['optionname'] == 'NumericTextOption1')) {
\r
83 $this->setOption('HiddenTextOption1', date('Y-m-d H:i:s'));
\r
84 $this->setOption('ReadonlyTextOption1', date('Y-m-d H:i:s'));
\r
89 jedit edit rules | http://jedit.org: powerful, open-source (gpl) texteditor
\r
90 :mode=php:tabSize=4:indentSize=4:noTabs=false:encoding=UTF-8:
\r
91 :folding=explicit:collapseFolds=1:wrap=none:maxLineLen=85:
\r