Commit 3b76ca85 authored by nkoth's avatar nkoth

[NEW] Allow show map mode buttons in page and articles listings

parent 0a311e2d
......@@ -52,5 +52,19 @@ function prefs_gmap_list() {
20 => tra('max zoom'),
)
),
'gmap_article_list' => array(
'name' => tra('Show map mode buttons in articles list'),
'type' => 'flag',
'dependencies' => array(
'feature_gmap',
),
),
'gmap_page_list' => array(
'name' => tra('Show map mode buttons in page list'),
'type' => 'flag',
'dependencies' => array(
'feature_gmap',
),
),
);
}
......@@ -1084,6 +1084,8 @@ function get_default_prefs() {
'gmap_defaulty' => '0',
'gmap_defaultz' => '1',
'gmap_key' => '',
'gmap_article_list' => 'n',
'gmap_page_list' => 'n',
// auth
'allowRegister' => 'n',
......
......@@ -32,7 +32,7 @@
<form method="post" action="{$smarty.server.PHP_SELF}" class="findtable">
{if $filegals_manager neq ''}<input type="hidden" name="filegals_manager" value="{$filegals_manager|escape}" />{/if}
{query _type='form_input' maxRecords='NULL' type='NULL' types='NULL' find='NULL' topic='NULL' lang='NULL' exact_match='NULL' categId='NULL' cat_categories='NULL' filegals_manager='NULL' save='NULL' offset='NULL'}
{query _type='form_input' maxRecords='NULL' type='NULL' types='NULL' find='NULL' topic='NULL' lang='NULL' exact_match='NULL' categId='NULL' cat_categories='NULL' filegals_manager='NULL' save='NULL' offset='NULL' searchlist='NULL' searchmap='NULL'}
<label class="findtitle">
{if empty($whatlabel)}
......@@ -221,6 +221,13 @@
<a href="{$smarty.server.PHP_SELF}?{query find='' types='' topic='' lang='' langOrphan='' exact_match='' categId='' maxRecords=''}" title="{tr}Clear Filter{/tr}">{tr}Clear Filter{/tr}</a>
</span>
{/if}
{if $gmapbuttons and $mapview}
<input type="submit" name="searchlist" value="{tr}List View{/tr}" />
<input type="hidden" name="mapview" value="y" />
{elseif $gmapbuttons}
<input type="submit" name="searchmap" value="{tr}Map View{/tr}" />
<input type="hidden" name="mapview" value="n" />
{/if}
</label>
</form>
......
......@@ -107,6 +107,8 @@
{preference name=art_list_reads}
{preference name=art_list_size}
{preference name=art_list_img}
{preference name=gmap_article_list}
</fieldset>
<fieldset>
<legend>{tr}Article View{/tr}</legend>
......
......@@ -22,6 +22,11 @@
{preference name=gmap_defaulty}
{preference name=gmap_defaultz}
</fieldset>
<fieldset>
<legend>{tr}Map mode in listings{/tr}</legend>
{preference name=gmap_article_list}
{preference name=gmap_page_list}
</fieldset>
</fieldset>
<div class="heading input_submit_container" style="text-align: center">
<input type="submit" value="{tr}Change preferences{/tr}" />
......
......@@ -298,6 +298,7 @@
{preference name=feature_lastChanges}
{preference name=feature_listorphanPages}
{preference name=feature_listorphanStructure}
{preference name=gmap_page_list}
<div class="adminoptionbox">
<fieldset>
......
......@@ -17,6 +17,10 @@
{include file='find.tpl' find_show_languages='y' find_show_categories_multi='y' find_show_num_rows='y' find_show_date_range='y'}
{/if}
{if $mapview}
{wikiplugin _name="googlemap" type="objectlist" width="400" height="400"}{/wikiplugin}
{/if}
{assign var=numbercol value=1}
<table class="normal">
<tr>
......
......@@ -20,6 +20,10 @@
</div>
{/if}
{if $mapview}
{wikiplugin _name="googlemap" type="objectlist" width="400" height="400"}{/wikiplugin}
{/if}
<div id="tiki-listpages-content">
{if $aliases}
<div class="aliases">
......
......@@ -10,6 +10,17 @@ include_once ('lib/articles/artlib.php');
$smarty->assign('headtitle', tra('List Articles'));
$access->check_feature('feature_articles');
$access->check_permission('tiki_p_read_article');
if ($prefs["gmap_article_list"] == 'y') {
$smarty->assign('gmapbuttons', true);
} else {
$smarty->assign('gmapbuttons', false);
}
if (isset($_REQUEST["mapview"]) && $_REQUEST["mapview"] == 'y' && !isset($_REQUEST["searchmap"]) && !isset($_REQUEST["searchlist"]) || isset($_REQUEST["searchmap"]) && !isset($_REQUEST["searchlist"])) {
$smarty->assign('mapview', true);
}
if (isset($_REQUEST["mapview"]) && $_REQUEST["mapview"] == 'n' && !isset($_REQUEST["searchmap"]) && !isset($_REQUEST["searchlist"]) || isset($_REQUEST["searchlist"]) && !isset($_REQUEST["searchmap"]) ) {
$smarty->assign('mapview', false);
}
if (isset($_REQUEST["remove"])) {
$artperms = Perms::get( array( 'type' => 'article', 'object' => $_REQUEST['remove'] ) );
......@@ -120,6 +131,19 @@ $listpages = $artlib->list_articles($offset, $maxRecords, $sort_mode, $find, $da
$smarty->assign_by_ref('cant', $listpages['cant']);
$smarty->assign_by_ref('listpages', $listpages["data"]);
if ($prefs["gmap_article_list"] == 'y') {
// Generate Google map plugin data
global $gmapobjectarray;
$gmapobjectarray = array();
foreach ($listpages["data"] as $art) {
$gmapobjectarray[] = array('type' => 'article',
'id' => $art["articleId"],
'title' => $art["title"],
'href' => 'tiki-read_article.php?articleId=' . $art["articleId"],
);
}
}
$topics = $artlib->list_topics();
$smarty->assign_by_ref('topics', $topics);
$types = $artlib->list_types();
......
......@@ -11,6 +11,17 @@ require_once ('tiki-setup.php');
require_once ('lib/ajax/ajaxlib.php');
$auto_query_args = array('initial', 'maxRecords', 'sort_mode', 'find', 'lang', 'langOrphan', 'findfilter_orphan', 'categId', 'category', 'page_orphans', 'structure_orphans', 'exact_match', 'hits_link_to_all_languages', 'create_new_pages_using_template_name');
if ($prefs["gmap_page_list"] == 'y') {
$smarty->assign('gmapbuttons', true);
} else {
$smarty->assign('gmapbuttons', false);
}
if (isset($_REQUEST["mapview"]) && $_REQUEST["mapview"] == 'y' && !isset($_REQUEST["searchmap"]) && !isset($_REQUEST["searchlist"]) || isset($_REQUEST["searchmap"]) && !isset($_REQUEST["searchlist"])) {
$smarty->assign('mapview', true);
}
if (isset($_REQUEST["mapview"]) && $_REQUEST["mapview"] == 'n' && !isset($_REQUEST["searchmap"]) && !isset($_REQUEST["searchlist"]) || isset($_REQUEST["searchlist"]) && !isset($_REQUEST["searchmap"]) ) {
$smarty->assign('mapview', false);
}
if ($prefs['feature_multilingual'] == 'y' && isset($_REQUEST['lang']) && isset($_REQUEST['term_srch'])) {
global $multilinguallib;
......@@ -272,6 +283,19 @@ if (!empty($multiprint_pages)) {
$languages = $tikilib->list_languages(false, 'y');
$smarty->assign_by_ref('languages', $languages);
}
if ($prefs["gmap_page_list"] == 'y') {
// Generate Google map plugin data
global $gmapobjectarray;
$gmapobjectarray = array();
foreach ($listpages["data"] as $p) {
$gmapobjectarray[] = array('type' => 'wiki page',
'id' => $p["pageName"],
'title' => $p["pageName"],
'href' => "tiki-index.php?page=" . urlencode($p["pageName"]) . "&bl=y",
);
}
}
$smarty->assign_by_ref('listpages', $listpages["data"]);
$smarty->assign_by_ref('cant', $listpages['cant']);
ask_ticket('list-pages');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment