]> lifelog.hopto.org Git - LifeLog.git/commitdiff
Started work on VIEW_OVERRIDE's.
authorWill Budicm <redacted>
Sun, 3 Jan 2021 05:21:56 +0000 (16:21 +1100)
committerWill Budicm <redacted>
Sun, 3 Jan 2021 05:21:56 +0000 (16:21 +1100)
Current Development Check List.md
dbLifeLog/main.cnf
htdocs/cgi-bin/login_ctr.cgi
htdocs/cgi-bin/system/modules/Settings.pm

index 98c92ff6afaa78607c246dccb1ad047b27fe6c94..cfddcff51e9a098c51cf0ae45efed83cfdb2032e 100644 (file)
   * Reset Whole View to page view, should still set the search option till it is ticked.
   * Unticking Keep in Session should be honored on next browsing.
 * Global view overrides. These get generated in the db if set on logon. And used instead of the normal view.
+  * Overrides must always show todays log entries, regardless of criteria.
   * VIEW_OVERRIDE_SYSLOGS={0/1}, anon if set 1-true, will hide older than today system logs. Doesn't affect category and keywords searches/views.
   * VIEW_OVERRIDE_WHERE={""/{your where clause}}, allows your own WHERE override. Doesn't affect category and keywords searches/views.
    * i.e. <<VIEW_OVERRIDE_WHERE<"RTF==1 OR STICKY==1">>>, will show only these type of log entries.  
-   * i.e. <<VIEW_OVERRIDE_WHERE<"DATE<TODAY+30days">>>, will show only logs less then 30 days old.
+   * i.e. <<VIEW_OVERRIDE_WHERE<"DATE > DATE('now','start of month', '-2 month')">>>, will show only logs from current last two months.
    * i.e. <<VIEW_OVERRIDE_WHERE<"ID_CAT!==(select id from cat where name like 'system log')>>>, same as setting <<VIEW_OVERRIDE_SYSLOGS<<1>>>.
 * Page section plugins.
   * Configured in main.cnf.
index b89b9fcdb278dff93821c5d179d3776da75a2bb2..9155ef0c8aeb8cae004ba58ef23dad55529cd875 100644 (file)
@@ -46,6 +46,28 @@ America/Austin=America/Chicago
 America/Texas=America/Chicago
 >>
 
+/*
+   Global view overrides. These get generated in the db if set on logon. And used instead of the normal data view.
+   Overrides must always show todays log entries, regardless of criteria.
+   Overrides don't affect category and keywords desired searches and views. They are mainly useful to filter out 
+   the not required to see on the main pages.
+   NOTE - These settings AND on VW_LOG_WITH_EXCLUDES if they are set. VW_ prefix signifies, database view, 
+   meaning this will be created. Based on the settings bellow you make. An interesting concept, don't you think?
+*/
+
+#######################
+# VIEW_OVERRIDE_SYSLOGS overrides not to show system logs older than today.
+# Default for 0, disabled.
+<<VIEW_OVERRIDE_SYSLOGS<0>>>
+
+#######################
+# VIEW_OVERRIDE_WHERE overrides what to, or not to select.
+# Default is not being used. OLDER_THAN keyword translates to appropriate SQL. 
+# By either months, days, hours. From current time.
+# i.e VIEW_OVERRIDE_WHERE<ID_CAT!=6 OR OLDER_THAN=2months>, this instructs skip older then to months logs and all sys logs.
+# i.e VIEW_OVERRIDE_WHERE<ID_CAT>=6>, this instructs skip all categories bellow and including sys logs..
+<<VIEW_OVERRIDE_WHERE<"">>>
+
 
 <<CONFIG<4>
 00|$RELEASE_VER = 2.1`LifeLog Application Version.
index 844df186f0c8280091bf2c028e5768c131066431..f572974c23560dfaa8424026ef17e72dfaebe0bb 100755 (executable)
@@ -397,6 +397,7 @@ try{
     if(!$curr_tables{Settings->VW_LOG}) {
         $db->do(Settings::createViewLOGStmt()) or LifeLogException -> throw("ERROR:".$@);
     }
+    # From 2.2+
     if(!$curr_tables{Settings->VW_LOG_WITH_EXCLUDES}) {
         # To cover all possible situations, this test elses too. 
         # As an older existing view might need to be recreated, to keep in synch.
@@ -528,6 +529,28 @@ sub createPageViewExcludeSQL {
     
 }
 
+sub createPageViewWhereOverrideSQL {
+    
+    my ($where,$days) = ("",0);
+    my $parse = $PAGE_EXCLUDES;
+    my @a = split('=',$parse);
+    if(scalar(@a)==2){
+        $days  = $a[0];
+        $parse = $a[1];
+    }
+    @a = split(',',$parse);
+    foreach (@a){
+        $where .= " ID_CAT!=$_ AND";
+    }    
+    
+    if(Settings::isProgressDB()){$where = "WHERE $where AND a.date >= (timestamp 'now' - interval '24 hours')"}
+    else{$where = "WHERE $where AND a.date >= date('now', '-24 hour')"}
+    
+
+    return Settings::createViewLOGStmt(Settings->VW_LOG_OVERRIDE_WHERE,$where);
+    
+}
+
 
 sub populate {
 
index 43461a2a3333cf0a89cea8b96ba1563fafc4c021..f9b8421337e5c1b2ffb645d61cdaebb9225ec6ef 100644 (file)
@@ -23,11 +23,24 @@ use experimental qw( switch );
 # This is the default developer release key, replace on istallation. As it is not secure.
 use constant CIPHER_KEY             => '95d7a85ba891da';
 use constant CIPHER_PADDING         => 'fe0a2b6a83e81f13a2d76ab104763773310df6b0a01c7cf9807b4b0ce2a02';
-# Default VIEW for all pages.
+
+# Default VIEW for all pages, it lists and sorts on all logs, super fast server side.
 use constant VW_LOG                 => 'VW_LOG';
-# Optional instructional VIEW from config file replacing above default.
+
+# Optional instructional VIEW from config file replacing VW_LOG. 
+# Filtering out by category ID certain specified entries.
 use constant VW_LOG_WITH_EXCLUDES   => 'VW_LOG_WITH_EXCLUDES';
 
+# Optional instructional VIEW from config directly overriding the 
+# where clause for data being delivered for pages.
+# This view will always return all last 24 hour entered log entries.
+# This view AND's by extending on VW_LOG_WITH_EXCLUDES, if is also set, which is something to be aware.
+# Otherwise, similar just replaces the VW_LOG to deliver pages.
+#
+use constant VW_LOG_OVERRIDE_WHERE  => 'VW_LOG_OVR_WHERE';
+
+
+
 #DEFAULT SETTINGS HERE!
 our $RELEASE_VER  = '2.1';
 our $TIME_ZONE    = 'Australia/Sydney';