Merge pull request #193 from WoltLab/template-indentation
[GitHub/WoltLab/com.woltlab.wcf.conversation.git] / templates / conversationAdd.tpl
CommitLineData
9544b6b4
MW
1{include file='header'}
2
c4b952d1 3{include file='shared_formError'}
9544b6b4 4
7d269a63 5<form id="messageContainer" class="jsFormGuard" method="post" action="{if $action == 'edit'}{link controller='ConversationDraftEdit' id=$conversationID}{/link}{else}{link controller='ConversationAdd'}{/link}{/if}">
7cd36813
MW
6 <section class="section">
7 <h2 class="sectionTitle">{lang}wcf.conversation.information{/lang}</h2>
10edf8ce 8
7cd36813
MW
9 <dl{if $errorField == 'subject'} class="formError"{/if}>
10 <dt><label for="subject">{lang}wcf.global.subject{/lang}</label></dt>
11 <dd>
17e16f52 12 <input type="text" id="subject" name="subject" value="{$subject}" required autofocus maxlength="255" class="long">
7cd36813
MW
13 {if $errorField == 'subject'}
14 <small class="innerError">
15 {if $errorType == 'empty'}
16 {lang}wcf.global.form.error.empty{/lang}
17 {elseif $errorType == 'censoredWordsFound'}
18 {lang}wcf.message.error.censoredWordsFound{/lang}
19 {else}
20 {lang}wcf.conversation.subject.error.{@$errorType}{/lang}
21 {/if}
22 </small>
23 {/if}
24 </dd>
25 </dl>
9544b6b4 26
7cd36813
MW
27 {event name='informationFields'}
28 </section>
29
30 <section class="section">
31 <h2 class="sectionTitle">{lang}wcf.conversation.participants{/lang}</h2>
41c23899 32
7cd36813
MW
33 <dl{if $errorField == 'participants'} class="formError"{/if}>
34 <dt><label for="participants">{lang}wcf.conversation.participants{/lang}</label></dt>
35 <dd>
83545ad0 36 <input type="text" id="participants" name="participants" class="long" value="">
7cd36813
MW
37 {if $errorField == 'participants'}
38 <small class="innerError">
39 {if $errorType == 'empty'}
40 {lang}wcf.global.form.error.empty{/lang}
41 {elseif $errorType|is_array}
42 {foreach from=$errorType item='errorData'}
43 {lang}wcf.conversation.participants.error.{@$errorData.type}{/lang}
44 {/foreach}
45 {else}
46 {lang}wcf.conversation.participants.error.{@$errorType}{/lang}
47 {/if}
48 </small>
49 {/if}
50 <small>{lang}wcf.conversation.participants.description{/lang}</small>
51 </dd>
52 </dl>
53
54 {if $__wcf->session->getPermission('user.conversation.canAddInvisibleParticipants')}
d5498d2d
AE
55 <dl{if $errorField == 'invisibleParticipants'} class="formError"{/if}>
56 <dt><label for="invisibleParticipants">{lang}wcf.conversation.invisibleParticipants{/lang}</label></dt>
57 <dd>
83545ad0 58 <input type="text" id="invisibleParticipants" name="invisibleParticipants" class="long" value="">
d5498d2d
AE
59 {if $errorField == 'invisibleParticipants'}
60 <small class="innerError">
61 {if $errorType == 'empty'}
62 {lang}wcf.global.form.error.empty{/lang}
63 {elseif $errorType|is_array}
64 {foreach from=$errorType item='errorData'}
65 {lang}wcf.conversation.participants.error.{@$errorData.type}{/lang}
66 {/foreach}
67 {else}
68 {lang}wcf.conversation.participants.error.{@$errorType}{/lang}
69 {/if}
70 </small>
71 {/if}
72 <small>{lang}wcf.conversation.invisibleParticipants.description{/lang}</small>
73 </dd>
74 </dl>
7cd36813
MW
75 {/if}
76
77 {if $__wcf->session->getPermission('user.conversation.canSetCanInvite')}
d5498d2d
AE
78 <dl>
79 <dt></dt>
80 <dd>
9d33eeda 81 <label><input type="checkbox" name="participantCanInvite" id="participantCanInvite" value="1"{if $participantCanInvite} checked{/if}> {lang}wcf.conversation.participantCanInvite{/lang}</label>
d5498d2d
AE
82 </dd>
83 </dl>
7cd36813
MW
84 {/if}
85
86 {event name='participantFields'}
87 </section>
88
89 <section class="section">
90 <h2 class="sectionTitle">{lang}wcf.conversation.message{/lang}</h2>
91
92 <dl class="wide{if $errorField == 'text'} formError{/if}">
93 <dt><label for="text">{lang}wcf.conversation.message{/lang}</label></dt>
94 <dd>
d12e45c8 95 <textarea id="text" name="text" class="wysiwygTextarea"
eb52f2e5
MW
96 data-autosave="com.woltlab.wcf.conversation.conversationAdd"
97 data-autosave-prompt="true"
98 data-support-mention="true"
dd495bf5 99 >{$text}</textarea>
7cd36813
MW
100 {if $errorField == 'text'}
101 <small class="innerError">
102 {if $errorType == 'empty'}
103 {lang}wcf.global.form.error.empty{/lang}
104 {elseif $errorType == 'tooLong'}
105 {lang}wcf.message.error.tooLong{/lang}
106 {elseif $errorType == 'censoredWordsFound'}
107 {lang}wcf.message.error.censoredWordsFound{/lang}
108 {elseif $errorType == 'disallowedBBCodes'}
109 {lang}wcf.message.error.disallowedBBCodes{/lang}
110 {else}
111 {lang}wcf.conversation.message.error.{@$errorType}{/lang}
112 {/if}
113 </small>
114 {/if}
115 </dd>
116 </dl>
117
118 {event name='messageFields'}
119 </section>
120
121 {include file='messageFormTabs' wysiwygContainerID='text'}
122
123 {event name='sections'}
9544b6b4
MW
124
125 <div class="formSubmit">
d12e45c8 126 <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s">
6404c8be 127 <button type="submit" class="button" name="draft" accesskey="d" value="1">{lang}wcf.conversation.button.saveAsDraft{/lang}</button>
dfecaf59 128 {include file='messageFormPreviewButton' previewMessageObjectType='com.woltlab.wcf.conversation.message' previewMessageObjectID=0}
aa94c120 129 {csrfToken}
3444c09e 130 </div>
9544b6b4
MW
131</form>
132
583b412e 133<script data-relocate="true">
ab10f51f 134 require(['WoltLabSuite/Core/Ui/ItemList/User'], function(UiItemListUser) {
583b412e 135 UiItemListUser.init('participants', {
83545ad0
MW
136 maxItems: {@$__wcf->getSession()->getPermission('user.conversation.maxParticipants')},
137 includeUserGroups: {if $__wcf->getSession()->getPermission('user.conversation.canAddGroupParticipants')}true{else}false{/if},
04684f40 138 restrictUserGroupIDs: [-1, {implode from=$allowedUserGroupIDs item=allowedUserGroupID}{@$allowedUserGroupID}{/implode}],
83545ad0
MW
139 csvPerType: true,
140 callbackSetupValues: function() {
141 return [
142 {implode from=$participantsData item=participant}
f6919951 143 { objectId: {@$participant['objectId']}, value: '{@$participant['value']|encodeJS}', type: '{@$participant['type']}' }
83545ad0
MW
144 {/implode}
145 ];
146 }
583b412e
MW
147 });
148
aa630add
AE
149 {if $__wcf->session->getPermission('user.conversation.canAddInvisibleParticipants')}
150 UiItemListUser.init('invisibleParticipants', {
151 maxItems: {@$__wcf->getSession()->getPermission('user.conversation.maxParticipants')},
152 includeUserGroups: {if $__wcf->getSession()->getPermission('user.conversation.canAddGroupParticipants')}true{else}false{/if},
153 restrictUserGroupIDs: [-1, {implode from=$allowedUserGroupIDs item=allowedUserGroupID}{@$allowedUserGroupID}{/implode}],
154 csvPerType: true,
155 callbackSetupValues: function() {
156 return [
157 {implode from=$invisibleParticipantsData item=participant}
158 { objectId: {@$participant['objectId']}, value: '{@$participant['value']|encodeJS}', type: '{@$participant['type']}' }
159 {/implode}
160 ];
161 }
162 });
163 {/if}
583b412e
MW
164 });
165
166 $(function() {
167 WCF.Message.Submit.registerButton('text', $('#messageContainer > .formSubmit > input[type=submit]'));
168 new WCF.Message.FormGuard();
169
c4b952d1 170 {include file='shared_messageQuoteManager' wysiwygSelector='text' supportPaste=true}
583b412e
MW
171 });
172</script>
9544b6b4 173
c4b952d1 174{include file='shared_wysiwyg'}
583b412e 175{include file='footer'}