Dotclear

Changeset 2411


Ignore:
Timestamp:
06/29/10 01:19:42 (13 years ago)
Author:
Osku
Message:

Templator : 1.0beta (DC 2.2 only)

Location:
plugins/templator
Files:
1 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • plugins/templator/_admin.php

    r2162 r2411  
    1818          $core->auth->check('admin',$core->blog->id)); 
    1919 
    20 if ($core->blog->settings->templator_flag) 
     20if ($core->blog->settings->templator->templator_flag) 
    2121{ 
    2222     $core->addBehavior('adminPostFormSidebar',array('templatorBehaviors','adminPostFormSidebar')); 
     
    3131     $core->addBehavior('adminPostsActions',array('templatorBehaviors','adminPostsActions')); 
    3232     $core->addBehavior('adminPostsActionsContent',array('templatorBehaviors','adminPostsActionsContent')); 
     33     $core->addBehavior('adminPagesActionsCombo',array('templatorBehaviors','adminPostsActionsCombo')); 
     34     $core->addBehavior('adminPagesActions',array('templatorBehaviors','adminPostsActions')); 
     35     $core->addBehavior('adminPagesActionsContent',array('templatorBehaviors','adminPostsActionsContent'));    
    3336} 
    3437 
     
    3942          global $core; 
    4043 
    41           $meta = new dcMeta($core); 
    42  
    43           $setting = unserialize($core->blog->settings->templator_files_active); 
    44           $ressources = unserialize($core->blog->settings->templator_files); 
     44          $setting = unserialize($core->blog->settings->templator->templator_files_active); 
     45          $ressources = unserialize($core->blog->settings->templator->templator_files); 
    4546          $tpl = array(' ' => ''); 
    4647          $tpl_post = array(); 
     48          //$type = (isset($_REQUEST['type'])) ?  $_REQUEST['type'] : 'post' ; 
     49          $selected = ''; 
    4750           
    4851          foreach ($setting as $k => $v) { 
    49                if (($ressources[$k]['type'] == 'post') && ($v['used'] == true)) 
     52               if (/*($ressources[$k]['type'] == $type) && */($v['used'] == true)) 
    5053               { 
    5154                    $tpl_post= array_merge($tpl_post, array($ressources[$k]['title']=> $k)); 
     
    5861               if ($post) 
    5962               { 
    60                     $post_meta = $meta->getMeta('template',null,null,$post->post_id); 
     63                    $params['meta_type'] = 'template'; 
     64                    $params['post_id'] = $post->post_id; 
     65                    $post_meta = $core->meta->getMetadata($params); 
    6166                    $selected = $post_meta->isEmpty()? '' : $post_meta->meta_id  ; 
    6267               } 
     
    7277          global $core; 
    7378 
    74           $meta = new dcMeta($core); 
    75  
    76           $setting = unserialize($core->blog->settings->templator_files_active); 
    77           $ressources = unserialize($core->blog->settings->templator_files); 
     79          $setting = unserialize($core->blog->settings->templator->templator_files_active); 
     80          $ressources = unserialize($core->blog->settings->templator->templator_files); 
    7881          $tpl = array('' => ''); 
    7982          $tpl_post = array(); 
     83          //$type = (isset($_REQUEST['type'])) ? $_REQUEST['type'] : 'page' ; 
     84          $selected = ''; 
    8085           
    8186          foreach ($setting as $k => $v) { 
    82                if (($ressources[$k]['type'] == 'page') && ($v['used'] == true)) 
     87               if (/*($ressources[$k]['type'] == $type) && */($v['used'] == true)) 
    8388               { 
    8489                    $tpl_post= array_merge($tpl_post, array($ressources[$k]['title']=> $k)); 
     
    9196               if ($post) 
    9297               { 
    93                     $post_meta = $meta->getMeta('template',null,null,$post->post_id); 
     98                    $params['meta_type'] = 'template'; 
     99                    $params['post_id'] = $post->post_id; 
     100                    $post_meta = $core->meta->getMetadata($params); 
    94101                    $selected = $post_meta->isEmpty()? '' : $post_meta->meta_id  ; 
    95102               } 
     
    110117               $tpl = $_POST['post_tpl']; 
    111118                
    112                $meta = new dcMeta($core); 
    113                 
    114                $meta->delPostMeta($post_id,'template'); 
     119               $core->meta->delPostMeta($post_id,'template'); 
    115120               if (!empty($_POST['post_tpl'])) 
    116121               { 
    117                     $meta->setPostMeta($post_id,'template',$tpl); 
     122                    $core->meta->setPostMeta($post_id,'template',$tpl); 
    118123               } 
    119124          } 
     
    131136               try 
    132137               { 
    133                     $meta = new dcMeta($core); 
    134138                    $tpl = $_POST['post_tpl']; 
    135139                     
    136140                    while ($posts->fetch()) 
    137141                    { 
    138                          $meta->delPostMeta($posts->post_id,'template'); 
     142                         $core->meta->delPostMeta($posts->post_id,'template'); 
    139143                         if (!empty($_POST['post_tpl'])) 
    140144                         { 
    141                               $meta->setPostMeta($posts->post_id,'template',$tpl); 
     145                              $core->meta->setPostMeta($posts->post_id,'template',$tpl); 
    142146                         } 
    143147                    } 
     
    156160          if ($action == 'tpl') 
    157161          { 
    158                $meta = new dcMeta($core); 
    159  
    160                $setting = unserialize($core->blog->settings->templator_files_active); 
    161                $ressources = unserialize($core->blog->settings->templator_files); 
     162               $setting = unserialize($core->blog->settings->templator->templator_files_active); 
     163               $ressources = unserialize($core->blog->settings->templator->templator_files); 
    162164               $tpl = array(' ' => ''); 
    163165               $tpl_post = array(); 
    164166           
    165167               foreach ($setting as $k => $v) { 
    166                     if (($ressources[$k]['type'] == 'post') && ($v['used'] == true)) 
     168                    if ($v['used'] == true) 
    167169                    { 
    168170                         $tpl_post= array_merge($tpl_post, array($ressources[$k]['title']=> $k)); 
  • plugins/templator/_define.php

    r2215 r2411  
    1515$this->registerModule( 
    1616     /* Name */               'Templator', 
    17      /* Description*/         'Select specific template for a post or a page', 
     17     /* Description*/         'Create and select more templates for your posts', 
    1818     /* Author */             'Osku and contributors', 
    19      /* Version */            '0.10', 
     19     /* Version */            '1.0beta', 
    2020     /* Permissions */        'contentadmin' 
    2121); 
  • plugins/templator/_install.php

    r2162 r2411  
    1212 
    1313if (!defined('DC_CONTEXT_ADMIN')) { exit; } 
     14 
     15if (version_compare(DC_VERSION,'2.2-beta','<')) 
     16{ 
     17     $core->error->add(__('Version 2.2-beta of Dotclear at least is required for module Templator.')); 
     18     $core->plugins->deactivateModule('templator'); 
     19     return false; 
     20} 
     21 
     22$new_version = $core->plugins->moduleInfo('templator','version'); 
    1423  
    15 $m_version = $core->plugins->moduleInfo('templator','version'); 
     24$current_version = $core->getVersion('templator'); 
    1625  
    17 $i_version = $core->getVersion('templator'); 
    18   
    19 if (version_compare($i_version,$m_version,'>=')) { 
     26if (version_compare($current_version,$new_version,'>=')) { 
    2027     return; 
    2128} 
    2229 
    23 $core->blog->settings->setNamespace('templator'); 
    24 $s =& $core->blog->settings; 
     30$core->blog->settings->addNamespace('templator'); 
     31$s =& $core->blog->settings->templator; 
    2532$s->put('templator_flag',false,'boolean','Templator activation flag',true,true); 
    2633$s->put('templator_files','','string','My own supplementary template files',true,true); 
    2734$s->put('templator_files_active','','string','My active supplementary template files',true,true); 
    2835 
    29 $core->setVersion('templator',$m_version); 
     36$core->setVersion('templator',$new_version); 
    3037return true; 
    3138?> 
  • plugins/templator/_prepend.php

    r2116 r2411  
    1212if (!defined('DC_RC_PATH')) { return; } 
    1313 
     14if (version_compare(DC_VERSION,'2.2-beta','<')) { return; } 
     15 
    1416$__autoload['dcTemplator'] = dirname(__FILE__).'/inc/class.templator.php'; 
    1517?> 
  • plugins/templator/_public.php

    r2215 r2411  
    1212if (!defined('DC_RC_PATH')) { return; } 
    1313 
    14 if ($core->blog->settings->templator_flag) 
     14if ($core->blog->settings->templator->templator_flag) 
    1515{ 
    1616     $core->addBehavior('publicBeforeDocument',array('publicTemplatorBehaviors','addTplPath')); 
    17      $core->addBehavior('urlHandlerServeDocument',array('publicTemplatorBehaviors','urlHandlerServeDocument')); 
     17     $core->addBehavior('urlHandlerBeforeGetData',array('publicTemplatorBehaviors','BeforeGetData')); 
    1818} 
    1919 
     
    2222     public static function addTplPath($core) 
    2323     { 
    24           $core->tpl->setPath($core->tpl->getPath(), dirname(__FILE__).'/default-templates'); 
     24          $core->tpl->setPath($core->tpl->getPath(), DC_TPL_CACHE.'/templator/default-templates'); 
    2525     } 
    2626      
    27      public static function urlHandlerServeDocument ($result) 
     27     public static function BeforeGetData ($_ctx) 
    2828     { 
    29           global $core, $_ctx; 
     29          global $core; 
    3030           
    31           if ($_ctx->posts->post_id) 
     31          if (array_key_exists($core->url->type,$core->getPostTypes())) 
    3232          { 
    33                $meta = new dcMeta($core); 
    34                $post_meta = $meta->getMeta('template',null,null,$_ctx->posts->post_id); 
     33               $params = array(); 
     34               $params['meta_type'] = 'template'; 
     35               $params['post_id'] = $_ctx->posts->post_id; 
     36               $post_meta = $core->meta->getMetadata($params); 
    3537                
    3638               if (!$post_meta->isEmpty()) 
    3739               { 
    38                     try 
    39                     { 
    40                          $result['content'] = $core->tpl->getData($post_meta->meta_id); 
    41                          //$result['tpl'] = $tpl; 
    42                     } 
    43                     catch (Exception $e)  
    44                     { 
    45                          return; 
    46                     } 
     40                    $_ctx->current_tpl = $post_meta->meta_id; 
    4741               } 
    48           } 
    49           else 
    50           { 
    51                return; 
    5242          } 
    5343     } 
  • plugins/templator/inc/class.templator.php

    r2116 r2411  
    2222      
    2323     public $tpl = array(); 
     24     public $theme_tpl = array(); 
    2425 
    2526     public function __construct($core) 
     
    2728          $this->core =& $core; 
    2829 
     30          $this->user_theme = $this->core->blog->themes_path.'/'.$this->core->blog->settings->system->theme; 
    2931          //$this->user_theme = path::real($this->core->blog->themes_path.'/'.$this->core->blog->settings->system->theme); 
     32          $this->user_post_tpl = path::real($this->user_theme.'/tpl/'.$this->post_default_name); 
     33          $this->user_page_tpl = path::real($this->user_theme.'/tpl/'.$this->page_default_name); 
    3034          $this->post_tpl = path::real($this->core->blog->themes_path.'/default/tpl/'.$this->post_default_name); 
    3135          $plugin_page = $this->core->plugins->getModules('pages'); 
     
    3842     public function canUseRessources($create=false) 
    3943     { 
    40           $path = $this->core->plugins->moduleInfo($this->self_name,'root') ; 
    41  
    42           $path_tpl = $this->core->plugins->moduleInfo($this->self_name,'root').'/'.$this->template_dir_name ; 
     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; 
    4348 
    4449          if (!is_dir($path)) { 
    45                return false; 
     50               if (!is_writable(DC_TPL_CACHE)) { 
     51                    return false; 
     52               } 
     53               if ($create) { 
     54                    files::makeDir($path); 
     55               } 
     56               return true; 
    4657          } 
    4758           
     
    7687          } 
    7788           
    78           //throw new Exception(sprintf(__(' %s'),$source[$f])); 
    79            
    8089          return array( 
    8190               'c' => file_get_contents($source[$f]), 
    8291               'w' => $this->getDestinationFile($f) !== false, 
    83                //'type' => $type, 
    8492               'f' => $f 
    8593          ); 
     
    109117          if  ($type == 'page') 
    110118          { 
    111                $base =  $this->page_tpl ; 
     119               if ($this->user_page_tpl) { 
     120                    $base = $this->user_page_tpl; 
     121               } else { 
     122                    $base =  $this->page_tpl; 
     123               } 
    112124          } 
    113125          else { 
    114                $base =  $this->post_tpl ; 
     126               if ($this->user_post_tpl) { 
     127                    $base = $this->user_post_tpl; 
     128               } else { 
     129                    $base =  $this->post_tpl; 
     130               } 
    115131          } 
    116132           
     
    174190               $fp = @fopen($dest,'wb'); 
    175191               if (!$fp) { 
    176                     throw new Exception('tocatch'); 
     192                    //throw new Exception('tocatch'); 
    177193               } 
    178194                
     
    188204          } 
    189205     } 
    190  
    191      protected function getDestinationFile($f) 
    192      { 
    193           $dest = $this->core->plugins->moduleInfo($this->self_name,'root').'/'.$this->template_dir_name.'/'.$f ; 
     206      
     207     public function copyTpl($name) 
     208     { 
     209          try 
     210          { 
     211               $file = $this->getSourceContent($name); 
     212               $dest = $this->getDestinationFile($name,true); 
     213 
     214               if ($dest == false) { 
     215                    throw new Exception(); 
     216               } 
     217 
     218               if (!is_dir(dirname($dest))) { 
     219                    files::makeDir(dirname($dest)); 
     220               } 
     221                
     222               $fp = @fopen($dest,'wb'); 
     223               if (!$fp) { 
     224                    throw new Exception('tocatch'); 
     225               } 
     226                
     227               $content = preg_replace('/(\r?\n)/m',"\n",$file['c']); 
     228               $content = preg_replace('/\r/m',"\n",$file['c']); 
     229                
     230               fwrite($fp,$file['c']); 
     231               fclose($fp); 
     232          } 
     233          catch (Exception $e) 
     234          { 
     235               throw $e; 
     236          } 
     237     }     
     238 
     239     protected function getDestinationFile($f,$totheme=false) 
     240     { 
     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; 
     243          if ($totheme) { 
     244               $dest = $this->user_theme.'/tpl/'.$f; 
     245          } 
    194246           
    195247          if (file_exists($dest) && is_writable($dest)) { 
     
    197249          } 
    198250           
    199           if (!is_dir(dirname($dest))) { 
    200                if (is_writable($this->core->blog->public_path)) { 
    201                     return $dest; 
    202                } 
    203           } 
    204            
    205251          if (is_writable(dirname($dest))) { 
    206252               return $dest; 
     
    212258     protected function findTemplates() 
    213259     { 
    214           $this->tpl = $this->getFilesInDir($this->core->plugins->moduleInfo($this->self_name,'root').'/'.$this->template_dir_name); 
     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); 
     262          $this->theme_tpl = $this->getFilesInDir(path::real($this->user_theme).'/tpl'); 
    215263           
    216264          uksort($this->tpl,array($this,'sortFilesHelper')); 
     265          uksort($this->theme_tpl,array($this,'sortFilesHelper')); 
    217266     } 
    218267      
  • plugins/templator/index.php

    r2215 r2411  
    1414$file_default = $file = array('c'=>null, 'w'=>false, 'type'=>null, 'f'=>null, 'default_file'=>false); 
    1515 
    16 $combo_types = array( 
    17      __('Entry') => 'post', 
    18      __('Page') => 'page' 
     16$combo_source = array( 
     17     'post.html' => 'post', 
     18     'page.html' => 'page' 
    1919); 
    2020 
    21 $tpl = unserialize($core->blog->settings->templator_files); 
    22 $active_tpl = unserialize($core->blog->settings->templator_files_active); 
    23 $templator_flag = (boolean)$core->blog->settings->templator_flag; 
     21foreach ($core->getPostTypes() as $k => $v) { 
     22     $combo_types[ucfirst($k)] = $k; 
     23} 
     24 
     25// Settings 
     26$core->blog->settings->addNamespace('templator'); 
     27$s = $core->blog->settings->templator; 
     28$tpl = unserialize($s->templator_files); 
     29$active_tpl = unserialize($s->templator_files_active); 
     30$templator_flag = (boolean)$s->templator_flag; 
     31 
     32// Get theme Infos 
     33$core->themes = new dcThemes($core); 
     34$core->themes->loadModules($core->blog->themes_path,null); 
     35$T = $core->themes->getModules($core->blog->settings->system->theme); 
    2436 
    2537$o = new dcTemplator($core); 
    2638$ressources = $o->canUseRessources(true); 
    2739$files= $o->tpl; 
     40$t_files = $o->theme_tpl; 
    2841 
    2942$add_template = false; 
     
    4053          if (!empty($_REQUEST['tpl']) && $core->auth->isSuperAdmin()) { 
    4154               $file = $o->getSourceContent($_REQUEST['tpl']); 
     55               $core->blog->triggerBlog();    
    4256          }  
    4357     } 
     
    6276          unset($tpl[$id]); 
    6377          unset($active_tpl[$id]); 
    64           $core->blog->settings->setNamespace('templator'); 
    65           $core->blog->settings->put('templator_files',serialize($tpl),'string','My own supplementary template files',true,true); 
    66           $core->blog->settings->put('templator_files',serialize($tpl),'string','My own supplementary template files'); 
    67           $core->blog->settings->put('templator_files_active',serialize($active_tpl),'string','My active supplementary template files'); 
     78          $s->put('templator_files',serialize($tpl),'string','My own supplementary template files',true,true); 
     79          $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'); 
    6881          $core->blog->triggerBlog(); 
    6982          http::redirect($p_url.'&del='.$id); 
     
    7588          $active_tpl[$id]['used'] = false; 
    7689           
    77           $core->blog->settings->setNamespace('templator'); 
    78           $core->blog->settings->put('templator_files_active',serialize($active_tpl),'string','My active supplementary template files'); 
     90          $s->put('templator_files_active',serialize($active_tpl),'string','My active supplementary template files'); 
    7991          http::redirect($p_url.'&hide='.$id); 
    8092     }     
     
    8597          $active_tpl[$id]['used'] = true; 
    8698           
    87           $core->blog->settings->setNamespace('templator'); 
    88           $core->blog->settings->put('templator_files_active',serialize($active_tpl),'string','My active supplementary template files'); 
     99          $s->put('templator_files_active',serialize($active_tpl),'string','My active supplementary template files'); 
    89100          $core->blog->triggerBlog(); 
    90101          http::redirect($p_url.'&show='.$id); 
     
    96107          $tpl[$id]['title'] = $_POST['file_title'][$id]; 
    97108           
    98           $core->blog->settings->setNamespace('templator'); 
    99           $core->blog->settings->put('templator_files',serialize($tpl),'string','My own supplementary template files',true,true); 
    100           $core->blog->settings->put('templator_files',serialize($tpl),'string','My own supplementary template files'); 
     109          $s->put('templator_files',serialize($tpl),'string','My own supplementary template files',true,true); 
     110          $s->put('templator_files',serialize($tpl),'string','My own supplementary template files'); 
    101111          $core->blog->triggerBlog(); 
    102112          http::redirect($p_url.'&update='.$id); 
    103113     } 
     114      
     115     if (!empty($_POST['copy']) && $core->blog->settings->system->theme != 'default') 
     116     { 
     117          $id = $_POST['file_id']; 
     118          $o->copyTpl($id); 
     119 
     120          //$core->blog->triggerBlog(); 
     121          http::redirect($p_url.'&copy='.$id); 
     122     } 
    104123} 
    105124catch (Exception $e) 
     
    113132     { 
    114133          $templator_flag = (empty($_POST['templator_flag'])) ? false : true; 
    115           $core->blog->settings->setNamespace('templator'); 
    116           $core->blog->settings->put('templator_flag',$templator_flag,'boolean','Templator activation flag'); 
     134 
     135          $s->put('templator_flag',$templator_flag,'boolean','Templator activation flag'); 
    117136          $core->blog->triggerBlog(); 
    118137          http::redirect($p_url.'&config=1'); 
     
    124143} 
    125144 
    126 if (!empty($_POST['filename']) && !empty($_POST['filetype']) && !empty($_POST['filetitle']) && $core->auth->isSuperAdmin()) 
     145if (!empty($_POST['filename']) && $core->auth->isSuperAdmin()) 
    127146{ 
    128147     $type = $_POST['filetype']; 
     148     $source = $_POST['filesource']; 
    129149     $name = files::tidyFileName($_POST['filename']).'.html'; 
    130150 
    131151     try { 
    132           $o->initializeTpl($name,$type); 
    133           $tpl[$name]['title'] = $_POST['filetitle'];  
    134           $tpl[$name]['type'] = $type;  
     152          $o->initializeTpl($name,$source); 
     153          $tpl[$name]['title'] = (empty($_POST['filetitle'])) ? $name : trim($_POST['filetitle']);  
     154          //$tpl[$name]['type'] = $type;  
    135155          $active_tpl[$name]['used'] = true;  
    136           $core->blog->settings->setNamespace('templator'); 
    137           $core->blog->settings->put('templator_files',serialize($tpl),'string','My own supplementary template files',true,true); 
    138           $core->blog->settings->put('templator_files',serialize($tpl),'string','My own supplementary template files'); 
    139           $core->blog->settings->put('templator_files_active',serialize($active_tpl),'string','My active supplementary template files'); 
     156          $s->put('templator_files',serialize($tpl),'string','My own supplementary template files',true,true); 
     157          $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'); 
    140159     } catch (Exception $e) { 
    141160          $core->error->add($e->getMessage()); 
     
    155174          $fp = fopen('php://output','wb'); 
    156175          $zip = new fileZip($fp); 
    157           $zip->addDirectory($core->plugins->moduleRoot('templator').'/default-templates','',true); 
     176          $zip->addDirectory(DC_TPL_CACHE.'/templator/default-templates','',true); 
    158177          header('Content-Disposition: attachment;filename=templator-templates.zip'); 
    159178          header('Content-Type: application/x-zip'); 
     
    206225} 
    207226 
     227if (!empty($_GET['copy'])) { 
     228     echo '<p class="message">'.__('The template has been successfully copied to blog theme.').'</p>'; 
     229} 
     230 
    208231if (!empty($_GET['del'])) { 
    209232     echo '<p class="message">'.sprintf(__('The template %s has been deleted.'),$_GET['del']).'</p>'; 
     
    241264          '<fieldset>'. 
    242265          '<legend>'.__('Create a new template').'</legend>'. 
    243           '<p><label>'.__('Usage:').' '. 
    244           form::combo('filetype',$combo_types).'</label></p>'. 
    245           '<p><label class="required" title="'.__('Required field').'">'.__('Filename:').' '. 
    246           form::field('filename',30,255).'</label></p>'. 
    247           '<p class="form-note">'.sprintf(__('The extension %s is automatically added'),'<code>.html</code>').'</p>'. 
    248           '<p><label class="required" title="'.__('Required field').'">'.__('Title:').' '. 
     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:').' '. 
    249273          form::field('filetitle',30,255).'</label></p>'. 
    250274          '<p>'.form::hidden(array('p'),'templator'). 
     
    264288          '<thead>'. 
    265289          '<tr>'. 
    266           '<th >'.__('Usage').'</th>'. 
     290          //'<th >'.__('Usage').'</th>'. 
    267291          '<th>'.__('Filename').'</th>'. 
    268292          '<th>'.__('Title').'</th>'. 
    269           '<th colspan="2" >'.__('Action').'</th>'. 
     293          '<th>'.__('Action').'</th>'. 
    270294          '<th>&nbsp;</th>'. 
    271295          '</tr>'. 
     
    275299          foreach ($tpl as $k => $v) 
    276300          { 
    277                if ($v['type'] == 'page') { 
    278                     $type = __('Page'); 
    279                } 
    280                else 
    281                { 
    282                     $type = __('Entry'); 
    283                } 
     301               //$type = ucfirst($v['type']); 
    284302 
    285303               if(isset($active_tpl[$k]['used']) && $active_tpl[$k]['used']) { 
    286304                    $line = ''; 
    287                     $status = '<img alt="'.__('available').'" title="'.__('available').'" src="images/check-on.png" />'; 
     305                    //$status = '<img alt="'.__('available').'" title="'.__('available').'" src="images/check-on.png" />'; 
    288306               } 
    289307               else 
    290308               { 
    291309                    $line = 'offline'; 
    292                     $status = '<img alt="'.__('unavailable').'" title="'.__('unavailable').'" src="images/check-off.png" />'; 
     310                    //$status = '<img alt="'.__('unavailable').'" title="'.__('unavailable').'" src="images/check-off.png" />'; 
    293311               } 
    294312 
     
    298316               echo 
    299317               '<tr class="line '.$line.'" id="l_'.($k).'">'. 
    300                '<td class="nowrap">'.$type.'</td>'. 
    301                '<td ><code>'.$k.'</code></td>'. 
     318               //'<td class="nowrap">'.$type.'</td>'. 
     319               '<td >'.$k.'</td>'. 
    302320               '<td >'. 
    303                     '<form action="'.$p_url.'" method="post"><p>'. 
     321                    '<form action="'.$p_url.'" method="post">'. 
    304322                    $core->formNonce(). 
    305323                    form::hidden(array('file_id'),html::escapeHTML($k)). 
     324                    '<p>'. 
    306325                    form::field(array('file_title['.$k.']','t'.$k),30,255,$v['title']). 
    307                     '<input type="submit" class="update" name="update" value="'.__('Update').'" />'. 
    308                     '</p></form></td>'. 
     326                    '&nbsp;<input type="submit" class="update" name="update" value="'.__('Update').'" />&nbsp;'. 
     327                    '</p>'. 
     328                    '</form></td>'. 
    309329 
    310330               '<td>'. 
     
    314334                    ((isset($active_tpl[$k]['used'])) && $active_tpl[$k]['used'] ?  
    315335                         '<input type="submit" class="disable" name="disable" value="'.__('Disable').'" /> ' :  
    316                          '<input type="submit" class="enable" name="enable" value="'.__('Enable').'" /> ' ). 
     336                         '<input type="submit" class="enable" name="enable" value="'.__('Enable').'" /> ' ); 
     337                    if (((!isset($t_files[$k]) || 
     338                    (strpos($t_files[$k],path::real($core->blog->themes_path.'/'.$core->blog->settings->system->theme)) !== 0))) && 
     339                    $core->blog->settings->system->theme != 'default') 
     340                    { 
     341                         echo '&nbsp;<input type="submit" class="copy" name="copy" value="'.__('Copy').'" />'; 
     342                    } 
     343                    echo 
    317344                    '</p></form></td>'. 
    318                '<td class="nowrap status">'.$status.'</td>'. 
    319345               '<td  class="nowrap status" >'.$edit.'</td >'. 
    320  
    321346               '</tr>'; 
    322347          } 
    323           echo '</tbody></table></div>'; 
     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>'; 
    324351 
    325352          if ($core->auth->isSuperAdmin()) 
     
    347374               (files::isDeletable($files[$k]) ? '<input type="submit" class="delete" name="delete" value="'.__('delete').'" /> ' : ''). 
    348375               '</p>'; 
     376                
     377 
    349378          } 
    350379          else 
    351380          { 
    352                echo '<p>'.__('This file is not writable. Please check your theme files permissions.').'</p>'; 
     381               echo '<p>'.__('This file is not writable. Please check your files permissions.').'</p>'; 
    353382          } 
    354383 
  • plugins/templator/locales/fr/main.po

    r2162 r2411  
    1 # Language: français 
    2 # Module: templator - 0.7 
    3 # Date: 2010-04-05 13:00:46 
    4 # Translated with translater 1.3 
     1# Language: Français 
     2# Module: templator - 0.11.1 
     3# Date: 2010-06-28 15:23:58 
     4# Translated with translater 1.4.1 
    55 
    66msgid "" 
    77msgstr "" 
    88"Content-Type: text/plain; charset=UTF-8\n" 
    9 "Project-Id-Version: templator 0.7\n" 
     9"Project-Id-Version: templator 0.11.1\n" 
    1010"POT-Creation-Date: \n" 
    11 "PO-Revision-Date: 2010-04-05T13:00:46+00:00\n" 
    12 "Last-Translator: Osku\n" 
     11"PO-Revision-Date: 2010-06-28T15:23:58+00:00\n" 
     12"Last-Translator: osku\n" 
    1313"Language-Team: \n" 
    1414"MIME-Version: 1.0\n" 
     
    2424msgstr "Gabarit spécifique :" 
    2525 
    26 #: _admin.php:124 
     26#: _admin.php:122 
    2727msgid "Appearance" 
    2828msgstr "Aspect" 
    2929 
    30 #: _admin.php:124 
     30#: _admin.php:122 
    3131msgid "Select template" 
    3232msgstr "Sélectionner le gabarit" 
    3333 
    34 #: _admin.php:177 
     34#: _admin.php:172 
    3535msgid "Select template for these entries" 
    3636msgstr "Sélectionner le gabarit pour ces billets" 
    3737 
    38 #: _admin.php:179 
     38#: _admin.php:174 
    3939msgid "Choose template:" 
    4040msgstr "Choisir le gabarit :" 
    4141 
    42 #: _admin.php:186 
    43 #: index.php:339 
     42#: _admin.php:181 
     43#: index.php:367 
    4444msgid "save" 
    4545msgstr "enregistrer" 
    4646 
    47 #: inc/class.templator.php:70 
     47#: _install.php:17 
     48msgid "Version 2.2-beta of Dotclear at least is required for module Templator." 
     49msgstr "La version 2.2-beta de Dotclear est requise pour le moule Templator." 
     50 
     51#: inc/class.templator.php:81 
    4852msgid "File does not exist." 
    4953msgstr "Le fichier n'existe pas." 
    5054 
    51 #: inc/class.templator.php:75 
    52 #: inc/class.templator.php:125 
     55#: inc/class.templator.php:86 
     56#: inc/class.templator.php:141 
    5357msgid "File %s is not readable" 
    5458msgstr "Le fichier %s n'est pas lisible" 
    5559 
    56 #: inc/class.templator.php:93 
     60#: inc/class.templator.php:101 
    5761msgid "No file" 
    5862msgstr "Aucun fichier" 
    5963 
    60 #: index.php:17 
    61 #: index.php:278 
    62 msgid "Entry" 
    63 msgstr "Billet" 
    64  
    65 #: index.php:18 
    66 #: index.php:274 
    67 msgid "Page" 
    68 msgstr "Page" 
    69  
    70 #: index.php:33 
     64#: index.php:46 
    7165msgid "The plugin is unusable with your configuration. You have to change file permissions." 
    7266msgstr "L'extension est inutilisable avec votre configuration. Vous devez modifier les permissions des fichiers." 
    7367 
    74 #: index.php:60 
     68#: index.php:74 
    7569msgid "Cannot delete file." 
    7670msgstr "Impossible d'effacer le fichier" 
    7771 
    78 #: index.php:168 
     72#: index.php:191 
    7973msgid "Templator" 
    8074msgstr "Templator" 
    8175 
    82 #: index.php:172 
     76#: index.php:195 
    8377msgid "Saving document..." 
    8478msgstr "Sauvegarde du document..." 
    8579 
    86 #: index.php:173 
     80#: index.php:196 
    8781msgid "Document saved" 
    8882msgstr "Document sauvegardé" 
    8983 
    90 #: index.php:174 
     84#: index.php:197 
    9185msgid "An error occurred:" 
    9286msgstr "Une erreur s'est produite :" 
    9387 
    94 #: index.php:186 
     88#: index.php:209 
    9589msgid "Supplementary templates" 
    9690msgstr "Gabarits supplémentaires" 
    9791 
    98 #: index.php:189 
     92#: index.php:212 
    9993msgid "Configuration successfully updated." 
    10094msgstr "Configuration mise à jour avec succès." 
    10195 
    102 #: index.php:193 
     96#: index.php:216 
    10397msgid "The template %s is now unavailable." 
    104 msgstr "Le gabagrit %s est maintenant indisponible." 
    105  
    106 #: index.php:197 
     98msgstr "Le gabarit %s est maintenant indisponible." 
     99 
     100#: index.php:220 
    107101msgid "The template %s is now available." 
    108102msgstr "Le gabarit %s est maintenant disponible." 
    109103 
    110 #: index.php:201 
     104#: index.php:224 
    111105msgid "The template title has been successfully updated." 
    112106msgstr "Le titre du gabarit a été mis à jour avec succès." 
    113107 
    114 #: index.php:205 
     108#: index.php:228 
     109msgid "The template has been successfully copied to blog theme." 
     110msgstr "Le gabarit a été copié vers le thème du blog avec succès." 
     111 
     112#: index.php:232 
    115113msgid "The template %s has been deleted." 
    116114msgstr "Le gabarit %s a été supprimé." 
    117115 
    118 #: index.php:209 
     116#: index.php:236 
    119117msgid "The template %s has been successfully created." 
    120118msgstr "Le gabarit %s a été créé avec succès." 
    121119 
    122 #: index.php:215 
     120#: index.php:242 
    123121msgid "Plugin activation" 
    124122msgstr "Activation de l'extension" 
    125123 
    126 #: index.php:218 
     124#: index.php:245 
    127125msgid "Enable extension" 
    128126msgstr "Activer l'extension" 
    129127 
    130 #: index.php:223 
     128#: index.php:250 
    131129msgid "Save configuration" 
    132130msgstr "Enregistrer la configuration" 
    133131 
    134 #: index.php:231 
    135 #: index.php:238 
     132#: index.php:258 
     133#: index.php:265 
    136134msgid "Create a new template" 
    137135msgstr "Créer un nouveau gabarit" 
    138136 
    139 #: index.php:239 
     137#: index.php:266 
     138msgid "Required field" 
     139msgstr "Champ obligatoire" 
     140 
     141#: index.php:266 
     142msgid "Filename:" 
     143msgstr "Nom de fichier :" 
     144 
     145#: index.php:268 
    140146msgid "Usage:" 
    141147msgstr "Usage :" 
    142148 
    143 #: index.php:241 
    144 #: index.php:244 
    145 msgid "Required field" 
    146 msgstr "Champ obligatoire" 
    147  
    148 #: index.php:241 
    149 msgid "Filename:" 
    150 msgstr "Nom de fichier :" 
    151  
    152 #: index.php:243 
    153 msgid "The extension %s is automatically added" 
    154 msgstr "L'extension %s est automatiquement ajoutée" 
    155  
    156 #: index.php:244 
     149#: index.php:270 
     150msgid "Template source:" 
     151msgstr "Gabarit source :" 
     152 
     153#: index.php:272 
    157154msgid "Title:" 
    158155msgstr "Titre :" 
    159156 
    160 #: index.php:248 
     157#: index.php:276 
    161158msgid "Create" 
    162159msgstr "Créer" 
    163160 
    164 #: index.php:258 
     161#: index.php:286 
    165162msgid "Available templates" 
    166163msgstr "Gabarits disponibles" 
    167164 
    168 #: index.php:262 
     165#: index.php:290 
    169166msgid "Usage" 
    170167msgstr "Usage" 
    171168 
    172 #: index.php:263 
     169#: index.php:291 
    173170msgid "Filename" 
    174171msgstr "Nom de fichier" 
    175172 
    176 #: index.php:264 
     173#: index.php:292 
    177174msgid "Title" 
    178175msgstr "Titre" 
    179176 
    180 #: index.php:265 
     177#: index.php:293 
    181178msgid "Action" 
    182179msgstr "Action" 
    183180 
    184 #: index.php:283 
    185 #: index.php:283 
     181#: index.php:305 
     182#: index.php:305 
    186183msgid "available" 
    187184msgstr "disponible" 
    188185 
    189 #: index.php:288 
    190 #: index.php:288 
     186#: index.php:310 
     187#: index.php:310 
    191188msgid "unavailable" 
    192189msgstr "indisponible" 
    193190 
    194 #: index.php:292 
     191#: index.php:314 
    195192msgid "edit this template" 
    196193msgstr "éditer le gabarit" 
    197194 
    198 #: index.php:303 
     195#: index.php:326 
    199196msgid "Update" 
    200197msgstr "Mettre à jour" 
    201198 
    202 #: index.php:311 
     199#: index.php:335 
    203200msgid "Disable" 
    204201msgstr "Désactiver" 
    205202 
    206 #: index.php:312 
     203#: index.php:336 
    207204msgid "Enable" 
    208205msgstr "Activer" 
    209206 
    210 #: index.php:323 
     207#: index.php:339 
     208#: index.php:345 
     209msgid "Copy" 
     210msgstr "Copier" 
     211 
     212#: index.php:345 
     213msgid "The %s button makes a copy to blog theme (<strong>%s</strong>)." 
     214msgstr "Le bouton %s réalise une copie vers le thème du blog (<strong>%s</strong>)." 
     215 
     216#: index.php:351 
    211217msgid "Download the templates directory as a zip file" 
    212218msgstr "Télécharger le répertoire des gabarits dans un fichier zip" 
    213219 
    214 #: index.php:332 
     220#: index.php:360 
    215221msgid "File editor" 
    216222msgstr "Éditeur de fichier" 
    217223 
    218 #: index.php:333 
     224#: index.php:361 
    219225msgid "Editing file %s" 
    220226msgstr "Modification du fichier %s" 
    221227 
    222 #: index.php:342 
     228#: index.php:370 
    223229msgid "delete" 
    224230msgstr "supprimer" 
    225231 
    226 #: index.php:347 
    227 msgid "This file is not writable. Please check your theme files permissions." 
    228 msgstr "Ce fichier ne peut pas être modifié. Veuillez vérifier les permissions des fichiers de votre thème." 
    229  
     232#: index.php:377 
     233msgid "This file is not writable. Please check your files permissions." 
     234msgstr "Ce fichier ne peut pas être modifié. Veuillez vérifier les permissions des fichiers." 
     235 
  • plugins/templator/style.css

    r2162 r2411  
    1111 
    1212input.enable { 
    13      border-color:#009900; 
    14      color:#009900; 
     13     color:#72921B; 
    1514} 
    1615 
    1716input.disable { 
    18      border-color:#CC0000; 
    19      color:#CC0000; 
     17     color:#931B2C; 
     18} 
     19 
     20input.copy { 
     21     color:#751658; 
    2022} 
    2123 
    2224input.delete { 
    23      color:#FF0000 !important; 
     25     color:#DD0000; 
    2426} 
     27 
     28input.update { 
     29     color:#777777; 
     30} 
     31 
     32span.copy{ 
     33     -moz-border-radius:3px 3px 3px 3px; 
     34     padding:2px; 
     35     background-color:#E2DFCA; 
     36     color:#751658; 
     37     font-weight:bold; 
     38} 
     39 
     40 
Note: See TracChangeset for help on using the changeset viewer.

Sites map