Dotclear

Changeset 2477


Ignore:
Timestamp:
07/10/10 19:30:32 (13 years ago)
Author:
Osku
Message:

templator 1.0RC5

Location:
plugins/templator
Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • plugins/templator/_admin.php

    r2411 r2477  
    2121{ 
    2222     $core->addBehavior('adminPostFormSidebar',array('templatorBehaviors','adminPostFormSidebar')); 
    23      $core->addBehavior('adminPageFormSidebar',array('templatorBehaviors','adminPageFormSidebar')); 
     23     $core->addBehavior('adminPageFormSidebar',array('templatorBehaviors','adminPostFormSidebar')); 
    2424 
    2525     $core->addBehavior('adminAfterPostCreate',array('templatorBehaviors','adminBeforePostUpdate')); 
     
    4242          global $core; 
    4343 
    44           $setting = unserialize($core->blog->settings->templator->templator_files_active); 
    4544          $ressources = unserialize($core->blog->settings->templator->templator_files); 
    46           $tpl = array(' ' => ''); 
     45          $tpl = array(__(' — standard — ') => ''); 
    4746          $tpl_post = array(); 
    48           //$type = (isset($_REQUEST['type'])) ?  $_REQUEST['type'] : 'post' ; 
    4947          $selected = ''; 
    5048           
    51           foreach ($setting as $k => $v) { 
    52                if (/*($ressources[$k]['type'] == $type) && */($v['used'] == true)) 
     49          foreach ($ressources as $k => $v) { 
     50               if (($v['isCat'] == false) && ($v['used'] == true)) 
    5351               { 
    54                     $tpl_post= array_merge($tpl_post, array($ressources[$k]['title']=> $k)); 
     52                    $tpl_post= array_merge($tpl_post, array($v['title']=> $k)); 
    5553               } 
    5654          } 
    5755 
    58           if (!empty($tpl_post)) 
     56          $tpl  = array_merge($tpl,$tpl_post); 
     57          if ($post) 
    5958          { 
    60                $tpl  = array_merge($tpl,$tpl_post); 
    61                if ($post) 
    62                { 
    63                     $params['meta_type'] = 'template'; 
    64                     $params['post_id'] = $post->post_id; 
    65                     $post_meta = $core->meta->getMetadata($params); 
    66                     $selected = $post_meta->isEmpty()? '' : $post_meta->meta_id  ; 
    67                } 
    68                 
    69                echo 
    70                '<h3><label for="post_tpl">'.__('Specific template:').'</label></h3>'. 
    71                '<div class="p" id="meta-edit-tpl">'.form::combo('post_tpl',$tpl,$selected).'</div>'; 
     59               $params['meta_type'] = 'template'; 
     60               $params['post_id'] = $post->post_id; 
     61               $post_meta = $core->meta->getMetadata($params); 
     62               $selected = $post_meta->isEmpty()? '' : $post_meta->meta_id  ; 
    7263          } 
    73      } 
    74  
    75      public static function adminPageFormSidebar($post) 
    76      { 
    77           global $core; 
    78  
    79           $setting = unserialize($core->blog->settings->templator->templator_files_active); 
    80           $ressources = unserialize($core->blog->settings->templator->templator_files); 
    81           $tpl = array('' => ''); 
    82           $tpl_post = array(); 
    83           //$type = (isset($_REQUEST['type'])) ? $_REQUEST['type'] : 'page' ; 
    84           $selected = ''; 
    8564           
    86           foreach ($setting as $k => $v) { 
    87                if (/*($ressources[$k]['type'] == $type) && */($v['used'] == true)) 
    88                { 
    89                     $tpl_post= array_merge($tpl_post, array($ressources[$k]['title']=> $k)); 
    90                } 
    91           } 
    92  
    93           if (!empty($tpl_post)) 
    94           { 
    95                $tpl  = array_merge($tpl,$tpl_post); 
    96                if ($post) 
    97                { 
    98                     $params['meta_type'] = 'template'; 
    99                     $params['post_id'] = $post->post_id; 
    100                     $post_meta = $core->meta->getMetadata($params); 
    101                     $selected = $post_meta->isEmpty()? '' : $post_meta->meta_id  ; 
    102                } 
    103                 
    104                echo 
    105                '<h3><label for="post_tpl">'.__('Specific template:').'</label></h3>'. 
    106                '<div class="p" id="meta-edit-tpl">'.form::combo('post_tpl',$tpl,$selected).'</div>'; 
    107           } 
     65          echo 
     66          '<h3><label for="post_tpl">'.__('Specific template:').'</label></h3>'. 
     67          '<div class="p" id="meta-edit-tpl">'.form::combo('post_tpl',$tpl,$selected).'</div>'; 
     68           
    10869     } 
    10970 
     
    160121          if ($action == 'tpl') 
    161122          { 
    162                $setting = unserialize($core->blog->settings->templator->templator_files_active); 
    163123               $ressources = unserialize($core->blog->settings->templator->templator_files); 
    164                $tpl = array('&nbsp;' => ''); 
     124               $tpl = array(__('&nbsp;&mdash;&nbsp;standard&nbsp;&mdash;&nbsp;') => ''); 
    165125               $tpl_post = array(); 
    166126           
    167                foreach ($setting as $k => $v) { 
    168                     if ($v['used'] == true) 
     127               foreach ($ressources as $k => $v) { 
     128                    if (($v['isCat'] == false) && ($v['used'] == true)) 
    169129                    { 
    170                          $tpl_post= array_merge($tpl_post, array($ressources[$k]['title']=> $k)); 
     130                         $tpl_post= array_merge($tpl_post, array($v['title']=> $k)); 
    171131                    } 
    172132               } 
    173133 
    174                if (!empty($tpl_post)) 
    175                { 
    176                     $tpl  = array_merge($tpl,$tpl_post); 
     134 
     135               $tpl  = array_merge($tpl,$tpl_post); 
     136           
     137               echo 
     138               '<h2>'.__('Select template for these entries').'</h2>'. 
     139               '<form action="posts_actions.php" method="post">'. 
     140               '<p><label class="classic">'.__('Choose template:').' '. 
     141               form::combo('post_tpl',$tpl). 
     142               '</label> '. 
     143           
     144               $hidden_fields. 
     145               $core->formNonce(). 
     146               form::hidden(array('action'),'tpl'). 
     147               '<input type="submit" value="'.__('save').'" /></p>'. 
     148               '</form>'; 
    177149                
    178                     echo 
    179                     '<h2>'.__('Select template for these entries').'</h2>'. 
    180                     '<form action="posts_actions.php" method="post">'. 
    181                     '<p><label class="classic">'.__('Choose template:').' '. 
    182                     form::combo('post_tpl',$tpl). 
    183                     '</label> '. 
    184                 
    185                     $hidden_fields. 
    186                     $core->formNonce(). 
    187                     form::hidden(array('action'),'tpl'). 
    188                     '<input type="submit" value="'.__('save').'" /></p>'. 
    189                     '</form>'; 
    190                } 
    191150          } 
    192151     } 
  • plugins/templator/_define.php

    r2411 r2477  
    1717     /* Description*/         'Create and select more templates for your posts', 
    1818     /* Author */             'Osku and contributors', 
    19      /* Version */            '1.0beta', 
     19     /* Version */            '1.0RC5', 
    2020     /* Permissions */        'contentadmin' 
    2121); 
  • plugins/templator/_install.php

    r2411 r2477  
    2828} 
    2929 
    30 $core->blog->settings->addNamespace('templator'); 
    3130$s =& $core->blog->settings->templator; 
    3231$s->put('templator_flag',false,'boolean','Templator activation flag',true,true); 
    3332$s->put('templator_files','','string','My own supplementary template files',true,true); 
    34 $s->put('templator_files_active','','string','My active supplementary template files',true,true); 
    3533 
    3634$core->setVersion('templator',$new_version); 
  • plugins/templator/_prepend.php

    r2411 r2477  
    1313 
    1414if (version_compare(DC_VERSION,'2.2-beta','<')) { return; } 
    15  
     15$core->blog->settings->addNamespace('templator'); 
    1616$__autoload['dcTemplator'] = dirname(__FILE__).'/inc/class.templator.php'; 
    1717?> 
  • plugins/templator/_public.php

    r2411 r2477  
    2222     public static function addTplPath($core) 
    2323     { 
    24           $core->tpl->setPath($core->tpl->getPath(), DC_TPL_CACHE.'/templator/default-templates'); 
     24          $core->tpl->setPath($core->tpl->getPath(), DC_TPL_CACHE.'/templator/'.$core->blog->id.'-default-templates'); 
    2525     } 
    2626      
     
    2828     { 
    2929          global $core; 
     30           
     31          $files_tpl = unserialize($core->blog->settings->templator->templator_files); 
    3032           
    3133          if (array_key_exists($core->url->type,$core->getPostTypes())) 
     
    3638               $post_meta = $core->meta->getMetadata($params); 
    3739                
    38                if (!$post_meta->isEmpty()) 
     40               if (!$post_meta->isEmpty() && $files_tpl[$post_meta->meta_id]['used']) 
    3941               { 
    4042                    $_ctx->current_tpl = $post_meta->meta_id; 
     43               } 
     44          } 
     45           
     46          if (($_ctx->current_tpl == "category.html")  
     47               && preg_match('/^[0-9]{1,}/',$_ctx->categories->cat_id,$cat_id)) 
     48          { 
     49               $tpl = 'category-'.$cat_id[0].'.html'; 
     50               if (($core->tpl->getFilePath($tpl)) && ($files_tpl[$tpl]['used'])) { 
     51                    $_ctx->current_tpl = $tpl; 
    4152               } 
    4253          } 
  • plugins/templator/form.js

    r2116 r2477  
    88          return false; 
    99     }); 
     10 
     11     $("#filecat").parent().parent().hide(); 
     12      
     13      $("#filesource").change(function() {  
     14          var f = $(this).val(); 
     15          if (f == 'category') { 
     16                $("#filename, #filetitle").parent().parent().hide(); 
     17                $("#filecat").parent().parent().show(); 
     18          } 
     19          else { 
     20               $("#filename, #filetitle").parent().parent().show(); 
     21                $("#filecat").parent().parent().hide(); 
     22          } 
     23      }); 
     24 
     25           
    1026}); 
  • plugins/templator/inc/class.templator.php

    r2411 r2477  
    1919     protected $post_default_name = 'post.html'; 
    2020     protected $page_default_name = 'page.html'; 
     21     protected $category_default_name = 'category.html'; 
    2122     protected $template_dir_name = 'default-templates'; 
     23      
     24     public $path; 
    2225      
    2326     public $tpl = array(); 
     
    2831          $this->core =& $core; 
    2932 
     33          $this->path = DC_TPL_CACHE.'/'.$this->self_name.'/'.$this->core->blog->id.'-'.$this->template_dir_name; 
    3034          $this->user_theme = $this->core->blog->themes_path.'/'.$this->core->blog->settings->system->theme; 
    31           //$this->user_theme = path::real($this->core->blog->themes_path.'/'.$this->core->blog->settings->system->theme); 
    3235          $this->user_post_tpl = path::real($this->user_theme.'/tpl/'.$this->post_default_name); 
    3336          $this->user_page_tpl = path::real($this->user_theme.'/tpl/'.$this->page_default_name); 
     37          $this->user_category_tpl = path::real($this->user_theme.'/tpl/'.$this->category_default_name); 
    3438          $this->post_tpl = path::real($this->core->blog->themes_path.'/default/tpl/'.$this->post_default_name); 
    3539          $plugin_page = $this->core->plugins->getModules('pages'); 
    3640          $this->page_tpl = path::real($plugin_page['root'].'/'.$this->template_dir_name.'/'.$this->page_default_name); 
     41          $this->category_tpl = path::real($this->core->blog->themes_path.'/default/tpl/'.$this->category_default_name); 
    3742           
    3843          $this->findTemplates(); 
     
    4247     public function canUseRessources($create=false) 
    4348     { 
    44           //$path = $this->core->plugins->moduleInfo($this->self_name,'root') ; 
    45           //$path_tpl = $this->core->plugins->moduleInfo($this->self_name,'root').'/'.$this->template_dir_name ; 
    46           $path = DC_TPL_CACHE.'/'.$this->self_name; 
    47           $path_tpl = $path.'/'.$this->template_dir_name; 
    48  
    49           if (!is_dir($path)) { 
     49          if (!is_dir($this->path)) { 
    5050               if (!is_writable(DC_TPL_CACHE)) { 
    5151                    return false; 
    5252               } 
    5353               if ($create) { 
    54                     files::makeDir($path); 
     54                    files::makeDir($this->path,true); 
    5555               } 
    5656               return true; 
    5757          } 
    5858           
    59           if (!is_dir($path_tpl)) { 
    60                if (!is_writable($path)) { 
    61                     return false; 
    62                } 
    63                if ($create) { 
    64                     files::makeDir($path_tpl); 
    65                } 
    66                return true; 
    67           } 
    68            
    69           if (!is_writable($path_tpl)) { 
     59          if (!is_writable($this->path)) { 
    7060               return false; 
    7161          } 
     
    115105     public function initializeTpl($name,$type) 
    116106     { 
    117           if  ($type == 'page') 
     107          if  ($type == 'category') 
     108          { 
     109               if ($this->user_category_tpl) { 
     110                    $base = $this->user_category_tpl; 
     111               } else { 
     112                    $base =  $this->category_tpl; 
     113               } 
     114          } 
     115          elseif  ($type == 'page') 
    118116          { 
    119117               if ($this->user_page_tpl) { 
     
    236234          } 
    237235     }     
    238  
     236      
    239237     protected function getDestinationFile($f,$totheme=false) 
    240238     { 
    241           //$dest = $this->core->plugins->moduleInfo($this->self_name,'root').'/'.$this->template_dir_name.'/'.$f ; 
    242           $dest = DC_TPL_CACHE.'/'.$this->self_name.'/'.$this->template_dir_name.'/'.$f; 
     239          $dest = $this->path.'/'.$f; 
    243240          if ($totheme) { 
    244241               $dest = $this->user_theme.'/tpl/'.$f; 
     
    258255     protected function findTemplates() 
    259256     { 
    260           //$this->tpl = $this->getFilesInDir($this->core->plugins->moduleInfo($this->self_name,'root').'/'.$this->template_dir_name); 
    261           $this->tpl = $this->getFilesInDir(DC_TPL_CACHE.'/'.$this->self_name.'/'.$this->template_dir_name); 
     257          $this->tpl = $this->getFilesInDir($this->path); 
    262258          $this->theme_tpl = $this->getFilesInDir(path::real($this->user_theme).'/tpl'); 
    263259           
  • plugins/templator/index.php

    r2411 r2477  
    1414$file_default = $file = array('c'=>null, 'w'=>false, 'type'=>null, 'f'=>null, 'default_file'=>false); 
    1515 
     16// Categories 
     17try { 
     18     $categories = $core->blog->getCategories(array('post_type'=>'post')); 
     19     while ($categories->fetch()) { 
     20          $categories_combo[] = new formSelectOption( 
     21               str_repeat('&nbsp;&nbsp;',$categories->level-1).'&bull; '.html::escapeHTML($categories->cat_title), 
     22               $categories->cat_id 
     23          ); 
     24          $categories_name['category-'.$categories->cat_id.'.html'] = $categories->cat_title; 
     25     } 
     26} catch (Exception $e) { } 
     27 
     28$hasCategories = ($categories->isEmpty()) ? false : true; 
     29 
    1630$combo_source = array( 
    1731     'post.html' => 'post', 
    18      'page.html' => 'page' 
     32     'page.html' => 'page'     
    1933); 
    2034 
    21 foreach ($core->getPostTypes() as $k => $v) { 
    22      $combo_types[ucfirst($k)] = $k; 
     35if (!$categories->isEmpty()) { 
     36     $combo_source['category.html'] = 'category'; 
    2337} 
    2438 
    2539// Settings 
    26 $core->blog->settings->addNamespace('templator'); 
    2740$s = $core->blog->settings->templator; 
    2841$tpl = unserialize($s->templator_files); 
    29 $active_tpl = unserialize($s->templator_files_active); 
    3042$templator_flag = (boolean)$s->templator_flag; 
    3143 
     
    3547$T = $core->themes->getModules($core->blog->settings->system->theme); 
    3648 
     49// New Templator 
    3750$o = new dcTemplator($core); 
    3851$ressources = $o->canUseRessources(true); 
     
    4053$t_files = $o->theme_tpl; 
    4154 
     55// May repair broken settings 
     56foreach ($files as $k => $v) 
     57{ 
     58     if(!isset($tpl[$k])) 
     59     { 
     60          $tpl[$k]; 
     61          $tpl[$k]['title'] = $k;  
     62          $tpl[$k]['isCat'] = preg_match('/^(category)(.+)$/',$k)? true : false;  
     63          $tpl[$k]['used'] = false;  
     64     } 
     65} 
     66foreach ($tpl as $k => $v) 
     67{ 
     68     if(!isset($files[$k])) 
     69     { 
     70          unset($tpl[$k]); 
     71     } 
     72} 
     73 
     74$s->put('templator_files',serialize($tpl),'string','My own supplementary template files'); 
     75 
     76 
    4277$add_template = false; 
    4378 
     
    75110          } 
    76111          unset($tpl[$id]); 
    77           unset($active_tpl[$id]); 
    78           $s->put('templator_files',serialize($tpl),'string','My own supplementary template files',true,true); 
    79112          $s->put('templator_files',serialize($tpl),'string','My own supplementary template files'); 
    80           $s->put('templator_files_active',serialize($active_tpl),'string','My active supplementary template files'); 
    81113          $core->blog->triggerBlog(); 
    82114          http::redirect($p_url.'&del='.$id); 
     
    86118     { 
    87119          $id = $_POST['file_id']; 
    88           $active_tpl[$id]['used'] = false; 
    89            
    90           $s->put('templator_files_active',serialize($active_tpl),'string','My active supplementary template files'); 
     120          $tpl[$id]['used'] = false; 
     121          $s->put('templator_files',serialize($tpl),'string','My own supplementary template files'); 
     122          $core->blog->triggerBlog(); 
    91123          http::redirect($p_url.'&hide='.$id); 
    92124     }     
     
    95127     { 
    96128          $id = $_POST['file_id']; 
    97           $active_tpl[$id]['used'] = true; 
    98            
    99           $s->put('templator_files_active',serialize($active_tpl),'string','My active supplementary template files'); 
     129          $tpl[$id]['used'] = true; 
     130          $s->put('templator_files',serialize($tpl),'string','My own supplementary template files'); 
    100131          $core->blog->triggerBlog(); 
    101132          http::redirect($p_url.'&show='.$id); 
     
    105136     { 
    106137          $id = $_POST['file_id']; 
    107           $tpl[$id]['title'] = $_POST['file_title'][$id]; 
    108            
    109           $s->put('templator_files',serialize($tpl),'string','My own supplementary template files',true,true); 
     138          $tpl[$id]['title'] = empty($_POST['file_title'][$id]) ? $id : $_POST['file_title'][$id]; 
    110139          $s->put('templator_files',serialize($tpl),'string','My own supplementary template files'); 
    111140          $core->blog->triggerBlog(); 
     
    117146          $id = $_POST['file_id']; 
    118147          $o->copyTpl($id); 
    119  
    120           //$core->blog->triggerBlog(); 
     148          $core->blog->triggerBlog(); 
    121149          http::redirect($p_url.'&copy='.$id); 
    122150     } 
     
    132160     { 
    133161          $templator_flag = (empty($_POST['templator_flag'])) ? false : true; 
    134  
    135162          $s->put('templator_flag',$templator_flag,'boolean','Templator activation flag'); 
    136163          $core->blog->triggerBlog(); 
     
    143170} 
    144171 
    145 if (!empty($_POST['filename']) && $core->auth->isSuperAdmin()) 
    146 { 
    147      $type = $_POST['filetype']; 
     172if (!empty($_POST['filesource']) && $core->auth->isSuperAdmin()) 
     173{ 
    148174     $source = $_POST['filesource']; 
    149175     $name = files::tidyFileName($_POST['filename']).'.html'; 
    150  
     176     $isCat = false; 
     177     if ($source == 'category') 
     178     { 
     179          $name = 'category-'.$_POST['filecat'].'.html'; 
     180          $isCat = true; 
     181     } 
     182     $title = (empty($_POST['filetitle'])) ? $name : trim($_POST['filetitle']); 
     183      
    151184     try { 
    152185          $o->initializeTpl($name,$source); 
    153           $tpl[$name]['title'] = (empty($_POST['filetitle'])) ? $name : trim($_POST['filetitle']);  
    154           //$tpl[$name]['type'] = $type;  
    155           $active_tpl[$name]['used'] = true;  
    156           $s->put('templator_files',serialize($tpl),'string','My own supplementary template files',true,true); 
     186          $tpl[$name]['title'] = $title;  
     187          $tpl[$name]['isCat'] = $isCat;  
     188          $tpl[$name]['used'] = true;  
    157189          $s->put('templator_files',serialize($tpl),'string','My own supplementary template files'); 
    158           $s->put('templator_files_active',serialize($active_tpl),'string','My active supplementary template files'); 
    159190     } catch (Exception $e) { 
    160191          $core->error->add($e->getMessage()); 
     
    163194     if (!$core->error->flag()) { 
    164195          $core->blog->triggerBlog(); 
    165           http::redirect($p_url.'&newtpl='.$type.'&name='.$name); 
     196          http::redirect($p_url.'&newtpl='.$name); 
    166197     } 
    167198} 
     
    174205          $fp = fopen('php://output','wb'); 
    175206          $zip = new fileZip($fp); 
    176           $zip->addDirectory(DC_TPL_CACHE.'/templator/default-templates','',true); 
     207          $zip->addDirectory(DC_TPL_CACHE.'/templator/'.$core->blog->id.'-default-templates/','',true); 
    177208          header('Content-Disposition: attachment;filename=templator-templates.zip'); 
    178209          header('Content-Type: application/x-zip'); 
     
    234265 
    235266if (!empty($_GET['newtpl'])) { 
    236      echo '<p class="message">'.sprintf(__('The template %s has been successfully created.'),$_GET['name']).'</p>'; 
    237 } 
    238  
    239 echo '<div id="private_options">'. 
    240      '<form method="post" action="'.$p_url.'">'. 
    241           '<fieldset>'. 
    242                '<legend>'. __('Plugin activation').'</legend>'. 
    243                     '<p class="field">'. 
    244                          form::checkbox('templator_flag', 1, $templator_flag). 
    245                          '<label class=" classic" for="templator_flag">'.__('Enable extension').'</label>'. 
    246                     '</p>'. 
    247           '</fieldset>'. 
    248           '<p>'.form::hidden(array('p'),'templator'). 
    249           $core->formNonce(). 
    250           '<input type="submit" name="saveconfig" value="'.__('Save configuration').'" /></p></form></div>'; 
     267     echo '<p class="message">'.sprintf(__('The template %s has been successfully created.'),$_GET['newtpl']).'</p>'; 
     268} 
     269 
     270echo '<div id="private_options"> 
     271     <form method="post" action="'.$p_url.'"> 
     272     <fieldset> 
     273     <legend>'. __('Plugin activation').'</legend> 
     274     <p class="field">'. 
     275     form::checkbox('templator_flag', 1, $templator_flag). 
     276     '<label class=" classic" for="templator_flag">'.__('Enable extension').'</label> 
     277     </p> 
     278     <p>'.form::hidden(array('p'),'templator'). 
     279     $core->formNonce(). 
     280     '<input type="submit" name="saveconfig" value="'.__('Save configuration').'" /> 
     281     </p> 
     282     </fieldset> 
     283     </form> 
     284     </div>'; 
    251285 
    252286if (!$core->error->flag()) 
    253287{ 
    254      if ($core->auth->isSuperAdmin()) 
    255      { 
    256           if (!$add_template) { 
    257                echo '<div class="two-cols" id="new-template"><h3><a class="new" id="templator-control" href="#">'. 
    258                __('Create a new template').'</a></h3></div>'; 
    259           } 
    260  
     288     if(!empty($tpl)) 
     289     { 
    261290          echo 
    262           '<div class="col">'. 
    263           '<form action="'.$p_url.'" method="post" id="add-template">'. 
    264           '<fieldset>'. 
    265           '<legend>'.__('Create a new template').'</legend>'. 
    266           '<p><label class="classic required" title="'.__('Required field').'">'.__('Filename:').' '. 
    267           form::field('filename',20,255).'</label><strong>'.html::escapeHTML('.html').'</strong></p>'. 
    268           //'<p class="field"><label>'.__('Usage:').' '. 
    269           //form::combo('filetype',$combo_types).'</label></p>'. 
    270           '<p class="field"><label for="filesource">'.__('Template source:').' '. 
    271           form::combo('filesource',$combo_source).'</label></p>'. 
    272           '<p class="field"><label for="filetitle">'.__('Title:').' '. 
    273           form::field('filetitle',30,255).'</label></p>'. 
    274           '<p>'.form::hidden(array('p'),'templator'). 
    275           $core->formNonce(). 
    276           '<input type="submit" name="add_message" value="'.__('Create').'" /></p>'. 
    277           '</fieldset>'. 
    278           '</form></div>'; 
    279       
    280      } 
    281  
    282      if(!empty($tpl)) 
    283      { 
    284           echo 
    285           '<div class="col">'. 
    286           '<h3>'.__('Available templates').'</h3>'. 
    287           '<table class="maximal">'. 
    288           '<thead>'. 
    289           '<tr>'. 
    290           //'<th >'.__('Usage').'</th>'. 
    291           '<th>'.__('Filename').'</th>'. 
    292           '<th>'.__('Title').'</th>'. 
    293           '<th>'.__('Action').'</th>'. 
    294           '<th>&nbsp;</th>'. 
    295           '</tr>'. 
    296           '</thead>'. 
    297           '<tbody id="tpl-post-list">'; 
     291          '<div class="col"> 
     292          <fieldset> 
     293          <legend>'.__('Available templates').'</legend> 
     294          <table class="maximal"> 
     295          <thead> 
     296          <tr> 
     297          <th>'.__('Filename').'</th> 
     298          <th>'.__('Title').'</th> 
     299          <th>'.__('Action').'</th> 
     300          <th>&nbsp;</th> 
     301          </tr> 
     302          </thead> 
     303          <tbody id="tpl-post-list">'; 
     304           
     305          ksort($tpl); 
    298306      
    299307          foreach ($tpl as $k => $v) 
    300308          { 
    301                //$type = ucfirst($v['type']); 
    302  
    303                if(isset($active_tpl[$k]['used']) && $active_tpl[$k]['used']) { 
     309               if(isset($tpl[$k]['used']) && $tpl[$k]['used']) { 
    304310                    $line = ''; 
    305                     //$status = '<img alt="'.__('available').'" title="'.__('available').'" src="images/check-on.png" />'; 
    306311               } 
    307312               else 
    308313               { 
    309314                    $line = 'offline'; 
    310                     //$status = '<img alt="'.__('unavailable').'" title="'.__('unavailable').'" src="images/check-off.png" />'; 
    311315               } 
     316                
     317               $hisCat = $v['isCat']; 
    312318 
    313319               $edit = ($core->auth->isSuperAdmin()) ?  
     
    316322               echo 
    317323               '<tr class="line '.$line.'" id="l_'.($k).'">'. 
    318                //'<td class="nowrap">'.$type.'</td>'. 
    319324               '<td >'.$k.'</td>'. 
    320                '<td >'. 
     325               '<td >'; 
     326               if (!$hisCat) 
     327               { 
     328                    echo 
    321329                    '<form action="'.$p_url.'" method="post">'. 
    322330                    $core->formNonce(). 
     
    324332                    '<p>'. 
    325333                    form::field(array('file_title['.$k.']','t'.$k),30,255,$v['title']). 
    326                     '&nbsp;<input type="submit" class="update" name="update" value="'.__('Update').'" />&nbsp;'. 
     334                    '&nbsp;<input type="submit" class="update" name="update" value="'.__('Rename').'" />&nbsp;'. 
    327335                    '</p>'. 
    328                     '</form></td>'. 
    329  
     336                    '</form>'; 
     337               } 
     338               else  
     339               { 
     340                    echo __('Category template').'&nbsp;:&nbsp;<strong>'.$categories_name[$k].'</strong>'; 
     341               } 
     342               echo 
     343               '</td>'. 
    330344               '<td>'. 
    331345                    '<form action="'.$p_url.'" method="post"><p>'. 
    332346                    $core->formNonce(). 
    333347                    form::hidden(array('file_id'),html::escapeHTML($k)). 
    334                     ((isset($active_tpl[$k]['used'])) && $active_tpl[$k]['used'] ?  
     348                    ((isset($tpl[$k]['used'])) && $tpl[$k]['used'] ?  
    335349                         '<input type="submit" class="disable" name="disable" value="'.__('Disable').'" /> ' :  
    336350                         '<input type="submit" class="enable" name="enable" value="'.__('Enable').'" /> ' ); 
     
    346360               '</tr>'; 
    347361          } 
    348           echo '</tbody></table> 
    349           <p>'.sprintf(__('The %s button makes a copy to blog theme (<strong>%s</strong>).'),'<span class="copy">'.__('Copy').'</span>',html::escapeHTML($T['name'])).'</p> 
    350           </div>'; 
    351  
     362          echo '</tbody></table>'; 
     363           
     364          if ($core->blog->settings->system->theme != 'default') 
     365          { 
     366               echo '<p>'.sprintf(__('The %s button makes a copy to blog theme (<strong>%s</strong>).'),'<span class="copy">'.__('Copy').'</span>',html::escapeHTML($T['name'])).'</p>'; 
     367          } 
     368           
    352369          if ($core->auth->isSuperAdmin()) 
    353370          { 
     
    355372                    __('Download the templates directory as a zip file').'</a></p>'; 
    356373          } 
     374          echo '</fieldset></div>'; 
     375     } 
     376      
     377     if ($core->auth->isSuperAdmin() && $file['c'] === null) 
     378     { 
     379          if (!$add_template) { 
     380               echo '<div class="two-cols" id="new-template"><h3><a class="new" id="templator-control" href="#">'. 
     381               __('Create a new template').'</a></h3></div>'; 
     382          } 
     383 
     384          echo 
     385          '<div class="col">'. 
     386          '<form action="'.$p_url.'" method="post" id="add-template">'. 
     387          '<fieldset>'. 
     388          '<legend>'.__('Create a new template').'</legend>'. 
     389          '<p class="field"><label for="filesource" class="required">'.__('Template source:').' '. 
     390          form::combo('filesource',$combo_source).'</label></p>'. 
     391          '<p><label for="filename" class="classic required" title="'.__('Required field').'">'.__('Filename:').' '. 
     392          form::field('filename',20,255).'</label><strong>'.html::escapeHTML('.html').'</strong></p>'; 
     393           
     394          if ($hasCategories) { 
     395               echo  
     396               '<p class="field"><label for="filecat">'.__('Category:'). 
     397               form::combo('filecat',$categories_combo,'').'</label></p>'; 
     398          } 
     399           
     400          echo 
     401          '<p class="field"><label for="filetitle">'.__('Title:').' '. 
     402          form::field('filetitle',30,255).'</label></p>'. 
     403          '<p>'.form::hidden(array('p'),'templator'). 
     404          $core->formNonce(). 
     405          '<input type="submit" name="add_message" value="'.__('Create').'" /></p>'. 
     406          '</fieldset>'. 
     407          '</form></div>'; 
     408      
    357409     } 
    358410 
  • plugins/templator/locales/fr/main.po

    r2411 r2477  
    11# Language: Français 
    2 # Module: templator - 0.11.1 
    3 # Date: 2010-06-28 15:23:58 
     2# Module: templator - 1.0RC2 
     3# Date: 2010-07-07 09:27:21 
    44# Translated with translater 1.4.1 
    55 
     
    77msgstr "" 
    88"Content-Type: text/plain; charset=UTF-8\n" 
    9 "Project-Id-Version: templator 0.11.1\n" 
     9"Project-Id-Version: templator 1.0RC2\n" 
    1010"POT-Creation-Date: \n" 
    11 "PO-Revision-Date: 2010-06-28T15:23:58+00:00\n" 
     11"PO-Revision-Date: 2010-07-07T09:27:21+00:00\n" 
    1212"Last-Translator: osku\n" 
    1313"Language-Team: \n" 
     
    1919msgstr "Plus de gabarits" 
    2020 
    21 #: _admin.php:65 
    22 #: _admin.php:98 
     21#: _admin.php:45 
     22#: _admin.php:124 
     23msgid "&nbsp;&mdash;&nbsp;standard&nbsp;&mdash;&nbsp;" 
     24msgstr "&nbsp;&mdash;&nbsp;standard&nbsp;&mdash;&nbsp;" 
     25 
     26#: _admin.php:66 
    2327msgid "Specific template:" 
    2428msgstr "Gabarit spécifique :" 
    2529 
    26 #: _admin.php:122 
     30#: _admin.php:90 
    2731msgid "Appearance" 
    2832msgstr "Aspect" 
    2933 
    30 #: _admin.php:122 
     34#: _admin.php:90 
    3135msgid "Select template" 
    3236msgstr "Sélectionner le gabarit" 
    3337 
    34 #: _admin.php:172 
     38#: _admin.php:138 
    3539msgid "Select template for these entries" 
    3640msgstr "Sélectionner le gabarit pour ces billets" 
    3741 
    38 #: _admin.php:174 
     42#: _admin.php:140 
    3943msgid "Choose template:" 
    4044msgstr "Choisir le gabarit :" 
    4145 
    42 #: _admin.php:181 
    43 #: index.php:367 
     46#: _admin.php:147 
     47#: index.php:419 
    4448msgid "save" 
    4549msgstr "enregistrer" 
     
    4751#: _install.php:17 
    4852msgid "Version 2.2-beta of Dotclear at least is required for module Templator." 
    49 msgstr "La version 2.2-beta de Dotclear est requise pour le moule Templator." 
    50  
    51 #: inc/class.templator.php:81 
     53msgstr "La version 2.2-beta de Dotclear est requise pour le module Templator." 
     54 
     55#: inc/class.templator.php:71 
    5256msgid "File does not exist." 
    5357msgstr "Le fichier n'existe pas." 
    5458 
    55 #: inc/class.templator.php:86 
    56 #: inc/class.templator.php:141 
     59#: inc/class.templator.php:76 
     60#: inc/class.templator.php:139 
    5761msgid "File %s is not readable" 
    5862msgstr "Le fichier %s n'est pas lisible" 
    5963 
    60 #: inc/class.templator.php:101 
     64#: inc/class.templator.php:91 
    6165msgid "No file" 
    6266msgstr "Aucun fichier" 
    6367 
    64 #: index.php:46 
     68#: index.php:81 
    6569msgid "The plugin is unusable with your configuration. You have to change file permissions." 
    6670msgstr "L'extension est inutilisable avec votre configuration. Vous devez modifier les permissions des fichiers." 
    6771 
    68 #: index.php:74 
     72#: index.php:109 
    6973msgid "Cannot delete file." 
    7074msgstr "Impossible d'effacer le fichier" 
    7175 
    72 #: index.php:191 
     76#: index.php:222 
    7377msgid "Templator" 
    7478msgstr "Templator" 
    7579 
    76 #: index.php:195 
     80#: index.php:226 
    7781msgid "Saving document..." 
    7882msgstr "Sauvegarde du document..." 
    7983 
    80 #: index.php:196 
     84#: index.php:227 
    8185msgid "Document saved" 
    8286msgstr "Document sauvegardé" 
    8387 
    84 #: index.php:197 
     88#: index.php:228 
    8589msgid "An error occurred:" 
    86 msgstr "Une erreur s'est produite :" 
    87  
    88 #: index.php:209 
     90msgstr "Une erreur s'est produite :" 
     91 
     92#: index.php:240 
    8993msgid "Supplementary templates" 
    9094msgstr "Gabarits supplémentaires" 
    9195 
    92 #: index.php:212 
     96#: index.php:243 
    9397msgid "Configuration successfully updated." 
    9498msgstr "Configuration mise à jour avec succès." 
    9599 
    96 #: index.php:216 
     100#: index.php:247 
    97101msgid "The template %s is now unavailable." 
    98102msgstr "Le gabarit %s est maintenant indisponible." 
    99103 
    100 #: index.php:220 
     104#: index.php:251 
    101105msgid "The template %s is now available." 
    102106msgstr "Le gabarit %s est maintenant disponible." 
    103107 
    104 #: index.php:224 
     108#: index.php:255 
    105109msgid "The template title has been successfully updated." 
    106110msgstr "Le titre du gabarit a été mis à jour avec succès." 
    107111 
    108 #: index.php:228 
     112#: index.php:259 
    109113msgid "The template has been successfully copied to blog theme." 
    110114msgstr "Le gabarit a été copié vers le thème du blog avec succès." 
    111115 
    112 #: index.php:232 
     116#: index.php:263 
    113117msgid "The template %s has been deleted." 
    114118msgstr "Le gabarit %s a été supprimé." 
    115119 
    116 #: index.php:236 
     120#: index.php:267 
    117121msgid "The template %s has been successfully created." 
    118122msgstr "Le gabarit %s a été créé avec succès." 
    119123 
    120 #: index.php:242 
     124#: index.php:273 
    121125msgid "Plugin activation" 
    122126msgstr "Activation de l'extension" 
    123127 
    124 #: index.php:245 
     128#: index.php:276 
    125129msgid "Enable extension" 
    126130msgstr "Activer l'extension" 
    127131 
    128 #: index.php:250 
     132#: index.php:280 
    129133msgid "Save configuration" 
    130134msgstr "Enregistrer la configuration" 
    131135 
    132 #: index.php:258 
    133 #: index.php:265 
     136#: index.php:293 
     137msgid "Available templates" 
     138msgstr "Gabarits disponibles" 
     139 
     140#: index.php:297 
     141msgid "Filename" 
     142msgstr "Nom de fichier :" 
     143 
     144#: index.php:298 
     145msgid "Title" 
     146msgstr "Titre" 
     147 
     148#: index.php:299 
     149msgid "Action" 
     150msgstr "Action" 
     151 
     152#: index.php:320 
     153msgid "edit this template" 
     154msgstr "éditer le gabarit" 
     155 
     156#: index.php:334 
     157msgid "Rename" 
     158msgstr "Renommer" 
     159 
     160#: index.php:340 
     161msgid "Category template" 
     162msgstr "Gabarit de catégorie" 
     163 
     164#: index.php:349 
     165msgid "Disable" 
     166msgstr "Désactiver" 
     167 
     168#: index.php:350 
     169msgid "Enable" 
     170msgstr "Activer" 
     171 
     172#: index.php:355 
     173#: index.php:363 
     174msgid "Copy" 
     175msgstr "Copier" 
     176 
     177#: index.php:363 
     178msgid "The %s button makes a copy to blog theme (<strong>%s</strong>)." 
     179msgstr "Le bouton %s réalise une copie vers le thème du blog (<strong>%s</strong>)." 
     180 
     181#: index.php:368 
     182msgid "Download the templates directory as a zip file" 
     183msgstr "Télécharger le répertoire des gabarits dans un fichier zip" 
     184 
     185#: index.php:377 
     186#: index.php:384 
    134187msgid "Create a new template" 
    135188msgstr "Créer un nouveau gabarit" 
    136189 
    137 #: index.php:266 
     190#: index.php:385 
     191msgid "Template source:" 
     192msgstr "Gabarit source :" 
     193 
     194#: index.php:387 
    138195msgid "Required field" 
    139196msgstr "Champ obligatoire" 
    140197 
    141 #: index.php:266 
     198#: index.php:387 
    142199msgid "Filename:" 
    143200msgstr "Nom de fichier :" 
    144201 
    145 #: index.php:268 
    146 msgid "Usage:" 
    147 msgstr "Usage :" 
    148  
    149 #: index.php:270 
    150 msgid "Template source:" 
    151 msgstr "Gabarit source :" 
    152  
    153 #: index.php:272 
     202#: index.php:392 
     203msgid "Category:" 
     204msgstr "Catégorie :" 
     205 
     206#: index.php:397 
    154207msgid "Title:" 
    155 msgstr "Titre :" 
    156  
    157 #: index.php:276 
     208msgstr "Titre :" 
     209 
     210#: index.php:401 
    158211msgid "Create" 
    159212msgstr "Créer" 
    160213 
    161 #: index.php:286 
    162 msgid "Available templates" 
    163 msgstr "Gabarits disponibles" 
    164  
    165 #: index.php:290 
    166 msgid "Usage" 
    167 msgstr "Usage" 
    168  
    169 #: index.php:291 
    170 msgid "Filename" 
    171 msgstr "Nom de fichier" 
    172  
    173 #: index.php:292 
    174 msgid "Title" 
    175 msgstr "Titre" 
    176  
    177 #: index.php:293 
    178 msgid "Action" 
    179 msgstr "Action" 
    180  
    181 #: index.php:305 
    182 #: index.php:305 
    183 msgid "available" 
    184 msgstr "disponible" 
    185  
    186 #: index.php:310 
    187 #: index.php:310 
    188 msgid "unavailable" 
    189 msgstr "indisponible" 
    190  
    191 #: index.php:314 
    192 msgid "edit this template" 
    193 msgstr "éditer le gabarit" 
    194  
    195 #: index.php:326 
    196 msgid "Update" 
    197 msgstr "Mettre à jour" 
    198  
    199 #: index.php:335 
    200 msgid "Disable" 
    201 msgstr "Désactiver" 
    202  
    203 #: index.php:336 
    204 msgid "Enable" 
    205 msgstr "Activer" 
    206  
    207 #: index.php:339 
    208 #: index.php:345 
    209 msgid "Copy" 
    210 msgstr "Copier" 
    211  
    212 #: index.php:345 
    213 msgid "The %s button makes a copy to blog theme (<strong>%s</strong>)." 
    214 msgstr "Le bouton %s réalise une copie vers le thème du blog (<strong>%s</strong>)." 
    215  
    216 #: index.php:351 
    217 msgid "Download the templates directory as a zip file" 
    218 msgstr "Télécharger le répertoire des gabarits dans un fichier zip" 
    219  
    220 #: index.php:360 
     214#: index.php:412 
    221215msgid "File editor" 
    222216msgstr "Éditeur de fichier" 
    223217 
    224 #: index.php:361 
     218#: index.php:413 
    225219msgid "Editing file %s" 
    226220msgstr "Modification du fichier %s" 
    227221 
    228 #: index.php:370 
     222#: index.php:422 
    229223msgid "delete" 
    230224msgstr "supprimer" 
    231225 
    232 #: index.php:377 
     226#: index.php:429 
    233227msgid "This file is not writable. Please check your files permissions." 
    234228msgstr "Ce fichier ne peut pas être modifié. Veuillez vérifier les permissions des fichiers." 
Note: See TracChangeset for help on using the changeset viewer.

Sites map