From: Will Budicm Date: Fri, 25 Dec 2020 21:50:13 +0000 (+1100) Subject: Order by id. X-Git-Url: https://lifelog.hopto.org/gitweb/?a=commitdiff_plain;h=46450a6093bfcf214dc4a3bba4b56515c1161703;p=LifeLog.git Order by id. --- diff --git a/Current Development Check List.md b/Current Development Check List.md index 4cb4fb4..cad61c8 100644 --- a/Current Development Check List.md +++ b/Current Development Check List.md @@ -6,6 +6,10 @@ ### v.2.2 EARTH RC 1 +* Search keep in session should preserve and always set options as selection till it is ticked. + * Reset Whole View to page view, should still set the search set the search option till it is ticked. + * Unticking Keep in Session should be honored on next browsing. +* Order by Categories added to search/view. * ✔ Page categories exclusion option in main.cnf. Log view server side is modified not to include excluded categories older by certain amount of days, default is 0, for from today older. * Search on multiple words should rank by encounter of words specified and display first. (That one is difficult) diff --git a/htdocs/cgi-bin/main.cgi b/htdocs/cgi-bin/main.cgi index 0807891..11fc4c2 100755 --- a/htdocs/cgi-bin/main.cgi +++ b/htdocs/cgi-bin/main.cgi @@ -115,31 +115,27 @@ $sss->param('theme', $TH_CSS); $sss->param('bgcolor', $BGCOL); #sss->param('sss_main', $today); # - #Reset Clicked if($cgi->param('srch_reset') == 1){ - $sss->clear('sss_vc'); - $sss->clear('sss_xc'); + $sss->clear('sss_vc');$sss->clear('sss_xc');$sss->clear('sss_ord_cat'); } - - if($prm_vc &&$prm_vc ne ""){ #TODO (2020-11-05) This is a subrotine candidate. It gets too complicated. should not have both $prm_vc and $prm_vc_lst; - $prm_xc =~ s/^0*//g;$prm_xc_lst=~ s/^\,$//g; - if(!$prm_vc_lst||$prm_vc_lst==0){#} && index($prm_xc, ',') > 0){ - $prm_vc_lst = $prm_vc; - }else{ - my $f; - my @vc_lst = split /\,/, $prm_vc_lst; @vc_lst = uniq(sort { $a <=> $b } @vc_lst); - foreach my $n(@vc_lst){ - if($n == $prm_vc){ $f=1; last; } - } - if(!$f){#not found view was clicked changing category but not adding it to vc list. Let's add it to the list. - $prm_vc_lst .= ",$prm_vc"; - } - $prm_vc_lst=~ s/\,$//g;$prm_vc_lst=~ s/\,\,/\,/g; - } + $prm_xc =~ s/^0*//g;$prm_xc_lst=~ s/^\,$//g; + if(!$prm_vc_lst||$prm_vc_lst==0){#} && index($prm_xc, ',') > 0){ + $prm_vc_lst = $prm_vc; + }else{ + my $f; + my @vc_lst = split /\,/, $prm_vc_lst; @vc_lst = uniq(sort { $a <=> $b } @vc_lst); + foreach my $n(@vc_lst){ + if($n == $prm_vc){ $f=1; last; } + } + if(!$f){#not found view was clicked changing category but not adding it to vc list. Let's add it to the list. + $prm_vc_lst .= ",$prm_vc"; + } + $prm_vc_lst=~ s/\,$//g;$prm_vc_lst=~ s/\,\,/\,/g; + } if ($cgi->param('sss_vc') eq 'on'){ @@ -185,10 +181,13 @@ if($prm_xc &&$prm_xc ne ""){ }else{ $prm_xc = $sss->param('sss_xc'); - $prm_xc_lst = $sss->param('sss_xc_lst'); + $prm_xc_lst = $sss->param('sss_xc_lst'); } - - +#Either Session or requested. +if($cgi->param('sss_ord_cat') eq 'on'){ + $stmE = ' ORDER BY ID_CAT '.$stmE; + $sss->param('sss_ord_cat', 1); +}else{$sss->param('sss_ord_cat', 0)} ## my @vc_lst = split /\,/, $prm_vc_lst; @vc_lst = uniq(sort { $a <=> $b } @vc_lst); my @xc_lst = split /\,/, $prm_xc_lst; @xc_lst = uniq(sort { $a <=> $b } @xc_lst); @@ -856,12 +855,14 @@ $log_output .= qq(
); - my $sss_checked = 'checked' if $isInViewMode; + my ($sss_checked, $sss_orderby); my ($vc_lst,$xc_lst) = ("",""); my $tdivvc = ''; my $tdivxc = ''; my $catselected = '   -- Select --   '; my $xcatselected = '   -- Select --   '; + if ($isInViewMode) { $sss_checked = 'checked'} + if ($sss->param('sss_ord_cat')){ $sss_orderby = 'checked'} if($prm_vc){ $catselected = $hshCats{$prm_vc}; @@ -949,6 +950,7 @@ $log_output .= qq(
Reset       Keep In Session + Order By Category $tdivxc @@ -1094,10 +1096,6 @@ try { return; } - if ( $view_all && $view_all == "1" ) { - $rec_limit = &Settings::viewAllLimit; - } - if ( $view_mode == "1" ) { if ($rs_cur) {