Dotclear

Changeset 377


Ignore:
Timestamp:
03/28/08 22:28:15 (16 years ago)
Author:
Moe
Message:

blocNotes : now with personal and blog-specific notebook

Location:
plugins/blocNotes
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • plugins/blocNotes/_admin.php

    r368 r377  
    2323 
    2424     require_once(dirname(__FILE__).'/lib.blocNotes.php'); 
     25 
     26     # dashboard 
     27     if (isset($__dashboard_icons) && $core->auth->check('blocNotes',$core->blog->id)) { 
     28          $__dashboard_icons[] = array(__('Bloc-notes'),'plugin.php?p=blocNotes','index.php?pf=blocNotes/icon.png'); 
     29     } 
    2530     $core->addBehavior('adminDashboardIcons',array('blocNotes','adminDashboardIcons')); 
    26      $core->addBehavior('adminPostForm',array('blocNotes','textarea')); 
    27      $core->addBehavior('adminAfterPostCreate',array('blocNotes','adminPost')); 
    28      $core->addBehavior('adminAfterPostUpdate',array('blocNotes','adminPost')); 
    29      $core->addBehavior('adminPostHeaders',array('blocNotes','adminpostHeaders')); 
     31 
     32     # post 
     33     $core->addBehavior('adminPostForm',array('blocNotes','form')); 
     34     $core->addBehavior('adminAfterPostCreate',array('blocNotes','putSettings')); 
     35     $core->addBehavior('adminAfterPostUpdate',array('blocNotes','putSettings')); 
     36     $core->addBehavior('adminPostHeaders',array('blocNotes','adminPostHeaders')); 
    3037 
    3138     $_menu['Plugins']->addItem(__('Bloc-notes'), 
  • plugins/blocNotes/_define.php

    r368 r377  
    2424$this->registerModule( 
    2525        /* Name */                      "Bloc-Notes", 
    26         /* Description*/                "Display a notebook on the backend", 
     26        /* Description*/                "Display notebooks on the backend", 
    2727        /* Author */                    "Moe (http://gniark.net/)", 
    28         /* Version */                   '1.0-beta2', 
     28        /* Version */                   '1.0-beta3', 
    2929        /* Permissions */               'usage,contentadmin' 
    3030); 
    31  
    32 /* 
    33 TODO : 
    34      personal notebook 
    35           -> global setting with username 
    36 */ 
    3731?> 
  • plugins/blocNotes/index.php

    r375 r377  
    2828          if (!empty($_POST['saveconfig'])) 
    2929          { 
    30                $core->blog->settings->setNameSpace('blocnotes'); 
    31                # Bloc-Notes' text 
    32                $core->blog->settings->put('blocNotes_text', 
    33                     $_POST['blocNotes_text'],'text','Bloc-Notes\' text'); 
     30               blocNotes::putSettings(); 
    3431               http::redirect($p_url.'&saveconfig=1'); 
    3532          } 
     
    6461     <div id="settings" title="<?php echo __('settings'); ?>"> 
    6562          <form method="post" action="<?php echo http::getSelfURI(); ?>"> 
    66                <fieldset> 
    67                     <legend><?php echo(__('Personal text, writable by you only')); ?></legend> 
    68                     <?php echo(blocNotes::textarea()); ?> 
    69                </fieldset> 
    70                <?php /* 
    71                <fieldset> 
    72                     <legend><?php echo(__('Personal text, writable by you only')); ?></legend> 
    73                     <?php echo(blocNotes::textarea('personal')); ?> 
    74                </fieldset> 
    75                <fieldset> 
    76                     <legend><?php echo(__('Blog-specific text, all the users can edit it')); ?></legend> 
    77                     <?php echo(blocNotes::textarea('blog')); ?> 
    78                </fieldset> 
    79                <p><?php echo __('These texts will be readable by all the users, don&#39;t write some'); ?></p> 
    80                */ ?> 
     63               <?php blocNotes::form(); ?> 
     64                
    8165 
    8266               <p><?php echo $core->formNonce(); ?></p> 
  • plugins/blocNotes/lib.blocNotes.php

    r369 r377  
    3030          } 
    3131 
    32           public static function textarea(&$post='') 
     32          public static function form() 
    3333          { 
    3434               global $core; 
    3535 
    36                echo('<p class="area" id="blocNotes">'. 
    37                     '<label for="blocNotes_text">'.__('Bloc-notes :').'</label>'. 
    38                     form::textarea('blocNotes_text',80,20, 
     36               echo '<p class="area" id="blocNotes_personal">'. 
     37                    '<label for="blocNotes_personal_text">'. 
     38                         __('Personal notebook (other users can&#39;t edit it) :'). 
     39                    '</label>'. 
     40                    form::textarea('blocNotes_personal_text',80,10, 
     41                    html::escapeHTML($core->blog->settings->{'blocNotes_text_'.$core->auth->userID()})). 
     42                    '</p>'. 
     43                    '<p class="area" id="blocNotes">'. 
     44                    '<label for="blocNotes_text">'. 
     45                         __('Blog-specific notebook (all the users of the blog can edit it) :'). 
     46                    '</label>'. 
     47                    form::textarea('blocNotes_text',80,10, 
    3948                    html::escapeHTML($core->blog->settings->blocNotes_text)). 
    40                     '</p>'); 
     49                    '</p>'. 
     50                    '<p>'. 
     51                    __('These notes may be read by anyone, don&#39;t write some sensitive information (password, personal information, etc.)'). 
     52                    '</p>'; 
    4153          } 
    4254 
    43           public static function adminPost() 
     55          public static function putSettings() 
    4456          { 
    4557               global $core; 
     
    4961                    $core->blog->settings->setNameSpace('blocnotes'); 
    5062                    # Bloc-Notes' text 
     63                    $core->blog->settings->put('blocNotes_text_'.$core->auth->userID(), 
     64                         $_POST['blocNotes_personal_text'],'text','Bloc-Notes\' personal text',true,true); 
    5165                    $core->blog->settings->put('blocNotes_text', 
    5266                         $_POST['blocNotes_text'],'text','Bloc-Notes\' text'); 
  • plugins/blocNotes/locales/fr/main.lang.php

    r374 r377  
    33// This file is generated by LangOmatic, a plugin for Dotclear 
    44 
    5 # _admin.php:31 
    6 # index.php:50 
    7 # index.php:58 
     5# _admin.php:28 
     6# _admin.php:38 
     7# index.php:47 
     8# index.php:55 
    89# lib.blocNotes.php:28 
    910$GLOBALS['__l10n']['Bloc-notes']='Bloc-notes'; 
    1011 
    11 # index.php:44 
     12# index.php:41 
    1213$GLOBALS['__l10n']['Configuration successfully updated.']='Configuration mise à jour avec succès.'; 
    1314 
    14 # index.php:64 
     15# index.php:61 
    1516$GLOBALS['__l10n']['settings']='paramètres'; 
    1617 
    1718# index.php:67 
    18 $GLOBALS['__l10n']['Text']='Texte'; 
    19  
    20 # index.php:72 
    2119$GLOBALS['__l10n']['Save configuration']='Enregistrer la configuration'; 
    2220 
    23 # lib.blocNotes.php:37 
    24 $GLOBALS['__l10n']['Bloc-notes :']='Bloc-notes :'; 
     21# lib.blocNotes.php:38 
     22$GLOBALS['__l10n']['Personal notebook (other users can&#39;t edit it) :']='Bloc-notes personnel (les autres utilisateurs ne peuvent pas le modifier) :'; 
     23 
     24# lib.blocNotes.php:45 
     25$GLOBALS['__l10n']['Blog-specific notebook (all the users of the blog can edit it) :']='Bloc-notes spécifique à ce blog (tous les utilisateurs du blog peuvent le modifier) :'; 
     26 
     27# lib.blocNotes.php:51 
     28$GLOBALS['__l10n']['These notes may be read by anyone, don&#39;t write some sensitive information (password, personal information, etc.)']='Ces notes pourraientt être lues par n\'importe qui, n\'écrivez pas d\'information sensible (mot de passe, information personnelle, etc.)'; 
    2529 
    2630?> 
  • plugins/blocNotes/post.js

    r376 r377  
    2121 ***** END LICENSE BLOCK *****/ 
    2222$(function() { 
    23      /* from /dotclear/admin/js/_post.js */ 
     23     /* modified from /dotclear/admin/js/_post.js */ 
     24     $('#blocNotes_personal label').toggleWithLegend($('#blocNotes_personal').children().not('label'),{ 
     25          cookie: 'dcx_post_blocNotes_p' 
     26 
     27     }); 
    2428     $('#blocNotes label').toggleWithLegend($('#blocNotes').children().not('label'),{ 
    25           cookie: 'dcx_post_blocNotes'/*, 
    26           hide: $('#blocNotes_text').val() == ''*/ 
     29          cookie: 'dcx_post_blocNotes' 
    2730     }); 
    2831}); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map