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 wrap: on
line diff
--- a/examples/common/default/default.css	Mon May 11 19:46:57 2020 +0900
+++ b/examples/common/default/default.css	Mon May 11 20:08:29 2020 +0900
@@ -35,6 +35,8 @@
 table.td3r td:nth-child(3) {text-align: right;}
 table.td3rr td:nth-child(n+3) {text-align: right;}
 table.td3evw th:nth-child(2n+4) {background: white;}
+table.thl th {text-align: left;}
+span#reverse {background: white; padding: 0 0 0 0.4ex; border: outset;}
 
 table.form, table.b, table.b tr, table.b td, table.b th {
   border: 1px solid black; border-collapse: collapse;
@@ -176,6 +178,10 @@
     display: block; background: #fadede;
     height: auto; opacity: 1.0; transition: 1s;
 }
+input.fold ~ *.folded {opacity: 0;}
+input[type="checkbox"].fold:checked ~ *.folded {
+    opacity: 1.0; transition: 2s;
+}
 
 /* fold2!! */
 div.foldtabs {
--- a/s4-funcs.sh	Mon May 11 19:46:57 2020 +0900
+++ b/s4-funcs.sh	Mon May 11 20:08:29 2020 +0900
@@ -1145,10 +1145,11 @@
   # $MAIL_FROM <- From: header value
   from=`echo "${MAIL_FROM:-$admin}"|nkf -jM|tr -d '\n'`
   rcpt=`echo $1|tr ' ' '\n'|sort -u|tr '\n' ' '` # uniq and strip newlines
+  rcptheader=`echo $1|tr ' ' '\n'|sort -u|sed '2,$s/^/To: /g'`
   subj=`echo $2|nkf -jM|tr -d '\n'`
   sender=${SENDER:-$admin}
   replyto=${REPLYTO:+"Reply-to: $REPLYTO$LF"}
-  (_m4 -D_RCPT_="${SMAIL_TO:-$rcpt}" -D_REPLYTO_="$replyto" -D_SUBJ_="\`$subj'" -D_FROM_="$from" $msgdir/mail-header.m4
+  (_m4 -D_RCPT_="${SMAIL_TO:-$rcptheader}" -D_REPLYTO_="$replyto" -D_SUBJ_="\`$subj'" -D_FROM_="$from" $msgdir/mail-header.m4
    cat $3 | nkf -jd ) | sendmail -f $sender $rcpt
 }
 smail_queue_flush() {
@@ -2655,10 +2656,16 @@
       else
 	mail_from="$noreply_from"
       fi
+      ar=`getpar supprcpt`
+      if [ -n "$ar" -a -n `getpar suppck` ]; then
+	for a in $ar; do
+	  checkdomain "$a" && supprcpt="$supprcpt $a"
+	done
+      fi
       ## SENDER=$noreply \ # Should not SENDER be set to $noreply??
       REPLYTO=$replyto \
       MAIL_FROM=$mail_from \
-	       smail "`email4groupbyuid "$grp" $usel` $user" \
+	       smail "`email4groupbyuid "$grp" $usel` $user$supprcpt" \
 	       "$gecos さんからのメッセージ" <<EOF
 $url
 のグループ「$grp」のメンバーである $gecos さんから、
@@ -2673,7 +2680,7 @@
 		left join user_s b on a.name=b.name and b.key='gecos';"
 	html pre<<EOF
 `query "$sql"`
-(送信者である $gecos さんも含まれます)
+${supprcpt:+追加宛先 $supprcpt$nl}(送信者である $gecos さんも含まれます)
 EOF
 	err SendDone: `echo $sql`
       fi
@@ -2787,6 +2794,7 @@
   fi
   b1='<label> <input type="checkbox" name="usel" value="'
   ba='<label class="admin"><input type="checkbox" name="usel" value="'
+  br='<span id="reverse" title="Reverse Selection"></span>'
   #b2='"> <span>' b3='</span></label>'
   #    	| sed  -e "s|^\(<TR><TD>\)k\([0-9]*\),\([^<]*\)|\1$ba\2$b2\3$b3|" \
   #	       -e "s|^\(<TR><TD>\)\([0-9]*\),\([^<]*\)|\1$b1\2$b2\3$b3|" \
@@ -2794,6 +2802,7 @@
   cgi_form grpaction<<EOF \
       	| sed  -e "s|^\(<TR><TD>\)k\([0-9]*\),\([^<]*\)|\1$ba\2$lnk|" \
 	       -e "s|^\(<TR><TD>\)\([0-9]*\),\([^<]*\)|\1$b1\2$lnk|" \
+	       -e "s|^\(<TR><TH>\)\(NAME\)|\1$br \2|" \
 	| _m4 -D_TITLE_="spaste(\`$tf')" \
 	      -D_SUBTITLE_="チェック後操作ボタン" \
 	      -D_FORM_="syscmd(cat)" -D_DUMPTABLE_="" \
@@ -2811,13 +2820,16 @@
 <div>
 `cgi_checkbox mkfrom yes 'id="mkfrom" checked'`<label for="mkfrom"
 >差出人を自分に(チェックを外すと相手が返事できない)</label><br>
-`cgi_textarea text "" cols=40`
+<input type="checkbox" name="suppck" id="supp" class="fold"><label for="supp"
+>宛先追加(通常空欄)</label>
+<span class="folded">`cgi_text supprcpt`(下記一覧の1人以上選択しないと無効)</span>
+<div>`cgi_textarea text "" cols=40`</div>
 </div>
 ${isowner:+$cmmsg$excmsg}
 `cgi_radio rm close id="x"`<label for="x">×</label>
 </div>
 <h4>$grp 参加者一覧</h4>$fromtonote
-<table class="td2r">
+<table class="td2r thl">
 `sq $db -header -html "$sql"`
 </table>
 `cgi_hidden grp $grid`
--- a/s4-main.js	Mon May 11 19:46:57 2020 +0900
+++ b/s4-main.js	Mon May 11 20:08:29 2020 +0900
@@ -54,7 +54,13 @@
 	    textarea.value = lines.join("\n");
 	}
     }
-    function init() {
+    function reverseChecks() {
+	var names = collectElementsByNameAttr("input", "usel");
+	for (let u of names) {
+	    u.checked = !u.checked;
+	}
+    }
+    function initBlogs() {
 	var el, check = collectElementsByNameAttr("input", "notifyto");
 	if (check)
 	    for (let i of check) {
@@ -65,5 +71,16 @@
 		if (RegExp.lastMatch == i.innerHTML)
 		    i.addEventListener("click", insertRedirect, null)
     }
+    function initGrpAction() {
+	var rev = document.getElementById("reverse");
+	if (rev && rev.tagName.match(/span/i)) {
+	    rev.textContent = " 反転 ";
+	    rev.addEventListener("click", reverseChecks, null);
+	}
+    }
+    function init() {
+	initGrpAction();
+	initBlogs();
+    }
     document.addEventListener('DOMContentLoaded', init, null);
 })();

yatex.org