Design Pattern "Enable a form to also upload files using the same semantization technique (including semantic titles) as is used for normal pages"

From SMW CindyKate by dataspects
Component 492809
Jump to navigation Jump to search
[edit]
Keywords/Contexts

Upload · Semantization

Annotations
{{#compound_query:Component 492809Property "-Has subobject" has a restricted application area and cannot be used as annotation property by a user.UseCaseMotivation;?HasDirection;?IsMotivating;?IsMotivatedBy;?HasReasoning
Property "-Has subobject" has a restricted application area and cannot be used as annotation property by a user.Design Pattern "Enable a form to also upload files using the same semantization technique (including semantic titles) as is used for normal pages";?HasDirection;?IsMotivating;?IsMotivatedBy;?HasReasoning Property "-Has subobject" has a restricted application area and cannot be used as annotation property by a user.Design Pattern "Enable a form to also upload files using the same semantization technique (including semantic titles) as is used for normal pages";?HasDirection;?IsMotivating;?IsMotivatedBy;?HasReasoning
name=MotivationsDeclaredOnThisPageResultItem|link=none}}
Motivations
Lua error in Module:Motivations at line 23: attempt to concatenate field 'hasReasoning' (a nil value).
[edit]

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 or File: (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
  ...
}}