Skip to content

Commit

Permalink
fix borken add_uri_params_to_query
Browse files Browse the repository at this point in the history
  • Loading branch information
walley committed Jun 22, 2018
1 parent b7794a5 commit 6fae8fd
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
Binary file modified guidepost
Binary file not shown.
43 changes: 37 additions & 6 deletions handler/Guidepost/Table.pm
Expand Up @@ -309,7 +309,8 @@ sub handler
&list_projects();
} elsif ($r->method() eq "POST") {
#post - add
#&add_to_project(10,1);
&debug_postdata();
&add_project($post_data{add});
} elsif ($r->method() eq "DELETE") {
#delete - remove
#&remove_project();
Expand Down Expand Up @@ -483,12 +484,13 @@ sub output_all()

if ($PROJECT ne "") {
$prj_id = &get_project_id($PROJECT);
$query = "select g.*, (select GROUP_CONCAT(k||':'||v, ';') from tags t where t.gp_id = g.id) from guidepost g,prjgp where g.id=prjgp.gp_id and prjgp.prj_id=$prj_id";
$query = "select g.*, (select GROUP_CONCAT(k||':'||v, ';') from tags t where t.gp_id = g.id) from guidepost g,prjgp where g.id=prjgp.gp_id and prjgp.prj_id=$prj_id ";
$query = &add_uri_params_to_query($query);
} else {
$query = "select g.*, (select GROUP_CONCAT(k||':'||v, ';') from tags t where t.gp_id = g.id) from guidepost g";
$query = "select g.*, (select GROUP_CONCAT(k||':'||v, ';') from tags t where t.gp_id = g.id) from guidepost g ";
$query = &add_uri_params_to_query($query, 1);
}

$query = &add_uri_params_to_query($query);
&output_data($query);
}

Expand Down Expand Up @@ -651,6 +653,15 @@ sub parse_query_string
}
}

################################################################################
sub debug_postdata
################################################################################
{
foreach (sort keys %post_data) {
wsyslog('debug', "postdata:" . $_ . "=" . $post_data{$_});
}
}

################################################################################
sub parse_post_data
################################################################################
Expand Down Expand Up @@ -757,10 +768,18 @@ sub show_by_name
sub add_uri_params_to_query()
################################################################################
{
my $query = shift;
my ($query, $add_where) = @_;


if ($BBOX) {
$query .= " and ".&add_bbox();

if ($add_where) {
$query .= " where ";
} else {
$query .= " and ";
}

$query .= " ".&add_bbox();
}

if ($LIMIT) {
Expand Down Expand Up @@ -2808,4 +2827,16 @@ sub list_projects()
}


################################################################################
sub add_project()
################################################################################
{
my $what = shift;

wsyslog("info", "add $what");

#insert into project blah

}

1;

0 comments on commit 6fae8fd

Please sign in to comment.