Dotclear


Ignore:
Timestamp:
06/27/11 14:38:41 (14 years ago)
Author:
Franck <carnet.franck.paul@…>
Branch:
themes
Message:

Premier pas pour la gestion des stickers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • themes/ductile/_config.php

    r395 r419  
    1313 
    1414l10n::set(dirname(__FILE__).'/locales/'.$_lang.'/main'); 
     15 
     16$sticker_images = array( 
     17     __('Contact') => 'sticker-contact.png', 
     18     __('Feed') => 'sticker-feed.png', 
     19     __('About') => 'sticker-about.png' 
     20); 
    1521 
    1622$fonts = array( 
     
    94100$ductile_user = array_merge($ductile_base,$ductile_user); 
    95101 
     102$ductile_stickers_base = array( 
     103     array('label' => null,'url' => null,'image' => null), 
     104     array('label' => null,'url' => null,'image' => null), 
     105     array('label' => null,'url' => null,'image' => null) 
     106); 
     107 
     108$ductile_stickers = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_stickers'); 
     109$ductile_stickers = @unserialize($ductile_stickers); 
     110if (!is_array($ductile_stickers)) { 
     111     $ductile_stickers = array(); 
     112} 
     113 
     114$ductile_stickers = $ductile_stickers_base; 
     115 
    96116$conf_tab = isset($_POST['conf_tab']) ? $_POST['conf_tab'] : 'html'; 
    97117 
     
    103123          if ($conf_tab == 'html') { 
    104124               $ductile_user['subtitle_hidden'] = (integer) !empty($_POST['subtitle_hidden']); 
     125                
     126               $count = 0; 
     127               if (!empty($_POST['sticker1_label']) && !empty($_POST['sticker1_url'])) { 
     128                    $ductile_stickers[$count]['label'] = $_POST['sticker1_label']; 
     129                    $ductile_stickers[$count]['url'] = $_POST['sticker1_url']; 
     130                    $ductile_stickers[$count]['image'] = $_POST['sticker1_image']; 
     131                    $count++; 
     132               } 
     133               if (!empty($_POST['sticker2_label']) && !empty($_POST['sticker2_url'])) { 
     134                    $ductile_stickers[$count]['label'] = $_POST['sticker2_label']; 
     135                    $ductile_stickers[$count]['url'] = $_POST['sticker2_url']; 
     136                    $ductile_stickers[$count]['image'] = $_POST['sticker2_image']; 
     137                    $count++; 
     138               } 
     139               if (!empty($_POST['sticker3_label']) && !empty($_POST['sticker3_url'])) { 
     140                    $ductile_stickers[$count]['label'] = $_POST['sticker3_label']; 
     141                    $ductile_stickers[$count]['url'] = $_POST['sticker3_url']; 
     142                    $ductile_stickers[$count]['image'] = $_POST['sticker3_image']; 
     143                    $count++; 
     144               } 
     145               for ($i = $count; $i < 3; $i++) { 
     146                    $ductile_stickers[$i]['label'] = null; 
     147                    $ductile_stickers[$i]['url'] = null; 
     148                    $ductile_stickers[$i]['image'] = null; 
     149               } 
    105150          } 
    106151           
     
    133178          $core->blog->settings->addNamespace('themes'); 
    134179          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_style',serialize($ductile_user)); 
     180          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_stickers',serialize($ductile_stickers)); 
    135181          $core->blog->triggerBlog(); 
    136182 
     
    159205'</fieldset>'; 
    160206 
     207//echo '<fieldset><legend>'.__('Stickers').'</legend>'; 
     208echo '<h3>'.__('Stickers').'</h3>'; 
     209 
     210echo '<table id="stickerslist">'.'<caption>'.__('Stickers').'</caption>'. 
     211'<thead>'. 
     212'<tr>'. 
     213'<th scope="col">'.__('Position').'</th>'. 
     214'<th scope="col">'.__('Label').'</th>'. 
     215'<th scope="col">'.__('URL').'</th>'. 
     216'<th scope="col">'.__('Icon').'</th>'. 
     217'</tr>'. 
     218'</thead>'. 
     219'<tbody>'. 
     220'<tr>'. 
     221'<td scope="raw">1</td>'. 
     222'<td>'.form::field('sticker1_label',20,255,$ductile_stickers[0]['label']).'</td>'. 
     223'<td>'.form::field('sticker1_url',40,255,$ductile_stickers[0]['url']).'</td>'. 
     224'<td>'.form::combo('sticker1_image',$sticker_images,$ductile_stickers[0]['image']).'</td>'. 
     225'</tr>'. 
     226'<tr>'. 
     227'<td scope="raw">2</td>'. 
     228'<td>'.form::field('sticker2_label',20,255,$ductile_stickers[1]['label']).'</td>'. 
     229'<td>'.form::field('sticker2_url',40,255,$ductile_stickers[1]['url']).'</td>'. 
     230'<td>'.form::combo('sticker2_image',$sticker_images,$ductile_stickers[1]['image']).'</td>'. 
     231'</tr>'. 
     232'<tr>'. 
     233'<td scope="raw">3</td>'. 
     234'<td>'.form::field('sticker3_label',20,255,$ductile_stickers[2]['label']).'</td>'. 
     235'<td>'.form::field('sticker3_url',40,255,$ductile_stickers[2]['url']).'</td>'. 
     236'<td>'.form::combo('sticker3_image',$sticker_images,$ductile_stickers[2]['image']).'</td>'. 
     237'</tr>'. 
     238'</tbody>'. 
     239'</table>'; 
     240 
     241//echo '</fieldset>'; 
     242 
    161243echo '<input type="hidden" name="conf_tab" value="html">'; 
    162244echo '<p class="clear"><input type="submit" value="'.__('Save').'" />'.$core->formNonce().'</p>'; 
Note: See TracChangeset for help on using the changeset viewer.

Sites map