Ignore:
Timestamp:
Jul 15, 2014, 8:03:00 PM (10 years ago)
Author:
flop25
Message:

Take A Tour:
-only 2 files per tour.tpl
-allow external tours
-absolute url when ending the tour
-better code, commented
wiki updated (2.7 technical changes)

Location:
trunk/plugins/TakeATour/tours
Files:
3 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/TakeATour/tours/2_7_0/config.inc.php

    r28393 r29046  
    11<?php
     2/**********************************
     3 * REQUIRED PATH TO THE TPL FILE */
    24
     5$TOUR_PATH = PHPWG_PLUGINS_PATH.'TakeATour/tours/2_7_0/tour.tpl';
     6
     7/*********************************/
     8
     9
     10/**********************
     11 *    Preparse part   *
     12 **********************/
     13  $template->assign('TAT_index', make_index_url(array('section' => 'categories')));
     14  $template->assign('TAT_search', get_root_url().'search.php');
     15
     16  //picture id
     17  if (isset($_GET['page']) and preg_match('/^photo-(\d+)(?:-(.*))?$/', $_GET['page'], $matches))
     18  {
     19    $_GET['image_id'] = $matches[1];
     20  }
     21  check_input_parameter('image_id', $_GET, false, PATTERN_ID);
     22  if (isset($_GET['image_id']) and pwg_get_session_var('TAT_image_id')==null)
     23  {
     24    $template->assign('TAT_image_id', $_GET['image_id']);
     25    pwg_set_session_var('TAT_image_id', $_GET['image_id']);
     26  }
     27  elseif (is_numeric(pwg_get_session_var('TAT_image_id')))
     28  {
     29    $template->assign('TAT_image_id', pwg_get_session_var('TAT_image_id'));
     30  }
     31  else
     32  {
     33    $query = '
     34    SELECT id
     35      FROM '.IMAGES_TABLE.'
     36      ORDER BY RAND()
     37      LIMIT 1 
     38    ;';
     39    $row = pwg_db_fetch_assoc(pwg_query($query));
     40    $template->assign('TAT_image_id', $row['id']);
     41  }
    342?>
  • trunk/plugins/TakeATour/tours/2_7_0/tour.tpl

    r28951 r29046  
    44  name: "2_7_0",
    55  orphan: true,
    6   onEnd: function (tour) {window.location = "admin.php?page=plugin-TakeATour&tour_ended=2_7_0"},
     6  onEnd: function (tour) {window.location = "{/literal}{$ABS_U_ADMIN}{literal}admin.php?page=plugin-TakeATour&tour_ended=2_7_0"},
    77  template: "<div class='popover'>          <div class='arrow'></div>          <h3 class='popover-title'></h3>          <div class='popover-content'></div>          <div class='popover-navigation'>            <div class='btn-group'>              <button class='btn btn-sm btn-default' data-role='prev'>&laquo; {/literal}{'Prev'|@translate|@escape:'javascript'}{literal}</button>              <button class='btn btn-sm btn-default' data-role='next'>{/literal}{'Next '|@translate|@escape:'javascript'}{literal} &raquo;</button>            </div>            <button class='btn btn-sm btn-default' data-role='end'>{/literal}{'End tour'|@translate|@escape:'javascript'}{literal}</button>          </div>        </div>",
    88});
  • trunk/plugins/TakeATour/tours/first_contact/config.inc.php

    r28169 r29046  
    11<?php
     2/**********************************
     3 * REQUIRED PATH TO THE TPL FILE */
     4
     5$TOUR_PATH = PHPWG_PLUGINS_PATH.'TakeATour/tours/first_contact/tour.tpl';
     6
     7/*********************************/
     8
    29if ( defined('IN_ADMIN') and IN_ADMIN )
    310{
     
    6976}
    7077
     78/**********************
     79 *    Preparse part   *
     80 **********************/
     81  //picture id
     82  if (isset($_GET['page']) and preg_match('/^photo-(\d+)(?:-(.*))?$/', $_GET['page'], $matches))
     83  {
     84    $_GET['image_id'] = $matches[1];
     85  }
     86  check_input_parameter('image_id', $_GET, false, PATTERN_ID);
     87  if (isset($_GET['image_id']) and pwg_get_session_var('TAT_image_id')==null)
     88  {
     89    $template->assign('TAT_image_id', $_GET['image_id']);
     90    pwg_set_session_var('TAT_image_id', $_GET['image_id']);
     91  }
     92  elseif (is_numeric(pwg_get_session_var('TAT_image_id')))
     93  {
     94    $template->assign('TAT_image_id', pwg_get_session_var('TAT_image_id'));
     95  }
     96  else
     97  {
     98    $query = '
     99    SELECT id
     100      FROM '.IMAGES_TABLE.'
     101      ORDER BY RAND()
     102      LIMIT 1 
     103    ;';
     104    $row = pwg_db_fetch_assoc(pwg_query($query));
     105    $template->assign('TAT_image_id', $row['id']);
     106  }
     107  //album id
     108  if (isset($_GET['page']) and preg_match('/^album-(\d+)(?:-(.*))?$/', $_GET['page'], $matches))
     109  {
     110    $_GET['cat_id'] = $matches[1];
     111  }
     112  check_input_parameter('cat_id', $_GET, false, PATTERN_ID);
     113  if (isset($_GET['cat_id']) and pwg_get_session_var('TAT_cat_id')==null)
     114  {
     115    $template->assign('TAT_cat_id', $_GET['cat_id']);
     116    pwg_set_session_var('TAT_cat_id', $_GET['cat_id']);
     117  }
     118  elseif (is_numeric(pwg_get_session_var('TAT_cat_id')))
     119  {
     120    $template->assign('TAT_cat_id', pwg_get_session_var('TAT_cat_id'));
     121  }
     122  else
     123  {
     124    $query = '
     125    SELECT id
     126      FROM '.CATEGORIES_TABLE.'
     127      ORDER BY RAND()
     128      LIMIT 1 
     129    ;';
     130    $row = pwg_db_fetch_assoc(pwg_query($query));
     131    $template->assign('TAT_cat_id', $row['id']);
     132  }
     133  global $conf;
     134  if ( isset($conf['enable_synchronization']) )
     135  {
     136    $template->assign('TAT_FTP', $conf['enable_synchronization']);
     137  }
     138
    71139?>
  • trunk/plugins/TakeATour/tours/first_contact/tour.tpl

    r28775 r29046  
    44  name: "first_contact",
    55  orphan: true,
    6   onEnd: function (tour) {window.location = "admin.php?page=plugin-TakeATour&tour_ended=first_contact"},
     6  onEnd: function (tour) {window.location = "{/literal}{$ABS_U_ADMIN}{literal}admin.php?page=plugin-TakeATour&tour_ended=first_contact"},
    77  template: "<div class='popover'>          <div class='arrow'></div>          <h3 class='popover-title'></h3>          <div class='popover-content'></div>          <div class='popover-navigation'>            <div class='btn-group'>              <button class='btn btn-sm btn-default' data-role='prev'>&laquo; {/literal}{'Prev'|@translate|@escape:'javascript'}{literal}</button>              <button class='btn btn-sm btn-default' data-role='next'>{/literal}{'Next '|@translate|@escape:'javascript'}{literal} &raquo;</button>            </div>            <button class='btn btn-sm btn-default' data-role='end'>{/literal}{'End tour'|@translate|@escape:'javascript'}{literal}</button>          </div>        </div>",
    88});
  • trunk/plugins/TakeATour/tours/privacy/config.inc.php

    r28951 r29046  
    11<?php
    2 if ( defined('IN_ADMIN') and IN_ADMIN )
    3 {
    4 /* first contact */
    5 add_event_handler('loc_end_element_set_global', 'TAT_FC_14');
    6 add_event_handler('loc_end_picture_modify', 'TAT_FC_16');
    7 add_event_handler('loc_end_picture_modify', 'TAT_FC_17');
    8 add_event_handler('loc_end_cat_modify', 'TAT_FC_23');
    9 add_event_handler('loc_end_themes_installed', 'TAT_FC_35');
    10 }
     2/**********************************
     3 * REQUIRED PATH TO THE TPL FILE */
    114
    12 function TAT_FC_14()
    13 {
    14   global $template;
    15   $template->set_prefilter('batch_manager_global', 'TAT_FC_14_prefilter');
    16 }
    17 function TAT_FC_14_prefilter ($content, &$smarty)
    18 {
    19   $search = '<span class="wrap2';
    20   $replacement = '{counter print=false assign=TAT_FC_14}<span {if $TAT_FC_14==1}id="TAT_FC_14"{/if} class="wrap2';
    21   $content = str_replace($search, $replacement, $content);
    22   $search = 'target="_blank">{\'Edit\'';
    23   $replacement = '>{\'Edit\'';
    24   return str_replace($search, $replacement, $content);
    25 }
    26 function TAT_FC_16()
    27 {
    28   global $template;
    29   $template->set_prefilter('picture_modify', 'TAT_FC_16_prefilter');
    30 }
    31 function TAT_FC_16_prefilter ($content, &$smarty)
    32 {
    33   $search = '<strong>{\'Linked albums\'|@translate}</strong>';
    34   $replacement = '<span id="TAT_FC_16"><strong>{\'Linked albums\'|@translate}</strong></span>';
    35   return str_replace($search, $replacement, $content);
    36 }
    37 function TAT_FC_17()
    38 {
    39   global $template;
    40   $template->set_prefilter('picture_modify', 'TAT_FC_17_prefilter');
    41 }
    42 function TAT_FC_17_prefilter ($content, &$smarty)
    43 {
    44   $search = '<strong>{\'Representation of albums\'|@translate}</strong>';
    45   $replacement = '<span id="TAT_FC_17"><strong>{\'Representation of albums\'|@translate}</strong></span>';
    46   return str_replace($search, $replacement, $content);
    47 }
    48 function TAT_FC_23()
    49 {
    50   global $template;
    51   $template->set_prefilter('album_properties', 'TAT_FC_23_prefilter');
    52 }
    53 function TAT_FC_23_prefilter ($content, &$smarty)
    54 {
    55   $search = '<strong>{\'Lock\'|@translate}</strong>';
    56   $replacement = '<span id="TAT_FC_23"><strong>{\'Lock\'|@translate}</strong></span>';
    57   return str_replace($search, $replacement, $content);
    58 }
    59 function TAT_FC_35()
    60 {
    61   global $template;
    62   $template->set_prefilter('themes', 'TAT_FC_35_prefilter');
    63 }
    64 function TAT_FC_35_prefilter ($content, &$smarty)
    65 {
    66   $search = '<a href="{$set_default_baseurl}{$theme.ID}" class="tiptip"';
    67   $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}';
    68   return str_replace($search, $replacement, $content);
    69 }
     5$TOUR_PATH = PHPWG_PLUGINS_PATH.'TakeATour/tours/privacy/tour.tpl';
    706
     7/*********************************/
     8
     9
     10
     11/**********************
     12 *    Preparse part   *
     13 **********************/
     14  //picture id
     15  if (isset($_GET['page']) and preg_match('/^photo-(\d+)(?:-(.*))?$/', $_GET['page'], $matches))
     16  {
     17    $_GET['image_id'] = $matches[1];
     18  }
     19  check_input_parameter('image_id', $_GET, false, PATTERN_ID);
     20  if (isset($_GET['image_id']) and pwg_get_session_var('TAT_image_id')==null)
     21  {
     22    $template->assign('TAT_image_id', $_GET['image_id']);
     23    pwg_set_session_var('TAT_image_id', $_GET['image_id']);
     24  }
     25  elseif (is_numeric(pwg_get_session_var('TAT_image_id')))
     26  {
     27    $template->assign('TAT_image_id', pwg_get_session_var('TAT_image_id'));
     28  }
     29  else
     30  {
     31    $query = '
     32    SELECT id
     33      FROM '.IMAGES_TABLE.'
     34      ORDER BY RAND()
     35      LIMIT 1 
     36    ;';
     37    $row = pwg_db_fetch_assoc(pwg_query($query));
     38    $template->assign('TAT_image_id', $row['id']);
     39  }
     40  //album id
     41  if (isset($_GET['page']) and preg_match('/^album-(\d+)(?:-(.*))?$/', $_GET['page'], $matches))
     42  {
     43    $_GET['cat_id'] = $matches[1];
     44  }
     45  check_input_parameter('cat_id', $_GET, false, PATTERN_ID);
     46  if (isset($_GET['cat_id']) and pwg_get_session_var('TAT_cat_id')==null)
     47  {
     48    $template->assign('TAT_cat_id', $_GET['cat_id']);
     49    pwg_set_session_var('TAT_cat_id', $_GET['cat_id']);
     50  }
     51  elseif (is_numeric(pwg_get_session_var('TAT_cat_id')))
     52  {
     53    $template->assign('TAT_cat_id', pwg_get_session_var('TAT_cat_id'));
     54  }
     55  else
     56  {
     57    $query = '
     58    SELECT id
     59      FROM '.CATEGORIES_TABLE.'
     60      ORDER BY RAND()
     61      LIMIT 1 
     62    ;';
     63    $row = pwg_db_fetch_assoc(pwg_query($query));
     64    $template->assign('TAT_cat_id', $row['id']);
     65  }
     66  global $conf;
     67  if ( isset($conf['enable_synchronization']) )
     68  {
     69    $template->assign('TAT_FTP', $conf['enable_synchronization']);
     70  }
    7171?>
  • trunk/plugins/TakeATour/tours/privacy/tour.tpl

    r29007 r29046  
    44  name: "privacy",
    55  orphan: true,
    6   onEnd: function (tour) {window.location = "admin.php?tour_ended=privacy";},
     6  onEnd: function (tour) {window.location = "{/literal}{$ABS_U_ADMIN}{literal}admin.php?tour_ended=privacy";},
    77  template: "<div class='popover tour'>
    88  <div class='arrow'></div>
Note: See TracChangeset for help on using the changeset viewer.