Commit b44b1032 authored by Son Nguyen's avatar Son Nguyen Committed by Gerrit Code Review
Browse files

Merge "Bug 1432435: needing to adjust multicolumn renderer"

parents 8266dbe2 92985e6e
......@@ -86,8 +86,14 @@ class FormRendererMultiColumnTable {/*{{{*/
foreach ($this->elements as $data) {
$columns = max($columns, count($data['builtelements']));
}
$toggle = 0;
$datatable = false;
$result = "<table cellspacing=\"0\" border=\"0\"><tbody>\n";
foreach ($this->elements as $title => $data) {
if ($datatable) {
$toggle = 1 - $toggle;
$data['settings']['class'] .= ' r' . $toggle;
}
$result .= "\t<tr";
// Set the class of the enclosing <tr> to match that of the element
if ($data['settings']['class']) {
......@@ -108,7 +114,13 @@ class FormRendererMultiColumnTable {/*{{{*/
}
foreach ($data['builtelements'] as $k => $builtelement) {
$rawelement = $data['rawelements'][$k];
$result .= "\t<td";
$dt = (!empty($rawelement['datatable'])) ? true : false;
if ($dt) {
$result .= "\t<th";
}
else {
$result .= "\t<td";
}
if (isset($rawelement['name'])) {
$result .= " id=\"" . $this->form->get_name() . '_' . Pieform::hsc($rawelement['name']) . '_container"';
}
......@@ -123,7 +135,12 @@ class FormRendererMultiColumnTable {/*{{{*/
if (isset($rawelement['helphtml'])) {
$result .= ' ' . $rawelement['helphtml'];
}
$result .= "</td>\n\t";
if ($dt) {
$result .= "</th>\n\t";
}
else {
$result .= "</td>\n\t";
}
// @todo description...
}
......@@ -131,6 +148,10 @@ class FormRendererMultiColumnTable {/*{{{*/
$result .= "\t<td></td>\n\t";
}
$result .= "</tr>\n";
// We want to add in the row class but not for the heading row so we do the check here
if (!empty($data['settings']['datatable'])) {
$datatable = true;
}
}
$result .= "</tbody></table>\n";
return $result;
......
......@@ -358,35 +358,47 @@ function service_fg_edit_form() {
'elements' => array(
'servicegroup' => array(
'title' => ' ',
'datatable' => true,
'class' => 'heading',
'type' => 'html',
'value' => get_string('service', 'auth.webservice'),
),
'component' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('component', 'auth.webservice'),
),
'enabled' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('enabled'),
),
'restricted' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('restrictedusers', 'auth.webservice'),
),
'tokenusers' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('fortokenusers', 'auth.webservice'),
),
'functions' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('functions', 'auth.webservice'),
),
'actions' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => '',
),
),
);
......@@ -481,6 +493,7 @@ function service_fg_edit_form() {
);
}
}
$pieform = new pieform($form);
return $pieform->build(false) . '<div class="function_add">' .
pieform(array(
......@@ -519,40 +532,53 @@ function service_tokens_edit_form() {
'elements' => array(
'token' => array(
'title' => ' ',
'datatable' => true,
'class' => 'heading',
'type' => 'html',
'value' => get_string('token', 'auth.webservice'),
),
'institution' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('institution'),
),
'username' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('username', 'auth.webservice'),
),
'servicename' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('servicename', 'auth.webservice'),
),
'enabled' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('enabled'),
),
'wssigenc' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('titlewssigenc', 'auth.webservice'),
),
'functions' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('functions', 'auth.webservice'),
),
'actions' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => '',
),
),
);
......@@ -660,6 +686,10 @@ function service_tokens_edit_form() {
);
}
}
else {
// no results so hide headings
$form['elements'] = array();
}
$username = '';
if ($user = param_integer('user', 0)) {
......@@ -721,35 +751,47 @@ function service_users_edit_form() {
'elements' => array(
'username' => array(
'title' => ' ',
'datatable' => true,
'class' => 'heading',
'type' => 'html',
'value' => get_string('username', 'auth.webservice'),
),
'institution' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('institution'),
),
'servicename' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('servicename', 'auth.webservice'),
),
'enabled' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('enabled'),
),
'wssigenc' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('titlewssigenc', 'auth.webservice'),
),
'functions' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('functions', 'auth.webservice'),
),
'actions' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => '',
),
),
);
......@@ -852,6 +894,10 @@ function service_users_edit_form() {
);
}
}
else {
// no results so hide headings
$form['elements'] = array();
}
$username = '';
if ($user = param_integer('user', 0)) {
......
......@@ -62,34 +62,46 @@ if (!empty($dbservices)) {
'service_name' => array(
'title' => ' ',
'class' => 'heading',
'datatable' => true,
'type' => 'html',
'value' => get_string('serviceaccess', 'auth.webservice'),
),
'enabled' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('enabled'),
),
'token' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('token', 'auth.webservice'),
),
'functions' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('functions', 'auth.webservice'),
),
'last_access' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('last_access', 'auth.webservice'),
),
'expires' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => get_string('expires', 'auth.webservice'),
),
'actions' => array(
'title' => ' ',
'datatable' => true,
'type' => 'html',
'value' => '',
),
),
);
foreach ($dbservices as $service) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment