Dotclear


Ignore:
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • locales/_pot/main.pot

    r2396 r2133  
    127127 
    128128#: admin/_fake_l10n.php:37 
    129 msgid "Last entries from feed ( RSS or Atom )" 
     129msgid "Last entries from feed" 
    130130msgstr "" 
    131131 
  • locales/_pot/plugins.pot

    r2396 r2133  
    26522652 
    26532653#: plugins/widgets/index.php:199 
    2654 msgid "Drag widgets from this list to one of the sidebars, for add." 
     2654msgid "Move widgets from this list to one of the sidebars." 
    26552655msgstr "" 
    26562656 
     
    27602760 
    27612761#: plugins/widgets/index.php:324 
    2762 msgid "No widget for now." 
     2762msgid "No widget." 
    27632763msgstr "" 
    27642764 
     
    27682768 
    27692769#: plugins/widgets/index.php:351 
    2770 msgid "Drag widgets here to remove." 
    2771 msgstr "" 
     2770msgid "Drag widgets here to remove them from this sidebar." 
     2771msgstr "" 
  • locales/fr/main.po

    r2396 r2145  
    102102msgstr "" 
    103103 
    104 msgid "Last entries from feed ( RSS or Atom )" 
    105 msgstr "Derniers billets du flux (RSS ou Atom)" 
     104msgid "Last entries from feed" 
     105msgstr "Derniers billets du flux" 
    106106 
    107107msgid "Simple text" 
  • locales/fr/plugins.po

    r2396 r2142  
    18951895msgstr "Widgets disponibles" 
    18961896 
    1897 msgid "Drag widgets from this list to one of the sidebars, for add." 
    1898 msgstr "Déplacez des widgets de cette liste vers l'un des volets, pour les ajouter." 
     1897msgid "Move widgets from this list to one of the sidebars." 
     1898msgstr "Déplacez des widgets de cette liste vers l'un des volets." 
    18991899 
    19001900msgid "order" 
     
    19761976msgstr "Nom de l'élément de réglage :" 
    19771977 
    1978 msgid "No widget for now." 
    1979 msgstr "Aucun widget pour le moment." 
     1978msgid "No widget." 
     1979msgstr "Aucun widget." 
    19801980 
    19811981msgid "Remove widget" 
    19821982msgstr "Retirer le widget" 
    19831983 
    1984 msgid "Drag widgets here to remove." 
    1985 msgstr "Glisser les widgets ici pour les retirer." 
     1984msgid "Drag widgets here to remove them from this sidebar." 
     1985msgstr "Glisser les widgets ici pour les retirer du volet." 
    19861986 
    19871987#~ msgid "Manage every blog configuration directive" 
     
    20512051#~ msgstr "Liens d'abonnements aux flux RSS ou Atom" 
    20522052 
    2053 #~ msgid "Last entries from feed ( RSS or Atom )" 
    2054 #~ msgstr "Derniers billets du flux (RSS ou Atom)" 
     2053#~ msgid "Last entries from feed" 
     2054#~ msgstr "Derniers billets d'un flux" 
    20552055 
    20562056#~ msgid "Simple text" 
  • plugins/blogroll/_widgets.php

    r2395 r1179  
    4141                    ) 
    4242          ); 
    43           $w->links->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0'))); 
    44           $w->links->advanced_setting('class',__('CSS class:'),''); 
     43          $w->links->setting('content_only',__('Content only'),0,'check'); 
     44          $w->links->setting('class',__('CSS class:'),''); 
    4545     } 
    4646      
  • plugins/pages/_widgets.php

    r2395 r1179  
    3838               array(__('Ascending') => 'asc', __('Descending') => 'desc') 
    3939          ); 
    40           $w->pages->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0'))); 
    41           $w->pages->advanced_setting('class',__('CSS class:'),''); 
     40          $w->pages->setting('content_only',__('Content only'),0,'check'); 
     41          $w->pages->setting('class',__('CSS class:'),''); 
    4242     } 
    4343      
  • plugins/simpleMenu/_widgets.php

    r2395 r1179  
    2727                    ) 
    2828          ); 
    29           $w->simplemenu->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0'))); 
    30           $w->simplemenu->advanced_setting('class',__('CSS class:'),''); 
     29          $w->simplemenu->setting('content_only',__('Content only'),0,'check'); 
     30          $w->simplemenu->setting('class',__('CSS class:'),''); 
    3131     } 
    3232} 
  • plugins/tags/_widgets.php

    r2395 r1179  
    3636                    ) 
    3737          ); 
    38           $w->tags->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0'))); 
    39           $w->tags->advanced_setting('class',__('CSS class:'),''); 
     38          $w->tags->setting('content_only',__('Content only'),0,'check'); 
     39          $w->tags->setting('class',__('CSS class:'),''); 
    4040     } 
    4141      
  • plugins/widgets/_default_widgets.php

    r2395 r1610  
    2222$__widgets->search->setting('homeonly',__('Display on:'),0,'combo', 
    2323     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2)); 
    24 $__widgets->search->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0'))); 
    25 $__widgets->search->advanced_setting('class',__('CSS class:'),''); 
     24$__widgets->search->setting('content_only',__('Content only'),0,'check'); 
     25$__widgets->search->setting('class',__('CSS class:'),''); 
    2626 
    2727$__widgets->create('navigation',__('Navigation links'),array('defaultWidgets','navigation'),null,'List of navigation links'); 
     
    2929$__widgets->navigation->setting('homeonly',__('Display on:'),0,'combo', 
    3030     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2)); 
    31 $__widgets->navigation->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0'))); 
    32 $__widgets->navigation->advanced_setting('class',__('CSS class:'),''); 
     31$__widgets->navigation->setting('content_only',__('Content only'),0,'check'); 
     32$__widgets->navigation->setting('class',__('CSS class:'),''); 
    3333 
    3434$__widgets->create('bestof',__('Selected entries'),array('defaultWidgets','bestof'),null,'List of selected entries'); 
     
    3737$__widgets->bestof->setting('homeonly',__('Display on:'),1,'combo', 
    3838     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2)); 
    39 $__widgets->bestof->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0'))); 
    40 $__widgets->bestof->advanced_setting('class',__('CSS class:'),''); 
     39$__widgets->bestof->setting('content_only',__('Content only'),0,'check'); 
     40$__widgets->bestof->setting('class',__('CSS class:'),''); 
    4141 
    4242$__widgets->create('langs',__('Blog languages'),array('defaultWidgets','langs'),null,'List of available languages'); 
     
    4444$__widgets->langs->setting('homeonly',__('Display on:'),1,'combo', 
    4545     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2)); 
    46 $__widgets->langs->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0'))); 
    47 $__widgets->langs->advanced_setting('class',__('CSS class:'),''); 
     46$__widgets->langs->setting('content_only',__('Content only'),0,'check'); 
     47$__widgets->langs->setting('class',__('CSS class:'),''); 
    4848 
    4949$__widgets->create('categories',__('Categories'),array('defaultWidgets','categories'),null,'List of categories'); 
     
    5353$__widgets->categories->setting('homeonly',__('Display on:'),0,'combo', 
    5454     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2)); 
    55 $__widgets->categories->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0'))); 
    56 $__widgets->categories->advanced_setting('class',__('CSS class:'),''); 
     55$__widgets->categories->setting('content_only',__('Content only'),0,'check'); 
     56$__widgets->categories->setting('class',__('CSS class:'),''); 
    5757 
    5858$__widgets->create('subscribe',__('Subscribe links'),array('defaultWidgets','subscribe'),null,'RSS or Atom feed subscription links'); 
     
    6161$__widgets->subscribe->setting('homeonly',__('Display on:'),1,'combo', 
    6262     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2)); 
    63 $__widgets->subscribe->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0'))); 
    64 $__widgets->subscribe->advanced_setting('class',__('CSS class:'),''); 
     63$__widgets->subscribe->setting('content_only',__('Content only'),0,'check'); 
     64$__widgets->subscribe->setting('class',__('CSS class:'),''); 
    6565 
    66 $__widgets->create('feed',__('Feed reader'),array('defaultWidgets','feed'),null,'Last entries from feed ( RSS or Atom )'); 
     66$__widgets->create('feed',__('Feed reader'),array('defaultWidgets','feed'),null,'Last entries from feed'); 
    6767$__widgets->feed->setting('title',__('Title:'),__('Somewhere else')); 
    6868$__widgets->feed->setting('url',__('Feed URL:'),''); 
     
    7070$__widgets->feed->setting('homeonly',__('Display on:'),1,'combo', 
    7171     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2)); 
    72 $__widgets->feed->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0'))); 
    73 $__widgets->feed->advanced_setting('class',__('CSS class:'),''); 
     72$__widgets->feed->setting('content_only',__('Content only'),0,'check'); 
     73$__widgets->feed->setting('class',__('CSS class:'),''); 
    7474 
    7575$__widgets->create('text',__('Text'),array('defaultWidgets','text'),null,'Simple text'); 
     
    7878$__widgets->text->setting('homeonly',__('Display on:'),0,'combo', 
    7979     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2)); 
    80 $__widgets->text->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0'))); 
    81 $__widgets->text->advanced_setting('class',__('CSS class:'),''); 
     80$__widgets->text->setting('content_only',__('Content only'),0,'check'); 
     81$__widgets->text->setting('class',__('CSS class:'),''); 
    8282 
    8383$__widgets->create('lastposts',__('Last entries'),array('defaultWidgets','lastposts'),null,'List of last entries published'); 
     
    9696$__widgets->lastposts->setting('homeonly',__('Display on:'),1,'combo', 
    9797     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2)); 
    98 $__widgets->lastposts->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0'))); 
    99 $__widgets->lastposts->advanced_setting('class',__('CSS class:'),''); 
     98$__widgets->lastposts->setting('content_only',__('Content only'),0,'check'); 
     99$__widgets->lastposts->setting('class',__('CSS class:'),''); 
    100100 
    101101$__widgets->create('lastcomments',__('Last comments'),array('defaultWidgets','lastcomments'),null,'List of last comments posted'); 
     
    104104$__widgets->lastcomments->setting('homeonly',__('Display on:'),1,'combo', 
    105105     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2)); 
    106 $__widgets->lastcomments->advanced_setting('content_only','',0,'radio', array(array(__('Content only'), '1'), array(__('Enclosing div'), '0'))); 
    107 $__widgets->lastcomments->advanced_setting('class',__('CSS class:'),''); 
     106$__widgets->lastcomments->setting('content_only',__('Content only'),0,'check'); 
     107$__widgets->lastcomments->setting('class',__('CSS class:'),''); 
    108108 
    109109# --BEHAVIOR-- initWidgets 
  • plugins/widgets/class.widgets.php

    r2395 r1474  
    139139     public $append_callback = null; 
    140140     private $settings = array(); 
    141      private $advance_id; 
    142      private $advanced_settings = array(); 
    143141      
    144142     public function serialize($order) { 
     
    146144          foreach ($this->settings as $k=>$v) 
    147145               $values[$k]=$v['value']; 
    148           foreach ($this->advanced_settings as $k=>$v) 
    149                $values[$k]=$v['value']; 
    150146          $values['id']=$this->id; 
    151147          $values['order']=$order; 
     
    193189     public function __get($n) 
    194190     { 
    195           $setting = null; 
    196191          if (isset($this->settings[$n])) { 
    197                $setting = $this->settings[$n]['value']; 
    198           } else if (isset($this->advanced_settings[$n])) { 
    199                $setting = $this->advanced_settings[$n]['value']; 
    200           } 
    201           return $setting; 
     192               return $this->settings[$n]['value']; 
     193          } 
     194          return null; 
    202195     } 
    203196      
     
    206199          if (isset($this->settings[$n])) { 
    207200               $this->settings[$n]['value'] = $v; 
    208           } else if (isset($this->advanced_settings[$n])) { 
    209                $this->advanced_settings[$n]['value'] = $v; 
    210201          } 
    211202     } 
     
    231222     } 
    232223      
    233      public function advanced_setting($name,$title,$value,$type='text') 
    234      { 
    235           if ($type == 'combo' || $type == 'radio') { 
    236                $options = @func_get_arg(4); 
    237                if (!is_array($options)) { 
    238                     return false; 
    239                } 
    240           } 
    241            
    242           $this->advanced_settings[$name] = array( 
    243                'title' => $title, 
    244                'type' => $type, 
    245                'value' => $value 
    246           ); 
    247            
    248           if (isset($options)) { 
    249                $this->advanced_settings[$name]['options'] = $options; 
    250           } 
    251      } 
    252       
    253      public function advance_settings() 
    254      { 
    255           return $this->advanced_settings; 
    256      } 
    257       
    258224     public function settings() 
    259225     { 
     
    266232          foreach ($this->settings as $id => $s) 
    267233          { 
    268                $res .= $this->formSetting($id,$s,$pr,$i=0); 
     234               $wfid = "wf-".$i; 
     235               $iname = $pr ? $pr.'['.$id.']' : $id; 
     236               switch ($s['type']) 
     237               { 
     238                    case 'text': 
     239                         $res .= 
     240                         '<p><label for="'.$wfid.'">'.$s['title'].'</label> '. 
     241                         form::field(array($iname,$wfid),20,255,html::escapeHTML($s['value']),'maximal'). 
     242                         '</p>'; 
     243                         break; 
     244                    case 'textarea': 
     245                         $res .= 
     246                         '<p><label for="'.$wfid.'">'.$s['title'].'</label> '. 
     247                         form::textarea(array($iname,$wfid),30,5,html::escapeHTML($s['value']),'maximal'). 
     248                         '</p>'; 
     249                         break; 
     250                    case 'check': 
     251                         $res .= 
     252                         '<p>'.form::hidden(array($iname),'0'). 
     253                         '<label class="classic" for="'.$wfid.'">'. 
     254                         form::checkbox(array($iname,$wfid),'1',$s['value']).' '.$s['title']. 
     255                         '</label></p>'; 
     256                         break; 
     257                    case 'combo': 
     258                         $res .= 
     259                         '<p><label for="'.$wfid.'">'.$s['title'].'</label> '. 
     260                         form::combo(array($iname,$wfid),$s['options'],$s['value']). 
     261                         '</p>'; 
     262                         break; 
     263               } 
    269264               $i++; 
    270           } 
    271            
    272           if ( count($this->advanced_settings) > 0 ) 
    273           { 
    274                $res .= '<div class="widgetAdvancedSettings">'; 
    275                $res .= '<h5>'.__('Réglages avancés').'</h5>'; 
    276            
    277                foreach ($this->advanced_settings as $id => $s) 
    278                { 
    279                     $res .= $this->formSetting($id,$s,$pr,$i); 
    280                     $i++; 
    281                } 
    282                 
    283                $res .= '</div>'; 
    284           } 
    285            
    286           return $res; 
    287      } 
    288       
    289      public function formSetting($id,$s,$pr='',&$i=0) 
    290      { 
    291           $res = ''; 
    292           $wfid = "wf-".$i; 
    293           $iname = $pr ? $pr.'['.$id.']' : $id; 
    294           switch ($s['type']) 
    295           { 
    296                case 'text': 
    297                     $res .= 
    298                     '<p><label for="'.$wfid.'">'.$s['title'].'</label> '. 
    299                     form::field(array($iname,$wfid),20,255,html::escapeHTML($s['value']),'maximal'). 
    300                     '</p>'; 
    301                     break; 
    302                case 'textarea': 
    303                     $res .= 
    304                     '<p><label for="'.$wfid.'">'.$s['title'].'</label> '. 
    305                     form::textarea(array($iname,$wfid),30,5,html::escapeHTML($s['value']),'maximal'). 
    306                     '</p>'; 
    307                     break; 
    308                case 'check': 
    309                     $res .= 
    310                     '<p>'.form::hidden(array($iname),'0'). 
    311                     '<label class="classic" for="'.$wfid.'">'. 
    312                     form::checkbox(array($iname,$wfid),'1',$s['value']).' '.$s['title']. 
    313                     '</label></p>'; 
    314                     break; 
    315                case 'radio': 
    316                     $res .= '<p>'.($s['title'] ? '<label class="classic">'.$s['title'].'</label><br/>' : ''); 
    317                     if(!empty($s['options'])) { 
    318                          foreach ($s['options'] as $k => $v) { 
    319                               $res .= $k > 0 ? '<br/>' : ''; 
    320                               $res .= 
    321                               '<label class="classic" for="'.$wfid.'-'.$k.'">'. 
    322                               form::radio(array($iname,$wfid.'-'.$k),$v[1],$s['value'] == $v[1]).' '.$v[0]. 
    323                               '</label>'; 
    324                          } 
    325                     } 
    326                     $res .= '</p>'; 
    327                     break; 
    328                case 'combo': 
    329                     $res .= 
    330                     '<p><label for="'.$wfid.'">'.$s['title'].'</label> '. 
    331                     form::combo(array($iname,$wfid),$s['options'],$s['value']). 
    332                     '</p>'; 
    333                     break; 
    334265          } 
    335266           
  • plugins/widgets/dragdrop.js

    r2395 r1766  
    2727          handle: ".widget-name", 
    2828          placeholder: "ui-sortable-placeholder", 
    29           items: "li:not(.sortable-delete-placeholder,.empty-widgets)", 
     29          items: "li:not(.sortable-delete-placeholder)", 
    3030          connectWith: ".connected, .sortable-delete", 
    3131          start: function( event, ui ) { 
     
    4343                
    4444               // signale les zones vides 
    45                if( ul.find('li:not(.empty-widgets)').length == 0 ) { 
    46                     ul.find('li.empty-widgets').show(); 
    47                     field.find('ul.sortable-delete').hide(); 
    48                } else { 
    49                     ul.find('li.empty-widgets').hide(); 
    50                     field.find('ul.sortable-delete').show(); 
    51                } 
     45               if( ul.find('li').length == 0 ) 
     46                     field.find('.empty-widgets').show(); 
     47               else field.find('.empty-widgets').hide(); 
    5248                
    5349               // remove 
     
    9995          } 
    10096     }); 
    101       
    102      $("li.ui-draggable, ul.ui-sortable li") 
    103           .not('ul.sortable-delete li, li.empty-widgets') 
    104           .css({'cursor':'move'}); 
     97     $("li.ui-draggable, ul.ui-sortable li").css({'cursor':'move'}); 
    10598}); 
  • plugins/widgets/index.php

    r2395 r1993  
    1313 
    1414include dirname(__FILE__).'/_default_widgets.php'; 
     15 
     16# Loading navigation, extra widgets and custom widgets 
     17$widgets_nav = null; 
     18if ($core->blog->settings->widgets->widgets_nav) { 
     19     $widgets_nav = dcWidgets::load($core->blog->settings->widgets->widgets_nav); 
     20} 
     21$widgets_extra = null; 
     22if ($core->blog->settings->widgets->widgets_extra) { 
     23     $widgets_extra = dcWidgets::load($core->blog->settings->widgets->widgets_extra); 
     24} 
     25$widgets_custom = null; 
     26if ($core->blog->settings->widgets->widgets_custom) { 
     27     $widgets_custom = dcWidgets::load($core->blog->settings->widgets->widgets_custom); 
     28} 
     29 
     30$append_combo = array( 
     31     '-' => 0, 
     32     __('navigation') => 'nav', 
     33     __('extra') => 'extra', 
     34     __('custom') => 'custom' 
     35); 
     36 
     37function literalNullString($v) 
     38{ 
     39     if ($v == '') { 
     40          return '&lt;'.__('empty string').'&gt;'; 
     41     } 
     42     return $v; 
     43} 
     44 
     45# Adding widgets to sidebars 
     46if (!empty($_POST['append']) && is_array($_POST['addw'])) 
     47{ 
     48     # Filter selection 
     49     $addw = array(); 
     50     foreach ($_POST['addw'] as $k => $v) { 
     51          if (($v == 'extra' || $v == 'nav' || $v == 'custom') && $__widgets->{$k} !== null ) { 
     52               $addw[$k] = $v; 
     53          } 
     54     } 
     55      
     56     # Append widgets 
     57     if (!empty($addw)) 
     58     { 
     59          if (!($widgets_nav instanceof dcWidgets)) { 
     60               $widgets_nav = new dcWidgets; 
     61          } 
     62          if (!($widgets_extra instanceof dcWidgets)) { 
     63               $widgets_extra = new dcWidgets(); 
     64          } 
     65          if (!($widgets_custom instanceof dcWidgets)) { 
     66               $widgets_custom = new dcWidgets(); 
     67          } 
     68           
     69          foreach ($addw as $k => $v) 
     70          { 
     71               switch ($v) { 
     72                    case 'nav': 
     73                         $widgets_nav->append($__widgets->{$k}); 
     74                         break; 
     75                    case 'extra': 
     76                         $widgets_extra->append($__widgets->{$k}); 
     77                         break; 
     78                    case 'custom': 
     79                         $widgets_custom->append($__widgets->{$k}); 
     80                         break; 
     81               } 
     82          } 
     83           
     84          try { 
     85               $core->blog->settings->addNamespace('widgets'); 
     86               $core->blog->settings->widgets->put('widgets_nav',$widgets_nav->store()); 
     87               $core->blog->settings->widgets->put('widgets_extra',$widgets_extra->store()); 
     88               $core->blog->settings->widgets->put('widgets_custom',$widgets_custom->store()); 
     89               $core->blog->triggerBlog(); 
     90               http::redirect($p_url); 
     91          } catch (Exception $e) { 
     92               $core->error->add($e->getMessage()); 
     93          } 
     94     } 
     95} 
     96 
     97# Update sidebars 
     98if (!empty($_POST['wup'])) 
     99{ 
     100     if (!isset($_POST['w']) || !is_array($_POST['w'])) { 
     101          $_POST['w'] = array(); 
     102     } 
     103      
     104     try 
     105     { 
     106          # Removing mark as _rem widgets 
     107          foreach ($_POST['w'] as $nsid => $nsw) { 
     108               foreach ($nsw as $i => $v) { 
     109                    if (!empty($v['_rem'])) { 
     110                         unset($_POST['w'][$nsid][$i]); 
     111                         continue; 
     112                    } 
     113               } 
     114          } 
     115           
     116          if (!isset($_POST['w']['nav'])) { 
     117               $_POST['w']['nav'] = array(); 
     118          } 
     119          if (!isset($_POST['w']['extra'])) { 
     120               $_POST['w']['extra'] = array(); 
     121          } 
     122          if (!isset($_POST['w']['custom'])) { 
     123               $_POST['w']['custom'] = array(); 
     124          } 
     125           
     126          $widgets_nav = dcWidgets::loadArray($_POST['w']['nav'],$__widgets); 
     127          $widgets_extra = dcWidgets::loadArray($_POST['w']['extra'],$__widgets); 
     128          $widgets_custom = dcWidgets::loadArray($_POST['w']['custom'],$__widgets); 
     129           
     130          $core->blog->settings->addNamespace('widgets'); 
     131          $core->blog->settings->widgets->put('widgets_nav',$widgets_nav->store()); 
     132          $core->blog->settings->widgets->put('widgets_extra',$widgets_extra->store()); 
     133          $core->blog->settings->widgets->put('widgets_custom',$widgets_custom->store()); 
     134          $core->blog->triggerBlog(); 
     135           
     136          http::redirect($p_url); 
     137     } 
     138     catch (Exception $e) 
     139     { 
     140          $core->error->add($e->getMessage()); 
     141     } 
     142} 
     143elseif (!empty($_POST['wreset'])) 
     144{ 
     145     try 
     146     { 
     147          $core->blog->settings->addNamespace('widgets'); 
     148          $core->blog->settings->widgets->put('widgets_nav',''); 
     149          $core->blog->settings->widgets->put('widgets_extra',''); 
     150          $core->blog->settings->widgets->put('widgets_custom',''); 
     151          $core->blog->triggerBlog(); 
     152           
     153          http::redirect($p_url); 
     154     } 
     155     catch (Exception $e) 
     156     { 
     157          $core->error->add($e->getMessage()); 
     158     } 
     159} 
    15160?> 
    16161<html> 
     
    42187<body> 
    43188<?php 
    44 # Loading navigation, extra widgets and custom widgets 
    45 $widgets_nav = null; 
    46 if ($core->blog->settings->widgets->widgets_nav) { 
    47      $widgets_nav = dcWidgets::load($core->blog->settings->widgets->widgets_nav); 
    48 } 
    49 $widgets_extra = null; 
    50 if ($core->blog->settings->widgets->widgets_extra) { 
    51      $widgets_extra = dcWidgets::load($core->blog->settings->widgets->widgets_extra); 
    52 } 
    53 $widgets_custom = null; 
    54 if ($core->blog->settings->widgets->widgets_custom) { 
    55      $widgets_custom = dcWidgets::load($core->blog->settings->widgets->widgets_custom); 
    56 } 
    57  
    58 $append_combo = array( 
    59      '-' => 0, 
    60      __('navigation') => 'nav', 
    61      __('extra') => 'extra', 
    62      __('custom') => 'custom' 
    63 ); 
    64  
    65 function literalNullString($v) 
    66 { 
    67      if ($v == '') { 
    68           return '&lt;'.__('empty string').'&gt;'; 
    69      } 
    70      return $v; 
    71 } 
    72  
    73 # Adding widgets to sidebars 
    74 if (!empty($_POST['append']) && is_array($_POST['addw'])) 
    75 { 
    76      # Filter selection 
    77      $addw = array(); 
    78      foreach ($_POST['addw'] as $k => $v) { 
    79           if (($v == 'extra' || $v == 'nav' || $v == 'custom') && $__widgets->{$k} !== null ) { 
    80                $addw[$k] = $v; 
    81           } 
    82      } 
    83            
    84      # Append 1 widget 
    85      $wid = false; 
    86      if( gettype($_POST['append']) == 'array' && count($_POST['append']) == 1 ) { 
    87           $wid = array_keys($_POST['append']); 
    88           $wid = $wid[0]; 
    89      } 
    90       
    91      # Append widgets 
    92      if (!empty($addw)) 
    93      { 
    94           if (!($widgets_nav instanceof dcWidgets)) { 
    95                $widgets_nav = new dcWidgets; 
    96           } 
    97           if (!($widgets_extra instanceof dcWidgets)) { 
    98                $widgets_extra = new dcWidgets(); 
    99           } 
    100           if (!($widgets_custom instanceof dcWidgets)) { 
    101                $widgets_custom = new dcWidgets(); 
    102           } 
    103            
    104           foreach ($addw as $k => $v) 
    105           { 
    106                if( !$wid || $wid == $k ) 
    107                { 
    108                     switch ($v) { 
    109                          case 'nav': 
    110                               $widgets_nav->append($__widgets->{$k}); 
    111                               break; 
    112                          case 'extra': 
    113                               $widgets_extra->append($__widgets->{$k}); 
    114                               break; 
    115                          case 'custom': 
    116                               $widgets_custom->append($__widgets->{$k}); 
    117                               break; 
    118                     } 
    119                } 
    120                 
    121           } 
    122            
    123           try { 
    124                $core->blog->settings->addNamespace('widgets'); 
    125                $core->blog->settings->widgets->put('widgets_nav',$widgets_nav->store()); 
    126                $core->blog->settings->widgets->put('widgets_extra',$widgets_extra->store()); 
    127                $core->blog->settings->widgets->put('widgets_custom',$widgets_custom->store()); 
    128                $core->blog->triggerBlog(); 
    129                http::redirect($p_url); 
    130           } catch (Exception $e) { 
    131                $core->error->add($e->getMessage()); 
    132           } 
    133      } 
    134 } 
    135  
    136 # Update sidebars 
    137 if (!empty($_POST['wup'])) 
    138 { 
    139      if (!isset($_POST['w']) || !is_array($_POST['w'])) { 
    140           $_POST['w'] = array(); 
    141      } 
    142       
    143      try 
    144      { 
    145           # Removing mark as _rem widgets 
    146           foreach ($_POST['w'] as $nsid => $nsw) { 
    147                foreach ($nsw as $i => $v) { 
    148                     if (!empty($v['_rem'])) { 
    149                          unset($_POST['w'][$nsid][$i]); 
    150                          continue; 
    151                     } 
    152                } 
    153           } 
    154            
    155           if (!isset($_POST['w']['nav'])) { 
    156                $_POST['w']['nav'] = array(); 
    157           } 
    158           if (!isset($_POST['w']['extra'])) { 
    159                $_POST['w']['extra'] = array(); 
    160           } 
    161           if (!isset($_POST['w']['custom'])) { 
    162                $_POST['w']['custom'] = array(); 
    163           } 
    164            
    165           $widgets_nav = dcWidgets::loadArray($_POST['w']['nav'],$__widgets); 
    166           $widgets_extra = dcWidgets::loadArray($_POST['w']['extra'],$__widgets); 
    167           $widgets_custom = dcWidgets::loadArray($_POST['w']['custom'],$__widgets); 
    168            
    169           $core->blog->settings->addNamespace('widgets'); 
    170           $core->blog->settings->widgets->put('widgets_nav',$widgets_nav->store()); 
    171           $core->blog->settings->widgets->put('widgets_extra',$widgets_extra->store()); 
    172           $core->blog->settings->widgets->put('widgets_custom',$widgets_custom->store()); 
    173           $core->blog->triggerBlog(); 
    174            
    175           http::redirect($p_url); 
    176      } 
    177      catch (Exception $e) 
    178      { 
    179           $core->error->add($e->getMessage()); 
    180      } 
    181 } 
    182 elseif (!empty($_POST['wreset'])) 
    183 { 
    184      try 
    185      { 
    186           $core->blog->settings->addNamespace('widgets'); 
    187           $core->blog->settings->widgets->put('widgets_nav',''); 
    188           $core->blog->settings->widgets->put('widgets_extra',''); 
    189           $core->blog->settings->widgets->put('widgets_custom',''); 
    190           $core->blog->triggerBlog(); 
    191            
    192           http::redirect($p_url); 
    193      } 
    194      catch (Exception $e) 
    195      { 
    196           $core->error->add($e->getMessage()); 
    197      } 
    198 } 
    199 /*?> 
    200 <html> 
    201 <head> 
    202   <title><?php echo __('Widgets'); ?></title> 
    203   <style type="text/css"> 
    204   <?php echo file_get_contents(dirname(__FILE__).'/style.css'); ?> 
    205   </style> 
    206   <?php 
    207           echo 
    208                dcPage::jsLoad('js/jquery/jquery-ui.custom.js'). 
    209                dcPage::jsLoad('index.php?pf=widgets/widgets.js'); 
    210   ?> 
    211   <?php  
    212      $core->auth->user_prefs->addWorkspace('accessibility');  
    213      $user_dm_nodragdrop = $core->auth->user_prefs->accessibility->nodragdrop; 
    214   ?> 
    215   <?php if (!$user_dm_nodragdrop) : ?> 
    216   <script type="text/javascript" src="index.php?pf=widgets/dragdrop.js"></script> 
    217   <?php endif; ?> 
    218   <script type="text/javascript"> 
    219   //<![CDATA[ 
    220   <?php echo dcPage::jsVar('dotclear.msg.confirm_widgets_reset', 
    221      __('Are you sure you want to reset sidebars?')); ?> 
    222   //]]> 
    223   </script> 
    224   <?php echo(dcPage::jsConfirmClose('sidebarsWidgets')); ?> 
    225 </head> 
    226 <body> 
    227 <?php*/ 
    228189echo dcPage::breadcrumb( 
    229190     array( 
     
    236197'<form id="listWidgets" action="'.$p_url.'" method="post"  class="widgets">'. 
    237198'<h3>'.__('Available widgets').'</h3>'. 
    238 '<p>'.__('Drag widgets from this list to one of the sidebars, for add.').'</p>'. 
     199'<p>'.__('Move widgets from this list to one of the sidebars.').'</p>'. 
    239200'<ul id="widgets-ref">'; 
    240201 
     
    246207     ($w->desc() != '' ? ' <span class="form-note">'.__($w->desc()).'</span>' : '').'</p>'. 
    247208     '<p class="manual-move remove-if-drag"><label class="classic">'.__('Append to:').'</label> '. 
    248      form::combo(array('addw['.$w->id().']'),$append_combo). 
    249      '<input type="submit" name="append['.$w->id().']" value="'.__('Add').'" /></p>'. 
     209     form::combo(array('addw['.$w->id().']'),$append_combo).'</p>'. 
    250210     '<div class="widgetSettings hidden-if-drag">'.$w->formSettings('w[void][0]',$j).'</div>'. 
    251211     '</li>'; 
     
    362322     } 
    363323      
     324     $res .= '<p class="empty-widgets" '.(!$widgets->isEmpty() ? 'style="display: none;"' : '').'>'.__('No widget.').'</p>'; 
     325      
    364326     $res .= '<ul id="'.$id.'" class="connected">'; 
    365       
    366      $res .= '<li class="empty-widgets" '.(!$widgets->isEmpty() ? 'style="display: none;"' : '').'>'.__('No widget for now.').'</li>'; 
    367327      
    368328     $i = 0; 
     
    386346      
    387347     $res .= '</ul>'; 
    388       
    389      $res .= '<ul class="sortable-delete"'.($i > 0 ? '':' style="display: none;"').'><li class="sortable-delete-placeholder">'. 
    390                __('Drag widgets here to remove.').'</li></ul>'; 
     348 
     349     if ($i > 0) { 
     350          $res .= '<ul class="sortable-delete"><li class="sortable-delete-placeholder">'. 
     351               __('Drag widgets here to remove them from this sidebar.').'</li></ul>'; 
     352     } 
    391353      
    392354     return $res; 
  • plugins/widgets/style.css

    r2395 r1669  
    3838     margin-bottom: 1em; 
    3939     list-style: none; 
    40 } 
    41 #dndnav > li.empty-widgets, 
    42 #dndextra > li.empty-widgets, 
    43 #dndcustom > li.empty-widgets { 
    44      border: 0; 
    4540} 
    4641#dndnav > li.ui-sortable-placeholder, 
Note: See TracChangeset for help on using the changeset viewer.

Sites map