Changeset 7358 for extensions/Random_Header
- Timestamp:
- Oct 23, 2010, 10:53:37 PM (14 years ago)
- Location:
- extensions/Random_Header
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Random_Header/admin/rh_admin.css
r7330 r7358 1 .randomHeader_fieldset legend{color:#ff3363;font-weight:bold;} 2 .randomHeader_fieldset{overflow-x:auto;} 3 .rh_input{width:335px;} 4 .rhconf{float:left;} 5 .rhactive{background-color:lightgreen;} 6 .rhinactive{border-color:red;} 7 8 1 .randomHeader_fieldset legend{color:#ff3363;font-weight:bold;} 9 2 10 3 .black_overlay{ -
extensions/Random_Header/admin/rh_admin.php
r7330 r7358 6 6 include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php'); 7 7 8 // delete conf for deleted themes (but not for deactivated themes) 9 foreach ($me->rh_config as $theme_in_rh_conf => $test) { 10 if (!file_exists($conf['themes_dir'].'/'.$theme_in_rh_conf.'/'.'themeconf.inc.php')) { 11 unset($me->rh_config[$theme_in_rh_conf]); 12 } 13 } 14 $me->save_config(); 15 16 8 17 9 18 $template->set_filenames( array('plugin_admin_content' => dirname(__FILE__).'/rh_admin.tpl') ); 19 $template->assign("RH_VERSION",RH_VERSION); 20 $template->assign("RH_confpanel",realpath( dirname(__FILE__).'/rh_theme_conf.tpl')); 10 21 $rhthemes = new themes(); 11 22 $rh_vierge=0; 12 23 13 24 foreach (get_pwg_themes() as $pwg_templateID => $pwg_template) { … … 21 32 $me->rh_config[$pwg_templateID]['mode_background'] = (isset( $_POST[$pwg_templateID.'mode_background'] )) ? $_POST[$pwg_templateID.'mode_background'] : 'off' ; 22 33 $me->save_config(); 34 23 35 } 24 36 25 37 $rhscreenshot=(file_exists(PHPWG_THEMES_PATH.$pwg_templateID . '/screenshot.png')) ? PHPWG_THEMES_PATH.$pwg_templateID . '/screenshot.png' : PHPWG_ROOT_PATH.'admin/themes/'.$conf['admin_theme'].'/images/missing_screenshot.png'; 26 $rhthemboxclass=($me->rh_config[$pwg_templateID]['selected_cat']!=0) ? 'themeDefault' : ' toto';27 38 $rhthemboxclass=($me->rh_config[$pwg_templateID]['selected_cat']!=0) ? 'themeDefault' : ''; 39 $rh_vierge=($me->rh_config[$pwg_templateID]['selected_cat']!=0) ? $rh_vierge+1 : $rh_vierge; 28 40 $template->append('rhthemes', array( 29 41 'CURRENT_THEME_NAME'=> $pwg_template, … … 40 52 )); 41 53 } 42 54 $template->assign('rh_vierge',$rh_vierge); 43 55 display_select_cat_wrapper( 44 56 'SELECT id,name,uppercats,global_rank FROM '.CATEGORIES_TABLE, -
extensions/Random_Header/admin/rh_admin.tpl
r7330 r7358 3 3 {/html_head} 4 4 5 6 <div class="titrePage"><h2>Random Header v2.2</h2></div> 5 <div class="titrePage"><h2>Random Header {$RH_VERSION}</h2></div> 7 6 <p>{'rh_description'|@translate}</p> 8 7 <p><i>{'rh_aide'|@translate}</i></p> 9 8 <form method="post" action="" class="properties"> 10 11 9 10 12 11 <div id="themesContent"> 12 {if $rh_vierge!=0} 13 13 <fieldset> 14 14 <legend>{'rh_active_conf'|@translate}</legend> 15 15 16 17 16 <div class="themeBoxes"> 18 17 {foreach from=$rhthemes item=i} 19 {if $i.CATSELECTED!=0} 20 21 22 <div class="themeBox {$i.THEMEBOXCLASS}"> 23 <div class="themeName">{$i.CURRENT_THEME_NAME}</div> 24 <div class="themeShot"><img src="{$i.SCREENSHOT_URL}" alt=""></div> 25 <div class="themeActions"> 26 <div> 27 <a href="javascript:void(0)" onclick="document.getElementById('light{$i.CURRENT_THEME_ID}').style.display='block';document.getElementById('fade').style.display='block'" title="">Configurer</a> 28 </div> 29 </div> <!-- themeActions --> 30 </div> 31 32 33 34 35 36 37 <div id="light{$i.CURRENT_THEME_ID}" class="rhconfpanel"> 38 <fieldset class="randomHeader_fieldset" style="float:left;"> 39 40 <legend>{'rh_theme'|@translate} : {$i.CURRENT_THEME_NAME}</legend> 41 42 <p> 43 <label> 44 {'rh_headers_category'|@translate}<br /> 45 <select class="categoryDropDown" name="{$i.CURRENT_THEME_ID}selected_cat"> 46 <option value="0">{'rh_inactif'|@translate}</option> 47 {html_options options=$categories selected=$i.CATSELECTED} 48 </select> 49 </label> 50 </p> 51 52 <p> 53 <input type="checkbox" {$i.MODE_BACKGROUND} name="{$i.CURRENT_THEME_ID}mode_background"> 54 <label>{'rh_as_background'|@translate}</label> 55 </p> 56 57 <p> 58 <input type="checkbox" {$i.ACTIVE_ON_PICTURE} name="{$i.CURRENT_THEME_ID}active_on_picture"> 59 <label>{'rh_on_picture'|@translate}</label> 60 </p> 61 62 <p> 63 <label>{'rh_additional_css'|@translate} :<br /></label> 64 <i>#theHeader :</i><br /> 65 <input class="rh_input" type="text" name="{$i.CURRENT_THEME_ID}head_css" value="{$i.HEAD_CSS}"><br /> 66 <i>#RandomImage : {'rh_inactif_on_bg'|@translate}</i><br /><input class="rh_input" type="text" name="{$i.CURRENT_THEME_ID}img_css" value="{$i.IMG_CSS}"><br /> 67 </p> 68 69 <p> 70 <label>{'rh_concat'|@translate} :</label> 71 <input type="checkbox" {$i.CONCAT_BEFORE} name="{$i.CURRENT_THEME_ID}concat_before"> {'rh_before'|@translate} <input type="checkbox" {$i.CONCAT_AFTER} name="{$i.CURRENT_THEME_ID}concat_after"> {'rh_after'|@translate} 72 </p> 73 74 </fieldset> 75 <div style="float:right;"> 76 <a style="border:none;" href="javascript:void(0)" onclick="document.getElementById('light{$i.CURRENT_THEME_ID}').style.display='none';document.getElementById('fade').style.display='none'" titlte="{'Close this window'|@translate}"> 77 <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/exit.png" class="button" alt="exit"></a> 78 </div> 79 <br /> 80 <div align="center" style="clear:left;"><input class="submit" type="submit" value="{'rh_submit'|@translate}" name="submit" /></div> 81 82 83 84 </div> 85 86 87 {/if} 18 {if $i.CATSELECTED!=0} 19 {include file="$RH_confpanel"} 20 {/if} 88 21 {/foreach} 89 22 </div> <!-- themeBoxes --> 90 23 </fieldset> 91 92 93 24 {/if} 94 25 95 26 <fieldset> 96 27 <legend>{'rh_inactive_conf'|@translate} : </legend> 97 28 98 99 29 <div class="themeBoxes"> 100 30 {foreach from=$rhthemes item=i} 101 {if $i.CATSELECTED==0} 102 103 104 <div class="themeBox {$i.THEMEBOXCLASS}"> 105 <div class="themeName">{$i.CURRENT_THEME_NAME}</div> 106 <div class="themeShot"><img src="{$i.SCREENSHOT_URL}" alt=""></div> 107 <div class="themeActions"> 108 <div> 109 <a href="javascript:void(0)" onclick="document.getElementById('light{$i.CURRENT_THEME_ID}').style.display='block';document.getElementById('fade').style.display='block'" title="">Configurer</a> 110 </div> 111 </div> <!-- themeActions --> 112 </div> 113 114 115 116 117 118 119 <div id="light{$i.CURRENT_THEME_ID}" class="rhconfpanel"> 120 <fieldset class="randomHeader_fieldset" style="float:left;"> 121 122 <legend>{'rh_theme'|@translate} : {$i.CURRENT_THEME_NAME}</legend> 123 124 <p> 125 <label> 126 {'rh_headers_category'|@translate}<br /> 127 <select class="categoryDropDown" name="{$i.CURRENT_THEME_ID}selected_cat"> 128 <option value="0">{'rh_inactif'|@translate}</option> 129 {html_options options=$categories selected=$i.CATSELECTED} 130 </select> 131 </label> 132 </p> 133 134 <p> 135 <input type="checkbox" {$i.MODE_BACKGROUND} name="{$i.CURRENT_THEME_ID}mode_background"> 136 <label>{'rh_as_background'|@translate}</label> 137 </p> 138 139 <p> 140 <input type="checkbox" {$i.ACTIVE_ON_PICTURE} name="{$i.CURRENT_THEME_ID}active_on_picture"> 141 <label>{'rh_on_picture'|@translate}</label> 142 </p> 143 144 <p> 145 <label>{'rh_additional_css'|@translate} :<br /></label> 146 <i>#theHeader :</i><br /> 147 <input class="rh_input" type="text" name="{$i.CURRENT_THEME_ID}head_css" value="{$i.HEAD_CSS}"><br /> 148 <i>#RandomImage : {'rh_inactif_on_bg'|@translate}</i><br /><input class="rh_input" type="text" name="{$i.CURRENT_THEME_ID}img_css" value="{$i.IMG_CSS}"><br /> 149 </p> 150 151 <p> 152 <label>{'rh_concat'|@translate} :</label> 153 <input type="checkbox" {$i.CONCAT_BEFORE} name="{$i.CURRENT_THEME_ID}concat_before"> {'rh_before'|@translate} <input type="checkbox" {$i.CONCAT_AFTER} name="{$i.CURRENT_THEME_ID}concat_after"> {'rh_after'|@translate} 154 </p> 155 156 </fieldset> 157 <div style="float:right;"> 158 <a style="border:none;" href="javascript:void(0)" onclick="document.getElementById('light{$i.CURRENT_THEME_ID}').style.display='none';document.getElementById('fade').style.display='none'" titlte="{'Close this window'|@translate}"> 159 <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/exit.png" class="button" alt="exit"></a> 160 </div> 161 <br /> 162 <div align="center" style="clear:left;"><input class="submit" type="submit" value="{'rh_submit'|@translate}" name="submit" /></div> 163 164 165 166 </div> 167 168 169 {/if} 31 {if $i.CATSELECTED==0} 32 {include file="$RH_confpanel"} 33 {/if} 170 34 {/foreach} 171 35 </div> <!-- themeBoxes --> 172 36 </fieldset> 173 37 174 </div> 38 </div> <!-- themesContent --> 39 175 40 <div id="fade" class="black_overlay"></div> 176 41 177 <div align="center" style="clear:left"><input class="submit" type="submit" value="{'rh_submit'|@translate}" name="submit" /></div>42 <div style="text-align:center;clear:left"><input class="submit" type="submit" value="{'rh_submit'|@translate}" name="submit" ></div> 178 43 </form> -
extensions/Random_Header/main.inc.php
r7330 r7358 15 15 class RandomHeader 16 16 { 17 var $rh_config; 17 var $rh_config; 18 18 19 function load_config() 19 { 20 $x = file_get_contents( dirname(__FILE__).'/data.dat' ); 21 22 if ($x!==false) 23 $this->rh_config = unserialize($x); 24 25 foreach (get_pwg_themes() as $pwg_templateID => $pwg_template) { 20 { 21 global $conf; 22 $this->rh_config = unserialize($conf['Random_Header']); 23 foreach (get_pwg_themes() as $pwg_templateID => $pwg_template) { 26 24 27 25 if (empty($this->rh_config[$pwg_templateID]['selected_cat'])) { … … 38 36 } 39 37 } 40 41 } 42 43 38 } 44 39 45 40 function save_config() 46 { 47 $file = fopen( dirname(__FILE__).'/data.dat', 'w' ); 48 fwrite($file, serialize($this->rh_config) ); 49 fclose( $file ); 50 } 41 { 42 $query = ' 43 UPDATE '.CONFIG_TABLE.' 44 SET value = "'.addslashes(serialize($this->rh_config)).'" 45 WHERE param = "Random_Header" 46 ;'; 47 pwg_query($query); 48 49 load_conf_from_db(); 50 } 51 51 52 52 function plugin_admin_menu($menu) … … 65 65 66 66 $usertheme=$user['theme'] ; 67 67 68 if (isset($this->rh_config[$usertheme])){ 68 69 if ( !defined('IN_ADMIN') && isset($page['body_id']) && ($page['body_id']!='thePicturePage' || $this->rh_config[$usertheme]['active_on_picture']=='on') ) { 69 70 … … 83 84 } 84 85 } 85 } 86 }} 86 87 } 87 88
Note: See TracChangeset
for help on using the changeset viewer.