Changeset 27998


Ignore:
Timestamp:
Mar 28, 2014, 7:17:44 PM (10 years ago)
Author:
flop25
Message:

manamanaging the picture and album ids, etc

Location:
extensions/TakeATour
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/TakeATour/admin.php

    r27898 r27998  
    1111    )
    1212  );
    13 /*
     13
    1414$template->func_combine_css(array(
    15         'path' => 'plugins/TakeATour/template/admin.css',
     15        'path' => 'plugins/TakeATour/css/admin.css',
    1616        )
    17 );*/
     17);
    1818
    1919$template->set_filename('plugin_admin_content', dirname(__FILE__) .'/tpl/admin.tpl');
  • extensions/TakeATour/language/en_UK/description.txt

    r27994 r27998  
    1 Apprenez à utiliser votre Piwigo, avec ce plugin qui vous prendra par la main à travers ses 'visites' à thèmes
     1Visit your Piwigo to learn how to use it. This plugin has multiple thematic tours for beginners and advanced users.
  • extensions/TakeATour/main.inc.php

    r27898 r27998  
    1818{
    1919  pwg_set_session_var('tour_to_launch', $_POST['submited_tour']);
    20   global $TAT_restart;
    21   $TAT_restart=true;
     20  global $TAT;
     21  $TAT['restart']=true;
    2222}
    2323elseif ( isset($_GET['tour_ended']) and in_array($_GET['tour_ended'], $avalaible_tour) and defined('IN_ADMIN') and IN_ADMIN )
    2424{
    2525  pwg_unset_session_var('tour_to_launch');
     26  pwg_unset_session_var('TAT_image_id');
     27  pwg_unset_session_var('TAT_cat_id');
    2628}
    2729
     
    3234function TAT_add_js_css()
    3335{
    34   global $template, $TAT_restart;
     36  global $template, $TAT;
    3537  $tour_to_launch=pwg_get_session_var('tour_to_launch');
    3638  load_language('plugin.lang', PHPWG_PLUGINS_PATH .'TakeATour/');
    3739  $template->set_filename('TAT_js_css', PHPWG_PLUGINS_PATH.'TakeATour/tpl/js_css.tpl');
    3840  $template->parse('TAT_js_css');//http://piwigo.org/forum/viewtopic.php?id=23248
    39   if (isset($TAT_restart) and $TAT_restart)
    40   {
    41     $TAT_restart=false;
     41  if (isset($TAT['restart']) and $TAT['restart'])
     42  {
     43    $TAT['restart']=false;
    4244    $template->assign('TAT_restart',true);
    4345  }
    4446  $tat_path=str_replace(basename($_SERVER['SCRIPT_NAME']),'', $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']);
    45   //$tat_path=$_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
    4647  $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
    47101  $template->set_filename('TAT_tour_tpl', PHPWG_PLUGINS_PATH.'TakeATour/tpl/'.$tour_to_launch.'.tpl');
    48102  $template->parse('TAT_tour_tpl');
     
    60114}
    61115
    62 function TAT_FC_14() {
     116function TAT_FC_14()
     117{
    63118  global $template;
    64119  $template->set_prefilter('batch_manager_global', 'TAT_FC_14_prefilter');
    65120}
    66 function TAT_FC_14_prefilter ($content, &$smarty) {
     121function TAT_FC_14_prefilter ($content, &$smarty)
     122{
    67123  $search = '<span class="wrap2';
    68124  $replacement = '{counter print=false assign=TAT_FC_14}<span {if $TAT_FC_14==1}id="TAT_FC_14"{/if} class="wrap2';
    69   return str_replace($search, $replacement, $content);
    70 }
    71 function TAT_FC_16() {
     125  $content = str_replace($search, $replacement, $content);
     126  $search = 'target="_blank">{\'Edit\'';
     127  $replacement = '>{\'Edit\'';
     128  return str_replace($search, $replacement, $content);
     129}
     130function TAT_FC_16()
     131{
    72132  global $template;
    73133  $template->set_prefilter('picture_modify', 'TAT_FC_16_prefilter');
    74134}
    75 function TAT_FC_16_prefilter ($content, &$smarty) {
     135function TAT_FC_16_prefilter ($content, &$smarty)
     136{
    76137  $search = '<strong>{\'Linked albums\'|@translate}</strong>';
    77138  $replacement = '<span id="TAT_FC_16"><strong>{\'Linked albums\'|@translate}</strong></span>';
    78139  return str_replace($search, $replacement, $content);
    79140}
    80 function TAT_FC_17() {
     141function TAT_FC_17()
     142{
    81143  global $template;
    82144  $template->set_prefilter('picture_modify', 'TAT_FC_17_prefilter');
    83145}
    84 function TAT_FC_17_prefilter ($content, &$smarty) {
     146function TAT_FC_17_prefilter ($content, &$smarty)
     147{
    85148  $search = '<strong>{\'Representation of albums\'|@translate}</strong>';
    86149  $replacement = '<span id="TAT_FC_17"><strong>{\'Representation of albums\'|@translate}</strong></span>';
    87150  return str_replace($search, $replacement, $content);
    88151}
    89 function TAT_FC_23() {
     152function TAT_FC_23()
     153{
    90154  global $template;
    91155  $template->set_prefilter('album_properties', 'TAT_FC_23_prefilter');
    92156}
    93 function TAT_FC_23_prefilter ($content, &$smarty) {
     157function TAT_FC_23_prefilter ($content, &$smarty)
     158{
    94159  $search = '<strong>{\'Lock\'|@translate}</strong>';
    95160  $replacement = '<span id="TAT_FC_23"><strong>{\'Lock\'|@translate}</strong></span>';
    96161  return str_replace($search, $replacement, $content);
    97162}
    98 function TAT_FC_35() {
     163function TAT_FC_35()
     164{
    99165  global $template;
    100166  $template->set_prefilter('themes', 'TAT_FC_35_prefilter');
    101167}
    102 function TAT_FC_35_prefilter ($content, &$smarty) {
     168function TAT_FC_35_prefilter ($content, &$smarty)
     169{
    103170  $search = '<a href="{$set_default_baseurl}{$theme.ID}" class="tiptip"';
    104171  $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}';
  • extensions/TakeATour/tpl/admin.tpl

    r27898 r27998  
    11<div class="titrePage">
    2   <h2>{'iconset_configpage'|@translate}</h2>
     2  <h2>{'takeatour_configpage'|@translate}</h2>
    33</div>
    4 <div id="themesContent">
     4<div id="TAT_Content">
    55  <fieldset>
    66    <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>
    78    <form action="{$F_ACTION}" method="post">
    89      <input type="hidden" name="submited_tour" value="first_contact">
    9       <input type="submit" name="button2" id="button2" value="{'Launch the Tour'|@translate}" style=" width:100%" />
     10      <input type="submit" name="button2" id="button2" value="{'Launch the Tour'|@translate}">
    1011    </form>
    1112  </fieldset>
  • extensions/TakeATour/tpl/first_contact.tpl

    r27898 r27998  
    1212    path: "{/literal}{$TAT_path}{literal}admin.php",
    1313    title: "{/literal}{'Welcome in your Piwigo gallery'|@translate}{literal}",
    14     content: "{/literal}{'Let\'s start by adding pictures'|@translate}{literal}"
     14    content: "{/literal}{'Hello! I will be your guide to discover Piwigo. Please follow my instructions, and click Next (or use the arrows of your keyboard) to navigate. If you go in an other page of the administration, you will be redirected to the current page of the Tour.<br>Let\'s start by adding pictures!'|@translate}{literal}"
    1515  },
    1616  {
     
    110110    reflex:true,
    111111    content: "{/literal}{'We will see now the edition page of one picture. That page is reachable from here but also from the public picture page when logged as an administrator. Click on Edit or go next'|@translate}{literal}",
    112     onNext:function (tour) {window.location = "admin.php?page=photo-1";}
     112    onNext:function (tour) {window.location = "admin.php?page=photo-{/literal}{$TAT_image_id}{literal}";}
    113113  },
    114114  {//15
    115115    path: /admin\.php\?page=photo-/,
    116     redirect:function (tour) {window.location = "admin.php?page=photo-1";},
     116    redirect:function (tour) {window.location = "admin.php?page=photo-{/literal}{$TAT_image_id}{literal}";},
    117117    placement: "bottom",
    118118    element: ".selected_tab",
     
    122122  {
    123123    path: /admin\.php\?page=photo-/,
    124     redirect:function (tour) {window.location = "admin.php?page=photo-1";},
     124    redirect:function (tour) {window.location = "admin.php?page=photo-{/literal}{$TAT_image_id}{literal}";},
    125125    placement: "top",
    126126    element: "#TAT_FC_16",
     
    129129  {
    130130    path: /admin\.php\?page=photo-/,
    131     redirect:function (tour) {window.location = "admin.php?page=photo-1";},
     131    redirect:function (tour) {window.location = "admin.php?page=photo-{/literal}{$TAT_image_id}{literal}";},
    132132    placement: "top",
    133133    element: "#TAT_FC_17",
     
    136136  {
    137137    path: /admin\.php\?page=photo-/,
    138     redirect:function (tour) {window.location = "admin.php?page=photo-1";},
     138    redirect:function (tour) {window.location = "admin.php?page=photo-{/literal}{$TAT_image_id}{literal}";},
    139139    placement: "top",
    140140    title: "{/literal}{'Manage albums'|@translate}{literal}",
     
    147147    title: "{/literal}{'Manage Albums'|@translate}{literal}",
    148148    content: "{/literal}{'Here are listed all the \'top\' albums, the ones at the root of your gallery. If you see an album with a dashed backgroung, it\'s an real physical album from a FTP synchro, which can\'t be moved or deleted from here. The others albums are called virtual albums.'|@translate}{literal}",
    149     onPrev: function (tour) {window.location = "admin.php?page=photo-1";},
     149    onPrev: function (tour) {window.location = "admin.php?page=photo-{/literal}{$TAT_image_id}{literal}";},
    150150
    151151  },
     
    166166  {
    167167    path: /admin\.php\?page=album-/,
    168     redirect:function (tour) {window.location = "admin.php?page=album-1";},
     168    redirect:function (tour) {window.location = "admin.php?page=album-{/literal}{$TAT_cat_id}{literal}";},
    169169    placement: "top",
    170170    element: ".selected_tab",
     
    174174  {
    175175    path: /admin\.php\?page=album-/,
    176     redirect:function (tour) {window.location = "admin.php?page=album-1";},
     176    redirect:function (tour) {window.location = "admin.php?page=album-{/literal}{$TAT_cat_id}{literal}";},
    177177    placement: "top",
    178178    element: "#TAT_FC_23",
     
    181181  {
    182182    path: /admin\.php\?page=album-/,
    183     redirect:function (tour) {window.location = "admin.php?page=album-1";},
     183    redirect:function (tour) {window.location = "admin.php?page=album-{/literal}{$TAT_cat_id}{literal}";},
    184184    placement: "bottom",
    185185    element: ".tabsheet",
     
    188188  {//25
    189189    path: /admin\.php\?page=album-[0-9]+-permissions/,
    190     redirect:function (tour) {window.location = "admin.php?page=album-1-permissions";},
     190    redirect:function (tour) {window.location = "admin.php?page=album-{/literal}{$TAT_cat_id}{literal}-permissions";},
    191191    placement: "left",
    192192    element: "#content",
     
    195195  },
    196196  {
     197    path: /admin\.php\?page=album-[0-9]+-permissions/,
     198    redirect:function (tour) {window.location = "admin.php?page=album-{/literal}{$TAT_cat_id}{literal}-permissions";},
    197199    placement: "top",
    198200    element: "#selectStatus",
     
    200202  },
    201203  {
     204    path: /admin\.php\?page=album-[0-9]+-permissions/,
     205    redirect:function (tour) {window.location = "admin.php?page=album-{/literal}{$TAT_cat_id}{literal}-permissions";},
    202206    placement: "top",
    203207    element: "#selectStatus",
     
    205209  },
    206210  {
    207     placement: "top",
    208     element: "",
     211    path: /admin\.php\?page=album-[0-9]+-permissions/,
     212    redirect:function (tour) {window.location = "admin.php?page=album-{/literal}{$TAT_cat_id}{literal}-permissions";},
     213    placement: "top",
    209214    title: "{/literal}{'Configuration'|@translate}{literal}",
    210215    content: "{/literal}{'Now we will look at the options available to set Piwigo working your way. Click on Configuration->Options or just hit Next.'|@translate}{literal}"
Note: See TracChangeset for help on using the changeset viewer.