-250 Removals
+109 Additions

Created by:phpboost

1# IF C_QUESTIONS # 1# IF C_QUESTIONS #
2<script> 2<script>
3 <!-- 3<!--
4 # IF C_MODERATION # 4 var questions_number = {QUESTIONS_NUMBER};
5 var FaqQuestions = function(id){
6 this.id = id;
7 this.questions_number = {QUESTIONS_NUMBER};
8 };
9 5
10 FaqQuestions.prototype = { 6 function delete_question(id_question)
11 init_sortable : function() { 7 {
12 jQuery("ul#questions-list").sortable({
13 handle: '.sortable-selector',
14 placeholder: '<div class="dropzone">' + ${escapejs(LangLoader::get_message('position.drop_here', 'common'))} + '</div>'
15 });
16 },
17 serialize_sortable : function() {
18 jQuery('#tree').val(JSON.stringify(this.get_sortable_sequence()));
19 },
20 get_sortable_sequence : function() {
21 var sequence = jQuery("ul#questions-list").sortable("serialize").get();
22 return sequence[0];
23 },
24 change_reposition_pictures : function() {
25 sequence = this.get_sortable_sequence();
26 var length = sequence.length;
27 for(var i = 0; i < length; i++)
28 {
29 if (jQuery('#list-' + sequence[i].id).is(':first-child'))
30 jQuery("#move-up-" + sequence[i].id).hide();
31 else
32 jQuery("#move-up-" + sequence[i].id).show();
33
34 if (jQuery('#list-' + sequence[i].id).is(':last-child'))
35 jQuery("#move-down-" + sequence[i].id).hide();
36 else
37 jQuery("#move-down-" + sequence[i].id).show();
38 }
39 }
40 };
41
42 var FaqQuestion = function(id, faq_questions){
43 this.id = id;
44 this.FaqQuestions = faq_questions;
45
46 if (FaqQuestions.questions_number > 1)
47 FaqQuestions.change_reposition_pictures();
48 };
49
50 FaqQuestion.prototype = {
51 delete : function() {
52 if (confirm(${escapejs(LangLoader::get_message('confirm.delete', 'status-messages-common'))})) 8 if (confirm(${escapejs(LangLoader::get_message('confirm.delete', 'status-messages-common'))}))
53 { 9 {
54 jQuery.ajax({ 10 jQuery.ajax({
55 url: '${relative_url(FaqUrlBuilder::ajax_delete())}', 11 url: '${relative_url(FaqUrlBuilder::ajax_delete())}',
56 type: "post", 12 type: "post",
57 dataType: "json", 13 dataType: "json",
58 data: {'id' : this.id, 'token' : '{TOKEN}'}, 14 data: {'id' : id_question, 'token' : '{TOKEN}'},
59 success: function(returnData) { 15 success: function(returnData) {
60 if(returnData.code > 0) { 16 if(returnData.code > 0) {
61 jQuery("#list-" + returnData.code).remove(); 17 jQuery("#question-" + returnData.code).remove();
62 # IF NOT C_DISPLAY_TYPE_ANSWERS_HIDDEN # 18 # IF NOT C_DISPLAY_TYPE_ANSWERS_HIDDEN #
63 jQuery("#title-question-" + returnData.code).remove(); 19 jQuery("#title-question-" + returnData.code).remove();
64 # ENDIF # 20 # ENDIF #
65 21
66 FaqQuestions.init_sortable(); 22 if (returnData.questions_number == 0) {
67 FaqQuestions.questions_number--;
68
69 FaqQuestions.change_reposition_pictures();
70 if (FaqQuestions.questions_number == 1) {
71 jQuery("#position-update-button").hide();
72 } else if (FaqQuestions.questions_number == 0) {
73 jQuery("#position-update-form").hide();
74 # IF NOT C_DISPLAY_TYPE_ANSWERS_HIDDEN # 23 # IF NOT C_DISPLAY_TYPE_ANSWERS_HIDDEN #
75 jQuery("#questions-titles-list").hide(); 24 jQuery("#questions-titles-list").hide();
76 # ENDIF # 25 # ENDIF #
77 jQuery("#no-item-message").show(); 26 jQuery("#no-item-message").show();
78 } 27 }
79 } 28 }
80 } 29 }
81 }); 30 });
82 } 31 }
83 } 32 }
84 }; 33
85
86 var FaqQuestions = new FaqQuestions('questions-list');
87 jQuery(document).ready(function() {
88 FaqQuestions.init_sortable();
89 jQuery('li.sortable-element').on('mouseout',function(){
90 FaqQuestions.change_reposition_pictures();
91 });
92 });
93 # ELSE #
94 var questions_number = {QUESTIONS_NUMBER};
95
96 function delete_question(id_question)
97 {
98 if (confirm(${escapejs(LangLoader::get_message('confirm.delete', 'status-messages-common'))}))
99 {
100 jQuery.ajax({
101 url: '${relative_url(FaqUrlBuilder::ajax_delete())}',
102 type: "post",
103 dataType: "json",
104 data: {'id' : id_question, 'token' : '{TOKEN}'},
105 success: function(returnData) {
106 if(returnData.code > 0) {
107 jQuery("#question-" + returnData.code).remove();
108 # IF NOT C_DISPLAY_TYPE_ANSWERS_HIDDEN #
109 jQuery("#title-question-" + returnData.code).remove();
110 # ENDIF #
111
112 if (returnData.questions_number == 0) {
113 # IF NOT C_DISPLAY_TYPE_ANSWERS_HIDDEN #
114 jQuery("#questions-titles-list").hide();
115 # ENDIF #
116 jQuery("#no-item-message").show();
117 }
118 }
119 }
120 });
121 }
122 }
123 # ENDIF #
124
125 # IF C_DISPLAY_TYPE_ANSWERS_HIDDEN # 34 # IF C_DISPLAY_TYPE_ANSWERS_HIDDEN #
126 function show_answer(id_question) 35 function show_answer(id_question)
127 { 36 {
128 if (jQuery("#question" + id_question)) { 37 if (jQuery("#question" + id_question)) {
129 if(jQuery("#answer" + id_question).css('display') == 'none') 38 if(jQuery("#answer" + id_question).css('display') == 'none')
130 { 39 {
131 jQuery("#answer" + id_question).fadeIn(); 40 jQuery("#answer" + id_question).fadeIn();
132 jQuery("#question" + id_question).removeClass('fa-caret-right'); 41 jQuery("#question" + id_question).removeClass('fa-caret-right');
133 jQuery("#question" + id_question).addClass('fa-caret-down'); 42 jQuery("#question" + id_question).addClass('fa-caret-down');
134 } 43 }
135 else 44 else
136 { 45 {
137 jQuery("#answer" + id_question).fadeOut(); 46 jQuery("#answer" + id_question).fadeOut();
138 jQuery("#question" + id_question).removeClass('fa-caret-down'); 47 jQuery("#question" + id_question).removeClass('fa-caret-down');
139 jQuery("#question" + id_question).addClass('fa-caret-right'); 48 jQuery("#question" + id_question).addClass('fa-caret-right');
49 }
140 } 50 }
141 } 51 }
142 } 52
143
144 jQuery(document).ready(function() { 53 jQuery(document).ready(function() {
145 var anchor = window.location.hash; 54 var anchor = window.location.hash;
146 var id_question; 55 var id_question;
147 56
148 id_question = anchor.substring(9,anchor.length); 57 id_question = anchor.substring(9,anchor.length);
149 if (anchor.substring(0,9) == "#question" && id_question.match(/^[0-9]+$/)) 58 if (anchor.substring(0,9) == "#question" && id_question.match(/^[0-9]+$/))
150 show_answer(id_question); 59 show_answer(id_question);
151 }); 60 });
152 # ENDIF # 61 # ENDIF #
153 --> 62-->
154</script> 63</script>
155# ENDIF # 64# ENDIF #
156# INCLUDE MSG # 65# INCLUDE MSG #
157<section id="module-faq"> 66<section id="module-faq">
158 <header> 67 <header>
68 <div class="cat-actions">
69 <a href="${relative_url(SyndicationUrlBuilder::rss('faq', ID_CAT))}" aria-label="${LangLoader::get_message('syndication', 'common')}"><i class="fa fa-syndication" aria-hidden="true" title="${LangLoader::get_message('syndication', 'common')}"></i></a>
70 # IF C_CATEGORY #
71 # IF C_DISPLAY_REORDER_LINK #
72 <a href="{U_REORDER_QUESTIONS}" aria-label="{@faq.reorder_questions}"><i class="fa fa-exchange-alt fa-fw" aria-hidden="true" title="{@faq.reorder_questions}"></i></a>
73 # ENDIF #
74 # IF IS_ADMIN #
75 <a href="{U_EDIT_CATEGORY}" aria-label="${LangLoader::get_message('edit', 'common')}"><i class="fa fa-edit fa-fw" aria-hidden="true" title="${LangLoader::get_message('edit', 'common')}"></i></a>
76 # ENDIF #
77 # ENDIF #
78 </div>
159 <h1> 79 <h1>
160 <a href="${relative_url(SyndicationUrlBuilder::rss('faq', ID_CAT))}" title="${LangLoader::get_message('syndication', 'common')}"><i class="fa fa-syndication"></i></a> 80 # IF C_PENDING #
161 # IF C_PENDING #{@faq.pending}# ELSE #{@module_title}# IF NOT C_ROOT_CATEGORY # - {CATEGORY_NAME}# ENDIF ## ENDIF # # IF C_CATEGORY ## IF IS_ADMIN #<a href="{U_EDIT_CATEGORY}" title="${LangLoader::get_message('edit', 'common')}"><i class="fa fa-edit smaller"></i></a># ENDIF ## ENDIF # 81 {@faq.pending}
82 # ELSE #
83 {@module_title}# IF NOT C_ROOT_CATEGORY # - {CATEGORY_NAME}# ENDIF #
84 # ENDIF #
162 </h1> 85 </h1>
163 # IF C_CATEGORY_DESCRIPTION #
164 <div class="cat-description">
165 {CATEGORY_DESCRIPTION}
166 </div>
167 # ENDIF #
168 </header> 86 </header>
169 87 # IF C_CATEGORY_DESCRIPTION #
88 <div class="cat-description">
89 {CATEGORY_DESCRIPTION}
90 </div>
91 # ENDIF #
92
170 # IF C_SUB_CATEGORIES # 93 # IF C_SUB_CATEGORIES #
171 <div class="subcat-container elements-container# IF C_SEVERAL_CATS_COLUMNS # columns-{NUMBER_CATS_COLUMNS}# ENDIF #"> 94 <div class="subcat-container elements-container# IF C_SEVERAL_CATS_COLUMNS # columns-{NUMBER_CATS_COLUMNS}# ENDIF #">
172 # START sub_categories_list # 95 # START sub_categories_list #
173 <div class="subcat-element block"> 96 <div class="subcat-element block">
174 <div class="subcat-content"> 97 <div class="subcat-content">
175 # IF sub_categories_list.C_CATEGORY_IMAGE #<a itemprop="about" href="{sub_categories_list.U_CATEGORY}"><img itemprop="thumbnailUrl" src="{sub_categories_list.CATEGORY_IMAGE}" alt="{sub_categories_list.CATEGORY_NAME}" /></a># ENDIF # 98 # IF sub_categories_list.C_CATEGORY_IMAGE #
176 <br /> 99 <a class="subcat-thumbnail" itemprop="about" href="{sub_categories_list.U_CATEGORY}" title="{sub_categories_list.CATEGORY_NAME}">
177 <a itemprop="about" href="{sub_categories_list.U_CATEGORY}">{sub_categories_list.CATEGORY_NAME}</a> 100 <img itemprop="thumbnailUrl" src="{sub_categories_list.CATEGORY_IMAGE}" alt="{sub_categories_list.CATEGORY_NAME}" />
178 <br /> 101 </a>
179 <span class="small">{sub_categories_list.QUESTIONS_NUMBER} # IF sub_categories_list.C_MORE_THAN_ONE_QUESTION #${TextHelper::lcfirst(LangLoader::get_message('faq.questions', 'common', 'faq'))}# ELSE #${TextHelper::lcfirst(LangLoader::get_message('faq.form.question', 'common', 'faq'))}# ENDIF #</span> 102 # ENDIF #
103 <a class="subcat-title" itemprop="about" href="{sub_categories_list.U_CATEGORY}">{sub_categories_list.CATEGORY_NAME}</a>
104 <span class="subcat-options">{sub_categories_list.QUESTIONS_NUMBER} # IF sub_categories_list.C_MORE_THAN_ONE_QUESTION #${TextHelper::lcfirst(LangLoader::get_message('faq.questions', 'common', 'faq'))}# ELSE #${TextHelper::lcfirst(LangLoader::get_message('faq.form.question', 'common', 'faq'))}# ENDIF #</span>
180 </div> 105 </div>
181 </div> 106 </div>
182 # END sub_categories_list # 107 # END sub_categories_list #
183 <div class="spacer"></div> 108 <div class="spacer"></div>
184 </div> 109 </div>
185 # IF C_SUBCATEGORIES_PAGINATION #<span class="center"># INCLUDE SUBCATEGORIES_PAGINATION #</span># ENDIF # 110 # IF C_SUBCATEGORIES_PAGINATION #<span class="center"># INCLUDE SUBCATEGORIES_PAGINATION #</span># ENDIF #
186 # ELSE # 111 # ELSE #
187 <div class="spacer"></div> 112 <div class="spacer"></div>
188 # ENDIF # 113 # ENDIF #
189 114
190
191 # IF C_QUESTIONS # 115 # IF C_QUESTIONS #
192 # IF C_PENDING # 116 # IF C_PENDING #
193 # IF C_MORE_THAN_ONE_QUESTION # 117 # IF C_MORE_THAN_ONE_QUESTION #
194 # INCLUDE SORT_FORM # 118 # INCLUDE SORT_FORM #
195 <div class="spacer"></div> 119 <div class="spacer"></div>
196 # ENDIF # 120 # ENDIF #
197 # ENDIF # 121 # ENDIF #
198 # IF NOT C_DISPLAY_TYPE_ANSWERS_HIDDEN # 122 # IF NOT C_DISPLAY_TYPE_ANSWERS_HIDDEN #
199 <div id="questions-titles-list"> 123 <div id="questions-titles-list">
200 <ol> 124 <ol>
201 # START questions # 125 # START questions #
202 <li id="title-question-{questions.ID}"# IF questions.C_NEW_CONTENT # class="new-content"# ENDIF #> 126 <li id="title-question-{questions.ID}"# IF questions.C_NEW_CONTENT # class="new-content"# ENDIF #>
203 <a href="#question{questions.ID}">{questions.QUESTION}</a> 127 <a href="#question{questions.ID}">{questions.QUESTION}</a>
204 </li> 128 </li>
205 # END questions # 129 # END questions #
206 </ol> 130 </ol>
207 <hr /> 131 <hr />
208 </div> 132 </div>
209 # ENDIF # 133 # ENDIF #
210 134
211 <div class="content elements-container"> 135 <div class="elements-container">
212 # IF C_MODERATION # 136 # START questions #
213 <form action="{REWRITED_SCRIPT}" method="post" id="position-update-form" onsubmit="FaqQuestions.serialize_sortable();"> 137 <article id="article-faq-{questions.ID}" itemscope="itemscope" itemtype="http://schema.org/CreativeWork" class="article-faq article-several# IF questions.C_NEW_CONTENT # new-content# ENDIF #">
214 <fieldset id="questions-management"> 138 <header class="faq-question-element">
215 <ul id="questions-list" class="sortable-block"> 139 <h3 class="question-title">
216 # START questions # 140 # IF questions.C_ACTION_USER #
217 <li class="sortable-element# IF questions.C_NEW_CONTENT # new-content# ENDIF #" id="list-{questions.ID}" data-id="{questions.ID}"> 141 <span class="actions"><a href="{questions.U_LINK}" aria-label="{questions.L_LINK_QUESTION}"><i class="fa fa-hand-point-right fa-fw" aria-hidden="true" title="{questions.L_LINK_QUESTION}"></i></a></span>
218 <div class="sortable-selector" title="${LangLoader::get_message('position.move', 'common')}"></div> 142 # ELSE #
219 <div class="sortable-title"> 143 <span class="actions actions-menu question-actions" id="question-{questions.ID}-actions">
220 <h3 class="question-title"> 144 <a href="" title="{@faq.actions.menu}" class="actions-title" onclick="open_submenu('question-{questions.ID}-actions', 'opened', 'question-actions');return false;"><i class="fa fa-actions-menu"></i></a>
221 # IF C_DISPLAY_TYPE_ANSWERS_HIDDEN # 145 <ul class="actions-submenu">
222 <a href="" onclick="show_answer({questions.ID});return false;" title="{questions.L_SHOW_ANSWER}"><i id="question{questions.ID}" class="fa fa-caret-right question-anchor"></i></a> 146 <li class="action"><a href="{questions.U_LINK}" title="{questions.L_LINK_QUESTION}" onclick="copy_to_clipboard('{questions.U_ABSOLUTE_LINK}');"><i class="fa fa-hand-point-right fa-fw" aria-hidden="true"></i> {questions.L_LINK_QUESTION}</a></li>
223 <a href="" onclick="show_answer({questions.ID});return false;" title="{questions.QUESTION}">{questions.QUESTION}</a> 147 # IF questions.C_EDIT #
224 # ELSE # 148 <li class="action"><a href="{questions.U_EDIT}" title="${LangLoader::get_message('edit', 'common')}"><i class="fa fa-edit fa-fw" aria-hidden="true"></i> ${LangLoader::get_message('edit', 'common')}</a></li>
225 <i id="question{questions.ID}" class="fa fa-caret-right question-anchor"></i> 149 # ENDIF #
226 <span>{questions.QUESTION}</span> 150 # IF questions.C_DELETE #
227 # ENDIF # 151 <li class="action"><a href="" onclick="delete_question({questions.ID});return false;" title="${LangLoader::get_message('delete', 'common')}"><i class="fa fa-delete" aria-hidden="true"></i> ${LangLoader::get_message('delete', 'common')}</a></li>
228 </h3> 152 # ENDIF #
229 <div class="sortable-actions"> 153 </ul>
230 # IF C_MORE_THAN_ONE_QUESTION #
231 <a href="" title="${LangLoader::get_message('position.move_up', 'common')}" id="move-up-{questions.ID}" onclick="return false;"><i class="fa fa-arrow-up"></i></a>
232 <a href="" title="${LangLoader::get_message('position.move_down', 'common')}" id="move-down-{questions.ID}" onclick="return false;"><i class="fa fa-arrow-down"></i></a>
233 # ENDIF #
234 <a href="{questions.U_EDIT}" title="${LangLoader::get_message('edit', 'common')}"><i class="fa fa-edit"></i></a>
235 <a href="" onclick="return false;" title="${LangLoader::get_message('delete', 'common')}" id="delete-{questions.ID}"><i class="fa fa-delete"></i></a>
236 </div>
237 <div id="answer{questions.ID}" class="faq-answer-container"# IF C_DISPLAY_TYPE_ANSWERS_HIDDEN # style="display: none;"# ENDIF #>
238 <div itemprop="text">{questions.ANSWER}</div>
239 </div>
240 </div>
241 <div class="spacer"></div>
242 <script>
243 <!--
244 jQuery(document).ready(function() {
245 var faq_question = new FaqQuestion({questions.ID}, FaqQuestions);
246
247 jQuery('#delete-{questions.ID}').on('click',function(){
248 faq_question.delete();
249 });
250
251 if (FaqQuestions.questions_number > 1) {
252 jQuery('#move-up-{questions.ID}').on('click',function(){
253 var li = jQuery(this).closest('li');
254 li.insertBefore( li.prev() );
255 FaqQuestions.change_reposition_pictures();
256 });
257 jQuery('#move-down-{questions.ID}').on('click',function(){
258 var li = jQuery(this).closest('li');
259 li.insertAfter( li.next() );
260 FaqQuestions.change_reposition_pictures();
261 });
262 }
263 });
264 -->
265 </script>
266 </li>
267 # END questions #
268 </ul>
269 </fieldset>
270 # IF C_MORE_THAN_ONE_QUESTION #
271 <fieldset class="fieldset-submit" id="position-update-button">
272 <button type="submit" name="submit" value="true" class="submit">${LangLoader::get_message('position.update', 'common')}</button>
273 <input type="hidden" name="token" value="{TOKEN}">
274 <input type="hidden" name="tree" id="tree" value="">
275 </fieldset>
276 # ENDIF #
277 </form>
278 # ELSE #
279 # START questions #
280 <article id="article-faq-{questions.ID}" itemscope="itemscope" itemtype="http://schema.org/CreativeWork" class="article-faq article-several# IF questions.C_NEW_CONTENT # new-content# ENDIF #">
281 <header class="faq-question-element">
282 <h3 class="question-title">
283 # IF C_DISPLAY_TYPE_ANSWERS_HIDDEN #
284 <a href="" onclick="show_answer({questions.ID});return false;" title="{questions.L_SHOW_ANSWER}"><i id="question{questions.ID}" class="fa fa-caret-right question-anchor"></i></a>
285 <a href="" onclick="show_answer({questions.ID});return false;" title="{questions.QUESTION}"><span itemprop="name">{questions.QUESTION}</span></a>
286 # ELSE #
287 <i id="question{questions.ID}" class="fa fa-caret-right question-anchor"></i>
288 <span itemprop="name">{questions.QUESTION}</span>
289 # ENDIF #
290 </h3>
291
292 <span class="actions">
293 <a href="{questions.U_LINK}" title="{questions.L_LINK_QUESTION}"><i class="fa fa-flag"></i></a>
294 # IF questions.C_EDIT #
295 <a href="{questions.U_EDIT}" title="${LangLoader::get_message('edit', 'common')}"><i class="fa fa-edit"></i></a>
296 # ENDIF #
297 # IF questions.C_DELETE #
298 <a href="" onclick="delete_question({questions.ID});return false;" title="${LangLoader::get_message('delete', 'common')}"><i class="fa fa-delete"></i></a>
299 # ENDIF #
300 </span> 154 </span>
301 155 # ENDIF #
302 <meta itemprop="url" content="{questions.U_LINK}"> 156
303 </header> 157 # IF C_DISPLAY_TYPE_ANSWERS_HIDDEN #
304 158 <a href="" onclick="show_answer({questions.ID});return false;" title="{questions.L_SHOW_ANSWER}"><i id="question{questions.ID}" class="fa fa-caret-right fa-fw question-anchor"></i></a>
305 <div class="content"> 159 <a href="" onclick="show_answer({questions.ID});return false;" title="{questions.QUESTION}"><span itemprop="name">{questions.QUESTION}</span></a>
306 <div id="answer{questions.ID}" class="faq-answer-container"# IF C_DISPLAY_TYPE_ANSWERS_HIDDEN # style="display: none;"# ENDIF #> 160 # ELSE #
307 <div itemprop="text">{questions.ANSWER}</div> 161 <i id="question{questions.ID}" class="fa fa-caret-right fa-fw question-anchor"></i>
308 </div> 162 <span itemprop="name">{questions.QUESTION}</span>
309 </div> 163 # ENDIF #
310 164 </h3>
311 <footer></footer> 165 <meta itemprop="url" content="{questions.U_LINK}">
312 </article> 166 </header>
313 # END questions # 167
314 # ENDIF # 168 <div id="answer{questions.ID}" class="content faq-answer-container"# IF C_DISPLAY_TYPE_ANSWERS_HIDDEN # style="display: none;"# ENDIF #>
169 <div itemprop="text">{questions.ANSWER}</div>
170 </div>
171
172 <footer></footer>
173 </article>
174 # END questions #
315 </div> 175 </div>
316 # ENDIF # 176 # ENDIF #
317 # IF NOT C_HIDE_NO_ITEM_MESSAGE # 177 # IF NOT C_HIDE_NO_ITEM_MESSAGE #
318 <div id="no-item-message"# IF C_QUESTIONS # style="display: none;"# ENDIF #> 178 <div id="no-item-message"# IF C_QUESTIONS # style="display: none;"# ENDIF #>
319 <div class="center"> 179 <div class="center">
320 ${LangLoader::get_message('no_item_now', 'common')} 180 ${LangLoader::get_message('no_item_now', 'common')}
321 </div> 181 </div>
322 </div> 182 </div>
323 # ENDIF # 183 # ENDIF #
324 184
325 <footer></footer> 185 <footer></footer>
326</section> 186</section>
Editor
Original Text
Changed Text
Recommended videos