Dotclear

Changeset 798


Ignore:
Timestamp:
02/22/09 23:44:26 (15 years ago)
Author:
Oaz
Message:
  • added path to all 'default-templates' folder for form search
  • check presence of theme editor to modify existing forms
Location:
plugins/myForms/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • plugins/myForms/trunk/_public.php

    r761 r798  
    5656  { 
    5757    global $core, $_REQUEST; 
    58     $core->tpl->setPath(array_merge($core->tpl->getPath(),array($core->plugins->moduleRoot("myForms")."/default-templates"))); 
     58     
     59    // add all 'default-templates' folders to form search path 
     60    $tplPath = $core->tpl->getPath(); 
     61          $plugins = $core->plugins->getModules(); 
     62          foreach($plugins as $plugin) 
     63               array_push($tplPath, $plugin['root'].'/default-templates'); 
     64    $core->tpl->setPath($tplPath); 
    5965     
    6066    self::loadForm(); 
  • plugins/myForms/trunk/index.php

    r761 r798  
    2525$core->themes = new dcThemes($core); 
    2626$core->themes->loadModules($core->blog->themes_path,null); 
    27 require_once(path::real(dirname(__FILE__).'/../themeEditor/class.themeEditor.php')); 
    28 class myFormsTplFileFinder extends dcThemeEditor 
    29 { 
    30      public function __construct(&$core) 
    31      { 
    32     return parent::__construct($core); 
    33      } 
    34      protected function getFilesInDir($dir,$ext=null,$prefix='') 
    35      { 
    36     return parent::getFilesInDir($dir,'myforms.html',$prefix); 
     27$themeEditorClass = path::real(dirname(__FILE__).'/../themeEditor/class.themeEditor.php'); 
     28if($themeEditorClass) { 
     29  require_once($themeEditorClass); 
     30  class myFormsTplFileFinder extends dcThemeEditor 
     31  { 
     32     public function __construct(&$core) 
     33     { 
     34      return parent::__construct($core); 
     35     } 
     36     protected function getFilesInDir($dir,$ext=null,$prefix='') 
     37     { 
     38      return parent::getFilesInDir($dir,'myforms.html',$prefix); 
     39    } 
    3740  } 
    3841} 
     
    7477  } 
    7578 
    76   print '<h2>'.__('Click on a form to modify it.').'</h2>'; 
    77   $fileFinder = new myFormsTplFileFinder($core); 
    78   echo $fileFinder->filesList('tpl','<a href="plugin.php?p=themeEditor&amp;tpl=%2$s" class="tpl-link">%1$s</a>'); 
     79  if($themeEditorClass) { 
     80    print '<h2>'.__('Click on a form to modify it.').'</h2>'; 
     81    $fileFinder = new myFormsTplFileFinder($core); 
     82    echo $fileFinder->filesList('tpl','<a href="plugin.php?p=themeEditor&amp;tpl=%2$s" class="tpl-link">%1$s</a>'); 
     83  } else { 
     84    print '<p class="message">'.__('You need the \'themeEditor\' extension to modify the existing forms.').'</p>'; 
     85  } 
    7986  print '<h2>'.__('Create a new form').'</h2>'; 
    8087  print '<form action="'.$p_url.'" method="post">'; 
Note: See TracChangeset for help on using the changeset viewer.

Sites map