]> lifelog.hopto.org Git - LifeLog.git/commitdiff
Added $RTF_SIZE setting and summing button.
authorMetabox <redacted>
Tue, 23 Jul 2019 00:18:29 +0000 (10:18 +1000)
committerMetabox <redacted>
Tue, 23 Jul 2019 00:18:29 +0000 (10:18 +1000)
dbLifeLog/main.cnf
htdocs/cgi-bin/config.cgi
htdocs/cgi-bin/main.cgi
htdocs/cgi-bin/wsrc/main.js

index a37e0e9239d0c8fe0bf2c561c758781873edb4d8..0894b0c54fd3124dba9aceaec659dcdf2312e187 100644 (file)
@@ -17,6 +17,7 @@ Credential format:<<AUTO_LOGIN <{alias}/{password}> , must be enabled option.
 20|$AUTO_WRD_LMT= 200`Autocomplete word gathering limit.
 22|$AUTO_LOGIN  = 0`Autologin option, that expires only if login out. Enter Credentials in main.cnf.
 24|$FRAME_SIZE  = 0`Youtube frame size settings, 0 - Large, 1 - Medium, 2- Small.
+26|$RTF_SIZE    = 2`RTF Document height, 0 - Large, 1 - Medium, 2- Small.
 <<CAT<3>
 01|Unspecified `For quick uncategorised entries.
 03|File System `Operating file system short log.
index 3db4f28310d5a4fa9399f2ff685e45b9a9410226..af267496c6c2997fefc69f5b61ee625f6d0eb110 100755 (executable)
@@ -32,6 +32,7 @@ our $IMG_W_H     = '210x120';
 our $AUTO_WRD_LMT= 200;
 our $AUTO_LOGIN  = 0;
 our $FRAME_SIZE  = 0;
+our $RTF_SIZE  = 0;
 #END OF SETTINGS
 
 #This is the OS developer release key, replace on istallation. As it is not secure.
@@ -184,7 +185,7 @@ $tbl = qq(<table id="cnf_sys" class="tbl" border="1" width="$PRC_WIDTH%">
                                                                <th width="60%">Description</th>
                                                </tr>
        );
-my $stm = 'SELECT * FROM CONFIG;';
+my $stm = 'SELECT ID, NAME, VALUE, DESCRIPTION FROM CONFIG;';
 $dbs = $db->prepare( $stm );
 $rv = $dbs->execute() or die or die "<p>Error->"& $DBI::errstri &"</p>";
 
@@ -239,13 +240,35 @@ while(my @row = $dbs->fetchrow_array()) {
                                }
                                else{
                                 $t = $v;
+                               }               
+               $v = qq(<select id="frms" name="var$i">
+                          <option value="0" $l>Large</option>
+                          <option value="1" $m>Medium</option>
+                                  <option value="2" $s>Small</option>
+                                  <option value="3" $t>---</option>
+                       </select>);     
+               }
+               elsif($n eq "RTF_SIZE"){
+                               my($l,$m,$s, $t)=("","");
+                               if($v == 0){
+                                        $l = "SELECTED"
                                }
-               $v = qq(<select id="almi" name="var$i">
+                               elsif($v == 1){
+                                        $m = "SELECTED"
+                               }
+                               elsif($v == 2){
+                                        $s = "SELECTED"
+                               }
+                               else{
+                                $t = $v;
+                               }               
+               $v = qq(<select id="rtfs" name="var$i">
                           <option value="0" $l>Large</option>
                           <option value="1" $m>Medium</option>
                                   <option value="2" $s>Small</option>
                                   <option value="3" $t>---</option>
                        </select>);     
+
                }
                elsif($n ne "RELEASE_VER"){              
                         $v = '<input name="var'.$i.'" type="text" value="'.$v.'" size="12">';
@@ -762,10 +785,17 @@ sub logout{
        exit;
 }
 
+CREATE TABLE CONFIG(
+                                                                                               ID TINY PRIMARY KEY NOT NULL,
+                                                                                               NAME VCHAR(16),
+                                                                                               VALUE VCHAR(28),
+                                                                                               DESCRIPTION VCHAR(128)
+                                                                               );
+
 sub changeSystemSettings {
        try{
-                       $dbs = $db->prepare("SELECT * FROM CONFIG;");
-                 $dbs->execute();
+                       $dbs = $db->prepare("SELECT ID, NAME FROM CONFIG;");
+                   $dbs->execute();
                        while (my @r=$dbs->fetchrow_array()){ 
                                my $var = $cgi->param('var'.$r[0]);
                                if(defined $var){                                       
@@ -781,6 +811,7 @@ sub changeSystemSettings {
                                                case "AUTO_WRD_LMT"{$AUTO_WRD_LMT=$var; updCnf($r[0],$var)}
                                                case "AUTO_LOGIN" {$AUTO_LOGIN=$var; updCnf($r[0],$var)}
                                                case "FRAME_SIZE" {$FRAME_SIZE=$var; updCnf($r[0],$var)}
+                                               case "RTF_SIZE"   {$RTF_SIZE=$var; updCnf($r[0],$var)}
                                         }
                                }
                        }
@@ -980,6 +1011,7 @@ sub getConfiguration {
                                case "AUTO_WRD_LMT" {$AUTO_WRD_LMT=$r[2]}
                                case "AUTO_LOGIN"       {$AUTO_LOGIN=$r[2]}
                                case "FRAME_SIZE"       {$FRAME_SIZE=$r[2]}
+                               case "RTF_SIZE"         {$RTF_SIZE=$r[2]}
                        }
 
                }
index 5e88543fc32d3778528b8350d682d250a6311fc5..93331d7b214c4ee9af72c280b16ce14d6eeff7f3 100755 (executable)
@@ -35,6 +35,7 @@ our $AUTHORITY    = '';
 our $IMG_W_H      = '210x120';
 our $AUTO_WRD_LMT = 1000;
 our $FRAME_SIZE   = 0;
+our $RTF_SIZE   = 0;
 #END OF SETTINGS
 
 my $cgi = CGI->new;
@@ -593,10 +594,11 @@ if ( $tbl_rc == 0 ) {
 }
 
 $tbl .=
-qq(<tr class="r0"><td>[Show All -> <a id="menu_close" href="#" onclick="return showAll();"><span  class="ui-icon ui-icon-heart"></span>]</a>
+qq(<tr class="r0"><td colspan="2">[Show All -> <a id="menu_close" href="#" onclick="return showAll();"><span  class="ui-icon ui-icon-heart"></span></a>]
 <a href="#top">&#x219F;</a></td>
-<td colspan="5" align="right"> 
+<td colspan="4" align="right"> 
     <input type="hidden" name="datediff" id="datediff" value="0"/>
+    <input type="submit" value="Sum Selected" onclick="return sumSelected()"/>&nbsp;
     <input type="submit" value="Date Diff Selected" onclick="return dateDiffSelected()"/>&nbsp;
     <button onclick="return selectAllLogs()">Select All</button>
     <input type="reset" value="Unselect All"/>
@@ -1036,6 +1038,7 @@ sub getConfiguration {
                   case "IMG_W_H"      { $IMG_W_H      = $r[2] }
                   case "AUTO_WRD_LMT" { $AUTO_WRD_LMT = $r[2] }
                   case "FRAME_SIZE"   { $FRAME_SIZE   = $r[2] }
+                  case "RTF_SIZE"     { $RTF_SIZE     = $r[2] }
                   else {
                       print "Unknow variable setting: " . $r[1] . " == " . $r[2];
                 }
@@ -1057,6 +1060,18 @@ return $am;
 
 sub quill {
     my $log_id = shift;
+my $h;
+switch ( $RTF_SIZE ) {
+    case "0" { $h = q(height:420px;) }
+    case "1" { $h = q(height:260px;) }
+    case "2" { $h = q(height:140px;) }
+    else{
+               $h = $RTF_SIZE;
+    }
+}
+
+
+
 return <<END;
   
 <table id="tbl_doc" class="tbl" width="$PRC_WIDTH%" style="border:1; margin-top: 5px;" hidden>
@@ -1108,7 +1123,7 @@ return <<END;
       <button class="ql-formula"></button>
     </span>  
   </div>
-  <div id="editor-container"></div>
+  <div id="editor-container" style="$h"></div>
   <div class="save_button">
   <input type="button" id="btn_save_doc" onclick="saveRTF(0, 'store'); return false;" value="Save"/>
   </div>
index f8bb39b5354e62bf202b258e9b00e7cbd03eb71e..4cf5e250d237774b262407a007eca33447ed5b72 100644 (file)
@@ -495,6 +495,25 @@ function dateDiffSelected() {
     return true;
 }
 
+function sumSelected() {
+    var chks = document.getElementsByName("chk");
+    var sum = 0;
+    for (var i = 0, n = chks.length; i < n; i++) {
+        if (chks[i].checked) {
+            var par = chks[i].parentNode.parentNode.childNodes;
+            for (var j = 0, nn = par.length; j < nn; j++) {
+                var el = par[j];
+                if (el.id && el.id.indexOf('a', 0) == 0) {
+                    sum = sum + Number(el.innerHTML);
+                    break;
+                }
+            }
+        }
+    }
+    $("#summary").html(sum.toFixed(2));
+    return false;
+}
+
 function saveRTF(id, action) {
     // alert(JSON.stringify(QUILL.getContents()));
     //Disabled on new log entry. Save and edit, obtains id. For now. @2019-07-20