Fixed minor things and added missing file
[vanilla-miry.git] / themes / discussion_form.php
blob760793db6a36f170f35ad8c1d5e0003ec39d0418
1 <?php
2 // Note: This file is included from the library/Vanilla/Vanilla.Control.DiscussionForm.php class.
4 echo '<div id="Form" class="StartDiscussion">
5 <fieldset>
6 <legend>'.$this->Title.'</legend>'
7 .$this->Get_Warnings()
8 .$this->Get_PostBackForm('frmPostDiscussion', 'post', 'post.php')
9 .'<ul>';
10 if ($this->Context->Configuration['USE_CATEGORIES']) {
11 $this->DelegateParameters['CategorySelect'] = &$cs;
12 $this->CallDelegate('DiscussionForm_PreCategoryRender');
13 //CategoryRole addon
14 if (isset($this->cat_filter))
15 $this->cat_filter->hide_categories($cs, $this->Context->Session->User->RoleID);
16 //CategoryRole end
17 $cs->Attributes .= ' id="ddCategories"';
18 echo '<li>
19 <label for="ddCategories">'.$this->Context->GetDefinition('SelectDiscussionCategory').'</label>
20 '.$cs->Get()
21 .'</li>';
22 } else {
23 echo '<input type="hidden" name="CategoryID" value="'.$cs->aOptions[0]['IdValue'].'" />';
25 $this->CallDelegate('DiscussionForm_PreTopicRender');
26 echo '<li>
27 <label for="txtTopic">'.$this->Context->GetDefinition(($Discussion->DiscussionID == 0?'EnterYourDiscussionTopic':'EditYourDiscussionTopic')).'</label>
28 <input id="txtTopic" type="text" name="Name" class="DiscussionBox" maxlength="100" value="'.$Discussion->Name.'" />
29 </li>';
31 if ($this->Context->Configuration['ENABLE_WHISPERS'] && $Discussion->DiscussionID == 0) {
32 echo '<li>
33 <label for="WhisperUsername">'.$this->Context->GetDefinition('WhisperYourCommentsTo').'</label>
34 <input id="WhisperUsername" name="WhisperUsername" type="text" value="'.FormatStringForDisplay($Discussion->WhisperUsername, 0).'" class="Whisper AutoCompleteInput" maxlength="20" />
35 <script type="text/javascript">
36 var WhisperAutoComplete = new AutoComplete("WhisperUsername", false);
37 WhisperAutoComplete.TableID = "WhisperAutoCompleteResults";
38 WhisperAutoComplete.KeywordSourceUrl = "'.$this->Context->Configuration['WEB_ROOT'].'ajax/getusers.php?Search=";
39 </script>
40 </li>
44 $this->CallDelegate('DiscussionForm_PreCommentRender');
45 echo '<li>
46 <label for="CommentBox">
47 <a href="./" id="CommentBoxController" onclick="'
48 ."ToggleCommentBox('".$this->Context->Configuration['WEB_ROOT']."ajax/switch.php', '".$this->Context->GetDefinition('SmallInput')."', '".$this->Context->GetDefinition('BigInput')."', '". $this->Context->Session->GetCsrfValidationKey()."'); return false;".'">'.$this->Context->GetDefinition($this->Context->Session->User->Preference('ShowLargeCommentBox')?'SmallInput':'BigInput').'</a>';
50 $this->CallDelegate('DiscussionForm_PostCommentToggle');
52 echo $this->Context->GetDefinition('EnterYourComments').'
53 </label>
54 <textarea name="Body" class="'
55 .($this->Context->Session->User->Preference('ShowLargeCommentBox') ? 'LargeCommentBox' : 'SmallCommentBox')
56 .'" id="CommentBox" rows="10" cols="85"'.$this->DiscussionFormAttributes.'>'
57 .$Discussion->Comment->Body
58 .'</textarea>
59 </li>'
60 .$this->GetPostFormatting($Discussion->Comment->FormatType)
61 .'</ul>';
63 $this->CallDelegate('DiscussionForm_PreButtonsRender');
65 echo '<div class="Submit">
66 <input type="submit" name="btnSave" value="'.$this->Context->GetDefinition(($Discussion->DiscussionID > 0) ? 'SaveYourChanges' : 'StartYourDiscussion').'" class="Button SubmitButton StartDiscussionButton" onclick="'
67 ."Wait(this, '".$this->Context->GetDefinition('Wait')."');"
68 .'"/>';
69 $this->CallDelegate('DiscussionForm_PostSubmitRender');
70 echo '<a href="'.(!$this->IsPostBack?'javascript:history.back();':'./').'" class="CancelButton">'.$this->Context->GetDefinition('Cancel').'</a>
71 </div>';
73 $this->CallDelegate('DiscussionForm_PostButtonsRender');
75 echo'</form>
76 </fieldset>
77 </div>';