From: Will Budic Date: Sun, 23 Feb 2020 00:19:45 +0000 (+1100) Subject: New Categories dropdown, developed. X-Git-Url: https://lifelog.hopto.org/gitweb/?a=commitdiff_plain;h=20777c6ccb2f157d420502886f621aa2c10dc6a3;p=LifeLog.git New Categories dropdown, developed. --- diff --git a/Current Development Check List.md b/Current Development Check List.md index cb9a762..f12dc24 100644 --- a/Current Development Check List.md +++ b/Current Development Check List.md @@ -10,7 +10,7 @@ This version is not compatible in data structure to prior versions. Data migrati ### v.1.7 Encountered * Application log needed in the background for System based logs. -* New Categories dropdown, grouping in ascending order and presenting in columns of five at a time. +* ✔ New Categories dropdown, grouping in ascending order and presenting in columns of five at a time. * New CNF Development. * Migration is currently hard to maintain and data export and import is wrongly reliant to CVS. * CVS imports/exports are to be made obsolete in the future. It is not safe. @@ -58,6 +58,7 @@ This version is not compatible in data structure to prior versions. Data migrati ## Planned New Possible Features of Minor Relevance +* Fit to page log. Making log subpage scrollable rather than whole page to see the bottom. * Make session timeot sub pages aware via JSON. * Multiple category assignment table (set via hashtags and end of a post). * Log cards Export/Import. Send log entries via email or USB, why not? diff --git a/htdocs/cgi-bin/config.cgi b/htdocs/cgi-bin/config.cgi index 86b3fb8..269441f 100755 --- a/htdocs/cgi-bin/config.cgi +++ b/htdocs/cgi-bin/config.cgi @@ -128,7 +128,7 @@ my $frmCats = qq(     or - Categories Configuration In -> $dbname  + Categories Configuration In -> $dbname 
WARNING! @@ -1054,7 +1054,7 @@ sub cats { sub error { - my $url = $cgi->url(); + my $url = $cgi->url(-path_info => 1); print qq(

Sorry Encountered Errors

Page -> $url

$ERROR

); print qq(

CGI Parameters

); print "
    \n"; diff --git a/htdocs/cgi-bin/main.cgi b/htdocs/cgi-bin/main.cgi index 90ee53e..442e931 100755 --- a/htdocs/cgi-bin/main.cgi +++ b/htdocs/cgi-bin/main.cgi @@ -84,8 +84,9 @@ my $lang = Date::Language->new(Settings::language()); my $today = DateTime->now; $today -> set_time_zone(Settings::timezone()); -#Excludes can be now set as permanent to page view excluded, visible if view searched. +#Excludes can be now be set as permanent to page view excluded, visible if view searched. #http://localhost:8080/cgi-bin/main.cgi?vc=0&category=0&xc=0&idx_cat_x=0&v_from=&v_to=&keywords=&srch_reset=0 + if(!$prm_vc && &Settings::keepExcludes){ if($prm_xc_lst){ &Settings::configProperty($db, 201, '^EXCLUDES', $prm_xc_lst); @@ -95,6 +96,10 @@ if(!$prm_vc && &Settings::keepExcludes){ $prm_xc = $prm_xc_lst if (!$prm_xc && !$cgi->param('srch_reset')); } } +elsif(!$prm_xc && $prm_xc_lst){ +#view call only + $prm_xc = $prm_xc_lst; +} if ( !$rs_dat_to && $rs_dat_from ) { my $dur = $today; @@ -145,6 +150,13 @@ if($prm_xc){ $prm_xc = $sss->param('sss_xc'); } + + +#TODO (2020-02-23) It gets too complicated. should not have both $prm_xc and $prm_xc_lst; + if(!$prm_xc_lst && index($prm_xc, ',') > 0){ + $prm_xc_lst = $prm_xc; + } +## my @xc_lst = split /\,/, $prm_xc_lst; @@ -183,6 +195,7 @@ print $cgi->start_html( { -type => 'text/css', -src => 'wsrc/quill/katex.min.css' }, { -type => 'text/css', -src => 'wsrc/quill/monokai-sublime.min.css' }, { -type => 'text/css', -src => 'wsrc/quill/quill.snow.css' }, + { -type => 'text/css', -src => 'wsrc/jquery.sweet-dropdown.css' }, ], -script => [ @@ -205,18 +218,19 @@ print $cgi->start_html( { -type => 'text/javascript', -src => 'wsrc/jscolor.js' }, { -type => 'text/javascript', -src => 'wsrc/moment.js' }, { -type => 'text/javascript', -src => 'wsrc/moment-timezone-with-data.js' }, + { -type => 'text/javascript', -src => 'wsrc/jquery.sweet-dropdown.js'} ], ); my $st; -my $str_sqlCat = "SELECT ID, NAME, DESCRIPTION FROM CAT ORDER BY ID;"; -my $str_sql = "SELECT ID, ID_CAT, ID_RTF, DATE, LOG, AMOUNT, AFLAG, STICKY FROM VW_LOG WHERE STICKY = 1 LIMIT ".&Settings::viewAllLimit.";"; +my $sqlCAT = "SELECT ID, NAME, DESCRIPTION FROM CAT ORDER BY ID;"; +my $sqlVWL = "SELECT ID, ID_CAT, ID_RTF, DATE, LOG, AMOUNT, AFLAG, STICKY FROM VW_LOG WHERE STICKY = 1 LIMIT ".&Settings::viewAllLimit.";"; print qq(## Using db -> $dsn\n) if $DEBUG; -$st = $db->prepare($str_sqlCat); +$st = $db->prepare($sqlCAT); $st->execute() or LifeLogException->throw($DBI::errstri); my $cats = qq('; +} +if($td_itm_cnt<5){#fill spacing. + for (my $i=0;$i<5-$td_itm_cnt;$i++){ + $td_cat .= "
  1.  
  2. "; + } +} +$td_cat .= ""; +$cats .= ''; $cats_v .= ''; $cats_x .= ''; for my $key ( keys %hshDesc ) { my $kv = $hshDesc{$key}; - if ( $kv ne ".." ) { - $cat_desc .= qq(
  3. $kv
  4. \n); + if ( $kv ne ".." && index($key,'HASH(0x')!=0) { + my $n = $hshCats{$key}; + $data_cats .= qq(\n); } } my $log_output = @@ -308,16 +339,16 @@ qq(
    $stmS = $stmS . " OR "; } } - $str_sql = $stmS . $stmE; + $sqlVWL = $stmS . $stmE; } } elsif ($rs_cat_idx && $rs_cat_idx != $prm_xc) { if ($stmD) { - $str_sql = $stmS . $stmD . " AND ID_CAT='" . $rs_cat_idx . "'" . $stmE; + $sqlVWL = $stmS . $stmD . " AND ID_CAT='" . $rs_cat_idx . "'" . $stmE; } else { - $str_sql = $stmS . " ID_CAT=" . $rs_cat_idx . ";" . $stmE; + $sqlVWL = $stmS . " ID_CAT=" . $rs_cat_idx . ";" . $stmE; } } else { @@ -329,17 +360,17 @@ qq( $ands .= " ID_CAT!=$_ AND"; } $ands =~ s/AND$//g; - $str_sql = $stmS . $ands . $stmE; + $sqlVWL = $stmS . $ands . $stmE; } else{ - $str_sql = $stmS . " ID_CAT!=$prm_xc;" . $stmE; + $sqlVWL = $stmS . " ID_CAT!=$prm_xc;" . $stmE; } } if ($stmD) { - $str_sql = $stmS . $stmD . $stmE; + $sqlVWL = $stmS . $stmD . $stmE; } } @@ -349,10 +380,10 @@ qq( my $tfId = 0; my $id = 0; - my $log_start = index $str_sql, "<="; + my $log_start = index $sqlVWL, "<="; my $re_a_tag = qr/.*<\/a>/si; - print $cgi->pre("###[Session PARAMS->vc=$prm_vc|xc=$prm_xc|xc_lst=@xc_lst|keepExcludes=".&Settings::keepExcludes."] -> ".$str_sql) if $DEBUG; + print $cgi->pre("###[Session PARAMS->vc=$prm_vc|xc=$prm_xc|xc_lst=$prm_xc_lst|xc_lst=@xc_lst|keepExcludes=".&Settings::keepExcludes."] -> ".$sqlVWL) if $DEBUG; if ( $log_start > 0 ) { @@ -376,13 +407,13 @@ qq( #place sticky or view param.ed entries first! - buildLog(traceDBExe($str_sql)); + buildLog(traceDBExe($sqlVWL)); - if(index ($str_sql, 'PID <=') < 1 && !$prm_vc && !$prm_xc && !$rs_keys && !$rs_dat_from){ - $str_sql = "SELECT ID, ID_CAT, ID_RTF, DATE, LOG, AMOUNT, AFLAG, STICKY FROM VW_LOG WHERE STICKY != 1 ORDER BY DATE DESC LIMIT ".&Settings::viewAllLimit.";"; - print $cgi->pre("###2 -> ".$str_sql) if $DEBUG; + if(index ($sqlVWL, 'PID <=') < 1 && !$prm_vc && !$prm_xc && !$rs_keys && !$rs_dat_from){ + $sqlVWL = "SELECT ID, ID_CAT, ID_RTF, DATE, LOG, AMOUNT, AFLAG, STICKY FROM VW_LOG WHERE STICKY != 1 ORDER BY DATE DESC LIMIT ".&Settings::viewAllLimit.";"; + print $cgi->pre("###2 -> ".$sqlVWL) if $DEBUG; ; - &buildLog(traceDBExe($str_sql)); + &buildLog(traceDBExe($sqlVWL)); } @@ -399,7 +430,7 @@ sub traceDBExe { sub buildLog { my $pst = shift; - #print "## str_sql: $str_sql\n"; + #print "## sqlVWL: $sqlVWL\n"; while ( my @row = $pst->fetchrow_array() ) { my $i = 0; $id = $row[$i++]; #ID must be rowid in LOG. @@ -748,10 +779,20 @@ _TXT . $today->ymd . " " . $today->hms . qq(">   -   - Category: - $cats -

    +   + + + Enter log... + + + Category:  + --Select -- + + + + Log: @@ -778,6 +819,7 @@ _TXT + @@ -811,17 +853,38 @@ _TXT qq( View by Category: - $cats_v   + + + --Select -- + + + + Exclude Category: - $cats_x   + + + + --Select -- + + + + + +    -    +   +        Keep In Seession @@ -859,7 +922,8 @@ _TXT # Page printout from here! # ################################ -print qq(