s4

changeset 960:0d9caeab3d81

Instant notify by "@all" sign at the beginning of article.
author HIROSE Yuuji <yuuji@gentei.org>
date Sat, 29 Jan 2022 10:41:41 +0900
parents 193d9d2ed9c9
children 3444e0a72bb7
files examples/common/default/default.css s4-blog.sh s4-main.js
diffstat 3 files changed, 31 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/examples/common/default/default.css	Fri Dec 24 08:39:25 2021 +0900
     1.2 +++ b/examples/common/default/default.css	Sat Jan 29 10:41:41 2022 +0900
     1.3 @@ -152,6 +152,10 @@
     1.4  td.repl h2:before {content: "■"; color: #a22;}
     1.5  td.repl h3:before {content: "◆"; color: #a22;}
     1.6  td.repl h4:before {content: "○";}
     1.7 +td.repl div.atall {
     1.8 +    color: white; background: #66f; padding: 0 0.8ex;
     1.9 +    display: inline-block; border-radius: 0.8ex;
    1.10 +}
    1.11  .blog_replies td.repatt {min-width: 12em;}
    1.12  table.blog_replies iframe {
    1.13      width: 80%; min-height: 300px; max-width: 50em; max-height: 80vw;
     2.1 --- a/s4-blog.sh	Fri Dec 24 08:39:25 2021 +0900
     2.2 +++ b/s4-blog.sh	Sat Jan 29 10:41:41 2022 +0900
     2.3 @@ -43,7 +43,10 @@
     2.4    blogtitle=`getvalbyid blog title "$blogid"`
     2.5    blogurl="$urlbase?replyblog+$blogid"
     2.6    action=${4:-書き込み}
     2.7 -  mode=`getvalbyid blog notify "$blogid"`
     2.8 +  case "$3" in
     2.9 +    @all*)	mode=all ;;
    2.10 +    *)		mode=`getvalbyid blog notify "$blogid"` ;;
    2.11 +  esac
    2.12    isgroup "$blogowner" && _isgroup=true || _isgroup=false
    2.13    ### EXCEPT=`sqlquote "$user"`	## User should receive to feal some annoyance
    2.14    case $mode in
    2.15 @@ -94,6 +97,8 @@
    2.16        fi
    2.17      elif echo "$firstline" | grep -q "^## "; then
    2.18        subject=${firstline#\#\# }
    2.19 +    elif echo "$firstline" | grep -q "^@all "; then
    2.20 +      subject=${firstline#@all }
    2.21      fi
    2.22    else
    2.23      # This else block is not symmetry, check later(2020-1209)
    2.24 @@ -609,7 +614,9 @@
    2.25    ntmode="通知モード=$blog_notify${blog_team:+ (team=$blog_team)}
    2.26  記事の1行目を「## 」(半角シャープシャープ空白=大見出し)
    2.27  にするとそれより後ろの部分がSubject(件名)になります。
    2.28 -If the first line begins with &quot;## &quot;, sent it as Subject of email."
    2.29 +記事先頭に @all で全員(チーム所有の場合はチーム全体)通知になります。
    2.30 +If the first line begins with &quot;## &quot;, sent it as Subject of email.
    2.31 +If begins with &quot;@all&quot;, notify to all group(or team) members."
    2.32    textform=$(cat<<-EOF
    2.33  <div class="fold">
    2.34  <input type="checkbox" id="cmt" checked><label
     3.1 --- a/s4-main.js	Fri Dec 24 08:39:25 2021 +0900
     3.2 +++ b/s4-main.js	Sat Jan 29 10:41:41 2022 +0900
     3.3 @@ -713,6 +713,15 @@
     3.4  	pjaxHistoryPush(preview);
     3.5  	btn.focus();
     3.6      }
     3.7 +    function helpMarkdownAt(e) {
     3.8 +	var area = e.target, pos = area.selectionStart;
     3.9 +	if (pos == 0) {
    3.10 +	    area.value = "@all" + area.value;
    3.11 +	    area.selectionStart = area.selectionEnd = 4;
    3.12 +	    dispInfoMomentary("@all で全員に通知します", area.parentNode);
    3.13 +	    e.preventDefault();
    3.14 +	}
    3.15 +    }
    3.16      function helpMarkdown(e) {
    3.17  	switch (e.key) {
    3.18  	case "Backspace": helpMarkdownBS(e); break;
    3.19 @@ -721,6 +730,7 @@
    3.20  	case "p":  if (e.metaKey) helpMarkdownPreview(e.target); break;
    3.21  	case "{":  helpMarkdownBrace(e); break;
    3.22  	case "}":  helpMarkdownBraceClose(e); break;
    3.23 +	case "@":  helpMarkdownAt(e); break;
    3.24  	}
    3.25      }
    3.26      /* Init event listeners */
    3.27 @@ -810,6 +820,14 @@
    3.28  	}
    3.29  	// Hack article_m links
    3.30  	registPjaxViewers(document.querySelectorAll("a[href]"));
    3.31 +	// Enclose "@all" with span
    3.32 +	for (i of document.querySelectorAll("td.repl")) {
    3.33 +	    let ii = i.innerHTML;
    3.34 +	    if (ii.startsWith("@all")) {
    3.35 +		ii = ii.replace(/^@all/,'<div class="atall">@all</div>');
    3.36 +		i.innerHTML = ii;
    3.37 +	    }
    3.38 +	}
    3.39      }
    3.40      function initGrpAction() {
    3.41  	var rev = document.getElementById("reverse");