Thread: [AppWrap-cvs] AppWrap/Apache AW_User.pm,1.8,1.9
Status: Beta
Brought to you by:
planetman
From: <pla...@us...> - 2002-12-26 01:30:12
|
Update of /cvsroot/appwrap/AppWrap/Apache In directory sc8-pr-cvs1:/tmp/cvs-serv31044 Modified Files: AW_User.pm Log Message: Cleaned up treatment of source column in &query_source. Index: AW_User.pm =================================================================== RCS file: /cvsroot/appwrap/AppWrap/Apache/AW_User.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AW_User.pm 5 Dec 2002 04:02:56 -0000 1.8 --- AW_User.pm 26 Dec 2002 01:30:08 -0000 1.9 *************** *** 30,34 **** use Apache::File (); ! $Apache::AW_User::VERSION = "0.05"; # 30Nov02. &make_download_catalyst links display nicer with # non-breaking spaces. --- 30,35 ---- use Apache::File (); ! $Apache::AW_User::VERSION = "0.06"; ! # 22Dec02. Cleaned up treatment of source column in &query_source. # 30Nov02. &make_download_catalyst links display nicer with # non-breaking spaces. *************** *** 917,921 **** # passes. $hash_row = { 'tablename'=>$tablename, 'date'=>$date, 'idnum'=>$idnum, 'col_list'=>[ @col_list] }; - # $hash_row = { 'tablename'=>$tablename, 'date'=>$date, 'idnum'=>$idnum, 'col_list'=>[ @col_list] }; push @$chgs, $hash_row; # re-initialize @col_list --- 918,921 ---- *************** *** 1193,1248 **** # 20 Jan. Same as &my_columns, except returns a hash ref ############################### ! sub ops_vbar { ! my $opts = shift; ! ! my $table = $opts->{table}; ! my $label; ! my $vb_style = $opts->{my_tables}{$table}{vbar_table_style}; ! my @rows; ! ! my $log = Apache->request->log; ! # is this a summary? ! my $summary = $opts->{args}{top_summary}; ! $label = ucfirst($summary) . ' Summary' if $summary; ! $label ||= $opts->{my_tables}{$table}{label}; ! ! # make vbar a table ! my $tab_start = '<table'; ! $tab_start .= ' style="' . $vb_style . '"' if $vb_style; ! $tab_start .= ' width="100%"><tr><td>' . $HNL; ! push @rows, $tab_start; ! ! # not tested yet ! my $link_vars = Apache::AppWrap::Subs::cclinks($opts); ! $label = $link_vars->{label}; ! my $region = $opts->{args}{region}; ! my $regional = '<p class="topicheader">' . $label . '<br /> by Region</p>' . $HNL; ! push @rows, $regional if $region; ! ! # actual regional links ! my $ref = region_links($opts); ! # if ($region && $ref) { ! if ($region && $ref && scalar(@$ref)) { ! push @rows, join("", @$ref); ! # foreach (@$ref) { ! # push @rows, $_ . $HNL; ! # } ! } ! ! # display recently changed items in the left side area ! $ref = Apache::AppWrap::Subs::recent_changes($opts); ! push @rows, join("", @$ref) if $ref && scalar(@$ref); ! ! $ref = make_download_catalyst ($opts); ! push @rows, join("", @$ref) if $ref && scalar(@$ref); ! ! $ref = Apache::AppWrap::Subs::favorites ($opts); ! push @rows, join("", @$ref) if $ref && scalar(@$ref); ! ! # close out the vbar table wrapper ! push @rows, '</td></tr></table>'; ! ! return \@rows; ! } # end &ops_vbar --- 1193,1248 ---- # 20 Jan. Same as &my_columns, except returns a hash ref ############################### ! #sub ops_vbar { ! # my $opts = shift; ! # ! # my $table = $opts->{table}; ! # my $label; ! # my $vb_style = $opts->{my_tables}{$table}{vbar_table_style}; ! # my @rows; ! # ! # my $log = Apache->request->log; ! # # is this a summary? ! # my $summary = $opts->{args}{top_summary}; ! # $label = ucfirst($summary) . ' Summary' if $summary; ! # $label ||= $opts->{my_tables}{$table}{label}; ! # ! # # make vbar a table ! # my $tab_start = '<table'; ! # $tab_start .= ' style="' . $vb_style . '"' if $vb_style; ! # $tab_start .= ' width="100%"><tr><td>' . $HNL; ! # push @rows, $tab_start; ! # ! # # not tested yet ! # my $link_vars = Apache::AppWrap::Subs::cclinks($opts); ! # $label = $link_vars->{label}; ! # my $region = $opts->{args}{region}; ! # ! # if ($region) { ! # my $regional = '<p class="topicheader">' . $label; ! # $regional .= '<br /> by Region</p>' . $HNL; ! # push @rows, $regional; ! # ! # # actual regional links ! # my $ref = region_links($opts); ! # if ($ref && scalar(@$ref)) { ! # push @rows, join("", @$ref); ! # } ! # } ! # ! # # display recently changed items in the left side area ! # my $ref = Apache::AppWrap::Subs::recent_changes($opts); ! # push @rows, join("", @$ref) if $ref && scalar(@$ref); ! # ! # $ref = make_download_catalyst ($opts); ! # push @rows, join("", @$ref) if $ref && scalar(@$ref); ! # ! # $ref = Apache::AppWrap::Subs::favorites ($opts); ! # push @rows, join("", @$ref) if $ref && scalar(@$ref); ! # ! # # close out the vbar table wrapper ! # push @rows, '</td></tr></table>'; ! # ! # return \@rows; ! #} # end &ops_vbar *************** *** 1255,1276 **** ############################### sub ops_header { ! my $opts = shift; ! my $table = $opts->{table}; ! my $my_tables = $opts->{my_tables}; ! my $label; ! # is this a summary request? ! my $summary = $opts->{args}{top_summary}; ! if ($summary) { ! $label = ucfirst($summary) . ' Summary'; ! # SubTitle usually added by paginator, but summary's don't use ! # paginator ! $opts->{SubTitle} = eval $my_tables->{summary}{subtitle}; ! } ! # if its not a summary, get the traditional label ! $label ||= $my_tables->{$table}{label}; ! my $region = $opts->{args}{region}; $table = $summary . 'summary' if $summary; --- 1255,1270 ---- ############################### sub ops_header { ! my $opts = shift; ! my $table = $opts->{table}; ! my $my_tables = $opts->{my_tables}; ! my $label; ! # is this a summary request? ! my $summary = $opts->{args}{top_summary}; ! # if its not a summary, get the traditional label ! $label = $my_tables->{$table}{label}; ! my $region = $opts->{args}{region}; $table = $summary . 'summary' if $summary; *************** *** 1930,1986 **** # returns a reference to an array of hashes. # create query statement for dashboard info ! # 13 Aug. 01. repairs allowing 'contact' to be an integer like ' # 'project_id' and 'product_id' # 24 Jan. 01. repairs for download ################################### sub get_dashboard_data { ! my $opts = shift; ! my $table = $opts->{table}; ! # set the label for display titles ! my $link_vars = Apache::AppWrap::Subs::cclinks( $opts ); ! my $label = $link_vars->{label}; ! # my $log = Apache->request->log; #$log->debug("\nget_dashboard_data: got here."); ! my $src_fields = Apache::AppWrap::Subs::query_source($opts); ! $opts->{src_fields} = $src_fields; ! # list the column names for query ! my $select = $src_fields->{select}; ! my $from = $src_fields->{from}; ! $from .= ',contacts'; ! ! my $where = 'projects.contact=contacts.idnum AND contacts.country=regions.country'; ! $where .= ' AND projects.stage>11 AND projects.stage<21'; ! my $other = ''; ! my $filter = $opts->{args}{filter}; ! if ($filter && $filter eq 'none') { ! $where = 'projects.contact=contacts.idnum AND contacts.country=regions.country'; ! } ! elsif ($filter && $filter eq 'completed') { ! $where = 'projects.contact=contacts.idnum AND contacts.country=regions.country'; ! $where .= ' AND projects.stage>16 AND projects.stage <21'; ! } #$log->debug("\nget_dashboard_data: where1=$where."); ! $opts->{Title} = $label; ! # loop through all args, skipping some. This is what makes the ! # cumulative filter by column value work. ! # foreach (my ($k,$v) = each %{ $opts->{args} }) { ! while (my ($k,$v) = each %{ $opts->{args} }) { ! # skip $sb and $page, as they may be in the query string, but ! # they are not in the table ! next if $k eq 'sb'; ! next if $k eq 'page'; ! next if $k eq 'filter'; ! next if $k eq 'download_flag'; ! # quote the data ! my $v_q = $dbh->quote( $v ) if $v; ! $where .= ' AND ' . $k . '=' . $v_q; ! # $where .= ' AND ' . $k . '=' . $v; ! } #$log->debug("\nget_dashboard_data: where2=$where."); ! return Apache::AppWrap::Subs::sqlSelectHashRef($select,$from,$where,$other); } # end get_dashboard_data --- 1924,1981 ---- # returns a reference to an array of hashes. # create query statement for dashboard info ! # 13 Aug. 01. repairs allowing 'contact' to be an integer like # 'project_id' and 'product_id' # 24 Jan. 01. repairs for download ################################### sub get_dashboard_data { ! my $opts = shift; ! my $table = $opts->{table}; ! # set the label for display titles ! my $link_vars = Apache::AppWrap::Subs::cclinks( $opts ); ! my $label = $link_vars->{label}; ! my $log = Apache->request->log; #$log->debug("\nget_dashboard_data: got here."); + my $src_fields = Apache::AppWrap::Subs::query_source($opts); + $opts->{src_fields} = $src_fields; + # list the column names for query + my $select = $src_fields->{select}; + #$log->debug("\nget_dashboard_data: select=$select."); + my $from = $src_fields->{from}; + $from .= ',contacts'; ! my $where = 'projects.contact=contacts.idnum'; ! $where .= ' AND contacts.country=regions.country'; ! $where .= ' AND projects.stage>11 AND projects.stage<21'; ! my $other; ! my $filter = $opts->{args}{filter}; ! if ($filter && $filter eq 'none') { ! $where = 'projects.contact=contacts.idnum'; ! $where .= ' AND contacts.country=regions.country'; ! } ! elsif ($filter && $filter eq 'completed') { ! $where = 'projects.contact=contacts.idnum'; ! $where .= ' AND contacts.country=regions.country'; ! $where .= ' AND projects.stage>16 AND projects.stage<21'; ! } #$log->debug("\nget_dashboard_data: where1=$where."); ! $opts->{Title} = $label; ! # loop through all args, skipping some. This is what makes the ! # cumulative filter by column value work. ! while (my ($k,$v) = each %{ $opts->{args} }) { ! # skip $sb and $page, as they may be in the query string, but ! # they are not in the table ! next if $k eq 'sb'; ! next if $k eq 'page'; ! next if $k eq 'filter'; ! next if $k eq 'download_flag'; ! # quote the data ! my $v_q = $dbh->quote( $v ) if $v; ! $where .= ' AND ' . $k . '=' . $v_q; ! } #$log->debug("\nget_dashboard_data: where2=$where."); ! return Apache::AppWrap::Subs::sqlSelectHashRef($select,$from,$where,$other); } # end get_dashboard_data |