s4

changeset 659:a36a2c3b3056

GrpAction: Reverse selection and supplemental rcpt address
author HIROSE Yuuji <yuuji@gentei.org>
date Mon, 11 May 2020 20:08:29 +0900
parents ef138b0c44a5
children 347ea2bca687
files examples/common/default/default.css s4-funcs.sh s4-main.js
diffstat 3 files changed, 41 insertions(+), 6 deletions(-) [+]
line diff
     1.1 --- a/examples/common/default/default.css	Mon May 11 19:46:57 2020 +0900
     1.2 +++ b/examples/common/default/default.css	Mon May 11 20:08:29 2020 +0900
     1.3 @@ -35,6 +35,8 @@
     1.4  table.td3r td:nth-child(3) {text-align: right;}
     1.5  table.td3rr td:nth-child(n+3) {text-align: right;}
     1.6  table.td3evw th:nth-child(2n+4) {background: white;}
     1.7 +table.thl th {text-align: left;}
     1.8 +span#reverse {background: white; padding: 0 0 0 0.4ex; border: outset;}
     1.9  
    1.10  table.form, table.b, table.b tr, table.b td, table.b th {
    1.11    border: 1px solid black; border-collapse: collapse;
    1.12 @@ -176,6 +178,10 @@
    1.13      display: block; background: #fadede;
    1.14      height: auto; opacity: 1.0; transition: 1s;
    1.15  }
    1.16 +input.fold ~ *.folded {opacity: 0;}
    1.17 +input[type="checkbox"].fold:checked ~ *.folded {
    1.18 +    opacity: 1.0; transition: 2s;
    1.19 +}
    1.20  
    1.21  /* fold2!! */
    1.22  div.foldtabs {
     2.1 --- a/s4-funcs.sh	Mon May 11 19:46:57 2020 +0900
     2.2 +++ b/s4-funcs.sh	Mon May 11 20:08:29 2020 +0900
     2.3 @@ -1145,10 +1145,11 @@
     2.4    # $MAIL_FROM <- From: header value
     2.5    from=`echo "${MAIL_FROM:-$admin}"|nkf -jM|tr -d '\n'`
     2.6    rcpt=`echo $1|tr ' ' '\n'|sort -u|tr '\n' ' '` # uniq and strip newlines
     2.7 +  rcptheader=`echo $1|tr ' ' '\n'|sort -u|sed '2,$s/^/To: /g'`
     2.8    subj=`echo $2|nkf -jM|tr -d '\n'`
     2.9    sender=${SENDER:-$admin}
    2.10    replyto=${REPLYTO:+"Reply-to: $REPLYTO$LF"}
    2.11 -  (_m4 -D_RCPT_="${SMAIL_TO:-$rcpt}" -D_REPLYTO_="$replyto" -D_SUBJ_="\`$subj'" -D_FROM_="$from" $msgdir/mail-header.m4
    2.12 +  (_m4 -D_RCPT_="${SMAIL_TO:-$rcptheader}" -D_REPLYTO_="$replyto" -D_SUBJ_="\`$subj'" -D_FROM_="$from" $msgdir/mail-header.m4
    2.13     cat $3 | nkf -jd ) | sendmail -f $sender $rcpt
    2.14  }
    2.15  smail_queue_flush() {
    2.16 @@ -2655,10 +2656,16 @@
    2.17        else
    2.18  	mail_from="$noreply_from"
    2.19        fi
    2.20 +      ar=`getpar supprcpt`
    2.21 +      if [ -n "$ar" -a -n `getpar suppck` ]; then
    2.22 +	for a in $ar; do
    2.23 +	  checkdomain "$a" && supprcpt="$supprcpt $a"
    2.24 +	done
    2.25 +      fi
    2.26        ## SENDER=$noreply \ # Should not SENDER be set to $noreply??
    2.27        REPLYTO=$replyto \
    2.28        MAIL_FROM=$mail_from \
    2.29 -	       smail "`email4groupbyuid "$grp" $usel` $user" \
    2.30 +	       smail "`email4groupbyuid "$grp" $usel` $user$supprcpt" \
    2.31  	       "$gecos さんからのメッセージ" <<EOF
    2.32  $url
    2.33  のグループ「$grp」のメンバーである $gecos さんから、
    2.34 @@ -2673,7 +2680,7 @@
    2.35  		left join user_s b on a.name=b.name and b.key='gecos';"
    2.36  	html pre<<EOF
    2.37  `query "$sql"`
    2.38 -(送信者である $gecos さんも含まれます)
    2.39 +${supprcpt:+追加宛先 $supprcpt$nl}(送信者である $gecos さんも含まれます)
    2.40  EOF
    2.41  	err SendDone: `echo $sql`
    2.42        fi
    2.43 @@ -2787,6 +2794,7 @@
    2.44    fi
    2.45    b1='<label> <input type="checkbox" name="usel" value="'
    2.46    ba='<label class="admin"><input type="checkbox" name="usel" value="'
    2.47 +  br='<span id="reverse" title="Reverse Selection"></span>'
    2.48    #b2='"> <span>' b3='</span></label>'
    2.49    #    	| sed  -e "s|^\(<TR><TD>\)k\([0-9]*\),\([^<]*\)|\1$ba\2$b2\3$b3|" \
    2.50    #	       -e "s|^\(<TR><TD>\)\([0-9]*\),\([^<]*\)|\1$b1\2$b2\3$b3|" \
    2.51 @@ -2794,6 +2802,7 @@
    2.52    cgi_form grpaction<<EOF \
    2.53        	| sed  -e "s|^\(<TR><TD>\)k\([0-9]*\),\([^<]*\)|\1$ba\2$lnk|" \
    2.54  	       -e "s|^\(<TR><TD>\)\([0-9]*\),\([^<]*\)|\1$b1\2$lnk|" \
    2.55 +	       -e "s|^\(<TR><TH>\)\(NAME\)|\1$br \2|" \
    2.56  	| _m4 -D_TITLE_="spaste(\`$tf')" \
    2.57  	      -D_SUBTITLE_="チェック後操作ボタン" \
    2.58  	      -D_FORM_="syscmd(cat)" -D_DUMPTABLE_="" \
    2.59 @@ -2811,13 +2820,16 @@
    2.60  <div>
    2.61  `cgi_checkbox mkfrom yes 'id="mkfrom" checked'`<label for="mkfrom"
    2.62  >差出人を自分に(チェックを外すと相手が返事できない)</label><br>
    2.63 -`cgi_textarea text "" cols=40`
    2.64 +<input type="checkbox" name="suppck" id="supp" class="fold"><label for="supp"
    2.65 +>宛先追加(通常空欄)</label>
    2.66 +<span class="folded">`cgi_text supprcpt`(下記一覧の1人以上選択しないと無効)</span>
    2.67 +<div>`cgi_textarea text "" cols=40`</div>
    2.68  </div>
    2.69  ${isowner:+$cmmsg$excmsg}
    2.70  `cgi_radio rm close id="x"`<label for="x">×</label>
    2.71  </div>
    2.72  <h4>$grp 参加者一覧</h4>$fromtonote
    2.73 -<table class="td2r">
    2.74 +<table class="td2r thl">
    2.75  `sq $db -header -html "$sql"`
    2.76  </table>
    2.77  `cgi_hidden grp $grid`
     3.1 --- a/s4-main.js	Mon May 11 19:46:57 2020 +0900
     3.2 +++ b/s4-main.js	Mon May 11 20:08:29 2020 +0900
     3.3 @@ -54,7 +54,13 @@
     3.4  	    textarea.value = lines.join("\n");
     3.5  	}
     3.6      }
     3.7 -    function init() {
     3.8 +    function reverseChecks() {
     3.9 +	var names = collectElementsByNameAttr("input", "usel");
    3.10 +	for (let u of names) {
    3.11 +	    u.checked = !u.checked;
    3.12 +	}
    3.13 +    }
    3.14 +    function initBlogs() {
    3.15  	var el, check = collectElementsByNameAttr("input", "notifyto");
    3.16  	if (check)
    3.17  	    for (let i of check) {
    3.18 @@ -65,5 +71,16 @@
    3.19  		if (RegExp.lastMatch == i.innerHTML)
    3.20  		    i.addEventListener("click", insertRedirect, null)
    3.21      }
    3.22 +    function initGrpAction() {
    3.23 +	var rev = document.getElementById("reverse");
    3.24 +	if (rev && rev.tagName.match(/span/i)) {
    3.25 +	    rev.textContent = " 反転 ";
    3.26 +	    rev.addEventListener("click", reverseChecks, null);
    3.27 +	}
    3.28 +    }
    3.29 +    function init() {
    3.30 +	initGrpAction();
    3.31 +	initBlogs();
    3.32 +    }
    3.33      document.addEventListener('DOMContentLoaded', init, null);
    3.34  })();