Article previous html
Jump to navigation
Jump to search
m (Admin moved page Form:Article html to Form:Article previous html) |
|||
(43 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<html> | <html> | ||
− | <div class="ci_form_container" | + | <div class="ci_form_container"> |
+ | |||
+ | <! ***attention! this will be stripped by PageForm | ||
+ | but nonetheless without it will not work ! | ||
+ | --> | ||
+ | <form class= method="post" > | ||
<div class="ci_form" action="" method="post"> | <div class="ci_form" action="" method="post"> | ||
Line 6: | Line 11: | ||
<!-- | <!-- | ||
+ | Article_Type | ||
Article_Title | Article_Title | ||
Article_Authors | Article_Authors | ||
− | |||
Article_Image | Article_Image | ||
Article_Day | Article_Day | ||
Line 14: | Line 19: | ||
Article_Year | Article_Year | ||
− | <!-------------------------- | + | |
+ | <!--------------------------Type--------------------------> | ||
<div class="ci_form_section"> | <div class="ci_form_section"> | ||
<span class="ci_form_section_label"> | <span class="ci_form_section_label"> | ||
− | + | Type | |
</span> | </span> | ||
− | < | + | <!-- |
+ | <option>Scientific</option> | ||
+ | <option>Philosophical-Humanistic</option> | ||
+ | <option>Historical</option> | ||
+ | <option>Literary</option> | ||
+ | <option>Guide</option> | ||
+ | <option>Other</option> | ||
+ | --> | ||
+ | |||
+ | <select class="ci_form_input" name="Form article[Type]"> | ||
+ | <option value="article">article</option> | ||
+ | <option value="post">post</option> | ||
+ | <option value="news">news</option> | ||
+ | </select> | ||
<span class="ci_form_section_help"> | <span class="ci_form_section_help"> | ||
− | + | Different kind of articles might be published in different categories. | |
</span> | </span> | ||
</div> | </div> | ||
− | <!-------------------------- | + | <!--------------------------TITLE--------------------------> |
<div class="ci_form_section"> | <div class="ci_form_section"> | ||
<span class="ci_form_section_label"> | <span class="ci_form_section_label"> | ||
− | + | Title | |
</span> | </span> | ||
− | <input class="ci_form_input" type="text" placeholder="" name="Form article[ | + | <input class="ci_form_input" type="text" placeholder="" name="Form article[Title]" value=""> |
<span class="ci_form_section_help"> | <span class="ci_form_section_help"> | ||
− | |||
</span> | </span> | ||
</div> | </div> | ||
− | <!-------------------------- | + | <!--------------------------Authors--------------------------> |
<div class="ci_form_section"> | <div class="ci_form_section"> | ||
<span class="ci_form_section_label"> | <span class="ci_form_section_label"> | ||
− | + | Authors | |
</span> | </span> | ||
− | < | + | <input class="ci_form_input" type="text" placeholder="" name="Form article[Authors]" value=""> |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<span class="ci_form_section_help"> | <span class="ci_form_section_help"> | ||
− | + | Please enter first and last name of authors separated by comma. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</span> | </span> | ||
Line 85: | Line 82: | ||
<div class="ci_form_section"> | <div class="ci_form_section"> | ||
<span class="ci_form_section_label"> | <span class="ci_form_section_label"> | ||
− | + | Creation/publishing date | |
</span> | </span> | ||
<table><tr><td> | <table><tr><td> | ||
− | <select class=" | + | <select class="ci_form_input" name="Form article[day]"> |
<option></option> | <option></option> | ||
<option>1</option> | <option>1</option> | ||
Line 127: | Line 124: | ||
</td><td> | </td><td> | ||
− | <select class=" | + | <select class="ci_form_input" name="Form article[month]"> |
<option></option> | <option></option> | ||
<option value="1">January</option> | <option value="1">January</option> | ||
Line 144: | Line 141: | ||
</td><td> | </td><td> | ||
− | <select class=" | + | <select class="ci_form_input" name="Form article[year]"> |
<option></option> | <option></option> | ||
<option>2020</option> | <option>2020</option> | ||
Line 222: | Line 219: | ||
<span class="ci_form_section_help"> | <span class="ci_form_section_help"> | ||
+ | The day is optional, and specifically for kind of ‘post” and ‘article” | ||
+ | might be omitted. | ||
+ | </span> | ||
+ | |||
+ | </div> | ||
+ | |||
+ | |||
+ | <!--------------------------EXCERPTS--------------------------> | ||
+ | |||
+ | <div class="ci_form_section"> | ||
+ | <span class="ci_form_section_label"> | ||
+ | Excerpt | ||
+ | </span> | ||
+ | |||
+ | <textarea name="Form article[Excerpt]" class="ci_form_input" style="width:100%" rows="3"> | ||
+ | </textarea> | ||
+ | |||
+ | <span class="ci_form_section_help"> | ||
+ | (Optionally), insert one significant thread representing the article. It might be used as a preview of it. | ||
</span> | </span> | ||
</div> | </div> | ||
+ | |||
+ | |||
+ | <!--------------------------TAGS--------------------------> | ||
+ | |||
+ | <div class="ci_form_section"> | ||
+ | <span class="ci_form_section_label"> | ||
+ | Tags | ||
+ | </span> | ||
+ | |||
+ | <textarea name="Form article[Tags]" class="ci_form_input" style="width:100%" rows="3"> | ||
+ | </textarea> | ||
+ | |||
+ | <span class="ci_form_section_help"> | ||
+ | (Optionally), enter or more tags relevant to this article: they might be used to insert it under one or more | ||
+ | corresponding categories. | ||
+ | </span> | ||
+ | |||
+ | </div> | ||
+ | |||
Line 230: | Line 265: | ||
<div class="ci_form_section_submit"> | <div class="ci_form_section_submit"> | ||
+ | <input type="hidden" name="Form article[Page name]" value=""> | ||
<input type="hidden" name="wpSave" value="Save page"> | <input type="hidden" name="wpSave" value="Save page"> | ||
<input type="hidden" name="pf_free_text" value="!free_text!"> | <input type="hidden" name="pf_free_text" value="!free_text!"> | ||
Line 238: | Line 274: | ||
</div> | </div> | ||
+ | </form> | ||
</div> | </div> | ||
Line 244: | Line 281: | ||
− | $(function(){ | + | $ci(function() { |
+ | |||
+ | $ci('form').submit(function() { | ||
+ | |||
+ | var type = $ci(this).find('[name="Form article[Type]"]').val(); | ||
+ | var title = $ci(this).find('[name="Form article[Title]"]').val(); | ||
+ | var authors = $ci(this).find('[name="Form article[Authors]"]').val(); | ||
+ | var month = $ci(this).find('[name="Form article[month]"]').val(); | ||
+ | var year = $ci(this).find('[name="Form article[year]"]').val(); | ||
+ | var day = $ci(this).find('[name="Form article[day]"]').val(); | ||
+ | |||
+ | var required = { | ||
+ | article: ['Title','Authors'], | ||
+ | post: ['Title','month','year'], | ||
+ | news: ['Title','day', 'month','year'] | ||
+ | } | ||
+ | |||
+ | if(required.hasOwnProperty(type)) { | ||
+ | for(var i in required[type]) { | ||
+ | if(!$ci(this).find('[name="Form article[' + required[type][i] + ']"]').val()) { | ||
+ | alert('Please enter ' + type + ' ' + required[type][i]); | ||
+ | return false; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | var obj_months = { | ||
+ | "1": "January", | ||
+ | "2": "February", | ||
+ | "3": "March", | ||
+ | "4": "April", | ||
+ | "5": "May", | ||
+ | "6": "June", | ||
+ | "7": "July", | ||
+ | "8": "August", | ||
+ | "9": "September", | ||
+ | "10": "October", | ||
+ | "11": "November", | ||
+ | "12": "December" | ||
+ | }; | ||
+ | |||
+ | var pagename; | ||
+ | switch(type) { | ||
+ | case 'article' : | ||
+ | pagename = 'Articles/' + authors + ' - ' + title; | ||
+ | break; | ||
+ | |||
+ | case 'post' : | ||
+ | pagename = 'Posts/'; | ||
+ | // ***attention!! | ||
+ | // see here https://phabricator.wikimedia.org/T12407 | ||
+ | // && will not work correctly ! | ||
+ | // if(month && year) | ||
+ | |||
+ | var month_year = false; | ||
+ | if(month) { | ||
+ | if(year) { | ||
+ | month_year = true; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if(month_year) { | ||
+ | pagename += obj_months[month] + ' ' + year + ' - ' + title; | ||
+ | } else if(year) { | ||
+ | pagename += title + ' (' + year + ')'; | ||
+ | } else { | ||
+ | pagename += title; | ||
+ | } | ||
+ | break; | ||
+ | |||
+ | case 'news' : | ||
+ | pagename = 'News/' + title; | ||
+ | break; | ||
+ | |||
+ | default : | ||
+ | pagename = type + '/' + title; | ||
+ | break; | ||
+ | } | ||
+ | |||
+ | pagename = '</html>{{#ci_userAffiliatedTo:}}<html>/' + pagename; | ||
+ | |||
+ | $ci(this).find('[name="Form article[Page name]"]').val(pagename) | ||
+ | |||
+ | /* | ||
+ | {{{info|page name={{#switch: <Article[Type]> | news = news/<Article[Title]> | post = posts/<Article[Title] | article = articles/<Article[Authors]> - <Article[Title]> | <Article[Type]>/<Article[Authors]> - <Article[Title]> }} }}} | ||
+ | */ | ||
+ | |||
− | + | // return false; | |
+ | }); | ||
− | $('.ci_form textarea').autosize(); | + | $ci('.ci_form textarea').autosize(); |
}); | }); |
Latest revision as of 17:05, 19 August 2020