~ubuntu-branches/ubuntu/lucid/libebox/lucid

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2008-02-27 13:19:28 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080227131928-8mefc35x4h4njvr0
Tags: 0.11.99-0ubuntu1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<%doc>
 
2
  This template will show the content from a model composite, that is
 
3
  the content from its components in an established layout.
 
4
 
 
5
  Parameters:
 
6
    model - <EBox::Model::Composite> the composite model to show
 
7
    hasChanged - Boolean indicating whether the composite model has
 
8
    changed or not
 
9
</%doc>
 
10
<%args>
 
11
  $model
 
12
  $hasChanged
 
13
</%args>
 
14
<%init>
 
15
  use EBox::Gettext;
 
16
  use Data::Dumper;
 
17
</%init>
 
18
<& .title,
 
19
   title => $model->printableName()
 
20
&>
 
21
% if ( $model->precondition() ) {
 
22
%    # Define the components when we are sure the precondition is
 
23
%    # matched
 
24
%    my $componentsRef = $model->components();
 
25
%    # Print the help if any
 
26
%    if ( $model->help() ) {
 
27
<div class="help">
 
28
  <% $model->help() %>
 
29
</div>
 
30
%    }
 
31
%    if ( $model->layout() eq 'tabbed' )
 
32
%    {
 
33
<& /ajax/tabMenu.mas,
 
34
   models => $componentsRef,
 
35
   selectedTab => 0,
 
36
   hasChanged => $hasChanged,
 
37
   tabName    => $model->name(),
 
38
&>
 
39
%    }
 
40
%    elsif ( $model->layout() eq 'top-bottom' )
 
41
%    {
 
42
%       foreach my $component (@{$componentsRef}) {
 
43
<& $component->Viewer(),
 
44
   model => $component,
 
45
   hasChanged => $hasChanged,
 
46
   action => 'view',
 
47
&>
 
48
%       }
 
49
%    }
 
50
%    elsif ( $model->layout() eq 'select' )
 
51
%    {
 
52
<& /ajax/selector.mas,
 
53
   composite => $model,
 
54
   hasChanged => $hasChanged,
 
55
&>
 
56
%    }
 
57
% }
 
58
% else
 
59
% {
 
60
<div class="note">
 
61
  <% $model->preconditionFailMsg() %>
 
62
</div>
 
63
% }
 
64
 
 
65
<%doc>
 
66
Method: .title
 
67
 
 
68
   Private component to print the title if any. It takes into account
 
69
   if the composite is the root one or not to determine which kind of
 
70
   title it is
 
71
 
 
72
Parameters:
 
73
 
 
74
   title - String the title to print
 
75
 
 
76
</%doc>
 
77
<%def .title>
 
78
<%args>
 
79
  $title => undef
 
80
</%args>
 
81
<%perl>
 
82
  # Print the model name if any
 
83
  if ( $title ) {
 
84
    # Check if we are the root component or not to determine the heading size
 
85
    if ( $m->depth() == 2 ) {
 
86
</%perl>
 
87
<& /title.mas,
 
88
    title => $title
 
89
&>
 
90
%   } else {
 
91
<h3>
 
92
  <% $title | h %>
 
93
</h3>
 
94
%   }
 
95
% }
 
96
 
 
97
</%def>