Changeset 16118 for extensions/AdditionalPages/trunk
- Timestamp:
- Jun 28, 2012, 12:11:22 PM (12 years ago)
- Location:
- extensions/AdditionalPages/trunk
- Files:
-
- 5 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AdditionalPages/trunk/admin/add_page.inc.php
r9660 r16118 19 19 'content' => '', 20 20 ); 21 } 22 23 // load template 24 if (isset($_GET['load_template'])) 25 { 26 if (file_exists(AP_DISTRIBUED . $_GET['load_template'])) 27 { 28 $distribued = load_ap_template($_GET['load_template'], true); 29 } 30 else 31 { 32 $distribued = trigger_event('load_ap_template', array(), $_GET['load_template']); 33 } 34 $edited_page = array_merge($edited_page, $distribued); 35 $template->assign('template_selected', $_GET['load_template']); 21 36 } 22 37 … … 198 213 } 199 214 215 // Available templates 216 if (!isset($_GET['edit'])) 217 { 218 $distribued = array(); 219 $dh = opendir(AP_DISTRIBUED); 220 if ($dh) 221 { 222 while (($dir = readdir($dh)) !== false) 223 { 224 if ( is_dir(AP_DISTRIBUED.$dir) and $dir!='.' and $dir!='..' ) 225 { 226 array_push($distribued, load_ap_template($dir, false)); 227 } 228 } 229 closedir($dh); 230 } 231 $distribued = trigger_event('load_ap_templates_list', $distribued); // external plugins can add templates 232 $template->assign('TEMPLATES', $distribued); 233 } 234 200 235 // template output 201 236 $template->assign(array( … … 212 247 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 213 248 249 250 function load_ap_template($dir, $with_content=true) 251 { 252 $path = AP_DISTRIBUED . $dir . '/'; 253 254 // default template 255 $template_conf = array( 256 'name' => $dir, 257 'title' => '', 258 'permalink' => '', 259 'lang' => 'ALL', 260 'homepage' => false, 261 'standalone' => false, 262 'level' => 0, 263 'users' => array('guest', 'generic', 'normal', 'admin', 'webmaster'), 264 'groups' => array(), 265 'content' => '', 266 ); 267 268 // load config 269 if (file_exists($path.'config.php')) 270 { 271 include($path.'config.php'); 272 } 273 274 // load content 275 if ( $with_content and file_exists($path.'content.tpl') ) 276 { 277 $template_conf['content'] = file_get_contents($path.'content.tpl'); 278 } 279 280 $template_conf['tpl_id'] = $dir; 281 return $template_conf; 282 } 283 214 284 ?> -
extensions/AdditionalPages/trunk/admin/template/add_page.tpl
r9660 r16118 7 7 auto_permalink = false; 8 8 }); 9 }); 10 11 var content_changed = false; 12 jQuery("#ap_content").change(function() { 13 content_changed = true; 14 }); 15 16 jQuery("#template").change(function() { 17 if ($(this).val() != '-1') { 18 {/literal} 19 if (content_changed == false || confirm("{'The content of the page changed, are your sure you wan\'t to quit without saving?'|@translate|escape:javascript}")) {ldelim} 20 window.location.href = "admin.php?page=plugin-AdditionalPages-add_page&load_template="+ $(this).val(); 21 } else {ldelim} 22 $(this).val('-1'); 23 } 24 {literal} 25 } 9 26 }); 10 27 }); … … 28 45 <legend></legend> 29 46 <ul> 47 {if $TEMPLATES} 48 <li> 49 <span class="property"> 50 <label for="template">{'Load a page model'|@translate}</label> 51 </span> 52 <select name="template" id="template"> 53 <option value="-1">---------</option> 54 {foreach from=$TEMPLATES item=tpl} 55 <option value="{$tpl.tpl_id}" {if $template_selected==$tpl.tpl_id}selected="selected"{/if}>{$tpl.name}</option> 56 {/foreach} 57 </select> 58 </li> 59 {/if} 60 30 61 <li> 31 62 <span class="property"> -
extensions/AdditionalPages/trunk/language/en_UK/plugin.lang.php
r9350 r16118 48 48 $lang['ap_language_perm'] = 'by language'; 49 49 50 $lang['Load a page model'] = 'Load a page model'; 51 $lang['The content of the page changed, are your sure you wan\'t to quit without saving?'] = 'The content of the page changed, are your sure you wan\'t to quit without saving?'; 52 50 53 ?> -
extensions/AdditionalPages/trunk/language/fr_FR/plugin.lang.php
r9350 r16118 48 48 $lang['ap_language_perm'] = 'par langue'; 49 49 50 $lang['Load a page model'] = 'Charger un modèle de page'; 51 $lang['The content of the page changed, are your sure you wan\'t to quit without saving?'] = 'Le contenu de la page a changé, êtes-vous sûr de vouloir quitter sans sauvegarder ?'; 52 50 53 ?> -
extensions/AdditionalPages/trunk/main.inc.php
r12502 r16118 16 16 define('AP_PATH' , PHPWG_PLUGINS_PATH . AP_DIR . '/'); 17 17 define('ADD_PAGES_TABLE' , $prefixeTable . 'additionalpages'); 18 define('AP_DISTRIBUED', AP_PATH . 'distribued/'); 18 19 19 20 $conf['AP'] = @unserialize($conf['additional_pages']);
Note: See TracChangeset
for help on using the changeset viewer.