aboutsummaryrefslogtreecommitdiffstats
path: root/view
diff options
context:
space:
mode:
Diffstat (limited to 'view')
-rw-r--r--[-rwxr-xr-x]view/tpl/field_checkbox.tpl22
-rw-r--r--view/tpl/field_duration.qmc.tpl87
-rw-r--r--[-rwxr-xr-x]view/tpl/field_input.tpl18
-rw-r--r--[-rwxr-xr-x]view/tpl/field_select.tpl16
4 files changed, 139 insertions, 4 deletions
diff --git a/view/tpl/field_checkbox.tpl b/view/tpl/field_checkbox.tpl
index f779f937c..b1665f75f 100755..100644
--- a/view/tpl/field_checkbox.tpl
+++ b/view/tpl/field_checkbox.tpl
@@ -1,5 +1,25 @@
<div id="{{$field.0}}_container" class="clearfix form-group checkbox">
- <label for="id_{{$field.0}}">{{$field.1}}</label>
+ <label for="id_{{$field.0}}">{{$field.1}}{{if $field.6}}<sup class="required zuiqmid"> {{$field.6}}</sup>{{/if}}</label>
<div class="float-right"><input type="checkbox" name='{{$field.0}}' id='id_{{$field.0}}' value="1" {{if $field.2}}checked="checked"{{/if}} {{if $field.5}}{{$field.5}}{{/if}} /><label class="switchlabel" for='id_{{$field.0}}'> <span class="onoffswitch-inner" data-on='{{if $field.4}}{{$field.4.1}}{{/if}}' data-off='{{if $field.4}}{{$field.4.0}}{{/if}}'></span><span class="onoffswitch-switch"></span></label></div>
<small class="form-text text-muted">{{$field.3}}</small>
</div>
+{{*
+ COMMENTS for this template:
+ @author hilmar runge, 2020.01
+ $field array index:
+ .0 field name: name=... for input, id=id_... for input, id=label_... for label, id=help_... for small text
+ .1 label text
+ .2 checked
+ .3 form text
+ .4 on/off value:
+ .4.0 off
+ .4.1 on
+ .5 additional operands for html input statement
+ .6 label text addition, used for qmc
+ css classes used:
+ .clearfix, .form_group, .checkbox
+ .floatright
+ .switchlabel, .onoffswitch-switch
+ .required, .code
+ .form-control, .form-text, .text-muted
+*}}
diff --git a/view/tpl/field_duration.qmc.tpl b/view/tpl/field_duration.qmc.tpl
new file mode 100644
index 000000000..5ef11a6b9
--- /dev/null
+++ b/view/tpl/field_duration.qmc.tpl
@@ -0,0 +1,87 @@
+{{if $wrapper!="no"}}<div id="{{$qmc}}{{$field.name}}_wrapper" class="form-group">{{/if}}
+
+<label for="{{$qmc}}{{$field.name}}fs">{{$label}}
+ {{if $qmcid}}<sup class="zuiqmid required">{{$qmcid}}</sup>{{/if}}
+</label>
+<fieldset name="{{$qmc}}{{$field.name}}fs" id="id_{{$qmc}}{{$field.name}}_fs" title="{{$field.title}}">
+
+<input id="{{$qmc}}{{$field.name}}n"
+ name="{{$qmc}}{{$field.name}}n"
+ class="inline-block mr-1 text-center" style="width: 5rem;"
+ type="number"
+{{if $field.min}} min="{{$field.min}}"{{/if}}
+{{if $field.max}} max="{{$field.max}}"{{/if}}
+ size="{{$field.size}}"
+ value="{{$field.value}}"
+ title="{{$field.title}}">
+
+{{foreach $rabot as $k=>$v}}
+ <input id="{{$qmc}}{{$field.name}}{{$k}}" name="{{$qmc}}{{$field.name}}"
+ type="radio" value="{{$k}}" {{if $field.default==$k}} checked="checked"{{/if}}>
+ <label for="{{$qmc}}{{$field.name}}{{$k}}">{{$v}}</label>
+{{/foreach}}
+
+</fieldset>
+
+<span id="{{$qmc}}{{$field.name}}_help" class="form-text text-muted">{{$help}}</span>
+
+{{if $wrapper!="no"}}</div>{{/if}}
+
+{{*
+ * Template field_duration.qmc.tpl
+ * **********************************
+ * Hilmar Runge, 2020.02
+ * The template generates one input field for numeric values and a radio button group, where one
+ * (and only one or no) selection can be active. The primary intented use is for entering time/date
+ * data in the form of amount (numeric) and the units (ie hours, days etc).
+ * Instead of using positional array parameters, keyed (named) parameters are treated. Imo, named parameters
+ * are easier to apply, the position does not matter and if one is not wanted or required, only omit it.
+ *
+ * The parameters in this template are:
+ * ************************************
+ * label A label for the whole. Optional.
+ * help An optional explanation text.
+ * qmc Optional a qualified message component prefix, best use case is 3 letters lowercase and depends
+ * on the module or component used in the system. Part of id's and names in html and css.
+ * qmcid The qmc message id. Optional. Should be qmc+4digits+1charsufffix (8 chars uppercase).
+ * field keyed array parameters:
+ * name The (unique) name of the elements also used for html ids,
+ * will be suffixed by 'n' for the numeric input and 'u' for the units
+ * title The title of the element
+ * legend a headline for the radio buttons (optional)
+ * rabot the keyed array of radio buttons, where:
+ * k the key becomes the submitted value
+ * v the string value is the label text for the radio button.
+ *
+ * Example to apply in php like:
+ * *****************************
+ $testcase = replace_macros(get_markup_template('field_radio_group.qmc.tpl'),
+ array(
+ 'label' => t('Exiration duration',
+ 'qmc' => 'zai', // not required
+ 'qmcid' => 'ZAI0000I', // not required
+ 'wrapper' => 'no', // when no wrapper around is desired
+ 'field' => // fieldset properties
+ array(
+ 'name' => 'due',
+ 'min' => "1", // the minimum value for the numeric input
+ 'max' => "99", // the maximum value for the numeric input
+ 'size' => "2", // the max digits for the numeric input
+ 'title' => 'time/date unit',
+ 'default' => 'd' // say 'default' => '' if none defaults (or omit)
+ ),
+ 'rabot' => // the radio buttons
+ array(
+ 'i' => 'Minute(s)',
+ 'h' => 'Hour(s)' ,
+ 'd' => 'Day(s)' ,
+ 'w' => 'Week(s)' ,
+ 'm' => 'Month(s)' ,
+ 'y' => 'Year(s)'
+ )
+ )
+ );
+ *
+ *}}
+
+
diff --git a/view/tpl/field_input.tpl b/view/tpl/field_input.tpl
index 65a837e5f..53139a0e7 100755..100644
--- a/view/tpl/field_input.tpl
+++ b/view/tpl/field_input.tpl
@@ -1,5 +1,19 @@
<div id="id_{{$field.0}}_wrapper" class="form-group">
- <label for="id_{{$field.0}}" id="label_{{$field.0}}">{{$field.1}}{{if $field.4}}<span class="required"> {{$field.4}}</span>{{/if}}</label>
+ <label for="id_{{$field.0}}" id="label_{{$field.0}}">{{$field.1}}{{if $field.4}}<sup class="required zuiqmid"> {{$field.4}}</sup>{{/if}}</label>
<input class="form-control" name="{{$field.0}}" id="id_{{$field.0}}" type="text" value="{{$field.2}}"{{if $field.5}} {{$field.5}}{{/if}}>
- <small id="help_{{$field.0}}" class="form-text text-muted">{{$field.3}}</small>
+ <span id="help_{{$field.0}}" class="form-text text-muted">{{$field.3}}</span>
</div>
+{{*
+ COMMENTS for this template:
+ @author hilmar runge, 2020.01
+ $field array index:
+ .0 field name: name=... for input, id=id_... for input, id=label_... for label, id=help_... for text
+ .1 label text
+ .2 field value
+ .3 help text
+ .4 label text addition, used for qmc
+ .5 additional html attributes
+ css classes used:
+ .required, .code
+ .form-control, .form-text, .text-muted
+*}}
diff --git a/view/tpl/field_select.tpl b/view/tpl/field_select.tpl
index 8c3776841..6c090ceb5 100755..100644
--- a/view/tpl/field_select.tpl
+++ b/view/tpl/field_select.tpl
@@ -1,7 +1,21 @@
<div class="form-group">
- <label for="id_{{$field.0}}">{{$field.1}}</label>
+ <label for="id_{{$field.0}}">{{$field.1}}{{if $field.5}}<sup class="required zuiqmid"> {{$field.5}}</sup>{{/if}}</label>
<select class="form-control" name="{{$field.0}}" id="id_{{$field.0}}">
{{foreach $field.4 as $opt=>$val}}<option value="{{$opt}}" {{if $opt==$field.2}}selected="selected"{{/if}}>{{$val}}</option>{{/foreach}}
</select>
<small class="form-text text-muted">{{$field.3}}</small >
</div>
+{{*
+ COMMENTS for this template:
+ @author hilmar runge, 2020.01
+ $field array index:
+ .0 field name: name=... for input, id=id_... for input, id=label_... for label, id=help_... for small text
+ .1 label text
+ .2 selected field
+ .3 form text
+ .4 option value(s)
+ .5 label text addition, used for qmc
+ css classes used:
+ .required, .code
+ .form-group, .form-control, .form-text, .text-muted
+*}}