~piersharding/udi/master-udi

« back to all changes in this revision

Viewing changes to htdocs/add_attr_form.php

  • Committer: Piers Harding
  • Date: 2011-10-02 21:27:04 UTC
  • mfrom: (151.1.63)
  • Revision ID: git-v1:a3e8fccd857706bbe9f37a05061ddc2e2d0b8143
Merge branch 'master' into test-master-merge

Conflicts:
        lib/ds_ldap_pla.php
        lib/page.php

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
if (! $request['dn'] || ! $app['server']->dnExists($request['dn']))
20
20
        error(sprintf(_('The entry (%s) does not exist.'),$request['dn']),'error','index.php');
21
21
 
22
 
$request['page'] = new TemplateRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
 
22
$request['page'] = new TemplateRender($app['server']->getIndex(),get_request('template','REQUEST',false,null));
23
23
$request['page']->setDN($request['dn']);
24
24
$request['page']->accept(true);
25
25
$request['template'] = $request['page']->getTemplate();
29
29
        $request['page']->drawTitle(sprintf('%s <b>%s</b>',_('Add new attribute'),get_rdn($request['dn'])));
30
30
        $request['page']->drawSubTitle();
31
31
 
32
 
        echo '<center>';
 
32
        echo '<div style="text-align: center;">';
33
33
        if (count($request['template']->getAvailAttrs())) {
34
34
                # If we have more than the configured entries, we'll separate our input to the old ways.
35
35
                if (count($request['template']->getAvailAttrs()) > $_SESSION[APPCONFIG]->getValue('appearance','max_add_attrs')) {
50
50
                                echo '<br />';
51
51
 
52
52
                                echo '<form action="cmd.php" method="post">';
 
53
                                echo '<div>';
53
54
 
54
55
                                if ($_SESSION[APPCONFIG]->getValue('confirm','update'))
55
56
                                        echo '<input type="hidden" name="cmd" value="update_confirm" />';
75
76
 
76
77
                                echo '<input type="text" name="single_item_value" size="20" />';
77
78
                                printf('<input type="submit" name="submit" value="%s" class="update_dn" />',_('Add'));
 
79
                                echo '</div>';
78
80
                                echo '</form>';
79
81
 
80
82
                        } else {
90
92
 
91
93
                                echo '<!-- Form to add a new BINARY attribute to this entry -->';
92
94
                                echo '<form action="cmd.php" method="post" enctype="multipart/form-data">';
 
95
                                echo '<div>';
93
96
 
94
97
                                if ($_SESSION[APPCONFIG]->getValue('confirm','update'))
95
98
                                        echo '<input type="hidden" name="cmd" value="update_confirm" />';
124
127
                                else
125
128
                                        printf('<br /><small><b>%s: %s</b></small><br />',_('Maximum file size'),ini_get('upload_max_filesize'));
126
129
 
 
130
                                echo '</div>';
127
131
                                echo '</form>';
128
132
 
129
133
                        } else {
138
142
                        printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
139
143
                        printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($request['dn']));
140
144
 
141
 
                        echo '<table class="entry" cellspacing="0" align="center" border=0>';
 
145
                        echo '<table class="entry" cellspacing="0" align="center" border="0">';
142
146
 
143
147
                        foreach ($request['template']->getAvailAttrs() as $attribute)
144
148
                                $request['page']->draw('Template',$attribute);
153
157
                printf('<small>(%s)</small>',_('no new attributes available for this entry'));
154
158
        }
155
159
 
156
 
        echo '</center>';
 
160
        echo '</div>';
157
161
 
158
162
# The ajax addition (it is going into an existing TemplateRendered page
159
163
} else {
161
165
        echo '<fieldset>';
162
166
        printf('<legend>%s</legend>',_('Add Attribute'));
163
167
        echo '<div id="ajADDATTR">';
164
 
        echo '<table class="entry" cellspacing="0" align="center" border=0>';
 
168
        echo '<table class="entry" cellspacing="0" align="center" border="0">';
165
169
        echo '<td valign="top" align="center">';
166
170
 
167
 
        printf('<select name="attr" onChange="ajDISPLAY(\'%s\',\'cmd=add_value_form&server_id=%s&dn=%s&meth=ajax&attr=\'+this.value,\'%s\',\'append\');">',
168
 
                'ADDATTR',$app['server']->getIndex(),rawurlencode(get_request('dn','REQUEST')),_('Please Wait'));
 
171
        printf('<select name="attr" onchange="ajDISPLAY(\'%s\',\'cmd=add_value_form&server_id=%s&dn=%s&attr=\'+this.value,\'%s\',\'append\');">',
 
172
                'ADDATTR',$app['server']->getIndex(),$request['template']->getDNEncode(),_('Please Wait'));
169
173
 
170
174
        printf('<option value="%s">%s</option>','','');
171
175
        foreach ($request['template']->getAvailAttrs() as $attribute)