Commit f3e8386f authored by Liam Sharpe's avatar Liam Sharpe Committed by Robert Lyon

Contact & add user page - bootstrap (Bug #1465107)

- have merged in the stuff from commit
e143a7e158c001838ea10a215ecacdfa6e1fd67b
from https://github.com/TheCrowsJoker/mahara/

Change-Id: I4465f176550d22a8f3e811613a4d0cc38fba94e8
parent 6603794c
......@@ -54,16 +54,19 @@ $elements = array(
'type' => 'text',
'title' => get_string('firstname'),
'rules' => array('required' => true),
'class' => 'form-control text',
),
'lastname' => array(
'type' => 'text',
'title' => get_string('lastname'),
'rules' => array('required' => true),
'class' => 'form-control text',
),
'email' => array(
'type' => 'text',
'title' => get_string('email'),
'rules' => array('required' => true),
'class' => 'form-control text',
),
'leap2afile' => array(
'type' => 'file',
......@@ -114,6 +117,7 @@ $elements = array(
'submit' => array(
'type' => 'submit',
'value' => get_string('createuser', 'admin'),
'class' => 'btn btn-success btn-lg btn-block mtm',
),
);
......@@ -145,6 +149,7 @@ $form = pieform(array(
'templatedir' => pieform_template_dir('adduser.php'),
'plugintype' => 'core',
'pluginname' => 'admin',
'class' => 'form-condensed',
'elements' => $elements,
));
......@@ -363,4 +368,5 @@ $smarty = smarty(array('adminadduser'));
setpageicon($smarty, 'icon-user-plus');
$smarty->assign('form', $form);
$smarty->assign('PAGEHEADING', TITLE);
$smarty->assign('headingclass', 'page-header');
$smarty->display('admin/users/add.tpl');
......@@ -144,7 +144,7 @@ $elements = array(
'profile' => array(
'type' => 'fieldset',
'legend' => get_string('aboutme', 'artefact.internal'),
'class' => $fieldset != 'aboutme' ? 'collapsed' : '',
'class' => 'has-help' . $fieldset != 'aboutme' ? 'collapsed' : '',
'elements' => get_desired_fields($items, array('firstname', 'lastname', 'studentid', 'preferredname', 'introduction'), 'about'),
),
'contact' => array(
......
......@@ -72,6 +72,7 @@ $elements['userid'] = array(
$elements['submit'] = array(
'type' => 'submit',
'value' => get_string('sendmessage'),
'class' => 'btn btn-success submit'
);
$contactform = pieform(array(
......@@ -81,6 +82,7 @@ $contactform = pieform(array(
'elements' => $elements,
'spam' => array(
'secret' => get_config('formsecret'),
'class' => 'hidden',
'mintime' => 5,
'hash' => array('name', 'email', 'subject', 'message', 'userid', 'submit'),
'reorder' => array('name', 'email'),
......
......@@ -42,8 +42,8 @@ if ($USER->is_logged_in()) {
if (get_config_plugin('blocktype', 'gallery', 'useslimbox2')) {
$langdir = (get_string('thisdirection', 'langconfig') == 'rtl' ? '-rtl' : '');
$stylesheets = array_merge($stylesheets, array('<script type="application/javascript" src="' . append_version_number(get_config('wwwroot') . 'lib/slimbox2/js/slimbox2.js') . '"></script>',
'<link rel="stylesheet" type="text/css" href="' . append_version_number(get_config('wwwroot') . 'lib/slimbox2/css/slimbox2' . $langdir . '.css') . '">'
));
'<link rel="stylesheet" type="text/css" href="' . append_version_number(get_config('wwwroot') . 'lib/slimbox2/css/slimbox2' . $langdir . '.css') . '">'
));
}
$viewcontent = $view->build_rows(); // Build content before initialising smarty in case pieform elements define headers.
......
......@@ -832,7 +832,7 @@ $string['leap2aimportfailed'] = '<p><strong>Sorry - Importing the Leap2A file fa
$string['newuseremailnotsent'] = 'Failed to send welcome email to new user.';
$string['newusercreated'] = 'New user account created successfully';
$string['noleap2axmlfiledetected'] = 'No leap2a.xml file detected - please check your export file again.';
$string['Or...'] = 'Or...';
$string['Or'] = 'Or';
$string['userwillreceiveemailandhastochangepassword'] = 'They will receive an email informing them of their new account details. On first login, they will be forced to change their password.';
$string['uploadleap2afile'] = 'Upload Leap2A file';
......
......@@ -266,7 +266,7 @@ class Pieform {/*{{{*/
'type' => 'text',
'title' => get_string('spamtrap'),
'defaultvalue' => '',
'class' => 'dontshow',
'class' => 'dontshow hidden',
),
);
$spamelements2 = array(
......@@ -277,7 +277,7 @@ class Pieform {/*{{{*/
'__invisiblesubmit' => array(
'type' => 'submit',
'value' => get_string('spamtrap'),
'class' => 'dontshow',
'class' => 'dontshow hidden',
),
);
$insert = rand(0, count($this->data['elements']));
......
......@@ -276,63 +276,58 @@ function general_account_prefs_form_elements($prefs) {
else {
$sitedefaultlabel = get_string('sitedefault', 'admin') . ' (' . $languages[get_config('lang')] . ')';
}
$elements['lang'] = array(
'type' => 'select',
'defaultvalue' => $prefs->lang,
'title' => get_string('language', 'account'),
'options' => array_merge(array('default' => $sitedefaultlabel), $languages),
'help' => true,
'ignore' => count($languages) < 2,
);
$sitethemes = array();
// Get all available standard site themes
if (get_config('sitethemeprefs') && !in_admin_section()) {
// get_user_accessible_themes() returns 'sitedefault' to mean fall back to the site or
// institution theme. This won't work for account prefs, where 'sitedefault' is just
// a theme that doesn't exist. So change the 'sitedefault' key to '', and the empty
// preference will be interpreted as "No theme selected".
$sitethemes = array_reverse(get_user_accessible_themes());
unset($sitethemes['sitedefault']);
$sitethemes = array_reverse($sitethemes);
}
// Get all user's institution themes
$institutionthemes = array();
global $USER;
if ($institutions = $USER->get('institutions')) {
$allthemes = get_all_theme_objects();
foreach ($institutions as $i) {
if (empty($i->theme)) {
$institutionthemes['sitedefault' . '/' . $i->institution] = $i->displayname . ' - ' . get_string('sitedefault', 'admin');
}
else {
$institutionthemes[$i->theme . '/' . $i->institution] = $i->displayname . ' - ' . $allthemes[$i->theme]->displayname;
if (isset($elements['type'])) {
$elements['lang'] = array(
'type' => 'select',
'defaultvalue' => $prefs->lang,
'title' => get_string('language', 'account'),
'options' => array_merge(array('default' => $sitedefaultlabel), $languages),
'help' => true,
'ignore' => count($languages) < 2,
);
$sitethemes = array();
// Get all available standard site themes
if (get_config('sitethemeprefs') && !in_admin_section()) {
// get_user_accessible_themes() returns 'sitedefault' to mean fall back to the site or
// institution theme. This won't work for account prefs, where 'sitedefault' is just
// a theme that doesn't exist. So change the 'sitedefault' key to '', and the empty
// preference will be interpreted as "No theme selected".
$sitethemes = array_reverse(get_user_accessible_themes());
unset($sitethemes['sitedefault']);
$sitethemes = array_reverse($sitethemes);
}
// Get all user's institution themes
$institutionthemes = array();
global $USER;
if ($institutions = $USER->get('institutions')) {
$allthemes = get_all_theme_objects();
foreach ($institutions as $i) {
if (empty($i->theme)) {
$institutionthemes['sitedefault' . '/' . $i->institution] = $i->displayname . ' - ' . get_string('sitedefault', 'admin');
}
else {
$institutionthemes[$i->theme . '/' . $i->institution] = $i->displayname . ' - ' . $allthemes[$i->theme]->displayname;
}
}
}
$themes = array_merge($sitethemes, $institutionthemes);
natcasesort($themes);
$currenttheme = $USER->get_themedata();
if (!isset($currenttheme->basename)) {
$defaulttheme = 'sitedefault';
}
else {
$defaulttheme = $currenttheme->basename;
}
if (isset($currenttheme->institutionname)) {
$defaulttheme = $defaulttheme . '/' . $currenttheme->institutionname;
}
if (!array_key_exists($defaulttheme, $themes)) {
reset($themes);
$defaulttheme = key($themes);
}
}
$themes = array_merge($sitethemes, $institutionthemes);
natcasesort($themes);
$currenttheme = $USER->get_themedata();
if (!isset($currenttheme->basename)) {
$defaulttheme = 'sitedefault';
}
else {
$defaulttheme = $currenttheme->basename;
}
if (isset($currenttheme->institutionname)) {
$defaulttheme = $defaulttheme . '/' . $currenttheme->institutionname;
}
if (!array_key_exists($defaulttheme, $themes)) {
reset($themes);
$defaulttheme = key($themes);
}
$elements['theme'] = array(
'type' => 'select',
'defaultvalue' => $defaulttheme,
'title' => get_string('theme'),
'options' => $themes,
'ignore' => count($themes) < 2,
'help' => true,
);
$elements['addremovecolumns'] = array(
'type' => 'switchbox',
......
......@@ -12261,12 +12261,12 @@ a.panel-footer .icon.pull-right, a.panel-footer .pull-right.mce-ico.mce-i-icon.t
}
/* line 2, ../../raw/sass/layout/panel/_panel-items.scss */
.panel-items.js-masonry {
.panel-items {
margin-left: -3%;
margin-bottom: 100px;
}
/* line 5, ../../raw/sass/layout/panel/_panel-items.scss */
.panel-items.js-masonry .panel {
.panel-items .panel {
width: 30.3%;
float: left;
margin-left: 3%;
......@@ -12274,27 +12274,27 @@ a.panel-footer .icon.pull-right, a.panel-footer .pull-right.mce-ico.mce-i-icon.t
}
@media (max-width: 768px) {
/* line 5, ../../raw/sass/layout/panel/_panel-items.scss */
.panel-items.js-masonry .panel {
.panel-items .panel {
width: 47%;
}
}
@media (max-width: 480px) {
/* line 5, ../../raw/sass/layout/panel/_panel-items.scss */
.panel-items.js-masonry .panel {
.panel-items .panel {
width: 97%;
}
}
/* line 16, ../../raw/sass/layout/panel/_panel-items.scss */
.panel-items.js-masonry .panel.double {
.panel-items .panel.double {
width: 63.6%;
}
/* line 19, ../../raw/sass/layout/panel/_panel-items.scss */
.panel-items.js-masonry .panel.panel-half {
.panel-items .panel.panel-half {
width: 47%;
}
@media (max-width: 768px) {
/* line 19, ../../raw/sass/layout/panel/_panel-items.scss */
.panel-items.js-masonry .panel.panel-half {
.panel-items .panel.panel-half {
width: 97%;
}
}
......@@ -12865,6 +12865,13 @@ label,
padding-right: 10px;
font-weight: normal;
}
.form-condensed label,
.form-condensed .pseudolabel {
min-width: 100px;
}
.form-condensed.pseudolabel {
min-width: 265px;
}
/* line 25, ../../raw/sass/form/_form.scss */
label.input-inline,
.pseudolabel.input-inline {
......@@ -13028,6 +13035,22 @@ label .col-collapse,
padding: 20px 0;
position: relative;
}
.form-group .form-group {
padding: 0;
}
.form-group.fieldset .form-group {
padding: 20px 0;
}
.form-condensed .form-group {
padding: 7px 0;
border: 0;
}
.form-condensed .form-group .form-group {
padding: 0;
}
.form-condensed .form-group.fieldset .form-group {
padding: 20px 0;
}
/* line 20, ../../raw/sass/form/_form-group.scss */
.form-group.bytes .pseudolabel {
display: none;
......@@ -13314,69 +13337,31 @@ label .col-collapse,
padding-bottom: 10px;
}
/* line 296, ../../raw/sass/form/_form-group.scss */
.form-group .file-wrapper,
.form-group .tag-wrapper input,
.form-group .about-text,
.form-group input[type=text],
.form-group input[type=password],
.form-group input[type=file],
.form-group textarea,
.form-group select {
.form-group .form-control {
display: inline-block;
}
.form-condensed .form-group .form-control:not(.with-dropdown):not(.dropdown-connect) {
width: auto;
}
@media (min-width: 768px) {
/* line 296, ../../raw/sass/form/_form-group.scss */
.form-group .file-wrapper,
.form-group .tag-wrapper input,
.form-group .about-text,
.form-group input[type=text],
.form-group input[type=password],
.form-group input[type=file],
.form-group textarea,
.form-group select {
.form-group .form-control {
width: 420px;
max-width: 85%;
}
/* line 308, ../../raw/sass/form/_form-group.scss */
.columns3 .form-group .file-wrapper, .form-inline .form-group .file-wrapper, .columns3
.form-group .tag-wrapper input, .form-inline
.form-group .tag-wrapper input, .columns3
.form-group .about-text, .form-inline
.form-group .about-text, .columns3
.form-group input[type=text], .form-inline
.form-group input[type=text], .columns3
.form-group input[type=password], .form-inline
.form-group input[type=password], .columns3
.form-group input[type=file], .form-inline
.form-group input[type=file], .columns3
.form-group textarea, .form-inline
.form-group textarea, .columns3
.form-group select, .form-inline
.form-group select {
.columns3 .form-group .form-control,
.form-inline .form-group .form-control {
max-width: 100%;
}
/* line 312, ../../raw/sass/form/_form-group.scss */
.form-inline .form-group .file-wrapper, .form-inline
.form-group .tag-wrapper input, .form-inline
.form-group .about-text, .form-inline
.form-group input[type=text], .form-inline
.form-group input[type=password], .form-inline
.form-group input[type=file], .form-inline
.form-group textarea, .form-inline
.form-group select {
.form-inline .form-group .form-control {
width: 100%;
}
}
@media (min-width: 1200px) {
/* line 296, ../../raw/sass/form/_form-group.scss */
.form-group .file-wrapper,
.form-group .tag-wrapper input,
.form-group .about-text,
.form-group input[type=text],
.form-group input[type=password],
.form-group input[type=file],
.form-group textarea,
.form-group select {
.form-group .form-control {
width: 500px;
}
}
......@@ -13678,6 +13663,9 @@ label .col-collapse,
overflow: hidden;
width: 230px;
}
.form-condensed.pieform .dropdown-group .picker {
max-width: 100%;
}
/* line 42, ../../raw/sass/form/_dropdown-group.scss */
.dropdown-group .dropdown-connect {
height: 35px;
......@@ -15606,6 +15594,24 @@ a.user-icon:hover:after, a.user-icon:focus:after, a .user-icon:hover:after, a .u
background: transparent;
width: 100%;
}
/* line 1, ../../raw/sass/features/_option-alt.scss */
.option-alt {
border-top: 1px solid $panel-default-border;
min-height: 157px;
position: relative;
}
/* line 8, ../../raw/sass/features/_option-alt.scss */
.option-alt-divider {
color: #999;
background: #fff;
text-transform: uppercase;
font-size: 1.2em;
position: absolute;
top: -15px;
left: 43%;
text-align: center;
padding: 0 10px;
}
/* line 19, ../../raw/sass/utilities/_mixins.scss */
.col-width-100 .comment-item .comment-attachment .panel.collapsible legend, .viewfooter .comment-item .comment-attachment .panel.collapsible legend {
overflow: hidden;
......
......@@ -2,83 +2,116 @@
echo $form_tag;
?>
<div id="adduser-t">
<div class="step step1" id="step1">
<h3><?php echo get_string('usercreationmethod', 'admin'); ?></h3>
<p class="step-descript"><?php echo get_string('howdoyouwanttocreatethisuser', 'admin'); ?></p>
<div class="choice"><input type="radio" name="createmethod" class="ic"<?php if (!isset($_POST['createmethod']) || $_POST['createmethod'] == 'scratch') { ?> checked="checked"<?php } ?> id="createfromscratch" value="scratch"> <label for="createfromscratch"><?php echo get_string('createnewuserfromscratch', 'admin'); ?></label></div>
<table>
<?php foreach (array('firstname', 'lastname', 'email') as $field) { ?>
<tr>
<th><?php echo $elements[$field]['labelhtml']; ?></th>
<td><?php echo $elements[$field]['html']; ?></td>
</tr>
<?php if ($elements[$field]['error']) { ?>
<tr>
<td class="errmsg" colspan="2"><?php echo $elements[$field]['error']; ?></td>
</tr>
<?php } ?>
<?php } ?>
</table>
<div id="or"><?php echo get_string('Or...', 'admin'); ?></div>
<div class="choice"><input type="radio" name="createmethod" class="ic"<?php if (isset($_POST['createmethod']) && $_POST['createmethod'] == 'leap2a') { ?> checked="checked"<?php } ?> id="uploadleap" value="leap2a"> <label for="uploadleap"><?php echo get_string('uploadleap2afile', 'admin'); ?></label> <?php echo get_help_icon('core', 'admin', 'adduser', 'leap2afile'); ?></div>
<?php echo $elements['leap2afile']['html']; ?>
<?php if ($elements['leap2afile']['error']) { ?>
<div class="errmsg"><?php echo $elements['leap2afile']['error']; ?></div>
<?php } ?>
</div>
<div class="filler">&raquo;</div>
<div class="step step2">
<h3><?php echo get_string('basicdetails', 'admin'); ?></h3>
<p class="step-descript"><?php echo get_string('basicinformationforthisuser', 'admin'); ?></p>
<table>
<?php foreach(array('username', 'password', 'staff', 'admin', 'authinstance', 'quota', 'institutionadmin') as $field) { ?>
<tr>
<th><?php echo $elements[$field]['labelhtml']; ?></th>
<td><?php echo $elements[$field]['html']; ?></td>
</tr>
<?php if (isset($elements[$field]['error'])) { ?>
<tr>
<td class="errmsg" colspan="2"><?php echo $elements[$field]['error']; ?></td>
</tr>
<?php } ?>
<?php } ?>
</table>
</div>
<div class="filler">&raquo;</div>
<div class="step step3">
<h3><?php echo get_string('create', 'admin'); ?></h3>
<p class="step-descript"><?php echo get_string('clickthebuttontocreatetheuser', 'admin'); ?></p>
<div class="center"><?php echo $elements['submit']['html']; ?></div>
<div id="step3info"><?php echo get_string('userwillreceiveemailandhastochangepassword', 'admin'); ?></div>
<div class="panel-items mb0 ml0">
<div class="step step1 panel panel-default first" id="step1">
<h3 class="panel-heading"><?php echo get_string('usercreationmethod', 'admin'); ?></h3>
<div class="panel-body mbl">
<div class="choice">
<input type="radio" name="createmethod" class="ic"<?php if (!isset($_POST['createmethod']) || $_POST['createmethod'] == 'scratch') { ?> checked="checked"<?php } ?> id="createfromscratch" value="scratch">
<label for="createfromscratch"><?php echo get_string('createnewuserfromscratch', 'admin'); ?></label>
</div>
<?php foreach (array('firstname', 'lastname', 'email') as $field) { ?>
<div class="form-group">
<label><?php echo $elements[$field]['labelhtml']; ?></label>
<?php echo $elements[$field]['html']; ?>
<?php if ($elements[$field]['error']) { ?>
<p class="text-danger"><?php echo $elements[$field]['error']; ?></p>
<?php } ?>
</div>
<?php } ?>
</div>
<div class="option-alt panel-body pt0 pbxl">
<span class="option-alt-divider" id="or">
<?php echo get_string('Or', 'admin'); ?>
</span>
<div class="choice ptm mtxl pbl">
<input type="radio" name="createmethod" class="ic"<?php if (isset($_POST['createmethod']) && $_POST['createmethod'] == 'leap2a') { ?> checked="checked"<?php } ?> id="uploadleap" value="leap2a"> <label for="uploadleap"><?php echo get_string('uploadleap2afile', 'admin'); ?></label> <?php echo get_help_icon('core', 'admin', 'adduser', 'leap2afile'); ?>
</div>
<?php echo $elements['leap2afile']['html']; ?>
<?php if ($elements['leap2afile']['error']) { ?>
<div class="errmsg"><?php echo $elements['leap2afile']['error']; ?></div>
<?php } ?>
</div>
</div>
<div class="step step2 panel panel-default">
<h3 class="panel-heading"><?php echo get_string('basicdetails', 'admin'); ?></h3>
<div class="panel-body">
<?php foreach (array('username', 'password', 'staff', 'admin', 'authinstance', 'quota', 'institutionadmin') as $field) { ?>
<?php if (isset($elements[$field]['type'])) { ?>
<div class="form-group <?php echo $elements[$field]['type']; ?>">
<?php echo $elements[$field]['labelhtml']; ?>
<?php echo $elements[$field]['html']; ?>
<?php if (isset($elements[$field]['error'])) { ?>
<p class="text-danger"><?php echo $elements[$field]['error']; ?></p>
<?php } ?>
</div>
<?php } ?>
<?php } ?>
</div>
</div>
<div class="step step3 panel panel-default">
<h3 class="panel-heading"><?php echo get_string('create', 'admin'); ?></h3>
<div class="panel-body">
<!-- Button trigger modal -->
<button type="button" class="btn btn-link pl0" data-toggle="modal" data-target="#general-account-options">
<span class="icon icon-cog prs text-default"></span>
<?php echo get_string('accountoptionsdesc', 'account'); ?>
</button>
<div class="mtl">
<?php echo $elements['submit']['html']; ?>
</div>
<p class="metadata ptl"><?php echo get_string('userwillreceiveemailandhastochangepassword', 'admin'); ?></p>
</div>
</div>
</div>
</div>
<div id="adduseroptions">
<?php
<div class="modal fade" id="general-account-options" tabindex="-1" role="dialog" aria-labelledby="#general-account-options-label">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="general-account-options-title" id="general-account-options-label"><?php echo get_string('accountoptionsdesc', 'account'); ?></h4>
</div>
// Render account preferences with a renderer (inside this template :D)
$accountprefs = (object) expected_account_preferences();
$accountprefs = array_keys(general_account_prefs_form_elements($accountprefs));
$fieldset_elements = array();
foreach ($accountprefs as $p) {
$fieldset_elements[] = $elements[$p];
}
$accountoptions_fieldset = array(
'type' => 'fieldset',
'legend' => get_string('accountoptionsdesc', 'account'),
'collapsible' => true,
'collapsed' => true,
'elements' => $fieldset_elements,
);
$this->include_plugin('renderer', $this->data['renderer']);
$this->include_plugin('element', 'fieldset');
$this->build_element_html($accountoptions_fieldset);
echo pieform_render_element($this, $accountoptions_fieldset);
echo $hidden_elements;
echo '</form>';
?>
</div>
<div class="modal-body">
<?php
// Render account preferences with a renderer (inside this template :D)
$accountprefs = (object) expected_account_preferences();
$accountprefs = array_keys(general_account_prefs_form_elements($accountprefs));
$fieldset_elements = array();
foreach ($accountprefs as $p) {
$fieldset_elements[] = $elements[$p];
}
$accountoptions_fieldset = array(
'name' => 'generalaccountoptions',
'type' => 'fieldset',
'class' => 'last',
'elements' => $fieldset_elements,
);
$this->include_plugin('renderer', $this->data['renderer']);
$this->include_plugin('element', 'fieldset');
$this->build_element_html($accountoptions_fieldset);
echo pieform_render_element($this, $accountoptions_fieldset);
echo $hidden_elements;
?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</form>
......@@ -37,6 +37,10 @@
height: $input-height-base;
overflow: hidden;
width: 230px;
.form-condensed.pieform & {
max-width: 100%;
}
}
.dropdown-connect {
......@@ -84,84 +88,3 @@
}
}
.pieform,
.dropdown {
.picker {
position: relative;
background: #fff;
display: inline-block;
min-width: 20px;
max-width: 100%;
&:before {
content: "\25BE";
font-family: "FontAwesome";
margin-top: 9px;
position: absolute;
right: 0%;
top: 0;
z-index: 0;
height: 17px;
padding-left: 10px;
padding-right: 10px;
line-height: 16px;
z-index: 2;
}
select.form-control {
@include appearance(none);
position: relative;
padding-right: 30px;
background: transparent;
height: $input-height-base;
left: 0;
margin: 0;
outline: none;
cursor: pointer;
top