5
This template establishes the common things that every model viewer
8
model - <EBox::Model::DataTable> the model to use its name
9
hasChanged - Boolean indicating whether the model has changed or
11
action - String the action be performed. Only if action is
12
equal to 'view' the whole model viewer will be
13
loaded, any other action just the body will be
14
updated. This behaviour could be enhanced just
15
printing the updated version of needed. *(Optional)*
27
% if ( $action eq 'view' or $action eq 'presetUpdate') {
30
hasChanged => $hasChanged
38
% # Anyway you should call the change menu sub-component to check if
39
% # any change has been done
41
hasChanged => $hasChanged
48
Prints the model viewer. This method must be called by every
49
component which inherits from this one. The body is not displayed
50
if the precondition is accomplished, if not a fail message is
55
model - <EBox::Model::DataTable> the model to view
56
hasChanged - Boolean indicating whether the model has changed or not
67
% if ( $model->precondition() ) {
68
<div id="<% $model->modelName() %>">
77
<% $model->preconditionFailMsg() %>
85
Include everything that a model view should have
89
model - <EBox::Model::DataTable> the model to view
95
<& SELF:headerScriptSection &>
96
<!-- Element to hide the elements while Asynchronous request are -->
97
<!-- working. Find more information at "table-helper.js" -->
98
<div id="<% 'hiddenDiv_' . $model->name() | h %>" class="hidden"></div>
100
% if ($model->help()) {
106
<div id='error_<% $model->modelName() | hu %>'></div>
109
<%method headerScriptSection>
110
<script type="text/javascript" src="/data/js/table-helper.js">
113
<script type="text/javascript" src="/data/js/fileUpload.js">//</script>
120
Set the model viewer body. The message if any is also shown.
124
model - <EBox::Model::DataTable> the model to view
125
onlyBody - boolean indicating if just the body is updated
126
*(Optional)* Default value: false
135
# Get the content from the first called template
136
my $requestCaller = $onlyBody ? 1 : 2;
137
my @childArgs = $m->caller_args($requestCaller);
139
% if ( $model->message() ) {
141
msg => $model->popMessage()
157
title - String the title
174
Show the form to edit the fields from a row
178
modelName - String the model name
179
formData - array containing <EBox::Types::Abstract> which form the
188
<table class="formTable">
190
<& SELF:editRowFields,
191
modelName => $modelName,
192
formData => \@formData
205
Method: editRowFields
207
Show the form to edit the fields from a row
211
modelName - String the model name
212
formData - array containing <EBox::Types::Abstract> which form the
216
<%method editRowFields>
221
% foreach my $type (grep { defined($_->HTMLSetter())} @formData)
225
<% $type->printableName() %>:
231
'tableName' => "$modelName"
241
Show the button to submit the form. It must be overriden. In order
242
to obtain the main arguments used $m->request_args()->{argName}.
251
Change the CSS class from the changes menu in order to advise the
252
user some changes have been made
263
$className = 'changed';
265
$className = 'notChanged';
268
$('changes_menu').className = '<% $className %>';
273
Group: Protected methods
279
Set the body for the viewer indeed. This method must be
280
overridden by the subclasses in order to show the model content
283
The original parameters from the subclass template must appear as
284
well with their own default values.
289
model - <EBox::Model::DataTable> the model to view
291
- Additional parameters, see above.
295
% # Default empty implementation