~piersharding/udi/master-udi

« back to all changes in this revision

Viewing changes to htdocs/add_oclass_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:
23
23
if (! $request['dn'] || ! $app['server']->dnExists($request['dn']))
24
24
        error(sprintf(_('The entry (%s) does not exist.'),$request['dn']),'error','index.php');
25
25
 
26
 
$request['page'] = new TemplateRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
 
26
$request['page'] = new TemplateRender($app['server']->getIndex(),get_request('template','REQUEST',false,null));
27
27
$request['page']->setDN($request['dn']);
28
28
$request['page']->accept(true);
29
29
$request['template'] = $request['page']->getTemplate();
60
60
        $request['page']->drawTitle(sprintf('%s <b>%s</b>',_('Add new objectClass to'),get_rdn($request['dn'])));
61
61
        $request['page']->drawSubTitle();
62
62
 
63
 
        echo '<center>';
 
63
        echo '<div style="text-align: center">';
64
64
        printf('<small><b>%s: </b>%s <b>%s</b> %s %s</small>',
65
65
                _('Instructions'),
66
66
                _('In order to add these objectClass(es) to this entry, you must specify'),
69
69
 
70
70
        echo '<br /><br />';
71
71
 
72
 
        echo '<form action="cmd.php" method="post" name="entry_form">';
 
72
        echo '<form action="cmd.php" method="post" id="entry_form">';
 
73
        echo '<div>';
73
74
 
74
75
        if ($_SESSION[APPCONFIG]->getValue('confirm','update'))
75
76
                echo '<input type="hidden" name="cmd" value="update_confirm" />';
78
79
 
79
80
        printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
80
81
        printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($request['dn']));
 
82
        echo '</div>';
81
83
 
82
 
        echo '<table class="entry" cellspacing="0">';
 
84
        echo '<table class="entry" cellspacing="0" border="0" style="margin-left: auto; margin-right: auto;">';
83
85
        printf('<tr><th colspan="2">%s</th></tr>',_('New Required Attributes'));
84
86
 
85
87
        $counter = 0;
86
 
        foreach ($request['template']->getAttribute('objectclass')->getValues() as $value) {
87
 
                echo '<tr><td colspan=2>';
 
88
        echo '<tr><td colspan="2">';
 
89
        foreach ($request['template']->getAttribute('objectclass')->getValues() as $value)
88
90
                $request['page']->draw('HiddenValue',$request['template']->getAttribute('objectclass'),$counter++);
89
 
                echo '</td></tr>';
90
 
        }
 
91
        echo '</td></tr>';
91
92
 
92
93
        foreach ($ldap['attrs']['need'] as $count => $attr)
93
94
                $request['page']->draw('Template',$attr);
94
95
 
95
96
        echo '</table>';
96
97
 
97
 
        echo '<br />';
98
 
 
99
 
        printf('<center><input type="submit" value="%s" /></center>',_('Add ObjectClass and Attributes'));
 
98
        printf('<div style="text-align: center;"><br /><input type="submit" value="%s" /></div>',_('Add ObjectClass and Attributes'));
100
99
        echo '</form>';
101
 
        echo '</center>';
 
100
        echo '</div>';
102
101
 
103
102
# There are no other required attributes, so we just need to add the objectclass to the DN.
104
103
} else {
108
107
                $href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s&modified_attrs[]=objectclass',
109
108
                        $app['server']->getIndex(),rawurlencode($request['dn']));
110
109
 
 
110
                if (get_request('meth','REQUEST') == 'ajax')
 
111
                        $href .= '&meth=ajax';
 
112
 
111
113
                header(sprintf('Location: %s',$href));
112
114
                die();
113
115
        }