Skip to content

Commit

Permalink
separately hide disabled and archived caches in search and map; fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
following5 committed Jun 19, 2013
1 parent ce3fa2f commit 8607628
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 10 deletions.
6 changes: 6 additions & 0 deletions htdocs/doc/sql/static-data/data.sql
Expand Up @@ -2503,6 +2503,8 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2082', 'Locked'
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2083', 'NEW', '2013-04-25 23:00:00');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2084', 'show archived', '2013-04-25 23:00:00');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2085', 'hide archived', '2013-04-25 23:00:00');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2089', 'disabled[pl]', '2013-04-25 23:00:00');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2090', 'archived[pl]', '2013-04-25 23:00:00');

-- Table sys_trans_ref
SET NAMES 'utf8';
Expand Down Expand Up @@ -6457,6 +6459,8 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2083', 'DE', 'NEU', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2084', 'DE', 'archivierte einblenden', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2085', 'DE', 'archivierte ausblenden', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2089', 'DE', 'deaktivierte', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2090', 'DE', 'archivierte', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1', 'EN', 'Reorder IDs \r', '2010-09-02 00:15:30');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2', 'EN', 'The database could not be reconnected.', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('3', 'EN', 'Testing – please do not login', '2010-08-28 11:48:07');
Expand Down Expand Up @@ -8025,6 +8029,8 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2076', 'EN', 'From Owner', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2077', 'EN', 'To Owner', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2078', 'EN', 'Maintenance', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2089', 'EN', 'disabled', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2090', 'EN', 'arcbived', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1', 'ES', 'Reordenar ID', '2010-12-09 00:17:55');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2', 'ES', 'La base de datos no se pudo conectar.', '2010-12-09 00:17:55');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('3', 'ES', 'En pruebas - por favor, no entre.', '2010-12-09 00:17:55');
Expand Down
11 changes: 10 additions & 1 deletion htdocs/lang/de/ocstyle/search.tpl.php
Expand Up @@ -194,6 +194,7 @@ function sync_options(element)
document.forms[formnames[i]].f_userowner.value = document.optionsform.f_userowner.checked ? 1 : 0;
document.forms[formnames[i]].f_userfound.value = document.optionsform.f_userfound.checked ? 1 : 0;
document.forms[formnames[i]].f_inactive.value = document.optionsform.f_inactive.checked ? 1 : 0;
document.forms[formnames[i]].f_disabled.value = document.optionsform.f_disabled.checked ? 1 : 0;
document.forms[formnames[i]].f_ignored.value = document.optionsform.f_ignored.checked ? 1 : 0;
document.forms[formnames[i]].f_otherPlatforms.value = document.optionsform.f_otherPlatforms.checked ? 1 : 0;
document.forms[formnames[i]].country.value = document.optionsform.country.value;
Expand Down Expand Up @@ -309,7 +310,8 @@ function switchAttributeCat2()
<tr>
<td>&nbsp;</td>
<td colspan="2">
<input type="checkbox" name="f_inactive" value="1" id="l_inactive" class="checkbox" onclick="sync_options(this)" {f_inactive_checked} > <label for="l_inactive">{t}Inactive{/t}</label>
<input type="checkbox" name="f_disabled" value="1" id="l_disabled" class="checkbox" onclick="sync_options(this)" {f_disabled_checked} > <label for="l_disabled">{t}disabled[pl]{/t}</label>&nbsp;
<input type="checkbox" name="f_inactive" value="1" id="l_inactive" class="checkbox" onclick="sync_options(this)" {f_inactive_checked} > <label for="l_inactive">{t}archived[pl]{/t}</label>&nbsp;
<input type="checkbox" name="f_otherPlatforms" value="1" id="l_otherPlatforms" class="checkbox" onclick="sync_options(this)" {f_otherPlatforms_checked} > <label for="l_otherPlatforms">{t}GC listings (also listed at gc.com){/t}</label>
</td>
</tr>
Expand Down Expand Up @@ -449,6 +451,7 @@ function switchAttributeCat2()
<input type="hidden" name="f_userowner" value="{hidopt_userowner}" />
<input type="hidden" name="f_userfound" value="{hidopt_userfound}" />
<input type="hidden" name="f_inactive" value="{hidopt_inactive}" />
<input type="hidden" name="f_disabled" value="{hidopt_disabled}" />
<input type="hidden" name="f_ignored" value="{hidopt_ignored}" />
<input type="hidden" name="f_otherPlatforms" value="{hidopt_otherPlatforms}" />
<input type="hidden" name="country" value="{country}" />
Expand Down Expand Up @@ -497,6 +500,7 @@ function switchAttributeCat2()
<input type="hidden" name="f_userowner" value="{hidopt_userowner}" />
<input type="hidden" name="f_userfound" value="{hidopt_userfound}" />
<input type="hidden" name="f_inactive" value="{hidopt_inactive}" />
<input type="hidden" name="f_disabled" value="{hidopt_disabled}" />
<input type="hidden" name="f_ignored" value="{hidopt_ignored}" />
<input type="hidden" name="f_otherPlatforms" value="{hidopt_otherPlatforms}" />
<input type="hidden" name="country" value="{country}" />
Expand Down Expand Up @@ -589,6 +593,7 @@ function switchAttributeCat2()
<input type="hidden" name="f_userowner" value="{hidopt_userowner}" />
<input type="hidden" name="f_userfound" value="{hidopt_userfound}" />
<input type="hidden" name="f_inactive" value="{hidopt_inactive}" />
<input type="hidden" name="f_disabled" value="{hidopt_disabled}" />
<input type="hidden" name="f_ignored" value="{hidopt_ignored}" />
<input type="hidden" name="f_otherPlatforms" value="{hidopt_otherPlatforms}" />
<input type="hidden" name="country" value="{country}" />
Expand Down Expand Up @@ -627,6 +632,7 @@ function switchAttributeCat2()
<input type="hidden" name="f_userowner" value="{hidopt_userowner}" />
<input type="hidden" name="f_userfound" value="{hidopt_userfound}" />
<input type="hidden" name="f_inactive" value="{hidopt_inactive}" />
<input type="hidden" name="f_disabled" value="{hidopt_disabled}" />
<input type="hidden" name="f_ignored" value="{hidopt_ignored}" />
<input type="hidden" name="f_otherPlatforms" value="{hidopt_otherPlatforms}" />
<input type="hidden" name="country" value="{country}" />
Expand Down Expand Up @@ -674,6 +680,7 @@ function switchAttributeCat2()
<input type="hidden" name="f_userowner" value="{hidopt_userowner}" />
<input type="hidden" name="f_userfound" value="{hidopt_userfound}" />
<input type="hidden" name="f_inactive" value="{hidopt_inactive}" />
<input type="hidden" name="f_disabled" value="{hidopt_disabled}" />
<input type="hidden" name="f_ignored" value="{hidopt_ignored}" />
<input type="hidden" name="f_otherPlatforms" value="{hidopt_otherPlatforms}" />
<input type="hidden" name="country" value="{country}" />
Expand Down Expand Up @@ -738,6 +745,7 @@ function switchAttributeCat2()
<input type="hidden" name="f_userowner" value="{hidopt_userowner}" />
<input type="hidden" name="f_userfound" value="{hidopt_userfound}" />
<input type="hidden" name="f_inactive" value="{hidopt_inactive}" />
<input type="hidden" name="f_disabled" value="{hidopt_disabled}" />
<input type="hidden" name="f_ignored" value="{hidopt_ignored}" />
<input type="hidden" name="f_otherPlatforms" value="{hidopt_otherPlatforms}" />
<input type="hidden" name="country" value="{country}" />
Expand Down Expand Up @@ -786,6 +794,7 @@ function switchAttributeCat2()
<input type="hidden" name="f_userowner" value="{hidopt_userowner}" />
<input type="hidden" name="f_userfound" value="{hidopt_userfound}" />
<input type="hidden" name="f_inactive" value="{hidopt_inactive}" />
<input type="hidden" name="f_disabled" value="{hidopt_disabled}" />
<input type="hidden" name="f_ignored" value="{hidopt_ignored}" />
<input type="hidden" name="f_otherPlatforms" value="{hidopt_otherPlatforms}" />
<input type="hidden" name="country" value="{country}" />
Expand Down
30 changes: 22 additions & 8 deletions htdocs/search.php
Expand Up @@ -207,10 +207,15 @@
$_REQUEST[$_REQUEST['searchto']] = "hoho";
}

//get the taken search options and backup them in the queries table (to view "the next page")
$options['f_userowner'] = isset($_REQUEST['f_userowner']) ? $_REQUEST['f_userowner'] : 0;
$options['f_userfound'] = isset($_REQUEST['f_userfound']) ? $_REQUEST['f_userfound'] : 0;
$options['f_inactive'] = isset($_REQUEST['f_inactive']) ? $_REQUEST['f_inactive'] : 1;
// get the search options parameters and store them in the queries table (to view "the next page")
$options['f_userowner'] = isset($_REQUEST['f_userowner']) ? $_REQUEST['f_userowner'] : 0; // Ocprop
$options['f_userfound'] = isset($_REQUEST['f_userfound']) ? $_REQUEST['f_userfound'] : 0; // Ocprop
$options['f_disabled'] = isset($_REQUEST['f_disabled']) ? $_REQUEST['f_disabled'] : 0;
$options['f_inactive'] = isset($_REQUEST['f_inactive']) ? $_REQUEST['f_inactive'] : 1; // Ocprop
// f_inactive formerly was used for both, archived and disabled caches.
// After adding the separate f_disabled option, it is used only for archived
// caches, but keeps its name for compatibility with existing stored or
// external searches.
$options['f_ignored'] = isset($_REQUEST['f_ignored']) ? $_REQUEST['f_ignored'] : 1;
$options['f_otherPlatforms'] = isset($_REQUEST['f_otherPlatforms']) ? $_REQUEST['f_otherPlatforms'] : 0;
$options['expert'] = isset($_REQUEST['expert']) ? $_REQUEST['expert'] : 0; // Ocprop: 0
Expand Down Expand Up @@ -431,9 +436,9 @@
if (!isset($options['cachetype'])) $options['cachetype'] = '';
if (!isset($options['cachesize'])) $options['cachesize'] = '';
if (!isset($options['bbox'])) $options['bbox'] = false;
if (!isset($options['f_disabled'])) $options['f_disabled'] = 0;

//prepare output
if(!isset($options['showresult'])) $options['showresult']='0';
if (!isset($options['showresult'])) $options['showresult'] = 0;
if ($options['showresult'] == 1)
{
if(!isset($options['output'])) $options['output']='';
Expand Down Expand Up @@ -903,8 +908,14 @@
{
$sql_where[] = '`caches`.`cache_id` NOT IN (SELECT `cache_logs`.`cache_id` FROM `cache_logs` WHERE `cache_logs`.`user_id`=\'' . sql_escape($usr['userid']) . '\' AND `cache_logs`.`type` IN (1, 7))';
}
if(!isset($options['f_inactive'])) $options['f_inactive']='0'; // Ocprop
if($options['f_inactive'] != 0) $sql_where[] = '`caches`.`status`=1';
if (!isset($options['f_inactive'])) $options['f_inactive']='0';
if ($options['f_inactive'] != 0) $sql_where[] = '`caches`.`status` NOT IN (3,6,7)';
// f_inactive formerly was used for both, archived and disabled caches.
// After adding the separate f_disabled option, it is used only for archived
// caches, but keeps its name for compatibility with existing stored or
// external searches.
if (!isset($options['f_disabled'])) $options['f_disabled']='0'; // Ocprop
if ($options['f_disabled'] != 0) $sql_where[] = '`caches`.`status`<>2';

if(isset($usr))
{
Expand Down Expand Up @@ -1138,6 +1149,9 @@ function outputSearchForm($options)
tpl_set_var('f_inactive_checked', ($options['f_inactive'] == 1) ? ' checked="checked"' : '');
tpl_set_var('hidopt_inactive', ($options['f_inactive'] == 1) ? '1' : '0');

tpl_set_var('f_disabled_checked', ($options['f_disabled'] == 1) ? ' checked="checked"' : '');
tpl_set_var('hidopt_disabled', ($options['f_disabled'] == 1) ? '1' : '0');

tpl_set_var('f_ignored_disabled', ($usr['userid'] == 0) ? ' disabled="disabled"' : '');
if ($usr['userid'] != 0)
tpl_set_var('f_ignored_disabled', ($options['f_ignored'] == 1) ? ' checked="checked"' : '');
Expand Down
13 changes: 12 additions & 1 deletion htdocs/templates2/ocstyle/map2.tpl
Expand Up @@ -211,7 +211,9 @@ function eval_filtercookies(aValues)
document.getElementById('f_userowner').checked = fs[1].indexOf('O') >= 0;
document.getElementById('f_userfound').checked = fs[1].indexOf('F') >= 0;
document.getElementById('f_ignored').checked = fs[1].indexOf('I') >= 0;
document.getElementById('f_disabled').checked = fs[1].indexOf('T') >= 0;
document.getElementById('f_inactive').checked = fs[1].indexOf('D') >= 0;
// disabled and archived options have strange names and IDs for backward compatibility
document.getElementById('f_otherPlatforms').checked = fs[1].indexOf('M') >= 0;
}
else if (fs[0] == 'rated')
Expand Down Expand Up @@ -297,6 +299,7 @@ function cookieSave(permanent_filter)
if (document.getElementById('f_userowner').checked) sFilter += 'O';
if (document.getElementById('f_userfound').checked) sFilter += 'F';
if (document.getElementById('f_ignored').checked) sFilter += 'I';
if (document.getElementById('f_disabled').checked) sFilter += 'T';
if (document.getElementById('f_inactive').checked) sFilter += 'D';
if (document.getElementById('f_otherPlatforms').checked) sFilter += 'M';
Expand Down Expand Up @@ -1887,6 +1890,7 @@ function reset_filter_values()
document.getElementById('f_userowner').checked = "";
document.getElementById('f_userfound').checked = "";
document.getElementById('f_ignored').checked = "checked";
document.getElementById('f_disabled').checked = "";
document.getElementById('f_inactive').checked = "checked";
document.getElementById('f_otherPlatforms').checked = "";
Expand Down Expand Up @@ -1974,6 +1978,7 @@ function get_searchfilter_params(output, skipqueryid, zip)
sPostBody += document.getElementById('f_userowner').checked ? '&f_userowner=1' : '&f_userowner=0';
sPostBody += document.getElementById('f_userfound').checked ? '&f_userfound=1' : '&f_userfound=0';
sPostBody += document.getElementById('f_ignored').checked ? '&f_ignored=1' : '&f_ignored=0';
sPostBody += document.getElementById('f_disabled').checked ? '&f_disabled=1' : '&f_disabled=0';
sPostBody += document.getElementById('f_inactive').checked ? '&f_inactive=1' : '&f_inactive=0';
sPostBody += document.getElementById('f_otherPlatforms').checked ? '&f_otherPlatforms=1' : '&f_otherPlatforms=0';
Expand Down Expand Up @@ -2365,10 +2370,16 @@ function toggle_attribselection(bSaveCookies)
<label for="f_ignored" {if $username==""}style="color:grey"{/if}>{t}My ignored{/t}</label>
</td>
</tr>
<tr>
<td style="white-space:nowrap">
<input type="checkbox" id="f_disabled" name="f_disabled" value="1" checked="checked" onchange="filter_changed()" class="checkbox" />
<label for="f_disabled">{t}disabled[pl]{/t}</label>
</td>
</tr>
<tr>
<td style="white-space:nowrap">
<input type="checkbox" id="f_inactive" name="f_inactive" value="1" checked="checked" onchange="filter_changed()" class="checkbox" />
<label for="f_inactive">{t}Not active{/t}</label>
<label for="f_inactive">{t}archived[pl]{/t}</label>
</td>
</tr>
<tr>
Expand Down

0 comments on commit 8607628

Please sign in to comment.