Dotclear

Changeset 2118


Ignore:
Timestamp:
03/10/10 09:03:33 (14 years ago)
Author:
Osku
Message:

Plugin carnaval : update to last version - enough for today :)

Location:
plugins/carnaval
Files:
6 added
5 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • plugins/carnaval/_admin.php

    r500 r2118  
    1 <?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ 
    2 /***************************************************************\ 
    3  *  This is 'Carnaval', a plugin for Dotclear 2                * 
    4  *                                                             * 
    5  *  Copyright (c) 2007-2008                                    * 
    6  *  Osku and contributors.                                     * 
    7  *                                                             * 
    8  *  This is an open source software, distributed under the GNU * 
    9  *  General Public License (version 2) terms and  conditions.  * 
    10  *                                                             * 
    11  *  You should have received a copy of the GNU General Public  * 
    12  *  License along with 'Carnaval' (see COPYING.txt);           * 
    13  *  if not, write to the Free Software Foundation, Inc.,       * 
    14  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA    * 
    15 \***************************************************************/ 
     1<?php  
     2# -- BEGIN LICENSE BLOCK ---------------------------------- 
     3# 
     4# This file is part of Carnaval a plugin for Dotclear 2. 
     5#  
     6# Copyright (c) 2010 Me and contributors 
     7# 
     8# Licensed under the GPL version 2.0 license. 
     9# A copy of this license is available in LICENSE file or at 
     10# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
     11# 
     12# -- END LICENSE BLOCK ------------------------------------ 
    1613if (!defined('DC_CONTEXT_ADMIN')) { return; } 
    1714 
    1815$_menu['Plugins']->addItem(__('Carnaval'), 
    19         'plugin.php?p=carnaval','index.php?pf=carnaval/icon.png', 
    20         preg_match('/plugin.php\?p=carnaval(&.*)?$/',$_SERVER['REQUEST_URI']), 
    21         $core->auth->check('usage,contentadmin',$core->blog->id)); 
     16     'plugin.php?p=carnaval','index.php?pf=carnaval/icon.png', 
     17     preg_match('/plugin.php\?p=carnaval(&.*)?$/',$_SERVER['REQUEST_URI']), 
     18     $core->auth->check('usage,contentadmin',$core->blog->id)); 
    2219?> 
  • plugins/carnaval/_define.php

    r780 r2118  
    1 <?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ 
    2 /***************************************************************\ 
    3  *  This is 'Carnaval', a plugin for Dotclear 2                * 
    4  *                                                             * 
    5  *  Copyright (c) 2007-2008                                    * 
    6  *  Osku and contributors.                                     * 
    7  *                                                             * 
    8  *  This is an open source software, distributed under the GNU * 
    9  *  General Public License (version 2) terms and  conditions.  * 
    10  *                                                             * 
    11  *  You should have received a copy of the GNU General Public  * 
    12  *  License along with 'Carnaval' (see COPYING.txt);           * 
    13  *  if not, write to the Free Software Foundation, Inc.,       * 
    14  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA    * 
    15 \***************************************************************/ 
     1<?php  
     2# -- BEGIN LICENSE BLOCK ---------------------------------- 
     3# 
     4# This file is part of Carnaval a plugin for Dotclear 2. 
     5#  
     6# Copyright (c) 2010 Me and contributors 
     7# 
     8# Licensed under the GPL version 2.0 license. 
     9# A copy of this license is available in LICENSE file or at 
     10# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
     11# 
     12# -- END LICENSE BLOCK ------------------------------------ 
     13if (!defined('DC_RC_PATH')) { return; } 
    1614 
    1715$this->registerModule( 
    1816     /* Name */          'Carnaval', 
    1917     /* Description*/    'Identify comments and trackbacks', 
    20      /* Author */        'Osku', 
    21      /* Version */       '1.2RC2', 
     18     /* Author */        'Osku and contributors', 
     19     /* Version */       '1.5', 
    2220     /* Permissions */   'contentadmin' 
    2321); 
  • plugins/carnaval/_install.php

    r1621 r2118  
    1 <?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ 
    2 /***************************************************************\ 
    3  *  This is 'Carnaval', a plugin for Dotclear 2                * 
    4  *                                                             * 
    5  *  Copyright (c) 2007-2008                                    * 
    6  *  Osku and contributors.                                     * 
    7  *                                                             * 
    8  *  This is an open source software, distributed under the GNU * 
    9  *  General Public License (version 2) terms and  conditions.  * 
    10  *                                                             * 
    11  *  You should have received a copy of the GNU General Public  * 
    12  *  License along with 'Carnaval' (see COPYING.txt);           * 
    13  *  if not, write to the Free Software Foundation, Inc.,       * 
    14  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA    * 
    15 \***************************************************************/ 
     1<?php  
     2# -- BEGIN LICENSE BLOCK ---------------------------------- 
     3# 
     4# This file is part of Carnaval a plugin for Dotclear 2. 
     5#  
     6# Copyright (c) 2010 Me and contributors 
     7# 
     8# Licensed under the GPL version 2.0 license. 
     9# A copy of this license is available in LICENSE file or at 
     10# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
     11# 
     12# -- END LICENSE BLOCK ------------------------------------ 
    1613 
    17 if (!defined('DC_CONTEXT_ADMIN')) { return; } 
     14if (!defined('DC_CONTEXT_ADMIN')) { exit; } 
    1815 
    1916# On lit la version du plugin 
     
    4946     ; 
    5047 
    51 # Schéma d'installation 
     48# Schema installation 
    5249$si = new dbStruct($core->con,$core->prefix); 
    5350$si->synchronize($s); 
    5451 
    55 if (!files::deltree(DC_TPL_CACHE.DIRECTORY_SEPARATOR.'cbtpl')) { 
    56      throw new Exception(__('To finish installation, please delete the whole cache/cbtpl directory.')); 
    57 } 
     52$core->blog->settings->setNamespace('carnaval'); 
     53$s =& $core->blog->settings; 
     54$s->put('carnaval_active',false,'boolean','Carnaval activation flag',true,true); 
     55$s->put('carnaval_colors',false,'boolean','Use colors defined with Carnaval plugin',true,true); 
    5856 
    5957$core->setVersion('carnaval',$m_version); 
  • plugins/carnaval/_prepend.php

    r459 r2118  
    1 <?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ 
    2 /***************************************************************\ 
    3  *  This is 'Carnaval', a plugin for Dotclear 2                * 
    4  *                                                             * 
    5  *  Copyright (c) 2007-2008                                    * 
    6  *  Osku and contributors.                                     * 
    7  *                                                             * 
    8  *  This is an open source software, distributed under the GNU * 
    9  *  General Public License (version 2) terms and  conditions.  * 
    10  *                                                             * 
    11  *  You should have received a copy of the GNU General Public  * 
    12  *  License along with 'Carnaval' (see COPYING.txt);           * 
    13  *  if not, write to the Free Software Foundation, Inc.,       * 
    14  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA    * 
    15 \***************************************************************/ 
     1<?php  
     2# -- BEGIN LICENSE BLOCK ---------------------------------- 
     3# 
     4# This file is part of Carnaval a plugin for Dotclear 2. 
     5#  
     6# Copyright (c) 2010 Me and contributors 
     7# 
     8# Licensed under the GPL version 2.0 license. 
     9# A copy of this license is available in LICENSE file or at 
     10# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
     11# 
     12# -- END LICENSE BLOCK ------------------------------------ 
    1613if (!defined('DC_RC_PATH')) { return; } 
    1714 
    18 $__autoload['dcCarnaval'] = dirname(__FILE__).'/class.dc.carnaval.php'; 
     15$__autoload['dcCarnaval'] = dirname(__FILE__).'/inc/class.dc.carnaval.php'; 
     16$__autoload['carnavalConfig'] = dirname(__FILE__).'/inc/class.carnaval.config.php'; 
    1917 
    20 dcCarnaval::init($GLOBALS['core']->blog); 
     18$carnaval = new dcCarnaval ($core->blog); 
    2119?> 
  • plugins/carnaval/_public.php

    r780 r2118  
    1 <?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ 
    2 /***************************************************************\ 
    3  *  This is 'Carnaval', a plugin for Dotclear 2                * 
    4  *                                                             * 
    5  *  Copyright (c) 2007-2008                                    * 
    6  *  Osku and contributors.                                     * 
    7  *                                                             * 
    8  *  This is an open source software, distributed under the GNU * 
    9  *  General Public License (version 2) terms and  conditions.  * 
    10  *                                                             * 
    11  *  You should have received a copy of the GNU General Public  * 
    12  *  License along with 'Carnaval' (see COPYING.txt);           * 
    13  *  if not, write to the Free Software Foundation, Inc.,       * 
    14  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA    * 
    15 \***************************************************************/ 
    16 if (!defined('DC_RC_PATH')) { return; } 
     1<?php  
     2# -- BEGIN LICENSE BLOCK ---------------------------------- 
     3# 
     4# This file is part of Carnaval a plugin for Dotclear 2. 
     5#  
     6# Copyright (c) 2010 Me and contributors 
     7# 
     8# Licensed under the GPL version 2.0 license. 
     9# A copy of this license is available in LICENSE file or at 
     10# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
     11# 
     12# -- END LICENSE BLOCK ------------------------------------ 
    1713 
    1814# On surchage les fonctions template 
    1915 
    2016if ($core->blog->settings->carnaval_active){ 
    21 $core->tpl->addValue('CommentIfMe',array('tplCarnaval','CommentIfMe')); 
    22 $core->tpl->addValue('PingIfOdd',array('tplCarnaval','PingIfOdd')); 
    23 $core->addBehavior('publicHeadContent',array('tplCarnaval','publicHeadContent')); 
     17     $core->tpl->addValue('CommentIfMe',array('tplCarnaval','CommentIfMe')); 
     18     $core->tpl->addValue('PingIfOdd',array('tplCarnaval','PingIfOdd')); 
     19 
     20     if ($core->blog->settings->carnaval_colors){ 
     21          $core->addBehavior('publicHeadContent',array('tplCarnaval','publicHeadContent')); 
     22     } 
    2423} 
    2524 
     
    5049     public static function getCommentClass() 
    5150     { 
    52           global $_ctx; 
    53            
    54           $classe_perso = dcCarnaval::getCommentClass($_ctx->comments->getEmail(false)); 
     51          global $core, $_ctx; 
     52          $carnaval = new dcCarnaval ($core->blog); 
     53          $classe_perso = $carnaval->getCommentClass($_ctx->comments->getEmail(false)); 
    5554          return html::escapeHTML($classe_perso); 
    5655     } 
     
    5857     public static function getPingClass() 
    5958     { 
    60           global $_ctx; 
    61            
    62           $classe_perso = dcCarnaval::getPingClass($_ctx->pings->getAuthorURL()); 
     59          global $core, $_ctx; 
     60          $carnaval = new dcCarnaval ($core->blog); 
     61          $classe_perso = $carnaval->getPingClass($_ctx->pings->getAuthorURL()); 
    6362          return html::escapeHTML($classe_perso); 
    6463     } 
    6564      
    6665      
    67      public static function publicHeadContent(&$core) 
     66     public static function publicHeadContent() 
    6867     { 
    69           if ($core->blog->settings->theme != 'default') { 
    70                return; 
    71           } 
    7268          echo '<style type="text/css">'."\n".self::carnavalStyleHelper()."\n</style>\n"; 
    7369     } 
     
    7571     public static function carnavalStyleHelper() 
    7672     { 
    77           $cval = dcCarnaval::getClasses(); 
     73          global $core; 
     74      
     75          $carnaval = new dcCarnaval ($core->blog); 
     76          $cval = $carnaval->getClasses(); 
    7877          $css = array(); 
    7978          while ($cval->fetch()) 
     
    8584                    self::prop($css,'#comments dd.'.$cl_class,'color',$cl_txt); 
    8685                    self::prop($css,'#comments dd.'.$cl_class,'background-color',$cl_backg); 
    87                     self::backgroundImg($css,'#comments dt.'.$cl_class, $cl_backg,$cl_class.'-comment-t.png'); 
    88                     self::backgroundImg($css,'#comments dd.'.$cl_class,$cl_backg,$cl_class.'-comment-b.png'); 
     86                    if ($core->blog->settings->theme == 'default') { 
     87                         self::backgroundImg($css,'#comments dt.'.$cl_class, $cl_backg,$cl_class.'-comment-t.png'); 
     88                         self::backgroundImg($css,'#comments dd.'.$cl_class,$cl_backg,$cl_class.'-comment-b.png'); 
     89                    } 
    8990                    foreach ($css as $selector => $values) 
    9091                    { 
  • plugins/carnaval/index.php

    r1728 r2118  
    1 <?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ 
    2 /***************************************************************\ 
    3  *  This is 'Carnaval', a plugin for Dotclear 2                * 
    4  *                                                             * 
    5  *  Copyright (c) 2007-2008                                    * 
    6  *  Osku and contributors.                                     * 
    7  *                                                             * 
    8  *  This is an open source software, distributed under the GNU * 
    9  *  General Public License (version 2) terms and  conditions.  * 
    10  *                                                             * 
    11  *  You should have received a copy of the GNU General Public  * 
    12  *  License along with 'Carnaval' (see COPYING.txt);           * 
    13  *  if not, write to the Free Software Foundation, Inc.,       * 
    14  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA    * 
    15 \***************************************************************/ 
     1<?php  
     2# -- BEGIN LICENSE BLOCK ---------------------------------- 
     3# 
     4# This file is part of Carnaval a plugin for Dotclear 2. 
     5#  
     6# Copyright (c) 2010 Me and contributors 
     7# 
     8# Licensed under the GPL version 2.0 license. 
     9# A copy of this license is available in LICENSE file or at 
     10# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
     11# 
     12# -- END LICENSE BLOCK ------------------------------------ 
    1613if (!defined('DC_CONTEXT_ADMIN')) { return; } 
    1714 
    18 if (!empty($_REQUEST['edit']) && !empty($_REQUEST['id'])) { 
    19      include dirname(__FILE__).'/edit.php'; 
    20      return; 
    21 } 
    22  
    23 if (!empty($_REQUEST['add'])) { 
    24      include dirname(__FILE__).'/add.php'; 
    25      return; 
    26 } 
    27  
    28 // Setting default parameters if missing configuration 
    29 if (is_null($core->blog->settings->carnaval_active)) { 
    30      try { 
    31           $core->blog->settings->setNameSpace('carnaval'); 
    32  
    33           // Carnaval is not active by default 
    34           $core->blog->settings->put('carnaval_active',false,'boolean'); 
    35           $core->blog->triggerBlog(); 
    36           http::redirect(http::getSelfURI()); 
    37      } 
    38      catch (Exception $e) { 
    39           $core->error->add($e->getMessage()); 
    40      } 
    41 } 
     15$carnaval = new dcCarnaval ($core->blog); 
     16$can_write_images = carnavalConfig::canWriteImages(); 
     17$comment_author = $comment_author_mail = $comment_author_site = $comment_class =  
     18$comment_text_color = $comment_background_color =  
     19$e_comment_author = $e_comment_author_mail = $e_comment_author_site = $e_comment_class =  
     20$e_comment_text_color = $e_comment_background_color = ''; 
     21 
     22$add_carnaval = false; 
     23$edit_carnaval = false; 
    4224 
    4325// Getting current parameters 
    4426$active = (boolean)$core->blog->settings->carnaval_active; 
     27$colors = (boolean)$core->blog->settings->carnaval_colors; 
     28 
     29try 
     30{ 
     31     if (!empty($_REQUEST['id']) ) { 
     32          $rs_c = $carnaval ->getClass($_REQUEST['id']); 
     33          if (!$rs_c->isEmpty()) 
     34          { 
     35               $edit_carnaval = true; 
     36          } 
     37     }  
     38} 
     39catch (Exception $e) 
     40{ 
     41     $core->error->add($e->getMessage()); 
     42} 
     43 
     44 
     45if (!empty($_POST['edit_class'])) 
     46{ 
     47     $id = $_REQUEST['id']; 
     48     $e_comment_author = $_POST['e_comment_author']; 
     49     $e_comment_author_mail = $_POST['e_comment_author_mail']; 
     50     $e_comment_author_site = $_POST['e_comment_author_site']; 
     51     $e_comment_class = $_POST['e_comment_class']; 
     52     $e_comment_text_color = carnavalConfig::adjustColor($_POST['e_comment_text_color']); 
     53     $e_comment_background_color = carnavalConfig::adjustColor($_POST['e_comment_background_color']); 
     54 
     55     try { 
     56          $carnaval ->updateClass($id,$e_comment_author,$e_comment_author_mail,$e_comment_author_site,$e_comment_text_color,$e_comment_background_color,$e_comment_class); 
     57          if ($can_write_images) 
     58          { 
     59               carnavalConfig::createImages($e_comment_background_color,$e_comment_class); 
     60          } 
     61          http::redirect($p_url.'&upd=1'); 
     62     } catch (Exception $e) { 
     63          $core->error->add($e->getMessage()); 
     64     } 
     65} 
     66 
     67 
     68 
     69if (!empty($_POST['add_class'])) 
     70{ 
     71     $comment_author = $_POST['comment_author']; 
     72     $comment_author_mail = $_POST['comment_author_mail']; 
     73     $comment_author_site = $_POST['comment_author_site']; 
     74     $comment_class = strtolower(text::str2URL($_POST['comment_class'])); 
     75     $comment_text_color = carnavalConfig::adjustColor($_POST['comment_text_color']); 
     76     $comment_background_color = carnavalConfig::adjustColor($_POST['comment_background_color']); 
     77      
     78     try { 
     79          $carnaval->addClass($comment_author,$comment_author_mail,$comment_author_site,$comment_text_color,$comment_background_color,$comment_class); 
     80          if ($can_write_images) 
     81          { 
     82               carnavalConfig::createImages($comment_background_color,$comment_class); 
     83          } 
     84 
     85     } catch (Exception $e) { 
     86          $add_carnaval = true; 
     87 
     88          $core->error->add($e->getMessage()); 
     89 
     90     } 
     91 
     92     if (!$core->error->flag()) { 
     93          http::redirect($p_url.'&addclass=1'); 
     94     } 
     95} 
    4596 
    4697# Delete CSS Class 
    47 if (!empty($_POST['removeaction']) && !empty($_POST['remove'])) { 
    48      foreach ($_POST['remove'] as $k => $v) 
     98if (!empty($_POST['removeaction']) && !empty($_POST['select'])) { 
     99     foreach ($_POST['select'] as $k => $v) 
    49100     { 
    50101          try { 
    51                dcCarnaval::delClass($v); 
     102               $carnaval ->delClass($v); 
    52103          } catch (Exception $e) { 
    53104               $core->error->add($e->getMessage()); 
     
    67118          $core->blog->settings->setNameSpace('carnaval'); 
    68119 
    69           $active = (empty($_POST['active']))?false:true; 
    70           $core->blog->settings->put('carnaval_active',$active,'boolean'); 
     120          $active = (empty($_POST['active'])) ? false : true; 
     121          $colors = (empty($_POST['colors'])) ? false : true; 
     122           
     123          $core->blog->settings->put('carnaval_active',$active,'boolean','Carnaval activation flag'); 
     124          $core->blog->settings->put('carnaval_colors',$colors,'boolean','Use colors defined with Carnaval plugin'); 
    71125 
    72126          $core->blog->triggerBlog(); 
    73  
    74           $msg = __('Configuration successfully updated.'); 
     127          http::redirect($p_url.'&config=1'); 
     128          //$msg = __('Configuration successfully updated.'); 
    75129     } 
    76130     catch (Exception $e) 
     
    82136# Get CSS Classes 
    83137try { 
    84      $rs = dcCarnaval::getClasses(); 
     138     $rs = $carnaval ->getClasses(); 
    85139} catch (Exception $e) { 
    86140     $core->error->add($e->getMessage()); 
     
    89143<html> 
    90144<head> 
    91   <title>Carnaval</title> 
     145     <title><?php echo __('Carnaval'); ?></title> 
     146     <?php echo dcPage::jsColorPicker(); ?> 
     147     <?php echo dcPage::jsLoad('index.php?pf=carnaval/admin.js'); ?> 
     148     <link rel="stylesheet" type="text/css" href="index.php?pf=carnaval/style.css" /> 
     149     <?php if (!$add_carnaval) { 
     150          echo dcPage::jsLoad('index.php?pf=carnaval/form.js'); 
     151     }?> 
     152     <script type="text/javascript"> 
     153     //<![CDATA[ 
     154     <?php echo dcPage::jsVar('dotclear.msg.delete_records',__("Are you sure you you want to delete selected CSS Classes ?")); ?> 
     155     //]]> 
     156     </script> 
    92157</head> 
    93  
    94158<body> 
    95 <h2 style="padding:8px 0 8px 34px;background:url(index.php?pf=carnaval/icon_32.png) no-repeat;"> 
    96 <?php echo html::escapeHTML($core->blog->name); ?> &rsaquo; Carnaval -  
    97 <a class="button" href="<?php echo $p_url.'&amp;add=1'; ?>"><?php echo html::escapeJS( 
    98 __('New CSS Class')); ?></a> 
    99 </h2> 
    100  
    101159<?php 
    102  
    103160if (!empty($_GET['removed'])) { 
    104      echo '<p class="message">'.__('Classes have been successfully removed.').'</p>'; 
     161          echo '<p class="message">'.__('Classes have been successfully removed.').'</p>'; 
    105162} 
    106163 
    107164if (!empty($_GET['addclass'])) { 
    108      echo '<p class="message">'.__('Class has been successfully created.').'</p>'; 
     165          echo '<p class="message">'.__('Class has been successfully created.').'</p>'; 
     166} 
     167 
     168if (!empty($_GET['upd'])) { 
     169     echo '<p class="message">'.__('CSS Class has been successfully updated').'</p>'; 
    109170} 
    110171 
    111172if (!empty($msg)) { 
    112      echo '<p class="message">'.$msg.'</p>'; 
    113 } 
    114  
     173          echo '<p class="message">'.$msg.'</p>'; 
     174} 
     175 
     176echo '<h2>'.html::escapeHTML($core->blog->name).' &rsaquo; '.__('Carnaval').'</h2>'; 
     177 
     178 
     179echo '<form action="'.$p_url.'" method="post" id="config-form">'. 
     180     '<fieldset><legend>'.__('Plugin activation').'</legend>'. 
     181          '<p class="field">'. 
     182          form::checkbox('active', 1, $active). 
     183          '<label class=" classic" for="active">'.__('Enable Carnaval').'</label></p>'. 
     184          '<p class="field">'. 
     185          form::checkbox('colors', 1, $colors). 
     186          '<label class=" classic" for="active">'.__('Use defined colors').'</label></p>'. 
     187     '</fieldset>'. 
     188          '<p>'.form::hidden(array('p'),'carnaval'). 
     189          $core->formNonce(). 
     190          '<input type="submit" name="saveconfig" accesskey="s" value="'.__('Save configuration').'"/>'. 
     191          '</p>'. 
     192     '</form>'; 
     193 
     194 
     195if (!$add_carnaval) { 
     196     echo '<div class="two-cols" id="new-class"><h3><a class="new" id="carnaval-control" href="#">'. 
     197     __('New CSS class').'</a></h3></div>'; 
     198} 
     199 
     200echo '<form action="'.$p_url.'" method="post" id="add-css">'. 
     201     '<fieldset><legend>'.__('New CSS Class').'</legend>'. 
     202     '<div class="col">'. 
     203          '<p class="field"><label class="classic required" title="'.__('Required field').'">'.__('Name:').' '. 
     204          form::field('comment_author',30,255,html::escapeHTML($comment_author),'',2). 
     205          '</label></p>'. 
     206          '<p class="field"><label class="classic required" title="'.__('Required field').'">'.__('CSS Class:').' '. 
     207          form::field('comment_class',30,255,html::escapeHTML($comment_class),'',3). 
     208          '</label></p>'. 
     209     '</div>'. 
     210     '<div class="col">'. 
     211          '<h3>'.__('For').'</h3>'. 
     212          '<p class="field"><label class="classic">'.__('Mail (for comments):').' '. 
     213          form::field('comment_author_mail',30,255,html::escapeHTML($comment_author_mail),'',4). 
     214          '</label></p>'. 
     215          '<p class="field"><label class="classic">'.__('URL (for trackbacks):').' '. 
     216          form::field('comment_author_site',30,255,html::escapeHTML($comment_author_site),'',5). 
     217          '</label></p>'. 
     218 
     219     '</div>'. 
     220     '<div class="col">'. 
     221          '<h4>'.__('Colors details (optionnal)').'</h4>'. 
     222          '<p class="field"><label class="classic">'.__('Text color:').' '. 
     223          form::field('comment_text_color',7,7,html::escapeHTML($comment_text_color),'colorpicker',6). 
     224          '</label></p>'. 
     225          '<p class="field"><label class="classic">'.__('Background color:').' '. 
     226          form::field('comment_background_color',7,7,html::escapeHTML($comment_background_color),'colorpicker',7). 
     227          '</label></p>'. 
     228     '</div>'. 
     229     form::hidden(array('p'),'carnaval'). 
     230     $core->formNonce(). 
     231     '<input type="submit" name="add_class" accesskey="a" value="'.__('save').'" tabindex="6" /> 
     232     </fieldset> 
     233     </form>'; 
     234 
     235if (!$rs->isEmpty()) 
     236{ 
     237     echo  
     238     '<form class="clear" action="'.$p_url.'" method="post" id="classes-form">'. 
     239     '<fieldset class="two-cols"><legend>'.__('My CSS Classes').'</legend>'. 
     240     '<table class="maximal">'. 
     241     '<thead>'. 
     242     '<tr>'. 
     243          '<th colspan="2">'.__('Name').'</th>'. 
     244          '<th>'.__('CSS Class').'</th>'. 
     245          '<th>'.__('Mail').'</th>'. 
     246          '<th>'.__('URL').'</th>'. 
     247          '<th colspan="2">'.__('Colors').'</th>'. 
     248     '</tr>'. 
     249     '</thead>'. 
     250     '<tbody id="classes-list">'; 
     251 
     252     while ($rs->fetch()) 
     253     { 
     254          $color = ($rs->comment_text_color) ? $rs->comment_text_color : 'inherit'; 
     255          $backgroundcolor = ($rs->comment_background_color) ? $rs->comment_background_color : 'inherit'; 
     256      
     257          echo 
     258          '<tr class="line" id="l_'.$rs->class_id.'">'. 
     259          '<td class="minimal">'.form::checkbox(array('select[]'),$rs->class_id).'</td>'. 
     260          '<td>'.html::escapeHTML($rs->comment_author).'</td>'.        
     261          '<td><code>'.html::escapeHTML($rs->comment_class).'</code></td>'.      
     262          '<td>'.html::escapeHTML($rs->comment_author_mail).'</td>'. 
     263          '<td>'.html::escapeHTML($rs->comment_author_site).'</td>'. 
     264          '<td><span style="color:'.$color.';background-color:'.$backgroundcolor.'">'.__('Thanks to use Carnaval').'</span></td>'. 
     265          '<td class="nowrap status"><a href="'.$p_url.'&amp;id='.$rs->class_id.'"><img src="images/edit-mini.png" alt="" title="'.__('Edit this record').'" /></a></td>'. 
     266          '</tr>'; 
     267     } 
     268 
     269     echo '</tbody></table></fieldset>'; 
     270 
     271 
     272     echo  
     273     '<div class="two-cols">'. 
     274     '<p class="col checkboxes-helpers"></p>'. 
     275     '<p class="col right">'. 
     276          form::hidden(array('p'),'carnaval'). 
     277          $core->formNonce(). 
     278          '<input type="submit" class="delete" name="removeaction" accesskey="d" value="'.__('delete').'" onclick="return window.confirm(dotclear.msg.delete_records)" />'. 
     279     '</p></div>'. 
     280 
     281     '</form>'; 
     282} 
     283 
     284if ($edit_carnaval) 
     285{ 
     286     echo  
     287     '<form class="clear" action="'.$p_url.'" method="post" id="update-css">'. 
     288     '<fieldset><legend>'.__('Edit CSS Class').'</legend>'. 
     289          '<p class="field"><label class="required" title="'.__('Required field').'">'.__('Name:').' '. 
     290          form::field('e_comment_author',30,255,html::escapeHTML($rs_c->comment_author),'',2). 
     291          '</label></p>'. 
     292          '<p class="field"><label class="required" title="'.__('Required field').'">'.__('CSS Class:').' '. 
     293          form::field('e_comment_class',30,255,html::escapeHTML($rs_c->comment_class),'',3). 
     294          '</label></p>'. 
     295          '<p class="field"><label>'.__('Mail:').' '. 
     296          form::field('e_comment_author_mail',30,255,html::escapeHTML($rs_c->comment_author_mail),'',4). 
     297          '</label></p>'. 
     298          '<p class="field"><label>'.__('URL:').' '. 
     299          form::field('e_comment_author_site',30,255,html::escapeHTML($rs_c->comment_author_site),'',5). 
     300          '</label></p>'. 
     301          '<p class="field"><label class="classic">'.__('Text color:').' '. 
     302          form::field('e_comment_text_color',7,7,html::escapeHTML($rs_c->comment_text_color),'colorpicker',6). 
     303          '</label></p>'. 
     304          '<p class="field"><label>'.__('Background color:').' '. 
     305          form::field('e_comment_background_color',7,7,html::escapeHTML($rs_c->comment_background_color),'colorpicker',7). 
     306          '</label></p>'. 
     307     form::hidden(array('p'),'carnaval'). 
     308     form::hidden('id',$rs_c->class_id). 
     309     $core->formNonce(). 
     310     '<input type="submit" class="update" name="edit_class" accesskey="u" value="'.__('update').'" tabindex="6" /> 
     311     </fieldset> 
     312     </form>'; 
     313} 
     314 
     315 
     316dcPage::helpBlock('carnaval'); 
     317 
     318     echo '</body></html>'; 
    115319?> 
    116 <?php 
    117      echo '<form action="'.$p_url.'" method="post" id="config-form">'; 
    118      echo '<fieldset><legend>'.__('Plugin activation').'</legend>'; 
    119      echo  
    120      '<p class="field">'. 
    121                form::checkbox('active', 1, $active). 
    122                '<label class=" classic" for="active">'.__('Enable Carnaval').'</label></p></fieldset>'; 
    123      echo  
    124      '<p>'.form::hidden(array('p'),'carnaval'). 
    125           $core->formNonce(). 
    126           '<input type="submit" name="saveconfig" accesskey="s" value="'.__('Save configuration').' (s)"/>'; 
    127      echo '</p></form>'; 
    128 ?> 
    129 <fieldset class="two-cols"><legend><?php echo __('My CSS Classes'); ?></legend> 
    130 <form action="plugin.php" method="post" id="classes-form"> 
    131 <table class="maximal"> 
    132 <thead> 
    133 <tr> 
    134   <th colspan="2"><?php echo __('Name'); ?></th> 
    135   <th><strong><?php echo __('CSS Class'); ?></strong></th> 
    136   <th><?php echo __('Mail'); ?></th> 
    137   <th><?php echo __('URL'); ?></th> 
    138   <th><?php if ($core->blog->settings->theme == 'default') {echo __('Text color');} ?></th> 
    139   <th><?php if ($core->blog->settings->theme == 'default') { echo __('Background color');} ?></th> 
    140 </tr> 
    141 </thead> 
    142 <tbody id="classes-list"> 
    143 <?php 
    144 while ($rs->fetch()) 
    145 { 
    146      echo 
    147      '<tr class="line" id="l_'.$rs->class_id.'">'. 
    148      '<td class="minimal">'.form::checkbox(array('remove[]'),$rs->class_id).'</td>'. 
    149      '<td>'.html::escapeHTML($rs->comment_author).'</a></td>'. 
    150      '<td><a href="'.$p_url.'&amp;edit=1&amp;id='.$rs->class_id.'">'. 
    151           html::escapeHTML($rs->comment_class).'</a></td>'. 
    152      '<td>'.html::escapeHTML($rs->comment_author_mail).'</td>'. 
    153      '<td>'.html::escapeHTML($rs->comment_author_site).'</td>'; 
    154      if ($core->blog->settings->theme == 'default') { 
    155           echo '<td>'.html::escapeHTML($rs->comment_text_color).'</td>'. 
    156           '<td>'.html::escapeHTML($rs->comment_background_color).'</td>'; 
    157      } 
    158      echo '</tr>'; 
    159 } 
    160 ?> 
    161 </tbody> 
    162 </table> 
    163  
    164 <div class="two-cols"> 
    165 <p class="col"> 
    166 <?php echo form::hidden(array('p'),'carnaval'); 
    167 echo $core->formNonce(); ?> 
    168 <input type="submit" name="removeaction" accesskey="d" 
    169 value="<?php echo __('Delete selected CSS Classes'); ?>" 
    170 onclick="return window.confirm('<?php echo html::escapeJS( 
    171 __('Are you sure you want to delete selected CSS Classes ?')); ?>');" /></p> 
    172 </div> 
    173  
    174 </fieldset> 
    175  
    176 <?php dcPage::helpBlock('carnaval');?> 
    177 </body></html> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map