Article html
Jump to navigation
Jump to search
(Admin moved page Form:Article html to Form:Article previous html) Tag: New redirect |
(Removed redirect to Form:Article previous html) Tag: Removed redirect |
||
Line 1: | Line 1: | ||
− | # | + | <html> |
+ | <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"> | ||
+ | |||
+ | <!-- | ||
+ | |||
+ | Article_Type | ||
+ | Article_Title | ||
+ | Article_Authors | ||
+ | Article_Image | ||
+ | Article_Day | ||
+ | Article_Month | ||
+ | Article_Year | ||
+ | |||
+ | |||
+ | <!--------------------------Type--------------------------> | ||
+ | |||
+ | <div class="ci_form_section"> | ||
+ | <span class="ci_form_section_label"> | ||
+ | Type | ||
+ | </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"> | ||
+ | Different kind of articles might be published in different categories. | ||
+ | </span> | ||
+ | |||
+ | </div> | ||
+ | |||
+ | <!--------------------------TITLE--------------------------> | ||
+ | |||
+ | <div class="ci_form_section"> | ||
+ | <span class="ci_form_section_label"> | ||
+ | Title | ||
+ | </span> | ||
+ | |||
+ | <input class="ci_form_input" type="text" placeholder="" name="Form article[Title]" value=""> | ||
+ | |||
+ | <span class="ci_form_section_help"> | ||
+ | </span> | ||
+ | |||
+ | </div> | ||
+ | |||
+ | <!--------------------------Authors--------------------------> | ||
+ | |||
+ | <div class="ci_form_section"> | ||
+ | <span class="ci_form_section_label"> | ||
+ | Authors | ||
+ | </span> | ||
+ | |||
+ | <input class="ci_form_input" type="text" placeholder="" name="Form article[Authors]" value=""> | ||
+ | |||
+ | <span class="ci_form_section_help"> | ||
+ | Please enter first and last name of authors separated by comma. | ||
+ | </span> | ||
+ | |||
+ | </div> | ||
+ | |||
+ | |||
+ | <!--------------------------Day, month, year of pubblication--------------------------> | ||
+ | |||
+ | <div class="ci_form_section"> | ||
+ | <span class="ci_form_section_label"> | ||
+ | Creation/publishing date | ||
+ | </span> | ||
+ | |||
+ | |||
+ | <table><tr><td> | ||
+ | <select class="ci_form_input" name="Form article[day]"> | ||
+ | <option></option> | ||
+ | <option>1</option> | ||
+ | <option>2</option> | ||
+ | <option>3</option> | ||
+ | <option>4</option> | ||
+ | <option>5</option> | ||
+ | <option>6</option> | ||
+ | <option>7</option> | ||
+ | <option>8</option> | ||
+ | <option>9</option> | ||
+ | <option>10</option> | ||
+ | <option>11</option> | ||
+ | <option>12</option> | ||
+ | <option>13</option> | ||
+ | <option>14</option> | ||
+ | <option>15</option> | ||
+ | <option>16</option> | ||
+ | <option>17</option> | ||
+ | <option>18</option> | ||
+ | <option>19</option> | ||
+ | <option>20</option> | ||
+ | <option>21</option> | ||
+ | <option>22</option> | ||
+ | <option>23</option> | ||
+ | <option>24</option> | ||
+ | <option>25</option> | ||
+ | <option>26</option> | ||
+ | <option>27</option> | ||
+ | <option>28</option> | ||
+ | <option>29</option> | ||
+ | <option>30</option> | ||
+ | <option>31</option> | ||
+ | </select> | ||
+ | |||
+ | </td><td> | ||
+ | |||
+ | <select class="ci_form_input" name="Form article[month]"> | ||
+ | <option></option> | ||
+ | <option value="1">January</option> | ||
+ | <option value="2">February</option> | ||
+ | <option value="3">March</option> | ||
+ | <option value="4">April</option> | ||
+ | <option value="5">May</option> | ||
+ | <option value="6">June</option> | ||
+ | <option value="7">July</option> | ||
+ | <option value="8">August</option> | ||
+ | <option value="9">September</option> | ||
+ | <option value="10">October</option> | ||
+ | <option value="11">November</option> | ||
+ | <option value="12">December</option> | ||
+ | </select> | ||
+ | </td><td> | ||
+ | |||
+ | <select class="ci_form_input" name="Form article[year]"> | ||
+ | <option></option> | ||
+ | <option>2020</option> | ||
+ | <option>2019</option> | ||
+ | <option>2018</option> | ||
+ | <option>2017</option> | ||
+ | <option>2016</option> | ||
+ | <option>2015</option> | ||
+ | <option>2014</option> | ||
+ | <option>2013</option> | ||
+ | <option>2012</option> | ||
+ | <option>2011</option> | ||
+ | <option>2010</option> | ||
+ | <option>2009</option> | ||
+ | <option>2008</option> | ||
+ | <option>2007</option> | ||
+ | <option>2006</option> | ||
+ | <option>2005</option> | ||
+ | <option>2004</option> | ||
+ | <option>2003</option> | ||
+ | <option>2002</option> | ||
+ | <option>2001</option> | ||
+ | <option>2000</option> | ||
+ | <option>1999</option> | ||
+ | <option>1998</option> | ||
+ | <option>1997</option> | ||
+ | <option>1996</option> | ||
+ | <option>1995</option> | ||
+ | <option>1994</option> | ||
+ | <option>1993</option> | ||
+ | <option>1992</option> | ||
+ | <option>1991</option> | ||
+ | <option>1990</option> | ||
+ | <option>1989</option> | ||
+ | <option>1988</option> | ||
+ | <option>1987</option> | ||
+ | <option>1986</option> | ||
+ | <option>1985</option> | ||
+ | <option>1984</option> | ||
+ | <option>1983</option> | ||
+ | <option>1982</option> | ||
+ | <option>1981</option> | ||
+ | <option>1980</option> | ||
+ | <option>1979</option> | ||
+ | <option>1978</option> | ||
+ | <option>1977</option> | ||
+ | <option>1976</option> | ||
+ | <option>1975</option> | ||
+ | <option>1974</option> | ||
+ | <option>1973</option> | ||
+ | <option>1972</option> | ||
+ | <option>1971</option> | ||
+ | <option>1970</option> | ||
+ | <option>1969</option> | ||
+ | <option>1968</option> | ||
+ | <option>1967</option> | ||
+ | <option>1966</option> | ||
+ | <option>1965</option> | ||
+ | <option>1964</option> | ||
+ | <option>1963</option> | ||
+ | <option>1962</option> | ||
+ | <option>1961</option> | ||
+ | <option>1960</option> | ||
+ | <option>1959</option> | ||
+ | <option>1958</option> | ||
+ | <option>1957</option> | ||
+ | <option>1956</option> | ||
+ | <option>1955</option> | ||
+ | <option>1954</option> | ||
+ | <option>1953</option> | ||
+ | <option>1952</option> | ||
+ | <option>1951</option> | ||
+ | <option>1950</option> | ||
+ | </select> | ||
+ | </td></tr></table> | ||
+ | |||
+ | |||
+ | <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> | ||
+ | |||
+ | </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> | ||
+ | |||
+ | |||
+ | |||
+ | <!--------------------------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="pf_free_text" value="!free_text!"> | ||
+ | |||
+ | <input class="ci_form_submit" type="submit" value="save"> | ||
+ | </div> | ||
+ | |||
+ | |||
+ | </div> | ||
+ | </form> | ||
+ | </div> | ||
+ | |||
+ | <script> | ||
+ | |||
+ | |||
+ | |||
+ | $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('.ci_form textarea').autosize(); | ||
+ | |||
+ | }); | ||
+ | |||
+ | |||
+ | </script> | ||
+ | |||
+ | |||
+ | </html> |
Revision as of 17:05, 19 August 2020