collection_select.htm
5.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<!--{template common/header}-->
<h3 class="flb">
<em>{lang collection}</em>
<span><a href="javascript:;" onclick="hideWindow('$_GET['handlekey']');" class="flbc" title="{lang close}">{lang close}</a></span>
</h3>
<script>
var remaincreateable = $reamincreatenum;
var titlelimit = '$titlelimit';
var requirecreate = false;
var createnow = false;
var reasonlimit = '$reasonlimit';
function succeedhandle_createcollection(url, msg, collectiondata) {
$("createbutton").disabled = false;
if(collectiondata['ctid']) {
$("selectCollection").options[$("selectCollection").length] = new Option($("newcollection").value, collectiondata['ctid'], true, true);
$("collectionlist").style.display='';
remaincreateable--;
if(remaincreateable <= 0) {
$("allowcreate").style.display='none';
} else {
$("reamincreatenum").innerHTML = remaincreateable;
}
display('createcollection');
$("submitnewtitle").value = $("newcollection").value = '';
}
$("nocreate").innerHTML = '';
if(requirecreate == true) {
$("createRemainTips").style.display='';
$("createbutton").style.display='';
$("newcollection").style.width='';
requirecreate = false;
if(createnow == true) {
setTimeout('$("btn_submitaddthread").click();', 101);
}
createnow = false;
}
}
function ajaxcreatecollection() {
if(!$("newcollection").value) {
showError('{lang collection_fill_entire}');
return false;
}
if(mb_strlen($("newcollection").value) > titlelimit) {
showError({lang collection_title_exceed});
return false;
}
$("createbutton").disabled = true;
$("submitnewtitle").value = $("newcollection").value;
ajaxpost('fastcreateform', 'fastcreatereturn', 'fastcreatereturn', 'onerror');
}
function checkreasonlen() {
if(mb_strlen($("formreason").value) > reasonlimit) {
showError({lang collection_reason_exceed});
return false;
}
if(requirecreate == true) {
createnow = true;
ajaxcreatecollection();
return false;
} else {
$("createRemainTips").style.display='';
$("createbutton").style.display='';
$("newcollection").style.width='';
}
return true;
}
</script>
<form action="forum.php?mod=collection&action=edit&op=addthread" method="post" onsubmit="update_collection();ajaxpost(this.id, 'form_addcollectionthread');" id="form_addcollectionthread" name="form_addcollectionthread">
<div class="c">
<div id="collectionlist" {if $reamincreatenum > 0 && count($allowcollections) <= 0}style="display:none;"{/if}>
<p>{lang collection_select}</p>
<select name="ctid" id="selectCollection" style="width: 280px;">
<!--{loop $collections $collection}-->
<!--{if !in_array($collection['ctid'], $tidcollections)}-->
<option value="$collection['ctid']">$collection['name']</option>
<!--{/if}-->
<!--{/loop}-->
</select>
</div>
<div id="allowcreate" {if $reamincreatenum <= 0}style="display:none;"{/if}>
<span id="nocreate"><!--{if !$collections}-->{lang collection_select_nocollection}<!--{/if}--></span>
<div class="mtm ntc_l">{lang collection_select_remain} <a href="javascript:;" onclick="display('createcollection');if($('createcollection').style.display!='none') {$('newcollection').focus();}" class="xi2" id="createRemainTips">{lang collection_create}</a></div>
</div>
<div id="createcollection" class="ptm vm" style="display:none">
{lang collection_title} <input type="text" value="" id="newcollection" class="px" /> <button type="button" id="createbutton" name="createbutton" onclick="javascript:ajaxcreatecollection();" class="pn pnc"><span>{lang collection_create}</span></button>
</div>
<div class="ptm">
<p class="pbn">{lang collection_addreason}</p>
<textarea name="reason" id="formreason" cols="50" rows="2" class="pt"></textarea>
</div>
</div>
<div class="o pns">
<a href="forum.php?mod=collection&op=my" target="_blank" class="z xi2">{lang collection_view_mine}</a>
<!--{if $tid}-->
<input type="hidden" name="tids[]" value="$tid">
<!--{elseif is_array($_GET['tids'])}-->
<!--{loop $_GET['tids'] $tid}-->
<input type="hidden" name="tids[]" value="$tid">
<!--{/if}-->
<!--{/if}-->
<input type="hidden" name="inajax" value="1">
<input type="hidden" name="handlekey" value="$_GET['handlekey']">
<input type="hidden" name="formhash" id="formhash" value="{FORMHASH}" />
<input type="hidden" name="addthread" id="addthread" value="1" />
<button type="submit" name="submitaddthread" id="btn_submitaddthread" onclick="return checkreasonlen();" class="pn pnc"><span>{lang collection_addbtn}</span></button>
</div>
</form>
<div style="display:none;">
<form action="forum.php?mod=collection&action=edit&op=add" method="post" id="fastcreateform">
<input type="hidden" name="formhash" id="formhash" value="{FORMHASH}" />
<input type="hidden" name="collectionsubmit" value="1" />
<input type="hidden" name="submitcollection" value="1" />
<input type="hidden" name="title" id="submitnewtitle" value="" />
</form>
</div>
<span id="fastcreatereturn"></span>
<!--{if $reamincreatenum > 0 && count($allowcollections) <= 0}-->
<script>
var random = <!--{echo TIMESTAMP}-->;
requirecreate = true;
$("createRemainTips").style.display='none';
$("createbutton").style.display='none';
$("newcollection").style.width='204px';
display('createcollection');
</script>
<!--{/if}-->
<!--{template common/footer}-->