Dotclear

Changeset 1123


Ignore:
Timestamp:
04/30/09 02:03:53 (14 years ago)
Author:
Moe
Message:

Example 0.3 :

  • added line numbers in index.php, sort of self-referencing feature
  • changed default tab
  • added link to post to show the adminPostFormSidebar behavior
Location:
plugins/example
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • plugins/example/_define.php

    r1122 r1123  
    4141     /* Description */        'This is an example', 
    4242     /* Author */                  'Dotclear Lab contributors', 
    43      /* Version */                 '0.2', 
     43     /* Version */                 '0.3', 
    4444     /* Permissions */        'usage,contentadmin' 
    4545); 
  • plugins/example/_prepend.php

    r1120 r1123  
    4040$__autoload['example'] = dirname(__FILE__).'/lib.example.php'; 
    4141 
    42 # register the 'example' URL 
     42# register the "example" URL 
    4343$core->url->register('example','example', 
    4444     '^example(?:/(.+))?$',array('exampleDocument','page')); 
    4545 
    46 # load the widget, on administration and on the blog 
     46# load the widget, in administration and on the blog 
    4747require_once(dirname(__FILE__).'/_widget.php'); 
    4848 
  • plugins/example/_public.php

    r1120 r1123  
    5454          $_ctx =& $GLOBALS['_ctx']; 
    5555           
    56           # if the URL is example/hello 
     56          # if the URL is "example/hello" 
    5757          if ($args == 'hello') 
    5858          { 
    5959               $_ctx->example = __('Hello World!'); 
    6060          } 
    61           # else, if the URL is example 
     61          # else, if the URL is "example" 
    6262          else 
    6363          { 
  • plugins/example/index.php

    r1122 r1123  
    3737if (!defined('DC_CONTEXT_ADMIN')) {return;} 
    3838 
     39function line($line) 
     40{ 
     41     return(' '.sprintf( 
     42          __('(line %s of the <strong>index.php</strong> file)'), 
     43          $line).' '); 
     44} 
     45 
    3946# default tab 
    40 $default_tab = 'settings'; 
     47$default_tab = 'administration'; 
     48 
     49if (!empty($_REQUEST['tab'])) 
     50{ 
     51     switch ($_REQUEST['tab']) 
     52     { 
     53          case 'settings' : 
     54               $default_tab = 'settings'; 
     55               break; 
     56     } 
     57} 
     58 
     59$rs = $core->blog->getPosts(array( 
     60     'order' => 'post_dt DESC', 
     61     'limit' => 1 
     62)); 
     63 
     64$post_link = $core->getPostAdminURL('post',$rs->post_id); 
     65 
     66unset($rs); 
    4167 
    4268# forms 
     69# define_combo_values 
    4370$combo_values = array( 
    4471     # group values 
     
    6895           
    6996          # redirect to the page, avoid conflicts with old settings 
    70           http::redirect($p_url.'&saveconfig=1'); 
     97          http::redirect($p_url.'&tab=settings&saveconfig=1'); 
    7198     } 
    7299} 
     
    106133     <?php if (!empty($msg)) {echo '<p class="message">'.$msg.'</p>';} ?> 
    107134      
    108      <div class="multi-part" id="settings" 
    109           title="<?php echo __('Settings'); ?>"> 
    110           <form method="post" action="<?php echo($p_url); ?>"> 
    111                <fieldset> 
    112                     <legend><?php echo(__('General settings')); ?></legend> 
    113                     <p> 
    114                          <?php echo( 
    115                          form::checkbox('setting_active',1, 
    116                               $settings->setting_active)); ?> 
    117                          <label class="classic" for="setting_active"> 
    118                          <?php echo(__('Enable this setting')); ?> 
    119                          </label> 
    120                     </p> 
    121                </fieldset> 
    122                <p><?php echo $core->formNonce(); ?></p> 
    123                <p><input type="submit" name="saveconfig" 
    124                     value="<?php echo __('Save configuration'); ?>" /></p> 
    125           </form> 
    126      </div> 
    127       
    128135     <div class="multi-part" id="administration" 
    129136          title="<?php echo __('Administration'); ?>"> 
    130137          <p> 
    131                <?php echo(__('If you edit an entry, you will see a new text in the right menu, this is due to a behavior, declared in the <strong>_admin.php</strong> file.')); ?> 
     138               <?php echo(__('If you edit an entry, you will see a new text in the right menu, this is due to a behavior, declared in the <strong>_admin.php</strong> file.'). 
     139               ' <a href="'.$post_link.'">'.__('example').'</a>'); ?> 
    132140          </p> 
    133141          <p> 
    134142               <?php echo(__('We can call the <code>example::HelloWorld()</code> function, defined in the <strong>lib.example.php</strong> file:')); ?> 
    135                <?php echo(example::HelloWorld()); ?> 
     143               <?php echo(example::HelloWorld().line(__LINE__)); ?></p> 
    136144          </p> 
    137145           
    138146          <h3><?php echo(__('Forms')); ?></h3> 
    139147           
    140           <h4><?php echo(__('Combo')); ?></h4> 
     148          <h4><?php echo(__('Combo').line(__LINE__)); ?></h4> 
    141149          <p><label><?php echo(__('Title:'). 
    142150               form::combo( 
    143151                    # name and id 
    144152                    'combo', 
    145                     # combo values, see the beginning of this file 
     153                    # combo values, search "define_combo_values" in this file 
    146154                    $combo_values, 
    147                     # default value, see the beginning of this file 
     155                    # default value, search "define_combo_values" in this file 
    148156                    $combo_default_value)); ?> 
    149157               </label></p> 
    150158           
    151           <h4><?php echo(__('Radio')); ?></h4> 
     159          <h4><?php echo(__('Radio').line(__LINE__)); ?></h4> 
    152160          <p> 
    153161               <label class="classic"><?php echo( 
     
    174182          </p> 
    175183           
    176           <h4><?php echo(__('Checkbox')); ?></h4> 
     184          <h4><?php echo(__('Checkbox').line(__LINE__)); ?></h4> 
    177185          <p> 
    178186               <label class="classic"> 
     
    209217          </p> 
    210218           
    211           <h4><?php echo(__('Field')); ?></h4> 
     219          <h4><?php echo(__('Field').line(__LINE__)); ?></h4> 
    212220          <p><label><?php echo(__('Title:'). 
    213221               form::field( 
     
    221229                    __('default value'))); ?></label></p> 
    222230           
    223           <h4><?php echo(__('Password')); ?></h4> 
     231          <h4><?php echo(__('Password').line(__LINE__)); ?></h4> 
    224232          <p><label><?php echo(__('Title:'). 
    225233               form::password( 
     
    233241                    __('default value'))); ?></label></p> 
    234242           
    235           <h4><?php echo(__('Textarea')); ?></h4> 
     243          <h4><?php echo(__('Textarea').line(__LINE__)); ?></h4> 
    236244          <p class="area"><label><?php echo(__('Title:'). 
    237245               form::textarea( 
     
    245253                    __('default value'))); ?></label></p> 
    246254           
    247           <h4><?php echo(__('Hidden')); ?></h4> 
     255          <h4><?php echo(__('Hidden').line(__LINE__)); ?></h4> 
    248256          <p><?php echo(form::hidden( 
    249257               # name 
     
    253261          <p><?php echo(__('(see the source of the page)')); ?></p> 
    254262           
    255           <h4><?php echo(__('Button')); ?></h4> 
     263          <h4><?php echo(__('Button').line(__LINE__)); ?></h4> 
    256264          <p><input type="submit" name="saveconfig" 
    257265               value="<?php echo __('Save configuration'); ?>" /> 
     
    259267               value="<?php echo __('Send'); ?>" /></p> 
    260268           
    261           <h4><?php echo(__('Fieldset')); ?></h4> 
     269          <h4><?php echo(__('Fieldset').line(__LINE__)); ?></h4> 
    262270           
    263271          <fieldset> 
     
    278286           
    279287          <p><?php printf(__('We can use the %1$s CSS class to have %2$s columns:'), 
    280                '<code>two-cols</code>',__('two')); ?></p> 
     288               '<code>two-cols</code>',__('two')); 
     289               echo(line(__LINE__)); ?></p> 
    281290           
    282291          <div class="two-cols"> 
     
    290299           
    291300          <p><?php printf(__('We can use the %1$s CSS class to have %2$s columns:'), 
    292                '<code>three-cols</code>',__('three')); ?></p> 
     301               '<code>three-cols</code>',__('three')); 
     302               echo(line(__LINE__)); ?></p> 
    293303           
    294304          <div class="three-cols class"> 
     
    330340          </p> 
    331341     </div> 
     342      
     343     <div class="multi-part" id="settings" 
     344          title="<?php echo __('Settings'); ?>"> 
     345          <form method="post" action="<?php echo($p_url); ?>"> 
     346               <fieldset> 
     347                    <legend><?php echo(__('General settings')); ?></legend> 
     348                    <p> 
     349                         <?php echo( 
     350                         form::checkbox('setting_active',1, 
     351                              $settings->setting_active)); ?> 
     352                         <label class="classic" for="setting_active"> 
     353                         <?php echo(__('Enable this setting')); ?> 
     354                         </label> 
     355                    </p> 
     356               </fieldset> 
     357               <p><?php echo $core->formNonce(); ?></p> 
     358               <p><input type="submit" name="saveconfig" 
     359                    value="<?php echo __('Save configuration'); ?>" /></p> 
     360          </form> 
     361     </div> 
    332362 
    333363</body> 
  • plugins/example/locales/fr/main.po

    r1122 r1123  
    33"Project-Id-Version: Example\n" 
    44"Report-Msgid-Bugs-To: \n" 
    5 "POT-Creation-Date: 2009-04-30 00:54+0100\n" 
    6 "PO-Revision-Date: 2009-04-30 00:55+0100\n" 
     5"POT-Creation-Date: 2009-04-30 02:00+0100\n" 
     6"PO-Revision-Date: 2009-04-30 02:00+0100\n" 
    77"Last-Translator: Moe <poedit@gniark.net>\n" 
    88"Language-Team: Moe <poedit@gniark.net>\n" 
     
    2020#: lib.example.php:50 
    2121#: _widget.php:70 
    22 #: index.php:262 
    23 #: index.php:265 
    24 #: index.php:274 
    25 #: index.php:277 
    26 #: index.php:280 
     22#: index.php:293 
     23#: index.php:296 
     24#: index.php:306 
     25#: index.php:309 
     26#: index.php:312 
    2727msgid "Hello World!" 
    28 msgstr "Bonjour le monde&nbsp;:!" 
     28msgstr "Bonjour le monde&nbsp;!" 
    2929 
    3030#: _public.php:64 
     
    3535#: _widget.php:94 
    3636#: _admin.php:42 
    37 #: index.php:86 
    38 #: index.php:104 
    39 #: index.php:289 
    40 #: index.php:296 
    41 #: index.php:300 
     37#: index.php:113 
     38#: index.php:131 
     39#: index.php:321 
     40#: index.php:328 
     41#: index.php:332 
    4242msgid "Example" 
    4343msgstr "Exemple" 
     
    5555msgstr "" 
    5656 
    57 #: index.php:45 
     57#: index.php:42 
     58#, php-format 
     59msgid "(line %s of the <strong>index.php</strong> file)" 
     60msgstr "(ligne %s du fichier <strong>index.php</strong>)" 
     61 
     62#: index.php:72 
    5863msgid "Numbers" 
    5964msgstr "Nombres" 
    6065 
    61 #: index.php:46 
    62 #: index.php:162 
    63 #: index.php:187 
     66#: index.php:73 
     67#: index.php:170 
     68#: index.php:195 
    6469msgid "one" 
    6570msgstr "un" 
    6671 
    67 #: index.php:47 
    68 #: index.php:165 
    69 #: index.php:198 
    70 #: index.php:258 
     72#: index.php:74 
     73#: index.php:173 
     74#: index.php:206 
     75#: index.php:288 
    7176msgid "two" 
    7277msgstr "deux" 
    7378 
    74 #: index.php:50 
     79#: index.php:77 
    7580msgid "A text value" 
    7681msgstr "Une valeur textuelle" 
    7782 
    78 #: index.php:80 
     83#: index.php:107 
    7984msgid "Configuration successfully updated." 
    8085msgstr "Configuration mise à jour avec succès." 
    8186 
    82 #: index.php:91 
     87#: index.php:118 
    8388msgid "Are you sure you want to save the configuration?" 
    8489msgstr "Êtes-vous certain de vouloir sauvegarder la configuration ?" 
    8590 
    86 #: index.php:109 
     91#: index.php:136 
     92msgid "Administration" 
     93msgstr "" 
     94 
     95#: index.php:138 
     96msgid "If you edit an entry, you will see a new text in the right menu, this is due to a behavior, declared in the <strong>_admin.php</strong> file." 
     97msgstr "Si vous modifiez un billet, vous verrez un nouveau texte dans le menu de droite, il est dû à un <em>behavior</em> (comportement), déclaré dans le fichier <strong>_admin.php</strong>." 
     98 
     99#: index.php:139 
     100msgid "example" 
     101msgstr "exemple" 
     102 
     103#: index.php:142 
     104msgid "We can call the <code>example::HelloWorld()</code> function, defined in the <strong>lib.example.php</strong> file:" 
     105msgstr "Nous pouvons appeler la fonction <code>example::HelloWorld()</code>, définie dans le fichier <strong>lib.example.php</strong>&nbsp;:" 
     106 
     107#: index.php:146 
     108msgid "Forms" 
     109msgstr "Formulaires" 
     110 
     111#: index.php:148 
     112#: index.php:273 
     113msgid "Combo" 
     114msgstr "Combo" 
     115 
     116#: index.php:149 
     117#: index.php:220 
     118#: index.php:232 
     119#: index.php:244 
     120#: index.php:274 
     121#: index.php:278 
     122msgid "Title:" 
     123msgstr "" 
     124 
     125#: index.php:159 
     126msgid "Radio" 
     127msgstr "Radio" 
     128 
     129#: index.php:176 
     130msgid "Checked by default" 
     131msgstr "Cochée par défaut" 
     132 
     133#: index.php:181 
     134msgid "Disabled" 
     135msgstr "Désactivé" 
     136 
     137#: index.php:184 
     138msgid "Checkbox" 
     139msgstr "Case à cocher" 
     140 
     141#: index.php:210 
     142msgid "Checked by default checkbox" 
     143msgstr "Case à cocher cochée par défaut" 
     144 
     145#: index.php:215 
     146msgid "Disabled checkbox" 
     147msgstr "Case à cocher désactivée" 
     148 
     149#: index.php:219 
     150msgid "Field" 
     151msgstr "Champ" 
     152 
     153#: index.php:229 
     154#: index.php:241 
     155#: index.php:253 
     156#: index.php:280 
     157msgid "default value" 
     158msgstr "valeur par défaut" 
     159 
     160#: index.php:231 
     161msgid "Password" 
     162msgstr "" 
     163 
     164#: index.php:243 
     165msgid "Textarea" 
     166msgstr "Zone de texte" 
     167 
     168#: index.php:255 
     169msgid "Hidden" 
     170msgstr "" 
     171 
     172#: index.php:260 
     173msgid "value" 
     174msgstr "valeur" 
     175 
     176#: index.php:261 
     177msgid "(see the source of the page)" 
     178msgstr "(voir la source de la page)" 
     179 
     180#: index.php:263 
     181msgid "Button" 
     182msgstr "" 
     183 
     184#: index.php:265 
     185#: index.php:359 
     186msgid "Save configuration" 
     187msgstr "Sauvegarder la configuration" 
     188 
     189#: index.php:267 
     190#: index.php:282 
     191msgid "Send" 
     192msgstr "" 
     193 
     194#: index.php:269 
     195msgid "Fieldset" 
     196msgstr "" 
     197 
     198#: index.php:272 
     199msgid "Fieldset legend" 
     200msgstr "" 
     201 
     202#: index.php:285 
     203msgid "Columns" 
     204msgstr "Colonnes" 
     205 
     206#: index.php:287 
     207#: index.php:300 
     208#, php-format 
     209msgid "We can use the %1$s CSS class to have %2$s columns:" 
     210msgstr "Nous pouvons utiliser la classe CSS %1$s pour avoir %2$s colonnes&nbsp;:" 
     211 
     212#: index.php:301 
     213msgid "three" 
     214msgstr "trois" 
     215 
     216#: index.php:318 
     217msgid "Public" 
     218msgstr "" 
     219 
     220#: index.php:320 
     221#, php-format 
     222msgid "URL of the %s page, defined in the <strong>_prepend.php</strong> file:" 
     223msgstr "URL de la page %s, définie dans le fichier <strong>_prepend.php</strong>&nbsp:" 
     224 
     225#: index.php:327 
     226#, php-format 
     227msgid "View the %s page" 
     228msgstr "Voir la page %s" 
     229 
     230#: index.php:331 
     231#, php-format 
     232msgid "View the %s page with an argument in its URL" 
     233msgstr "Voir la page %s avec un argument dans l'URL" 
     234 
     235#: index.php:336 
     236msgid "Widget" 
     237msgstr "" 
     238 
     239#: index.php:338 
     240msgid "An example widget is available on the widgets page." 
     241msgstr "Un widget d'exemple est disponible sur la page des widgets." 
     242 
     243#: index.php:339 
     244msgid "It is defined in the <strong>_widget.php</strong> file." 
     245msgstr "Il est défini dans le fichier <strong>_widget.php</strong>." 
     246 
     247#: index.php:344 
    87248msgid "Settings" 
    88249msgstr "Paramètres" 
    89250 
    90 #: index.php:112 
     251#: index.php:347 
    91252msgid "General settings" 
    92253msgstr "Paramètres généraux" 
    93254 
    94 #: index.php:118 
     255#: index.php:353 
    95256msgid "Enable this setting" 
    96257msgstr "Activer ce paramètre" 
    97258 
    98 #: index.php:124 
    99 msgid "Save configuration" 
    100 msgstr "Sauvegarder la configuration" 
    101  
    102 #: index.php:129 
    103 msgid "Administration" 
    104 msgstr "" 
    105  
    106 #: index.php:131 
    107 msgid "If you edit an entry, you will see a new text in the right menu, this is due to a behavior, declared in the <strong>_admin.php</strong> file." 
    108 msgstr "Si vous modifiez un billet, vous verrez un nouveau texte dans le menu de droite, il est dû à un <em>behavior</em> (comportement), déclaré dans le fichier <strong>_admin.php</strong>." 
    109  
    110 #: index.php:134 
    111 msgid "We can call the <code>example::HelloWorld()</code> function, defined in the <strong>lib.example.php</strong> file:" 
    112 msgstr "Nous pouvons appeler la fonction <code>example::HelloWorld()</code>, définie dans le fichier <strong>lib.example.php</strong>&nbsp;:" 
    113  
    114 #: index.php:138 
    115 msgid "Forms" 
    116 msgstr "Formulaires" 
    117  
    118 #: index.php:140 
    119 msgid "Combo" 
    120 msgstr "Combo" 
    121  
    122 #: index.php:141 
    123 #: index.php:212 
    124 #: index.php:224 
    125 #: index.php:236 
    126 msgid "Title:" 
    127 msgstr "" 
    128  
    129 #: index.php:151 
    130 msgid "Radio" 
    131 msgstr "Radio" 
    132  
    133 #: index.php:168 
    134 msgid "Checked by default" 
    135 msgstr "Cochée par défaut" 
    136  
    137 #: index.php:173 
    138 msgid "Disabled" 
    139 msgstr "Désactivé" 
    140  
    141 #: index.php:176 
    142 msgid "Checkbox" 
    143 msgstr "Case à cocher" 
    144  
    145 #: index.php:202 
    146 msgid "Checked by default checkbox" 
    147 msgstr "Case à cocher cochée par défaut" 
    148  
    149 #: index.php:207 
    150 msgid "Disabled checkbox" 
    151 msgstr "Case à cocher désactivée" 
    152  
    153 #: index.php:211 
    154 msgid "Field" 
    155 msgstr "" 
    156  
    157 #: index.php:221 
    158 #: index.php:233 
    159 #: index.php:245 
    160 msgid "default value" 
    161 msgstr "valeur par défaut" 
    162  
    163 #: index.php:223 
    164 msgid "Password" 
    165 msgstr "" 
    166  
    167 #: index.php:235 
    168 msgid "Textarea" 
    169 msgstr "" 
    170  
    171 #: index.php:247 
    172 msgid "Hidden" 
    173 msgstr "" 
    174  
    175 #: index.php:252 
    176 msgid "value" 
    177 msgstr "" 
    178  
    179 #: index.php:253 
    180 msgid "(see the source of the page)" 
    181 msgstr "(voir la source de la page)" 
    182  
    183 #: index.php:255 
    184 msgid "Columns" 
    185 msgstr "Colonnes" 
    186  
    187 #: index.php:257 
    188 #: index.php:269 
    189 #, php-format 
    190 msgid "We can use the %1$s CSS class to have %2$s columns:" 
    191 msgstr "Nous pouvons utiliser la classe CSS %1$s pour avoir %2$s colonnes&nbsp;:" 
    192  
    193 #: index.php:270 
    194 msgid "three" 
    195 msgstr "trois" 
    196  
    197 #: index.php:286 
    198 msgid "Public" 
    199 msgstr "" 
    200  
    201 #: index.php:288 
    202 #, php-format 
    203 msgid "URL of the %s page, defined in the <strong>_prepend.php</strong> file:" 
    204 msgstr "URL de la page %s, définie dans le fichier <strong>_prepend.php</strong>&nbsp:" 
    205  
    206 #: index.php:295 
    207 #, php-format 
    208 msgid "View the %s page" 
    209 msgstr "Voir la page %s" 
    210  
    211 #: index.php:299 
    212 #, php-format 
    213 msgid "View the %s page with an argument in its URL" 
    214 msgstr "Voir la page %s avec un argument dans l'URL" 
    215  
    216 #: index.php:304 
    217 msgid "Widget" 
    218 msgstr "" 
    219  
    220 #: index.php:306 
    221 msgid "An example widget is available on the widgets page." 
    222 msgstr "Un widget d'exemple est disponible sur la page des widgets." 
    223  
    224 #: index.php:307 
    225 msgid "It is defined in the <strong>_widget.php</strong> file." 
    226 msgstr "Il est défini dans le fichier <strong>_widget.php</strong>." 
    227  
Note: See TracChangeset for help on using the changeset viewer.

Sites map