~ubuntu-branches/ubuntu/vivid/zentyal-core/vivid-proposed

« back to all changes in this revision

Viewing changes to src/templates/ajax/tableBody.mas

  • Committer: Package Import Robot
  • Author(s): Jorge Salamero Sanz
  • Date: 2012-08-28 10:03:33 UTC
  • Revision ID: package-import@ubuntu.com-20120828100333-oz3n5kpav4z0tl27
Tags: 2.3.21+quantal1
New upstream release for Quantal

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
use EBox::Gettext;
16
16
use EBox::Model::DataTable;
17
17
use POSIX;
 
18
use Perl6::Junction qw(any);
18
19
</%init>
19
20
<& PARENT:view,
20
21
   model      => $model,
55
56
  my $printableRowName = $model->table()->{'printableRowName'};
56
57
  my $tableName = $model->table()->{'tableName'};
57
58
  my $printableTableName = $model->table()->{'printableTableName'};
 
59
  my $onlyCustomActions = $model->table()->{'onlyCustomActions'};
 
60
  my $withoutActions = $model->table()->{'withoutActions'};
58
61
  my @ids;
59
62
  if (not $model->customFilter()) {
60
63
    @ids =  @{$model->ids()};
64
67
  unless ($page) {
65
68
    $page = 0;
66
69
  }
67
 
  # Fetch the edited row if we are editing one
68
 
  my $rowEdit;
69
 
  if ($editid and ($editid ne 'undefined')) {
70
 
          $rowEdit = $model->row($editid);
71
 
  }
72
70
 
73
 
  # Fetch the data to be displayed in setters, if we are editing a row
74
 
  # we should show the contents of the current fields. If we are
75
 
  # adding a new row, the fields are empty except for a preset values
76
 
  # adding where preset contents must be shown
77
 
  my @formData = @tableHead;
78
 
  if ($rowEdit) {
79
 
      @formData = @{$rowEdit->elements()};
80
 
  } elsif ( ((keys %presetParams) > 0)
81
 
            and $action eq 'presetUpdate') {
82
 
      # The preset is not empty
83
 
      @formData = values(%presetParams);
84
 
  }
85
71
  # If the action is a preset update, choose for an edition or an
86
72
  # addition whether the editid is set or not
87
73
  if ( $action eq 'presetUpdate' ) {
92
78
my $pageSize = $model->pageSize();
93
79
$pageSize or
94
80
    $pageSize = 10;
 
81
 
 
82
my %checkAllControls;
 
83
my $checkAllProperty = $model->checkAllProperty();
 
84
if ($checkAllProperty) {
 
85
   %checkAllControls = map {
 
86
       my $field = $_;
 
87
       my $id =  $tableName . '_'. $field . '_CheckAll';
 
88
       ( $field => $id)
 
89
    } @{ $checkAllProperty } ;
 
90
}
95
91
</%init>
96
92
<& .pageTitle,
97
93
   crumbs => $model->viewCustomizer()->HTMLTitle()
98
94
&>
99
95
 
100
 
% if ( $model->pageTitle() ) {
101
 
%      my $viewCustomizer = $model->viewCustomizer();
102
 
%      my $msg = $viewCustomizer ? $viewCustomizer->permanentMessage() : undef;
103
 
%      my $type = $viewCustomizer ? $viewCustomizer->permanentMessageType() : undef;
104
 
%      if ($msg) {
105
 
<& /msg.mas,
106
 
   msg => $msg,
107
 
   class => $type,
108
 
&>
109
 
%      }
110
 
%      if ( $model->message() ) {
111
 
<& /msg.mas,
112
 
   msg => $model->popMessage(),
113
 
   class => $model->messageClass()
114
 
&>
115
 
%      }
116
 
% }
117
 
 
118
 
 
119
 
% my $help = $model->help();
120
 
% if ($help) {
121
 
<div class="help">
122
 
  <% $help %>
123
 
</div>
124
 
% }
125
 
% my $disabledModuleWarning = $model->disabledModuleWarning();
126
 
% if ($disabledModuleWarning) {
127
 
<div class="warning">
128
 
  <% $disabledModuleWarning %>
129
 
</div>
130
 
% }
131
 
 
132
 
%  if ( $action ne 'changeAdd' and $action ne 'changeEdit' )
133
 
%  {
134
 
%    if ( $model->printableModelName() )
135
 
%    {
136
 
<& PARENT:title,
137
 
   title => $model->headTitle()
138
 
&>
139
 
%    }
140
 
%    if ($changeView and exists $actions->{'add'})
141
 
%    {
142
 
  <a href='#' class='addNew'
143
 
      name='add'
144
 
         onClick="<%
145
 
                 $model->changeViewJS( changeType => "changeAdd",
146
 
                      editId => "undefined",
147
 
                      page => $page,
148
 
                      isFilter => 0)
149
 
                %>;return false"><% __('Add new') %></a>
150
 
   <br/>
151
 
   <br/>
152
 
%    }
 
96
%  my $showEditForm =  $action eq any('changeAdd', 'changeEdit', 'clone');
 
97
%  if (not $showEditForm)  {
 
98
%    if ( $model->printableModelName() )  {
 
99
       <& PARENT:title,
 
100
          title => $model->headTitle()
 
101
        &>
 
102
        <& SELF:messagesAndHelp, model => $model &>
 
103
%    }
 
104
%    unless ((defined $onlyCustomActions) and $onlyCustomActions)  {
 
105
%        if ($changeView) {
 
106
           <& SELF:tableActionLinks,
 
107
               model => $model,
 
108
               addAction =>  (exists $actions->{'add'}),
 
109
               page => $page,
 
110
           &>
 
111
 
 
112
%        }
 
113
%     }
153
114
  <span id="<% 'creatingForm_' . $tableName %>"></span>
154
115
%  }
155
116
 
156
 
%  if ( $action eq 'changeAdd' or $action eq 'changeEdit' )  {
157
 
%   if ( $action eq 'changeAdd' )  {
158
 
%     my $addingStr = __x('Adding a new {row}', row => $printableRowName);
159
 
<& PARENT:title, title => $addingStr &>
160
 
%    } elsif ( $action eq 'changeEdit' )  {
161
 
<h3>
162
117
 
163
 
%     my $editingStr = __x('Editing {row}', row => $printableRowName);
164
 
<& PARENT:title, title => $editingStr &>
 
118
%  unless ((defined $onlyCustomActions) and $onlyCustomActions) {
 
119
%   if ($showEditForm) {
 
120
<& SELF:editFormTitle,
 
121
   action => $action,
 
122
   printableRowName => $printableRowName,
 
123
&>
 
124
<& SELF:messagesAndHelp, model => $model &>
 
125
<& SELF:editFormPopulated,
 
126
   action => $action,
 
127
   model  => $model,
 
128
   editid => $editid,
 
129
   presetParams  => \%presetParams
 
130
&>
165
131
%   }
166
 
 
167
 
<& PARENT:editForm,
168
 
    modelName => $tableName,
169
 
    formData => \@formData,
170
 
    sections => $model->sections(),
171
 
&>
172
 
 
173
 
%   my $customizer = $formData[0]->model()->viewCustomizer();
174
 
%   if ($customizer) {
175
 
<script>
176
 
<%   $customizer->onChangeActionsJS() %>
177
 
</script>
178
 
%    }
179
132
%  }
180
133
 
181
134
 
182
 
% if (@ids or length($filter) > 0)
183
 
%  {
184
 
%    if ( $action eq 'changeAdd' or $action eq 'changeEdit' )
185
 
%    {
 
135
% if (@ids or length($filter) > 0)  {
 
136
%
 
137
%   unless ((defined $onlyCustomActions) and $onlyCustomActions)   {
 
138
%    if ( $action eq 'changeAdd' or $action eq 'changeEdit' )  {
186
139
<h3>
187
140
  <%
188
141
    $printableTableName
189
142
  %>
190
143
</h3>
191
144
%    }
 
145
%   }
 
146
<& SELF:topToolbar,
 
147
   tableName => $tableName,
 
148
   model     => $model,
 
149
   filter     => $filter,
 
150
&>
192
151
 
193
 
<table class="bDataTable">
194
 
    <tr>
195
 
        <td>
196
 
<form action="javascript:void(0)">
197
 
%    my $filterId =  $tableName  .  '_filterLoading';
198
 
  <input type='text'
199
 
      name='<%
200
 
              $tableName
201
 
            %>'
202
 
      id='<%
203
 
            $tableName . "_filter"
204
 
          %>'
205
 
      value="<%
206
 
              $filter
207
 
             %>"
208
 
  />
209
 
  <input type='submit'
210
 
      name='filter'
211
 
      value="<% __('Search') %>"
212
 
      title="Apply"
213
 
      onClick="setLoading('<%
214
 
                             $filterId
215
 
                            %>');
216
 
                <%
217
 
                  $model->changeViewJS( changeType => "changeList",
218
 
                     editId => 'undefined',
219
 
                     page => 0,
220
 
                     isFilter => 1)
221
 
               %>;
222
 
               return false"
223
 
  />
224
 
  <span id="<%
225
 
              $filterId
226
 
            %>"
227
 
  ></span>
228
 
</form>
229
 
        </td>
230
 
    </tr>
231
 
</table>
232
152
<table class='<%
233
153
               $model->table()->{'class'}
234
154
              %>'>
235
155
 
236
 
<& SELF:tableHead, tableHead => \@tableHead &>
 
156
<& SELF:tableHead, tableHead => \@tableHead,
 
157
                   actions   => ((defined $withoutActions) ? not  $withoutActions: 1),
 
158
                   model => $model,
 
159
                   page  => $page,
 
160
                   checkAllControls => \%checkAllControls,
 
161
 &>
237
162
 
238
163
    <tbody>
239
164
<%perl>
255
180
        $row = $model->row($ids[$idx]);
256
181
      }
257
182
</%perl>
258
 
      <tr class='border'
259
 
          id="<%
260
 
                $row->id()
261
 
              %>">
262
 
 
263
 
%      foreach my $td (@{$row->elements()})
264
 
%      {
265
 
%        next unless ($td->HTMLViewer());
 
183
      <tr class='border' id="<% $row->id() %>">
 
184
 
 
185
%      foreach my $td (@{$row->elements()})      {
 
186
<%perl>
 
187
          next unless ($td->HTMLViewer());
 
188
 
 
189
          my @viewerParams = (data => $td);
 
190
          if ($td->isa('EBox::Types::Boolean')) {
 
191
              my $checkAllId = $checkAllControls{$td->fieldName()};
 
192
              push  @viewerParams, (checkAllId => $checkAllId);
 
193
          }
 
194
</%perl>
266
195
        <td class='tcenter'>
267
196
          <&
268
197
            $td->HTMLViewer(),
269
 
            'data' => $td
 
198
             @viewerParams
270
199
          &>
271
200
        </td>
272
 
 
273
201
%    }
274
202
 
 
203
% unless ((defined $withoutActions) and $withoutActions) {
275
204
<& SELF:actionCell, model => $model,
276
205
                    actions => $actions,
277
206
 
283
212
                    changeView => $changeView,
284
213
                    page => $page
285
214
                    &>
 
215
% }
286
216
      </tr>
287
217
%     if ($displayRows == $pageSize and not (defined($filter) and length($filter) > 0) ) {
288
218
%       $matches = scalar(@ids);
318
248
>
319
249
% }
320
250
 
321
 
% if ( $action eq 'changeEdit' and $editid ) {
 
251
% unless ((defined $onlyCustomActions) and $onlyCustomActions) {
 
252
%  if ( $action eq 'changeEdit' and $editid ) {
322
253
<script>highlightRow('<% $editid %>', 1);</script>
 
254
%  }
323
255
% }
324
 
 
325
256
% # End body method
326
257
</%method>
327
258
 
 
259
<%method topToolbar>
 
260
<%args>
 
261
$tableName
 
262
$model
 
263
$filter => undef
 
264
</%args>
 
265
<table class="bDataTable">
 
266
    <tr>
 
267
        <td>
 
268
         <& SELF:filterForm,
 
269
            tableName => $tableName,
 
270
            model     => $model,
 
271
            filter    => $filter,
 
272
         &>
 
273
        </td>
 
274
    </tr>
 
275
</table>
 
276
</%method>
 
277
 
 
278
<%method filterForm>
 
279
<%args>
 
280
$tableName
 
281
$model
 
282
$filter
 
283
</%args>
 
284
<%init>
 
285
 my $filterId =  $tableName  .  '_filterLoading';
 
286
</%init>
 
287
<form action="javascript:void(0)">
 
288
 
 
289
  <input type='text'
 
290
      name='<%
 
291
              $tableName
 
292
            %>'
 
293
      id='<%
 
294
            $tableName . "_filter"
 
295
          %>'
 
296
      value="<%
 
297
              $filter
 
298
             %>"
 
299
  />
 
300
  <input type='submit'
 
301
      name='filter'
 
302
      value="<% __('Search') %>"
 
303
      title="Apply"
 
304
      onClick="setLoading('<%
 
305
                             $filterId
 
306
                            %>');
 
307
                <%
 
308
                  $model->changeViewJS( changeType => "changeList",
 
309
                     editId => 'undefined',
 
310
                     page => 0,
 
311
                     isFilter => 1)
 
312
               %>;
 
313
               return false"
 
314
  />
 
315
  <span id="<%
 
316
              $filterId
 
317
            %>"
 
318
  ></span>
 
319
</form>
 
320
</%method>
 
321
 
 
322
<%method editFormTitle>
 
323
<%args>
 
324
$action
 
325
$printableRowName
 
326
</%args>
 
327
%    my $formTitle;
 
328
%    if ( $action eq 'changeAdd' )  {
 
329
%      $formTitle = __x('Adding a new {row}', row => $printableRowName);
 
330
%    } elsif ( $action eq 'changeEdit' )  {
 
331
<h3>
 
332
%     $formTitle = __x('Editing {row}', row => $printableRowName);
 
333
%    } elsif ($action eq 'clone') {
 
334
<h3>
 
335
%     $formTitle = __x('Cloning {row}', row => $printableRowName);
 
336
%    }
 
337
<& PARENT:title, title => $formTitle &>
 
338
</%method>
 
339
 
 
340
<%method editFormPopulated>
 
341
<%args>
 
342
$action
 
343
$model
 
344
$editid
 
345
%presetParams  => ()
 
346
@customizerParams => ()
 
347
</%args>
 
348
<%init>
 
349
  my $tableName = $model->table()->{'tableName'};
 
350
  my @tableHead = @{$model->table()->{'tableDescription'}};
 
351
  if ($action eq 'add') {
 
352
      foreach my $element (@tableHead) {
 
353
          $element->setValue($element->defaultValue());
 
354
      }
 
355
  }
 
356
 
 
357
  # Fetch the data to be displayed in setters, if we are editing a row
 
358
  # we should show the contents of the current fields. If we are
 
359
  # adding a new row, the fields are empty except for a preset values
 
360
  # adding where preset contents must be shown
 
361
  my @formData;
 
362
  my @extraComponents;
 
363
  if ($editid and ($editid ne 'undefined')) {
 
364
      my  $fetchRow = $model->row($editid);
 
365
      @formData = @{$fetchRow->elements()};
 
366
      if ($action eq 'clone') {
 
367
          # unique fields should not be cloned
 
368
          my @uniqFields = grep { $_->unique()  } @tableHead;
 
369
          foreach my $uniqField (@uniqFields) {
 
370
              foreach my $clonedField (@formData) {
 
371
                  if ($uniqField->fieldName() eq $clonedField->fieldName()) {
 
372
                      $clonedField = $uniqField;
 
373
                      last;
 
374
                  }
 
375
              }
 
376
          }
 
377
      }
 
378
  } elsif ( ((keys %presetParams) > 0)
 
379
            and $action eq 'presetUpdate') {
 
380
      # The preset is not empty
 
381
      @formData = values(%presetParams);
 
382
  } else {
 
383
      @formData = @tableHead;
 
384
 }
 
385
</%init>
 
386
<& PARENT:editForm,
 
387
    modelName => $tableName,
 
388
    formData => \@formData,
 
389
    sections => $model->sections(),
 
390
&>
 
391
 
 
392
%    my $customizer = $formData[0]->model()->viewCustomizer(@customizerParams);
 
393
%    if ($customizer) {
 
394
<script>
 
395
<%   $customizer->onChangeActionsJS() %>
 
396
</script>
 
397
%     }
 
398
</%method>
 
399
 
328
400
<%doc>
329
401
   Method: buttons
330
402
 
345
417
  my $filter = $requestArgs->{filter};
346
418
  my $page   = $requestArgs->{page};
347
419
  my $tpages = $requestArgs->{tpages};
 
420
 
 
421
  my $modelName  = $model->modelName();
348
422
  my $changeView = $model->action('changeView');
 
423
  my $onlyCustomActions = $model->table()->{'onlyCustomActions'};
 
424
  my $withoutActions = $model->table()->{'withoutActions'};
 
425
  my $cloneId;
349
426
 
350
427
  if ( $action eq 'presetUpdate' ) {
351
428
      $action = 'changeAdd' if ( not $editid );
352
429
      $action = 'changeEdit' if ( $editid );
 
430
  } elsif ($action eq 'clone') {
 
431
      $action = 'changeAdd';
 
432
      $cloneId = $editid;
353
433
  }
354
434
</%init>
 
435
% unless ((defined $withoutActions) and $withoutActions) {
355
436
<tr>
356
437
  <td id="applyChanges">
357
438
  </td>
358
 
  <td id="<% 'buttons_' . $model->modelName() %>">
359
 
% if ( $action eq 'changeAdd' )
 
439
  <td id="<% 'buttons_' .  $modelName %>">
 
440
% unless ((defined $onlyCustomActions) and $onlyCustomActions)
360
441
% {
 
442
%  if ( $action eq 'changeAdd' )
 
443
%  {
 
444
%    # extra input for cloneId
 
445
%    if ($cloneId)  {
 
446
        <&/input/hidden.mas,
 
447
              name => $modelName . '_cloneId',
 
448
              id => $modelName . '_cloneId',
 
449
              value => $cloneId
 
450
         &>
 
451
%    }
361
452
    <& /input/submit.mas,
362
453
        class => 'inputButton',
363
454
        type => 'submit',
364
455
        name => 'add',
365
456
        value => __('Add'),
366
457
        title => 'Add',
367
 
        onclick => $model->addNewRowJS($page) . '; return false'
 
458
        onclick => $model->addNewRowJS($page, cloneId => $cloneId) . '; return false'
368
459
    &>
369
 
% }
370
 
% elsif ($action eq 'changeEdit')
371
 
% {
 
460
%  }
 
461
%  elsif ($action eq 'changeEdit')
 
462
%  {
372
463
    <& /input/submit.mas,
373
464
        class => 'inputButton',
374
465
        type => 'submit',
377
468
        title => 'Change',
378
469
        onclick => $model->changeRowJS($editid, $page) . '; return false'
379
470
    &>
380
 
% }
381
 
% if ($changeView)
382
 
% {
 
471
%  }
 
472
%  if ($changeView)
 
473
%  {
383
474
    <& /input/submit.mas,
384
475
        class => 'inputButton',
385
476
        type => 'submit',
391
482
                          page => $page,
392
483
                          isFilter => 0) . '; return false'
393
484
    &>
 
485
%  }
394
486
% }
395
487
  </td>
396
488
</tr>
397
 
 
398
 
 
399
 
 
 
489
% }
400
490
</%method>
401
491
 
402
492
 
409
499
 
410
500
Parameteres:
411
501
  @tableHead - list with the types of the fields of the tale's rows
 
502
  $actions   - whether to show Action row or not
 
503
  $model
 
504
  $page
412
505
</%doc>
413
506
<%args>
414
507
@tableHead
 
508
$actions
 
509
$model
 
510
$page
 
511
%checkAllControls => ()
415
512
</%args>
416
513
    <thead>
417
 
%    foreach my $th (@tableHead)
418
 
%    {
 
514
%   my $checkAll = %checkAllControls;
 
515
%   foreach my $th (@tableHead)  {
419
516
%      next unless ($th->HTMLViewer());
420
517
      <th class='<%
421
518
                   $th->class()
423
520
        <%
424
521
          $th->printableName()
425
522
        %>
 
523
 
 
524
%    if ($checkAll) {
 
525
%      my $spaceAdded = 0;
 
526
%      my $fieldName = $th->fieldName();
 
527
%      if ($th->isa('EBox::Types::Boolean')) {
 
528
%         my $checkAllId = $checkAllControls{$fieldName};
 
529
%         if ($checkAllId) {
 
530
            <& SELF:checkAllControl,
 
531
                id => $checkAllId,
 
532
                fieldName => $fieldName,
 
533
                model     => $model,
 
534
                page      => $page,
 
535
             &>
 
536
%            $spaceAdded = 1;
 
537
%         }
 
538
%      }
 
539
%      unless ($spaceAdded) {
 
540
            <div>&nbsp;</div>
 
541
%      }
 
542
%     }
426
543
      </th>
427
 
%    }
 
544
%   }
428
545
 
 
546
%    if ($actions) {
429
547
      <th class='thOptions'>
430
548
        <%
431
549
          __('Action')
432
550
        %>
 
551
%      if ($checkAll) {
 
552
            <div>&nbsp;</div>
 
553
%      }
433
554
      </th>
 
555
%    }
434
556
    </thead>
435
557
</%method>
436
558
 
 
559
<%method checkAllControl>
 
560
<%args>
 
561
$id
 
562
$fieldName
 
563
$model
 
564
$page
 
565
</%args>
 
566
<%init>
 
567
my $tableName = $model->name();
 
568
my $divId = $id;
 
569
$divId =~ s/_CheckAll$/_div_CheckAll/;
 
570
 
 
571
 
 
572
my $checkAllJS=  $model->changeViewJS( changeType => "checkboxSetAll",
 
573
                      editId =>  $fieldName,
 
574
                      page => $page,
 
575
                      isFilter => 0);
 
576
my $uncheckAllJS=  $model->changeViewJS( changeType => "checkboxUnsetAll",
 
577
                      editId => $fieldName,
 
578
                      page => $page,
 
579
                      isFilter => 0);
 
580
my $onChangeJS =qq|if (this.checked) {$checkAllJS } else {$uncheckAllJS;} |;
 
581
my @htmlAttrs = (onchange => $onChangeJS);
 
582
push @htmlAttrs, (id => $id);
 
583
if ( $model->checkAllControlValue($fieldName)) {
 
584
  push @htmlAttrs, ('checked' => 'checked');
 
585
}
 
586
 
 
587
</%init>
 
588
<div id=<% $divId %> >
 
589
<input  type='checkbox'
 
590
 <& /htmlAttributes.mas, @htmlAttrs &>
 
591
/>
 
592
</div>
 
593
</%method>
 
594
 
 
595
<%method tableActionLinks>
 
596
<%args>
 
597
$model
 
598
$addAction
 
599
$page
 
600
</%args>
 
601
<%init>
 
602
my $actionLinksAdded = 0;
 
603
my $tableName = $model->name();
 
604
my $checkAll  = $model->checkAllProperty();
 
605
</%init>
 
606
% if ($addAction)  {
 
607
%   $actionLinksAdded = 1;
 
608
  <a href='#' class='addNew'
 
609
      name='add'
 
610
         onClick="<%
 
611
                 $model->changeViewJS( changeType => "changeAdd",
 
612
                      editId => "undefined",
 
613
                      page => $page,
 
614
                      isFilter => 0)
 
615
                %>;return false"><% __('Add new') %></a>
 
616
% }
 
617
 
 
618
% if ($actionLinksAdded) {
 
619
    <br/><br/>
 
620
% }
 
621
 
 
622
</%method>
 
623
 
437
624
<%method actionCell>
438
625
<%doc>
439
626
    Print the action cell for the row
466
653
      my $rowReadOnly = $row->readOnly()   ;
467
654
 
468
655
      my $disabled = '';
469
 
      my $edit = 'edit';
470
 
      my $edit_msg = __('Edit');
471
 
      my $delete = 'delete';
472
 
      my $delete_msg = __('Delete');
473
 
      if ($rowReadOnly) {
 
656
      my ($edit, $edit_msg);
 
657
      my ($delete, $delete_msg);
 
658
      my ($clone, $clone_msg);
 
659
      if (not $rowReadOnly) {
 
660
          $edit = 'edit';
 
661
          $edit_msg = __('Edit');
 
662
          $delete = 'delete';
 
663
          $delete_msg = __('Delete');
 
664
          $clone = 'clone';
 
665
          $clone_msg = __('Clone');
 
666
      } else {
474
667
          $disabled = 'disabled';
475
668
          $edit = 'edit-inactive';
476
669
          $delete = 'delete-inactive';
477
670
          $edit_msg = __('Read-only row: edit disabled');
478
671
          $delete_msg = __('Read-only row: delete disabled');
 
672
          $clone = 'clone-inactive';
 
673
          $clone_msg = __('Read-only row: clone disabled');
479
674
      }
 
675
      my $onlyCustomActions = $model->table()->{'onlyCustomActions'};
480
676
</%perl>
481
677
<& /ajax/customActions.mas, model => $model, id => $row->{id}, type => 'image' &>
482
678
 
 
679
%    unless ((defined $onlyCustomActions) and $onlyCustomActions)
 
680
%    {
483
681
%      if ($actions->{'del'})
484
682
%      {
485
683
          <input class='inputButton'
521
719
          />
522
720
%      }
523
721
 
 
722
%      if ($actions->{'clone'})
 
723
%      {
 
724
          <input class='inputButton'
 
725
              <%
 
726
                $disabled
 
727
              %>
 
728
              type='image'
 
729
              name='clone'
 
730
              value="Clone"
 
731
              title="<% $clone_msg  %>"
 
732
              alt="Clone"
 
733
              src='/data/images/<% $clone %>.png'
 
734
              onClick="<%
 
735
                          $model->actionClickedJS('clone',
 
736
                             $row->{id},
 
737
                              '',
 
738
                              $page)
 
739
                       %>"
 
740
          />
 
741
 
 
742
%      }
 
743
 
524
744
%      if ($model->table()->{'order'} == 1)
525
745
%      {
526
746
        <& SELF:.moveRowActions,
533
753
            page => $page,
534
754
        &>
535
755
%      }
 
756
 
 
757
%    }
536
758
        </td>
537
759
</%method>
538
760
 
705
927
%       }
706
928
 
707
929
%# Not custom actions
708
 
%# Currently they does not show, reenable them if you want they to appear in the legend
 
930
%# Currently they does not show, reenable them if you want they to appear in the
 
931
%# legend. Also add the clone action if we want to show it
709
932
 
710
933
<%perl>
711
934
    my $edit = 'edit';