Changeset 2663:8dd9be9b33c1
- Timestamp:
- 02/14/14 22:05:36 (11 years ago)
- Branch:
- default
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
locales/fr/plugins.po
r2647 r2663 1992 1992 msgstr "Du jeu de template :" 1993 1993 1994 msgid "Reset" 1995 msgstr "Réinitialiser" 1996 1997 msgid "Are you sure you want to reset this file?" 1998 msgstr "Êtes-vous sûr de vouloir réinitialiser ce fichier ?" 1999 2000 msgid "The file has been reset." 2001 msgstr "Le fichier a été réinitialisé." 2002 1994 2003 #~ msgid "RSS or Atom feed subscription links" 1995 2004 #~ msgstr "Liens d'abonnement aux flux RSS ou Atom" -
plugins/themeEditor/_define.php
r2566 r2663 16 16 /* Description*/ "Theme Editor", 17 17 /* Author */ "Olivier Meunier", 18 /* Version */ '1. 0',18 /* Version */ '1.1', 19 19 array( 20 20 'type' => 'plugin' -
plugins/themeEditor/class.themeEditor.php
r2651 r2663 158 158 } 159 159 160 public function deletableFile($type,$f) 161 { 162 if ($type != 'tpl') { 163 // Only tpl files may be deleted 164 return false; 165 } 166 167 $files = $this->getFilesFromType($type); 168 if (isset($files[$f])) { 169 $dest = $this->getDestinationFile($type,$f); 170 if ($dest) { 171 if (file_exists($dest) && is_writable($dest)) { 172 // Is there a model (parent theme or template set) ? 173 if (isset($this->tpl_model[$f])) { 174 return true; 175 } 176 } 177 } 178 } 179 return false; 180 } 181 182 public function deleteFile($type,$f) 183 { 184 if ($type != 'tpl') { 185 // Only tpl files may be deleted 186 return; 187 } 188 189 $files = $this->getFilesFromType($type); 190 if (!isset($files[$f])) { 191 throw new Exception(__('File does not exist.')); 192 } 193 194 try 195 { 196 $dest = $this->getDestinationFile($type,$f); 197 if ($dest) { 198 // File exists and may be deleted 199 unlink($dest); 200 201 // Updating template files list 202 $this->findTemplates(); 203 } 204 } 205 catch (Exception $e) 206 { 207 throw new Exception(sprintf(__('Unable to delete file %s. Please check your theme files and folders permissions.'),$f)); 208 } 209 } 210 160 211 protected function getDestinationFile($type,$f) 161 212 { … … 235 286 $this->tpl = array_merge( 236 287 $this->getFilesInDir($this->tplset_theme), 237 $this->getFilesInDir($this->parent_theme.'/tpl'), 238 $this->getFilesInDir($this->user_theme.'/tpl') 288 $this->getFilesInDir($this->parent_theme.'/tpl') 239 289 ); 290 $this->tpl_model = $this->tpl; 291 292 $this->tpl = array_merge($this->tpl,$this->getFilesInDir($this->user_theme.'/tpl')); 240 293 241 294 # Then we look in 'default-templates' plugins directory … … 243 296 foreach ($plugins as $p) { 244 297 $this->tpl = array_merge($this->getFilesInDir($p['root'].'/default-templates'),$this->tpl); 298 $this->tpl_model = array_merge($this->getFilesInDir($p['root'].'/default-templates'),$this->tpl_model); 245 299 } 246 300 -
plugins/themeEditor/index.php
r2566 r2663 52 52 $o->writeFile($file['type'],$file['f'],$file['c']); 53 53 } 54 55 # Delete file 56 if (!empty($_POST['delete'])) 57 { 58 $o->deleteFile($file['type'],$file['f']); 59 dcPage::addSuccessNotice(__('The file has been deleted.')); 60 http::redirect($p_url.'&'.$file['type'].'='.$file['f']); 61 } 54 62 } 55 63 catch (Exception $e) … … 68 76 <?php echo dcPage::jsVar('dotclear.msg.document_saved',__("Document saved")); ?> 69 77 <?php echo dcPage::jsVar('dotclear.msg.error_occurred',__("An error occurred:")); ?> 78 <?php echo dcPage::jsVar('dotclear.msg.confirm_reset_file',__("Are you sure you want to reset this file?")); ?> 70 79 <?php echo dcPage::jsVar('dotclear.colorsyntax',$user_ui_colorsyntax); ?> 71 80 //]]> … … 122 131 echo 123 132 '<p><input type="submit" name="write" value="'.__('Save').' (s)" accesskey="s" /> '. 133 ($o->deletableFile($file['type'],$file['f']) ? '<input type="submit" name="delete" class="delete" value="'.__('Reset').'" />' : ''). 124 134 $core->formNonce(). 125 135 ($file['type'] ? form::hidden(array($file['type']),$file['f']) : ''). -
plugins/themeEditor/script.js
r2566 r2663 1 1 $(function() { 2 // Cope with saving 2 3 var msg = false; 3 4 $('#file-form input[name="write"]').click(function() { … … 31 32 return false; 32 33 }); 34 35 // Confirm for deleting current file 36 $('#file-form input[name="delete"]').click(function() { 37 return window.confirm(dotclear.msg.confirm_reset_file); 38 }); 39 33 40 });
Note: See TracChangeset
for help on using the changeset viewer.