aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/TakeATour/tours
diff options
context:
space:
mode:
authorflop25 <flop25@piwigo.org>2014-07-15 18:03:00 +0000
committerflop25 <flop25@piwigo.org>2014-07-15 18:03:00 +0000
commit69c4a00dae2048dc685c6b1328f1a9e24335ce1f (patch)
tree757ab1d16471acc4c78bd76139649746cda642d7 /plugins/TakeATour/tours
parent0efcdefe415f0d5bd440b20be4518b5ec6c4c2c3 (diff)
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) git-svn-id: http://piwigo.org/svn/trunk@29046 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'plugins/TakeATour/tours')
-rw-r--r--plugins/TakeATour/tours/2_7_0/config.inc.php39
-rw-r--r--plugins/TakeATour/tours/2_7_0/config_preparse.inc.php31
-rw-r--r--plugins/TakeATour/tours/2_7_0/tour.tpl2
-rw-r--r--plugins/TakeATour/tours/first_contact/config.inc.php68
-rw-r--r--plugins/TakeATour/tours/first_contact/config_preparse.inc.php59
-rw-r--r--plugins/TakeATour/tours/first_contact/tour.tpl2
-rw-r--r--plugins/TakeATour/tours/privacy/config.inc.php134
-rw-r--r--plugins/TakeATour/tours/privacy/config_preparse.inc.php59
-rw-r--r--plugins/TakeATour/tours/privacy/tour.tpl2
9 files changed, 177 insertions, 219 deletions
diff --git a/plugins/TakeATour/tours/2_7_0/config.inc.php b/plugins/TakeATour/tours/2_7_0/config.inc.php
index 0165eb215..76b671632 100644
--- a/plugins/TakeATour/tours/2_7_0/config.inc.php
+++ b/plugins/TakeATour/tours/2_7_0/config.inc.php
@@ -1,3 +1,42 @@
<?php
+/**********************************
+ * REQUIRED PATH TO THE TPL FILE */
+$TOUR_PATH = PHPWG_PLUGINS_PATH.'TakeATour/tours/2_7_0/tour.tpl';
+
+/*********************************/
+
+
+/**********************
+ * Preparse part *
+ **********************/
+ $template->assign('TAT_index', make_index_url(array('section' => 'categories')));
+ $template->assign('TAT_search', get_root_url().'search.php');
+
+ //picture id
+ if (isset($_GET['page']) and preg_match('/^photo-(\d+)(?:-(.*))?$/', $_GET['page'], $matches))
+ {
+ $_GET['image_id'] = $matches[1];
+ }
+ check_input_parameter('image_id', $_GET, false, PATTERN_ID);
+ if (isset($_GET['image_id']) and pwg_get_session_var('TAT_image_id')==null)
+ {
+ $template->assign('TAT_image_id', $_GET['image_id']);
+ pwg_set_session_var('TAT_image_id', $_GET['image_id']);
+ }
+ elseif (is_numeric(pwg_get_session_var('TAT_image_id')))
+ {
+ $template->assign('TAT_image_id', pwg_get_session_var('TAT_image_id'));
+ }
+ else
+ {
+ $query = '
+ SELECT id
+ FROM '.IMAGES_TABLE.'
+ ORDER BY RAND()
+ LIMIT 1
+ ;';
+ $row = pwg_db_fetch_assoc(pwg_query($query));
+ $template->assign('TAT_image_id', $row['id']);
+ }
?> \ No newline at end of file
diff --git a/plugins/TakeATour/tours/2_7_0/config_preparse.inc.php b/plugins/TakeATour/tours/2_7_0/config_preparse.inc.php
deleted file mode 100644
index 87aa6227b..000000000
--- a/plugins/TakeATour/tours/2_7_0/config_preparse.inc.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
- $template->assign('TAT_index', make_index_url(array('section' => 'categories')));
- $template->assign('TAT_search', get_root_url().'search.php');
-
- //picture id
- if (isset($_GET['page']) and preg_match('/^photo-(\d+)(?:-(.*))?$/', $_GET['page'], $matches))
- {
- $_GET['image_id'] = $matches[1];
- }
- check_input_parameter('image_id', $_GET, false, PATTERN_ID);
- if (isset($_GET['image_id']) and pwg_get_session_var('TAT_image_id')==null)
- {
- $template->assign('TAT_image_id', $_GET['image_id']);
- pwg_set_session_var('TAT_image_id', $_GET['image_id']);
- }
- elseif (is_numeric(pwg_get_session_var('TAT_image_id')))
- {
- $template->assign('TAT_image_id', pwg_get_session_var('TAT_image_id'));
- }
- else
- {
- $query = '
- SELECT id
- FROM '.IMAGES_TABLE.'
- ORDER BY RAND()
- LIMIT 1
- ;';
- $row = pwg_db_fetch_assoc(pwg_query($query));
- $template->assign('TAT_image_id', $row['id']);
- }
-?> \ No newline at end of file
diff --git a/plugins/TakeATour/tours/2_7_0/tour.tpl b/plugins/TakeATour/tours/2_7_0/tour.tpl
index e62390f57..eea93b55e 100644
--- a/plugins/TakeATour/tours/2_7_0/tour.tpl
+++ b/plugins/TakeATour/tours/2_7_0/tour.tpl
@@ -3,7 +3,7 @@
var tour = new Tour({
name: "2_7_0",
orphan: true,
- onEnd: function (tour) {window.location = "admin.php?page=plugin-TakeATour&tour_ended=2_7_0"},
+ onEnd: function (tour) {window.location = "{/literal}{$ABS_U_ADMIN}{literal}admin.php?page=plugin-TakeATour&tour_ended=2_7_0"},
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>",
});
{/literal}{if $TAT_restart}tour.restart();{/if}{literal}
diff --git a/plugins/TakeATour/tours/first_contact/config.inc.php b/plugins/TakeATour/tours/first_contact/config.inc.php
index 74bad9eda..30f797c66 100644
--- a/plugins/TakeATour/tours/first_contact/config.inc.php
+++ b/plugins/TakeATour/tours/first_contact/config.inc.php
@@ -1,4 +1,11 @@
<?php
+/**********************************
+ * REQUIRED PATH TO THE TPL FILE */
+
+$TOUR_PATH = PHPWG_PLUGINS_PATH.'TakeATour/tours/first_contact/tour.tpl';
+
+/*********************************/
+
if ( defined('IN_ADMIN') and IN_ADMIN )
{
/* first contact */
@@ -68,4 +75,65 @@ function TAT_FC_35_prefilter ($content, &$smarty)
return str_replace($search, $replacement, $content);
}
+/**********************
+ * Preparse part *
+ **********************/
+ //picture id
+ if (isset($_GET['page']) and preg_match('/^photo-(\d+)(?:-(.*))?$/', $_GET['page'], $matches))
+ {
+ $_GET['image_id'] = $matches[1];
+ }
+ check_input_parameter('image_id', $_GET, false, PATTERN_ID);
+ if (isset($_GET['image_id']) and pwg_get_session_var('TAT_image_id')==null)
+ {
+ $template->assign('TAT_image_id', $_GET['image_id']);
+ pwg_set_session_var('TAT_image_id', $_GET['image_id']);
+ }
+ elseif (is_numeric(pwg_get_session_var('TAT_image_id')))
+ {
+ $template->assign('TAT_image_id', pwg_get_session_var('TAT_image_id'));
+ }
+ else
+ {
+ $query = '
+ SELECT id
+ FROM '.IMAGES_TABLE.'
+ ORDER BY RAND()
+ LIMIT 1
+ ;';
+ $row = pwg_db_fetch_assoc(pwg_query($query));
+ $template->assign('TAT_image_id', $row['id']);
+ }
+ //album id
+ if (isset($_GET['page']) and preg_match('/^album-(\d+)(?:-(.*))?$/', $_GET['page'], $matches))
+ {
+ $_GET['cat_id'] = $matches[1];
+ }
+ check_input_parameter('cat_id', $_GET, false, PATTERN_ID);
+ if (isset($_GET['cat_id']) and pwg_get_session_var('TAT_cat_id')==null)
+ {
+ $template->assign('TAT_cat_id', $_GET['cat_id']);
+ pwg_set_session_var('TAT_cat_id', $_GET['cat_id']);
+ }
+ elseif (is_numeric(pwg_get_session_var('TAT_cat_id')))
+ {
+ $template->assign('TAT_cat_id', pwg_get_session_var('TAT_cat_id'));
+ }
+ else
+ {
+ $query = '
+ SELECT id
+ FROM '.CATEGORIES_TABLE.'
+ ORDER BY RAND()
+ LIMIT 1
+ ;';
+ $row = pwg_db_fetch_assoc(pwg_query($query));
+ $template->assign('TAT_cat_id', $row['id']);
+ }
+ global $conf;
+ if ( isset($conf['enable_synchronization']) )
+ {
+ $template->assign('TAT_FTP', $conf['enable_synchronization']);
+ }
+
?> \ No newline at end of file
diff --git a/plugins/TakeATour/tours/first_contact/config_preparse.inc.php b/plugins/TakeATour/tours/first_contact/config_preparse.inc.php
deleted file mode 100644
index 711dfe349..000000000
--- a/plugins/TakeATour/tours/first_contact/config_preparse.inc.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
- //picture id
- if (isset($_GET['page']) and preg_match('/^photo-(\d+)(?:-(.*))?$/', $_GET['page'], $matches))
- {
- $_GET['image_id'] = $matches[1];
- }
- check_input_parameter('image_id', $_GET, false, PATTERN_ID);
- if (isset($_GET['image_id']) and pwg_get_session_var('TAT_image_id')==null)
- {
- $template->assign('TAT_image_id', $_GET['image_id']);
- pwg_set_session_var('TAT_image_id', $_GET['image_id']);
- }
- elseif (is_numeric(pwg_get_session_var('TAT_image_id')))
- {
- $template->assign('TAT_image_id', pwg_get_session_var('TAT_image_id'));
- }
- else
- {
- $query = '
- SELECT id
- FROM '.IMAGES_TABLE.'
- ORDER BY RAND()
- LIMIT 1
- ;';
- $row = pwg_db_fetch_assoc(pwg_query($query));
- $template->assign('TAT_image_id', $row['id']);
- }
- //album id
- if (isset($_GET['page']) and preg_match('/^album-(\d+)(?:-(.*))?$/', $_GET['page'], $matches))
- {
- $_GET['cat_id'] = $matches[1];
- }
- check_input_parameter('cat_id', $_GET, false, PATTERN_ID);
- if (isset($_GET['cat_id']) and pwg_get_session_var('TAT_cat_id')==null)
- {
- $template->assign('TAT_cat_id', $_GET['cat_id']);
- pwg_set_session_var('TAT_cat_id', $_GET['cat_id']);
- }
- elseif (is_numeric(pwg_get_session_var('TAT_cat_id')))
- {
- $template->assign('TAT_cat_id', pwg_get_session_var('TAT_cat_id'));
- }
- else
- {
- $query = '
- SELECT id
- FROM '.CATEGORIES_TABLE.'
- ORDER BY RAND()
- LIMIT 1
- ;';
- $row = pwg_db_fetch_assoc(pwg_query($query));
- $template->assign('TAT_cat_id', $row['id']);
- }
- global $conf;
- if ( isset($conf['enable_synchronization']) )
- {
- $template->assign('TAT_FTP', $conf['enable_synchronization']);
- }
-?> \ No newline at end of file
diff --git a/plugins/TakeATour/tours/first_contact/tour.tpl b/plugins/TakeATour/tours/first_contact/tour.tpl
index 48acd5927..92b934c54 100644
--- a/plugins/TakeATour/tours/first_contact/tour.tpl
+++ b/plugins/TakeATour/tours/first_contact/tour.tpl
@@ -3,7 +3,7 @@
var tour = new Tour({
name: "first_contact",
orphan: true,
- onEnd: function (tour) {window.location = "admin.php?page=plugin-TakeATour&tour_ended=first_contact"},
+ onEnd: function (tour) {window.location = "{/literal}{$ABS_U_ADMIN}{literal}admin.php?page=plugin-TakeATour&tour_ended=first_contact"},
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>",
});
{/literal}{if $TAT_restart}tour.restart();{/if}{literal}
diff --git a/plugins/TakeATour/tours/privacy/config.inc.php b/plugins/TakeATour/tours/privacy/config.inc.php
index 74bad9eda..446e94f3f 100644
--- a/plugins/TakeATour/tours/privacy/config.inc.php
+++ b/plugins/TakeATour/tours/privacy/config.inc.php
@@ -1,71 +1,71 @@
<?php
-if ( defined('IN_ADMIN') and IN_ADMIN )
-{
-/* first contact */
-add_event_handler('loc_end_element_set_global', 'TAT_FC_14');
-add_event_handler('loc_end_picture_modify', 'TAT_FC_16');
-add_event_handler('loc_end_picture_modify', 'TAT_FC_17');
-add_event_handler('loc_end_cat_modify', 'TAT_FC_23');
-add_event_handler('loc_end_themes_installed', 'TAT_FC_35');
-}
+/**********************************
+ * REQUIRED PATH TO THE TPL FILE */
-function TAT_FC_14()
-{
- global $template;
- $template->set_prefilter('batch_manager_global', 'TAT_FC_14_prefilter');
-}
-function TAT_FC_14_prefilter ($content, &$smarty)
-{
- $search = '<span class="wrap2';
- $replacement = '{counter print=false assign=TAT_FC_14}<span {if $TAT_FC_14==1}id="TAT_FC_14"{/if} class="wrap2';
- $content = str_replace($search, $replacement, $content);
- $search = 'target="_blank">{\'Edit\'';
- $replacement = '>{\'Edit\'';
- return str_replace($search, $replacement, $content);
-}
-function TAT_FC_16()
-{
- global $template;
- $template->set_prefilter('picture_modify', 'TAT_FC_16_prefilter');
-}
-function TAT_FC_16_prefilter ($content, &$smarty)
-{
- $search = '<strong>{\'Linked albums\'|@translate}</strong>';
- $replacement = '<span id="TAT_FC_16"><strong>{\'Linked albums\'|@translate}</strong></span>';
- return str_replace($search, $replacement, $content);
-}
-function TAT_FC_17()
-{
- global $template;
- $template->set_prefilter('picture_modify', 'TAT_FC_17_prefilter');
-}
-function TAT_FC_17_prefilter ($content, &$smarty)
-{
- $search = '<strong>{\'Representation of albums\'|@translate}</strong>';
- $replacement = '<span id="TAT_FC_17"><strong>{\'Representation of albums\'|@translate}</strong></span>';
- return str_replace($search, $replacement, $content);
-}
-function TAT_FC_23()
-{
- global $template;
- $template->set_prefilter('album_properties', 'TAT_FC_23_prefilter');
-}
-function TAT_FC_23_prefilter ($content, &$smarty)
-{
- $search = '<strong>{\'Lock\'|@translate}</strong>';
- $replacement = '<span id="TAT_FC_23"><strong>{\'Lock\'|@translate}</strong></span>';
- return str_replace($search, $replacement, $content);
-}
-function TAT_FC_35()
-{
- global $template;
- $template->set_prefilter('themes', 'TAT_FC_35_prefilter');
-}
-function TAT_FC_35_prefilter ($content, &$smarty)
-{
- $search = '<a href="{$set_default_baseurl}{$theme.ID}" class="tiptip"';
- $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}';
- return str_replace($search, $replacement, $content);
-}
+$TOUR_PATH = PHPWG_PLUGINS_PATH.'TakeATour/tours/privacy/tour.tpl';
+/*********************************/
+
+
+
+/**********************
+ * Preparse part *
+ **********************/
+ //picture id
+ if (isset($_GET['page']) and preg_match('/^photo-(\d+)(?:-(.*))?$/', $_GET['page'], $matches))
+ {
+ $_GET['image_id'] = $matches[1];
+ }
+ check_input_parameter('image_id', $_GET, false, PATTERN_ID);
+ if (isset($_GET['image_id']) and pwg_get_session_var('TAT_image_id')==null)
+ {
+ $template->assign('TAT_image_id', $_GET['image_id']);
+ pwg_set_session_var('TAT_image_id', $_GET['image_id']);
+ }
+ elseif (is_numeric(pwg_get_session_var('TAT_image_id')))
+ {
+ $template->assign('TAT_image_id', pwg_get_session_var('TAT_image_id'));
+ }
+ else
+ {
+ $query = '
+ SELECT id
+ FROM '.IMAGES_TABLE.'
+ ORDER BY RAND()
+ LIMIT 1
+ ;';
+ $row = pwg_db_fetch_assoc(pwg_query($query));
+ $template->assign('TAT_image_id', $row['id']);
+ }
+ //album id
+ if (isset($_GET['page']) and preg_match('/^album-(\d+)(?:-(.*))?$/', $_GET['page'], $matches))
+ {
+ $_GET['cat_id'] = $matches[1];
+ }
+ check_input_parameter('cat_id', $_GET, false, PATTERN_ID);
+ if (isset($_GET['cat_id']) and pwg_get_session_var('TAT_cat_id')==null)
+ {
+ $template->assign('TAT_cat_id', $_GET['cat_id']);
+ pwg_set_session_var('TAT_cat_id', $_GET['cat_id']);
+ }
+ elseif (is_numeric(pwg_get_session_var('TAT_cat_id')))
+ {
+ $template->assign('TAT_cat_id', pwg_get_session_var('TAT_cat_id'));
+ }
+ else
+ {
+ $query = '
+ SELECT id
+ FROM '.CATEGORIES_TABLE.'
+ ORDER BY RAND()
+ LIMIT 1
+ ;';
+ $row = pwg_db_fetch_assoc(pwg_query($query));
+ $template->assign('TAT_cat_id', $row['id']);
+ }
+ global $conf;
+ if ( isset($conf['enable_synchronization']) )
+ {
+ $template->assign('TAT_FTP', $conf['enable_synchronization']);
+ }
?> \ No newline at end of file
diff --git a/plugins/TakeATour/tours/privacy/config_preparse.inc.php b/plugins/TakeATour/tours/privacy/config_preparse.inc.php
deleted file mode 100644
index 711dfe349..000000000
--- a/plugins/TakeATour/tours/privacy/config_preparse.inc.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
- //picture id
- if (isset($_GET['page']) and preg_match('/^photo-(\d+)(?:-(.*))?$/', $_GET['page'], $matches))
- {
- $_GET['image_id'] = $matches[1];
- }
- check_input_parameter('image_id', $_GET, false, PATTERN_ID);
- if (isset($_GET['image_id']) and pwg_get_session_var('TAT_image_id')==null)
- {
- $template->assign('TAT_image_id', $_GET['image_id']);
- pwg_set_session_var('TAT_image_id', $_GET['image_id']);
- }
- elseif (is_numeric(pwg_get_session_var('TAT_image_id')))
- {
- $template->assign('TAT_image_id', pwg_get_session_var('TAT_image_id'));
- }
- else
- {
- $query = '
- SELECT id
- FROM '.IMAGES_TABLE.'
- ORDER BY RAND()
- LIMIT 1
- ;';
- $row = pwg_db_fetch_assoc(pwg_query($query));
- $template->assign('TAT_image_id', $row['id']);
- }
- //album id
- if (isset($_GET['page']) and preg_match('/^album-(\d+)(?:-(.*))?$/', $_GET['page'], $matches))
- {
- $_GET['cat_id'] = $matches[1];
- }
- check_input_parameter('cat_id', $_GET, false, PATTERN_ID);
- if (isset($_GET['cat_id']) and pwg_get_session_var('TAT_cat_id')==null)
- {
- $template->assign('TAT_cat_id', $_GET['cat_id']);
- pwg_set_session_var('TAT_cat_id', $_GET['cat_id']);
- }
- elseif (is_numeric(pwg_get_session_var('TAT_cat_id')))
- {
- $template->assign('TAT_cat_id', pwg_get_session_var('TAT_cat_id'));
- }
- else
- {
- $query = '
- SELECT id
- FROM '.CATEGORIES_TABLE.'
- ORDER BY RAND()
- LIMIT 1
- ;';
- $row = pwg_db_fetch_assoc(pwg_query($query));
- $template->assign('TAT_cat_id', $row['id']);
- }
- global $conf;
- if ( isset($conf['enable_synchronization']) )
- {
- $template->assign('TAT_FTP', $conf['enable_synchronization']);
- }
-?> \ No newline at end of file
diff --git a/plugins/TakeATour/tours/privacy/tour.tpl b/plugins/TakeATour/tours/privacy/tour.tpl
index 52ae96a5d..fa2270f51 100644
--- a/plugins/TakeATour/tours/privacy/tour.tpl
+++ b/plugins/TakeATour/tours/privacy/tour.tpl
@@ -3,7 +3,7 @@
var tour = new Tour({
name: "privacy",
orphan: true,
- onEnd: function (tour) {window.location = "admin.php?tour_ended=privacy";},
+ onEnd: function (tour) {window.location = "{/literal}{$ABS_U_ADMIN}{literal}admin.php?tour_ended=privacy";},
template: "<div class='popover tour'>
<div class='arrow'></div>
<h3 class='popover-title'></h3>