s4

changeset 252:75dfaceac01f

Link to newest article of the blog in the recent writing place
author HIROSE Yuuji <yuuji@gentei.org>
date Sun, 17 Jul 2016 23:59:37 +0859
parents 9e8e43ed3c11
children a40d258cc5aa
files examples/common/default/default.css s4-funcs.sh
diffstat 2 files changed, 33 insertions(+), 19 deletions(-) [+]
line diff
     1.1 --- a/examples/common/default/default.css	Sun Jul 17 13:31:20 2016 +0859
     1.2 +++ b/examples/common/default/default.css	Sun Jul 17 23:59:37 2016 +0859
     1.3 @@ -24,6 +24,7 @@
     1.4  td {padding-left: 0.5ex; padding-right: 0.5ex;}
     1.5  table.td2r td:nth-child(2) {text-align: right;}
     1.6  table.td3r td:nth-child(3) {text-align: right;}
     1.7 +
     1.8  table.form, table.b, table.b tr, table.b td, table.b th {
     1.9    border: 1px solid black; border-collapse: collapse;
    1.10  }
    1.11 @@ -105,7 +106,15 @@
    1.12      height: auto; opacity: 1.0; transition: 1s;
    1.13  }
    1.14  div.dumptable {max-height: 15em; overflow: auto;}
    1.15 -
    1.16 +table.td4fw td:nth-child(4) {max-width: 8em; white-space: nowrap; overflow: hidden;}
    1.17 +table.td67fw {max-width: 9%;}
    1.18 +table.dumpblogs td:nth-child(4) {
    1.19 +    max-width: 7.6em; white-space: nowrap; overflow: hidden;}
    1.20 +table.dumpblogs td:nth-child(5),
    1.21 +table.dumpblogs td:nth-child(6) {
    1.22 +    max-width: 12em; white-space: nowrap; overflow: hidden;}
    1.23 +table.dumpblogs td:nth-child(7) {
    1.24 +    min-width: 5em; white-space: nowrap; overflow: hidden;}
    1.25  
    1.26  /********************* icon list *********************/
    1.27  div.iconlist {
     2.1 --- a/s4-funcs.sh	Sun Jul 17 13:31:20 2016 +0859
     2.2 +++ b/s4-funcs.sh	Sun Jul 17 23:59:37 2016 +0859
     2.3 @@ -22,7 +22,7 @@
     2.4  msgdir=$templ/msg
     2.5  timeout="+2 days"
     2.6  memoplimitdays="7"
     2.7 -dumpcollen=17
     2.8 +dumpcollen=22
     2.9  #thumbxy=120x120
    2.10  thumbxy=96x96
    2.11  maximagexy=1600x1600
    2.12 @@ -1495,20 +1495,25 @@
    2.13      # Display Most Recent Entry
    2.14      shortval=${dumpcollen:+"substr(val, 0, $dumpcollen)"}
    2.15      shortval=${shortval:-val}
    2.16 -    DT_SQL="SELECT b.rowid LINK,
    2.17 -       ctime,
    2.18 -       (SELECT $shortval FROM blog_s WHERE key='title' AND id=b.id) title,
    2.19 -       (SELECT gecos FROM gecoses
    2.20 -        WHERE name=(SELECT val FROM blog_s
    2.21 -                   WHERE key='owner' AND id=b.id)) owner
    2.22 -    FROM blog b
    2.23 -     JOIN
    2.24 -     (SELECT distinct blogid, max(val) ctime
    2.25 -      FROM article a, article_s s
    2.26 -      ON a.id=s.id AND a.author='$user' AND s.key='ctime'
    2.27 -      GROUP BY blogid ORDER BY val DESC LIMIT 50
    2.28 -     ) m
    2.29 -     ON b.id=m.blogid;"
    2.30 +    DT_SQL="WITH arts AS(
    2.31 +	  SELECT (SELECT rowid FROM blog WHERE id=a.blogid) brid,
    2.32 +	         a.blogid, a.id id, s.val ctime
    2.33 +	  FROM article a NATURAL JOIN article_s s
    2.34 +	  WHERE s.key = 'ctime' AND a.author='$user'
    2.35 +	  GROUP by s.id
    2.36 +	)
    2.37 +	SELECT a1.brid || '#' || a1.id LINK,
    2.38 +	       a1.ctime,
    2.39 +	       (SELECT val FROM blog_s
    2.40 +	        WHERE key='title' AND id=a1.blogid) title,
    2.41 +	       (SELECT gecos
    2.42 +	        FROM   gecoses
    2.43 +		WHERE name=(SELECT val FROM blog_s
    2.44 +		            WHERE key='owner' AND id=a1.blogid)) owner
    2.45 +	FROM arts a1
    2.46 +	WHERE a1.ctime = (SELECT max(ctime) FROM arts WHERE blogid=a1.blogid)
    2.47 +	GROUP BY a1.brid ORDER by a1.ctime DESC LIMIT 50;"
    2.48 +
    2.49      cat<<-EOF
    2.50  	<div class="fold">
    2.51  	`cgi_checkbox mrd yes id="mre"`<label
    2.52 @@ -2529,7 +2534,7 @@
    2.53    ### elink="<a href=\"$myname?edittable+$2+\\2\">EDIT</a>"
    2.54    VIEW=${DT_VIEW-replyblog}
    2.55    if [ -n "$VIEW" ]; then
    2.56 -    dvlink=" <a href=\"$myname?$VIEW+\\2\">VIE</a><a href=\"$myname?$VIEW+\\2#bottom\">W</a>"
    2.57 +    dvlink=" <a href=\"$myname?$VIEW+\\2\\3\">VIE</a><a href=\"$myname?$VIEW+\\2#bottom\">W</a>"
    2.58    fi
    2.59    # $DT_CHLD=ChildTable:BindColumn
    2.60    if [ -n "$DT_CHLD" ]; then
    2.61 @@ -2541,7 +2546,7 @@
    2.62  			    user='$user' and tbl='$2' and tblrowid=a.rowid),\
    2.63  		    '1970-01-01'))"
    2.64      cnt="$cntnew as '新着', $cntall as '総数',"
    2.65 -    dt_class=" td2r td3r"
    2.66 +    dt_class=" td2r td3r dumpblogs"
    2.67    fi
    2.68    # Construct join expression
    2.69    eav="" scols=""
    2.70 @@ -2568,7 +2573,7 @@
    2.71  	 then (SELECT gecos FROM gecoses WHERE name=val) END) as gecos
    2.72   from ${2}_s c group by $pk) b on a.$pk=b.$pk $4;"}
    2.73    err SQL=`echo "$sql"`
    2.74 -  cat<<EOF | sed "s,\(<TR><TD>\)\([1-9][0-9]*\)</TD>,\1$elink$dvlink</TD>,"
    2.75 +  cat<<EOF | sed "s,\(<TR><TD>\)\([1-9][0-9]*\)\(#[0-9a-fxs]*\)*</TD>,\1$elink$dvlink</TD>,"
    2.76  <div> <!-- for folding by check button (s4-funcs.sh:dumptable()) -->
    2.77  <div class="dumptable">
    2.78  <table class="b$dt_class">