Design Pattern "Enable a form to also upload files using the same semantization technique (including semantic titles) as is used for normal pages"
|
Content
Goal
You want to use a single form for creating various generically categorized content, and that content shall be normal pages as well as files.
Implementation
In the form, the designer specifies the name syntax of the pages to be created with the form
{{{info ... |page name=<Academy Component[Content Type]><Academy Component[Academy Component Type]> <unique number;random><Academy Component[File Type]> }}}
Explanations
<Academy Component[Content Type]>
will either be empty orFile:
(see below)<Academy Component[Academy Component Type]>
is a value in accordance with my KIM Practice Pattern "Generic Categories")<Academy Component[File Type]>
will be empty or a file extension such as.png
(see below)
In the form, the user is asked whether the new content is a normal page or a file
!File? |{{{field|Content Type|input type=dropdown|values=File:|show on select=File:=>div_file_type}}}
The dropdown offers two values: empty (which is the default) and File:
. If File:
is selected, then the form displays the <div id="div_file_type">
.
In the form, the user is asked for the file's type/format
<div id="div_file_type"> {|class="formtable" !File Type |{{{field|File Type|input type=dropdown|values=.png,.jpg,.pdf}}} |'''CAUTION''': If you forget to set the file type, you'll need to add it manually by moving the created page! |} </div>
Please note the Caution: remark.
After saving the form→page, the user is asked to upload the file
Upon saving the new page informs the user No file by this name exists, but you can upload it.
.
Clicking upload it
takes the user to the Upload file form.
That form has its Destination filename:
field preset in accordance with the above's
page name=<Academy Component[Content Type]><Academy Component[Academy Component Type]> <unique number;random><Academy Component[File Type]>
E.g. File:SMW Concept 100000.png
IMPORTANT: Before clicking Upload file
you NEED TO CHECK Ignore any warnings
. (If you forget this, you need to click Ignore warning and save file anyway
in the subsequent form)
Summary of the page created
You will end up with a new page called File:SMW Concept 100000.png
containing
{{Academy Component |Academy Component Title=SMW Data Input and Storage: What is it? It's a THIS. |Content Type=File: |File Type=.jpg |Academy Component Type=SMW Concept ... }}