Changeset 28059
- Timestamp:
- Apr 2, 2014, 10:48:29 PM (10 years ago)
- Location:
- extensions/TakeATour
- Files:
-
- 8 added
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/TakeATour/main.inc.php
r27998 r28059 18 18 { 19 19 pwg_set_session_var('tour_to_launch', $_POST['submited_tour']); 20 global $TAT ;21 $TAT ['restart']=true;20 global $TAT_restart; 21 $TAT_restart=true; 22 22 } 23 23 elseif ( isset($_GET['tour_ended']) and in_array($_GET['tour_ended'], $avalaible_tour) and defined('IN_ADMIN') and IN_ADMIN ) 24 24 { 25 25 pwg_unset_session_var('tour_to_launch'); 26 pwg_unset_session_var('TAT_image_id');27 pwg_unset_session_var('TAT_cat_id');28 26 } 29 27 30 if ( pwg_get_session_var('tour_to_launch') and defined('IN_ADMIN') and IN_ADMIN )28 if ( pwg_get_session_var('tour_to_launch') and defined('IN_ADMIN') and IN_ADMIN ) 31 29 { 32 add_event_handler('init', 'TAT_add_js_css'); 30 if !in_array(pwg_get_session_var('tour_to_launch'), $conf['TakeATour_tour_ignored']) or !isset($conf['TakeATour_tour_ignored'])) 31 { 32 add_event_handler('init', 'TAT_add_js_css'); 33 include('tours/'.pwg_get_session_var('tour_to_launch').'/config.inc.php'); 34 } 33 35 } 34 36 function TAT_add_js_css() 35 37 { 36 global $template, $TAT ;38 global $template, $TAT_restart; 37 39 $tour_to_launch=pwg_get_session_var('tour_to_launch'); 38 40 load_language('plugin.lang', PHPWG_PLUGINS_PATH .'TakeATour/'); 39 41 $template->set_filename('TAT_js_css', PHPWG_PLUGINS_PATH.'TakeATour/tpl/js_css.tpl'); 40 42 $template->parse('TAT_js_css');//http://piwigo.org/forum/viewtopic.php?id=23248 41 if (isset($TAT ['restart']) and $TAT['restart'])43 if (isset($TAT_restart) and $TAT_restart) 42 44 { 43 $TAT ['restart']=false;45 $TAT_restart=false; 44 46 $template->assign('TAT_restart',true); 45 47 } 46 48 $tat_path=str_replace(basename($_SERVER['SCRIPT_NAME']),'', $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']); 49 //$tat_path=$_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; 47 50 $template->assign('TAT_path', $tat_path); 48 //picture id 49 if (isset($_GET['page']) and preg_match('/^photo-(\d+)(?:-(.*))?$/', $_GET['page'], $matches)) 50 { 51 $_GET['image_id'] = $matches[1]; 52 } 53 check_input_parameter('image_id', $_GET, false, PATTERN_ID); 54 if (isset($_GET['image_id']) and pwg_get_session_var('TAT_image_id')==null) 55 { 56 $template->assign('TAT_image_id', $_GET['image_id']); 57 pwg_set_session_var('TAT_image_id', $_GET['image_id']); 58 } 59 elseif (is_numeric(pwg_get_session_var('TAT_image_id'))) 60 { 61 $template->assign('TAT_image_id', pwg_get_session_var('TAT_image_id')); 62 } 63 else 64 { 65 $query = ' 66 SELECT id 67 FROM '.IMAGES_TABLE.' 68 ORDER BY RAND() 69 LIMIT 1 70 ;'; 71 $row = pwg_db_fetch_assoc(pwg_query($query)); 72 $template->assign('TAT_image_id', $row['id']); 73 } 74 //album id 75 if (isset($_GET['page']) and preg_match('/^album-(\d+)(?:-(.*))?$/', $_GET['page'], $matches)) 76 { 77 $_GET['cat_id'] = $matches[1]; 78 } 79 check_input_parameter('cat_id', $_GET, false, PATTERN_ID); 80 if (isset($_GET['cat_id']) and pwg_get_session_var('TAT_cat_id')==null) 81 { 82 $template->assign('TAT_cat_id', $_GET['cat_id']); 83 pwg_set_session_var('TAT_cat_id', $_GET['cat_id']); 84 } 85 elseif (is_numeric(pwg_get_session_var('TAT_cat_id'))) 86 { 87 $template->assign('TAT_cat_id', pwg_get_session_var('TAT_cat_id')); 88 } 89 else 90 { 91 $query = ' 92 SELECT id 93 FROM '.CATEGORIES_TABLE.' 94 ORDER BY RAND() 95 LIMIT 1 96 ;'; 97 $row = pwg_db_fetch_assoc(pwg_query($query)); 98 $template->assign('TAT_cat_id', $row['id']); 99 } 100 51 include('tours/'.$tour_to_launch.'/config_preparse.inc.php') 101 52 $template->set_filename('TAT_tour_tpl', PHPWG_PLUGINS_PATH.'TakeATour/tpl/'.$tour_to_launch.'.tpl'); 102 53 $template->parse('TAT_tour_tpl'); 103 unset($tour_to_launch);104 54 } 105 55 106 if ( defined('IN_ADMIN') and IN_ADMIN )107 {108 /* first contact */109 add_event_handler('loc_end_element_set_global', 'TAT_FC_14');110 add_event_handler('loc_end_picture_modify', 'TAT_FC_16');111 add_event_handler('loc_end_picture_modify', 'TAT_FC_17');112 add_event_handler('loc_end_cat_modify', 'TAT_FC_23');113 add_event_handler('loc_end_themes_installed', 'TAT_FC_35');114 }115 116 function TAT_FC_14()117 {118 global $template;119 $template->set_prefilter('batch_manager_global', 'TAT_FC_14_prefilter');120 }121 function TAT_FC_14_prefilter ($content, &$smarty)122 {123 $search = '<span class="wrap2';124 $replacement = '{counter print=false assign=TAT_FC_14}<span {if $TAT_FC_14==1}id="TAT_FC_14"{/if} class="wrap2';125 $content = str_replace($search, $replacement, $content);126 $search = 'target="_blank">{\'Edit\'';127 $replacement = '>{\'Edit\'';128 return str_replace($search, $replacement, $content);129 }130 function TAT_FC_16()131 {132 global $template;133 $template->set_prefilter('picture_modify', 'TAT_FC_16_prefilter');134 }135 function TAT_FC_16_prefilter ($content, &$smarty)136 {137 $search = '<strong>{\'Linked albums\'|@translate}</strong>';138 $replacement = '<span id="TAT_FC_16"><strong>{\'Linked albums\'|@translate}</strong></span>';139 return str_replace($search, $replacement, $content);140 }141 function TAT_FC_17()142 {143 global $template;144 $template->set_prefilter('picture_modify', 'TAT_FC_17_prefilter');145 }146 function TAT_FC_17_prefilter ($content, &$smarty)147 {148 $search = '<strong>{\'Representation of albums\'|@translate}</strong>';149 $replacement = '<span id="TAT_FC_17"><strong>{\'Representation of albums\'|@translate}</strong></span>';150 return str_replace($search, $replacement, $content);151 }152 function TAT_FC_23()153 {154 global $template;155 $template->set_prefilter('album_properties', 'TAT_FC_23_prefilter');156 }157 function TAT_FC_23_prefilter ($content, &$smarty)158 {159 $search = '<strong>{\'Lock\'|@translate}</strong>';160 $replacement = '<span id="TAT_FC_23"><strong>{\'Lock\'|@translate}</strong></span>';161 return str_replace($search, $replacement, $content);162 }163 function TAT_FC_35()164 {165 global $template;166 $template->set_prefilter('themes', 'TAT_FC_35_prefilter');167 }168 function TAT_FC_35_prefilter ($content, &$smarty)169 {170 $search = '<a href="{$set_default_baseurl}{$theme.ID}" class="tiptip"';171 $replacement = '{counter print=false assign=TAT_FC_35}<a href="{$set_default_baseurl}{$theme.ID}" class="tiptip" {if $TAT_FC_35==1}id="TAT_FC_35"{/if}';172 return str_replace($search, $replacement, $content);173 }174 56 175 57 /* -
extensions/TakeATour/tpl/admin.tpl
r27998 r28059 1 1 <div class="titrePage"> 2 <h2>{' takeatour_configpage'|@translate}</h2>2 <h2>{'iconset_configpage'|@translate}</h2> 3 3 </div> 4 <div id=" TAT_Content">4 <div id="themesContent"> 5 5 <fieldset> 6 6 <legend>{'First Contact'|@translate}</legend> 7 <div class="TAT_description">{'Recommended for beginners, this tour introduce you Piwigo, its basic features. It will start by adding pictures, then manage them. The tour continues with album management and permissions, and ends on the customization using the configuration, the themes and the plugins.'|@translate}</div>8 7 <form action="{$F_ACTION}" method="post"> 9 8 <input type="hidden" name="submited_tour" value="first_contact"> 10 <input type="submit" name="button2" id="button2" value="{'Launch the Tour'|@translate}" >9 <input type="submit" name="button2" id="button2" value="{'Launch the Tour'|@translate}" style=" width:100%" /> 11 10 </form> 12 11 </fieldset>
Note: See TracChangeset
for help on using the changeset viewer.