Mercurial > hgrepos > hgweb.cgi > s4
changeset 764:d1f60cdc3e1a feature-world
Migration support added
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Sun, 07 Jun 2020 19:27:46 +0900 |
parents | 3f0ef9bb1776 |
children | f36f1f148a4f |
files | s4-funcs.sh scripts/s4-sns.case |
diffstat | 2 files changed, 80 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/s4-funcs.sh Sun Jun 07 06:15:13 2020 +0900 +++ b/s4-funcs.sh Sun Jun 07 19:27:46 2020 +0900 @@ -94,7 +94,7 @@ . ./s4-world.sh 2>> tmp/debug.out fi v="" -for i in $S4WORLDS; do +for i in $S4WORLDLIST; do _aname=${i%:*}; _apath=${i##*:} v=${v}"<tr><td>⇒ <a href=\"$_apath\">$_aname</a></td></tr>$nl" done @@ -1853,8 +1853,40 @@ # GF_ACTION="?grp+$1" edittable "$formdir/grp.def" "grp" "$rowid" #2015-0804 GF_STAGE="groupupdate" edittable "$formdir/grp.def" "grp" "$rowid" if [ -z "$STOPCLONEMSG" ]; then - html div 'class="fold"' <<-EOF - `cgi_checkbox clone yes id="clone"`<label + ## Setup migration menu + v="" + for i in $S4WORLDLIST; do + _aname=${i%:*}; _apath=${i##*:} + conf=`echo $_apath | sed -e 's/-world-/-config-/;s/\..*$/.sh/'` + if [ x"$myname" != x"$_apath" ]; then + v=${v}"<option value=\"$conf\">$_aname</option>$nl" + fi + done + if [ -n "$S4MASTERDB" ]; then + v=${v}"<option value=\"s4-config.sh\">Base</option>$nl" + fi + err v=$v + if [ -n "$v" ]; then + migrate=$(cat<<-EOF + `cgi_radio grpaction migrate id="migrate"`<label + for="migrate">別Worldへ移住</label> + <div> + <form action="?migrategrp"> + <p>移住先:<select name="migrateto">$nl$v$nl</select></p> + <p>グループや掲示板のURLが変わります。 + 外部からリンクしている場合は飛べなくなります。</p> + <p><label>`cgi_checkbox emichk yes`確認</label></p> + `cgi_hidden stage migrategrp` + `cgi_hidden rowid $rowid` + `cgi_submit OK` + `cgi_reset Reset` + </form> + </div> + EOF + ) + fi + html div 'class="foldtabs"' <<-EOF + `cgi_radio grpaction clone id="clone"`<label for="clone">同一メンバーで別グループを作成する</label> <div> <p>構成メンバーが同じ新規グループを作成します。</p> @@ -1869,9 +1901,53 @@ <p>ボタンを押すと即作成します。不要な場合はグループ編集で 削除してください。</p> </div> + $migrate + `cgi_radio grpaction close id="x"`<label for="x" accesskey="x">×</label> + <div style="height: 5em; background: transparent;"></div> EOF fi } +migrategrp() { + rowid=`getpar rowid` + rowid=${rowid%%[!0-9]*} + grp=`getgroupbyid $rowid` + if ! isgrpowner "$user" "$grp"; then + echo "<p><a href=\"?grp+$rowid\">`echo "$grp"|htmlescape`</a></p>" + return + fi + if [ x`getpar emichk` != x"yes" ]; then + echo "移住確認未チェックなので中止します。" | html p + grp "$rowid" + return + fi + destconf=`getpar migrateto` + err destconf=$destconf + if [ ! -e $destconf ]; then + echo "移住先Worldが認識できないので中止します($destconf)。" | html p + grp "$rowid" + return + fi + if [ -n "$worldconf" ]; then + srcconf=$worldconf + else + srcconf=s4-config.sh + fi + _m4 -D_TITLE_="移住操作" -D_BODYCLASS_="" $layout/html.m4.html + echo "移住操作" | html h1 + echo '<pre>' + # err ./s4-migrate.sh "$srcconf" "$destconf" "$rowid" + . ./s4-migrate.sh "$srcconf" "$destconf" "$rowid" + rc=$? + echo "</pre>" + if [ $rc -eq 0 ]; then + echo "World [$world] への移住完了。" | html p + echo "<p><a href=\"$dsturl?grp+$destrowid\">移住先</a></p>" + else + echo "移住失敗" | html p + echo "移動先に重複がないか確認して下さい。" | html p + fi + return +} mems() { _m4 -D_TITLE_="参加者一覧" -D_BODYCLASS_=listmember $layout/html.m4.html kwd=`getpar kwd`
--- a/scripts/s4-sns.case Sun Jun 07 06:15:13 2020 +0900 +++ b/scripts/s4-sns.case Sun Jun 07 19:27:46 2020 +0900 @@ -19,7 +19,7 @@ showattc "$@" exit 0 # Do not output further chunks ;; - invite|groupman|userconf|groupconf|mems|grps|grp|groupupdate|groupclone|grpaction|joingrpadmit|commission|editheading|editart|showattc|send2mem|mvart) + invite|groupman|userconf|groupconf|mems|grps|grp|groupupdate|groupclone|grpaction|joingrpadmit|commission|editheading|editart|showattc|send2mem|mvart|migrategrp) contenttype; echo [ -n "$1" ] && shift $stage "$@"