Dotclear

Changeset 563:87842010f794 for themes


Ignore:
Timestamp:
07/10/11 21:58:19 (14 years ago)
Author:
Franck <carnet.franck.paul@…>
Branch:
themes
Message:

Mise en place gestion paramétrée des types de liste de billets (home, catégorie, search, tag, archive-month)

Location:
themes/ductile
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • themes/ductile/_config.php

    r515 r563  
    1313 
    1414l10n::set(dirname(__FILE__).'/locales/'.$_lang.'/admin'); 
     15 
     16$list_types = array( 
     17     __('Title') => 'title', 
     18     __('Short') => 'short', 
     19     __('Full') => 'full' 
     20); 
     21 
     22$contexts = array( 
     23     'default' => __('Home (first page)'), 
     24     'default-page' => __('Home (other pages)'), 
     25     'category' => __('Entries for a category'), 
     26     'tag' => __('Entries for a tag'), 
     27     'search' => __('Search result entries'), 
     28     'archive-month' => __('Month archive entries') 
     29); 
    1530 
    1631$sticker_images = array( 
     
    111126if (!is_array($ductile_stickers)) { 
    112127     $ductile_stickers = $ductile_stickers_base; 
     128} 
     129 
     130$ductile_lists_base = array( 
     131     'default' => null, 
     132     'default-page' => null, 
     133     'category' => null, 
     134     'tag' => null, 
     135     'search' => null, 
     136     'archive-month' => null 
     137); 
     138 
     139$ductile_lists = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_entries_lists'); 
     140$ductile_lists = @unserialize($ductile_lists); 
     141if (!is_array($ductile_lists)) { 
     142     $ductile_lists = $ductile_lists_base; 
    113143} 
    114144 
     
    147177                    $ductile_stickers[$i]['image'] = null; 
    148178               } 
     179 
     180               for ($i = 0; $i < count($_POST['list_type']); $i++) { 
     181                    $ductile_lists[$_POST['list_ctx'][$i]] = $_POST['list_type'][$i]; 
     182               } 
     183                
    149184          } 
    150185           
     
    180215          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_style',serialize($ductile_user)); 
    181216          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_stickers',serialize($ductile_stickers)); 
     217          $core->blog->settings->themes->put($core->blog->settings->system->theme.'_entries_lists',serialize($ductile_lists)); 
    182218          $core->blog->triggerBlog(); 
    183219 
     
    242278echo '</fieldset>'; 
    243279 
     280echo '<fieldset><legend>'.__('Entries list types').'</legend>'; 
     281 
     282echo '<table id="entrieslist">'.'<caption>'.__('Entries lists').'</caption>'. 
     283'<thead>'. 
     284'<tr>'. 
     285'<th scope="col">'.__('Context').'</th>'. 
     286'<th scope="col">'.__('Entries list type').'</th>'. 
     287'</tr>'. 
     288'</thead>'. 
     289'<tbody>'; 
     290foreach ($ductile_lists as $k => $v) { 
     291     echo  
     292          '<tr>'. 
     293          '<td scope="raw">'.$contexts[$k].'</td>'. 
     294          '<td>'.form::hidden(array('list_ctx[]'),$k).form::combo(array('list_type[]'),$list_types,$v).'</td>'. 
     295          '</tr>'; 
     296} 
     297echo 
     298'</tbody>'. 
     299'</table>'; 
     300 
     301echo '</fieldset>'; 
     302 
    244303echo '<input type="hidden" name="conf_tab" value="html">'; 
    245304echo '<p class="clear"><input type="submit" value="'.__('Save').'" />'.$core->formNonce().'</p>'; 
  • themes/ductile/_public.php

    r515 r563  
    1717$core->addBehavior('publicInsideFooter',array('tplDuctileTheme','publicInsideFooter')); 
    1818 
     19# Templates 
     20$core->tpl->addValue('ductileEntriesList',array('tplDuctileTheme','ductileEntriesList')); 
     21 
    1922class tplDuctileTheme 
    2023{ 
     24     public static function ductileEntriesList($attr) 
     25     { 
     26          global $core; 
     27          $default = isset($attr['default']) ? trim($attr['default']) : 'short'; 
     28 
     29          $model = ''; 
     30          $s = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_entries_lists'); 
     31          if ($s !== null) { 
     32               $s = @unserialize($s); 
     33               if (is_array($s)) { 
     34                    if (isset($s[$core->url->type])) { 
     35                         $model = $s[$core->url->type]; 
     36                    } 
     37               } 
     38          } 
     39 
     40          $local_attr = array('src' => '_entry-'.($model ? $model : $default).'.html'); 
     41          return $core->tpl->includeFile($local_attr); 
     42     } 
     43 
    2144     public static function publicInsideFooter($core) 
    2245     { 
  • themes/ductile/tpl/archive_month.html

    r470 r563  
    5858       <div class="content-inner"> 
    5959          <tpl:Entries no_content="1"> 
    60                     {{tpl:include src="_entry-title.html"}} 
     60               {{tpl:ductileEntriesList default="title"}} 
    6161            </tpl:Entries> 
    6262       </div> 
  • themes/ductile/tpl/category.html

    r535 r563  
    8787  <tpl:Entries> 
    8888 
    89      {{tpl:include src="_entry-short.html"}} 
     89     {{tpl:ductileEntriesList default="short"}} 
    9090    
    9191    <tpl:EntriesFooter> 
  • themes/ductile/tpl/home.html

    r470 r563  
    6464          <tpl:SysIf current_mode="default"> 
    6565               <tpl:LoopPosition start="1" length="1"> 
    66                {{tpl:include src="_entry-full.html"}} 
    67           </tpl:LoopPosition> 
     66                    {{tpl:include src="_entry-full.html"}} 
     67               </tpl:LoopPosition> 
    6868      
    6969               <tpl:LoopPosition start="2"> 
    70                {{tpl:include src="_entry-short.html"}} 
    71           </tpl:LoopPosition> 
    72      </tpl:SysIf> 
    73       
     70                    {{tpl:ductileEntriesList default="short"}} 
     71               </tpl:LoopPosition> 
     72          </tpl:SysIf> 
     73      
    7474          <!-- Next pages --> 
    7575          <tpl:SysIf current_mode="!default"> 
    76           {{tpl:include src="_entry-short.html"}} 
    77      </tpl:SysIf>    
    78      
     76               {{tpl:ductileEntriesList default="short"}} 
     77          </tpl:SysIf>    
     78 
    7979          <!-- Pagination --> 
    8080    <tpl:EntriesFooter> 
  • themes/ductile/tpl/search.html

    r535 r563  
    6868  <tpl:Entries> 
    6969 
    70           {{tpl:include src="_entry-short.html"}} 
     70     {{tpl:ductileEntriesList default="short"}} 
    7171    
    7272    <tpl:EntriesFooter> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map