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 diff
1.1 --- a/s4-funcs.sh Sun Jun 07 06:15:13 2020 +0900 1.2 +++ b/s4-funcs.sh Sun Jun 07 19:27:46 2020 +0900 1.3 @@ -94,7 +94,7 @@ 1.4 . ./s4-world.sh 2>> tmp/debug.out 1.5 fi 1.6 v="" 1.7 -for i in $S4WORLDS; do 1.8 +for i in $S4WORLDLIST; do 1.9 _aname=${i%:*}; _apath=${i##*:} 1.10 v=${v}"<tr><td>⇒ <a href=\"$_apath\">$_aname</a></td></tr>$nl" 1.11 done 1.12 @@ -1853,8 +1853,40 @@ 1.13 # GF_ACTION="?grp+$1" edittable "$formdir/grp.def" "grp" "$rowid" #2015-0804 1.14 GF_STAGE="groupupdate" edittable "$formdir/grp.def" "grp" "$rowid" 1.15 if [ -z "$STOPCLONEMSG" ]; then 1.16 - html div 'class="fold"' <<-EOF 1.17 - `cgi_checkbox clone yes id="clone"`<label 1.18 + ## Setup migration menu 1.19 + v="" 1.20 + for i in $S4WORLDLIST; do 1.21 + _aname=${i%:*}; _apath=${i##*:} 1.22 + conf=`echo $_apath | sed -e 's/-world-/-config-/;s/\..*$/.sh/'` 1.23 + if [ x"$myname" != x"$_apath" ]; then 1.24 + v=${v}"<option value=\"$conf\">$_aname</option>$nl" 1.25 + fi 1.26 + done 1.27 + if [ -n "$S4MASTERDB" ]; then 1.28 + v=${v}"<option value=\"s4-config.sh\">Base</option>$nl" 1.29 + fi 1.30 + err v=$v 1.31 + if [ -n "$v" ]; then 1.32 + migrate=$(cat<<-EOF 1.33 + `cgi_radio grpaction migrate id="migrate"`<label 1.34 + for="migrate">別Worldへ移住</label> 1.35 + <div> 1.36 + <form action="?migrategrp"> 1.37 + <p>移住先:<select name="migrateto">$nl$v$nl</select></p> 1.38 + <p>グループや掲示板のURLが変わります。 1.39 + 外部からリンクしている場合は飛べなくなります。</p> 1.40 + <p><label>`cgi_checkbox emichk yes`確認</label></p> 1.41 + `cgi_hidden stage migrategrp` 1.42 + `cgi_hidden rowid $rowid` 1.43 + `cgi_submit OK` 1.44 + `cgi_reset Reset` 1.45 + </form> 1.46 + </div> 1.47 + EOF 1.48 + ) 1.49 + fi 1.50 + html div 'class="foldtabs"' <<-EOF 1.51 + `cgi_radio grpaction clone id="clone"`<label 1.52 for="clone">同一メンバーで別グループを作成する</label> 1.53 <div> 1.54 <p>構成メンバーが同じ新規グループを作成します。</p> 1.55 @@ -1869,9 +1901,53 @@ 1.56 <p>ボタンを押すと即作成します。不要な場合はグループ編集で 1.57 削除してください。</p> 1.58 </div> 1.59 + $migrate 1.60 + `cgi_radio grpaction close id="x"`<label for="x" accesskey="x">×</label> 1.61 + <div style="height: 5em; background: transparent;"></div> 1.62 EOF 1.63 fi 1.64 } 1.65 +migrategrp() { 1.66 + rowid=`getpar rowid` 1.67 + rowid=${rowid%%[!0-9]*} 1.68 + grp=`getgroupbyid $rowid` 1.69 + if ! isgrpowner "$user" "$grp"; then 1.70 + echo "<p><a href=\"?grp+$rowid\">`echo "$grp"|htmlescape`</a></p>" 1.71 + return 1.72 + fi 1.73 + if [ x`getpar emichk` != x"yes" ]; then 1.74 + echo "移住確認未チェックなので中止します。" | html p 1.75 + grp "$rowid" 1.76 + return 1.77 + fi 1.78 + destconf=`getpar migrateto` 1.79 + err destconf=$destconf 1.80 + if [ ! -e $destconf ]; then 1.81 + echo "移住先Worldが認識できないので中止します($destconf)。" | html p 1.82 + grp "$rowid" 1.83 + return 1.84 + fi 1.85 + if [ -n "$worldconf" ]; then 1.86 + srcconf=$worldconf 1.87 + else 1.88 + srcconf=s4-config.sh 1.89 + fi 1.90 + _m4 -D_TITLE_="移住操作" -D_BODYCLASS_="" $layout/html.m4.html 1.91 + echo "移住操作" | html h1 1.92 + echo '<pre>' 1.93 + # err ./s4-migrate.sh "$srcconf" "$destconf" "$rowid" 1.94 + . ./s4-migrate.sh "$srcconf" "$destconf" "$rowid" 1.95 + rc=$? 1.96 + echo "</pre>" 1.97 + if [ $rc -eq 0 ]; then 1.98 + echo "World [$world] への移住完了。" | html p 1.99 + echo "<p><a href=\"$dsturl?grp+$destrowid\">移住先</a></p>" 1.100 + else 1.101 + echo "移住失敗" | html p 1.102 + echo "移動先に重複がないか確認して下さい。" | html p 1.103 + fi 1.104 + return 1.105 +} 1.106 mems() { 1.107 _m4 -D_TITLE_="参加者一覧" -D_BODYCLASS_=listmember $layout/html.m4.html 1.108 kwd=`getpar kwd`
2.1 --- a/scripts/s4-sns.case Sun Jun 07 06:15:13 2020 +0900 2.2 +++ b/scripts/s4-sns.case Sun Jun 07 19:27:46 2020 +0900 2.3 @@ -19,7 +19,7 @@ 2.4 showattc "$@" 2.5 exit 0 # Do not output further chunks 2.6 ;; 2.7 - invite|groupman|userconf|groupconf|mems|grps|grp|groupupdate|groupclone|grpaction|joingrpadmit|commission|editheading|editart|showattc|send2mem|mvart) 2.8 + invite|groupman|userconf|groupconf|mems|grps|grp|groupupdate|groupclone|grpaction|joingrpadmit|commission|editheading|editart|showattc|send2mem|mvart|migrategrp) 2.9 contenttype; echo 2.10 [ -n "$1" ] && shift 2.11 $stage "$@"