Commit 3586cf12 authored by Naomi Guyer's avatar Naomi Guyer Committed by Robert Lyon

Bootstrap tidy up fixes (BUG 1465107)

Change-Id: Icb22e6c2318630fe5043b73351af878fe85d5ad1
parent 8f8e8b3f
......@@ -87,28 +87,40 @@ EOF
$form = new Pieform(array(
'name' => 'buttons',
'renderer' => 'div',
'class' => 'btn-group',
'autofocus' => false,
'elements' => array(
'unsuspend' => array(
'class' => 'btn btn-default pt0',
'type' => 'submit',
'name' => 'unsuspend',
'value' => get_string('unsuspendusers', 'admin')
),
'delete' => array(
'class' => 'btn btn-default pt0',
'type' => 'submit',
'confirm' => get_string('confirmdeleteusers', 'admin'),
'name' => 'delete',
'value' => get_string('deleteusers', 'admin')
),
'unexpire' => array(
'class' => 'btn btn-default pt0',
'type' => 'submit',
'name' => 'unexpire',
'value' => get_string('unexpireusers', 'admin')
),
'buttons' => array(
'type' => 'fieldset',
'class' => 'btn-group btn-group-top',
'isformgroup' => false,
'elements' => array(
'unsuspend' => array(
'class' => 'btn-default text-inline',
'type' => 'submit',
'isformgroup' => false,
'renderelementsonly' => true,
'name' => 'unsuspend',
'value' => get_string('unsuspendusers', 'admin')
),
'delete' => array(
'class' => 'btn-default text-inline',
'type' => 'submit',
'isformgroup' => false,
'renderelementsonly' => true,
'confirm' => get_string('confirmdeleteusers', 'admin'),
'name' => 'delete',
'value' => get_string('deleteusers', 'admin')
),
'unexpire' => array(
'class' => 'btn-default text-inline',
'type' => 'submit',
'isformgroup' => false,
'renderelementsonly' => true,
'name' => 'unexpire',
'value' => get_string('unexpireusers', 'admin')
)
)
)
)
));
$smarty->assign('buttonformopen', $form->get_form_tag());
......
......@@ -1066,7 +1066,7 @@ class ArtefactTypeAnnotationfeedback extends ArtefactType {
$form = array(
'name' => 'add_annotation_feedback_form_' . $blockid,
'method' => 'post',
'class' => 'add_annotation_feedback_form',
'class' => 'add_annotation_feedback_form form-condensed',
'plugintype' => 'artefact',
'pluginname' => 'annotation',
'jsform' => true,
......@@ -1092,7 +1092,7 @@ class ArtefactTypeAnnotationfeedback extends ArtefactType {
}
$form['elements']['message'] = array(
'type' => 'wysiwyg',
'class' => 'pt0',
'class' => 'pt0 hide-label',
'title' => get_string('Annotationfeedback', 'artefact.annotation'),
'rows' => 5,
'cols' => 80,
......
......@@ -541,10 +541,13 @@ class ArtefactTypeComment extends ArtefactType {
return array(0, '');
}
$artefacttitle = $artefact->title;
$artefacturl = get_config('wwwroot') . 'artefact/artefact.php?view=' . $view->get('id') . '&artefact=' . $artefact->get('id');
if ($html) {
$smarty = smarty_core();
$smarty->assign('artefacturl', $artefacturl);
$smarty->assign('artefacttitle', $artefacttitle);
$smarty->assign('blockid', $blockid);
$smarty->assign('commentcount', $commentcount);
$smarty->assign('comments', $comments);
......@@ -715,7 +718,7 @@ class ArtefactTypeComment extends ArtefactType {
'class' => 'center',
'url' => $data->baseurl,
'jsonscript' => $data->jsonscript,
'datatable' => 'feedbacktable',
'datatable' => ($onview) ? 'feedbacktable' : 'commentlist',
'count' => $data->count,
'limit' => $data->limit,
'offset' => $data->offset,
......@@ -763,6 +766,7 @@ class ArtefactTypeComment extends ArtefactType {
$form['elements']['message'] = array(
'type' => 'wysiwyg',
'title' => get_string('message'),
'class' => 'hide-label',
'rows' => 5,
'cols' => 80,
'rules' => array('maxlength' => 8192),
......
......@@ -138,7 +138,7 @@ class PluginBlocktypeFolder extends PluginBlocktype {
),
'sortorder' => array(
'type' => 'select',
'labelhtml' => get_string('sortorder'),
'title' => get_string('sortorder'),
'defaultvalue' => isset($configdata['sortorder']) ? $configdata['sortorder'] : get_config_plugin('blocktype', 'folder', 'sortorder'),
'options' => array('asc' => get_string('ascending'), 'desc' => get_string('descending')),
),
......
......@@ -16,7 +16,7 @@ $string['title'] = 'Image gallery';
$string['description1'] = 'A collection of images from your files area or an external gallery';
$string['select'] = 'Image selection';
$string['selectfolder'] = 'Display all images from one of my folders (will include images uploaded later)';
$string['selectfolder'] = 'Display all images from a folder (includes images uploaded later)';
$string['selectimages'] = 'Choose individual images to display';
$string['selectexternal'] = 'Display images from external gallery';
$string['externalgalleryurl'] = 'Gallery URL or RSS';
......
......@@ -31,13 +31,12 @@ jQuery(function($) {
editor.show();
editor.focus();
document.location.href = "#" + formTop;
}
else {
$("#" + t).removeClass("js-hidden").focus();
}
});
}
};
simpleresume.connect_cancelbuttons = function() {
$("#resumefieldform input.submitcancel.cancel").click(function(e) {
......@@ -66,7 +65,7 @@ jQuery(function($) {
}
$("#" + t + "edit_container").find('input.openedit').focus();
});
}
};
simpleresume.simple_resumefield_init = function() {
this.connect_editbuttons();
......@@ -87,7 +86,7 @@ jQuery(function($) {
}
});
}
}
};
simpleresume.simple_resumefield_init();
});
......
......@@ -1244,7 +1244,7 @@ function auth_get_login_form() {
function auth_get_login_form_elements() {
// See if user can register
if (count_records('institution', 'registerallowed', 1, 'suspended', 0)) {
$registerlink = '<span class="mrm"><a class="btn btn-primary btn-xs" href="' . get_config('wwwroot') . 'register.php">' . get_string('register') . '</a></span>';
$registerlink = '<a class="btn btn-primary btn-xs" href="' . get_config('wwwroot') . 'register.php">' . get_string('register') . '</a> |';
}
else {
$registerlink = '';
......@@ -1253,6 +1253,7 @@ function auth_get_login_form_elements() {
$elements = array(
'login_username' => array(
'type' => 'text',
'class' => 'fullwidth',
'title' => get_string('username') . ':',
'description' => get_string('usernamedescription'),
'defaultvalue' => (isset($_POST['login_username'])) ? $_POST['login_username'] : '',
......@@ -1262,6 +1263,7 @@ function auth_get_login_form_elements() {
),
'login_password' => array(
'type' => 'password',
'class' => 'fullwidth',
'title' => get_string('password') . ':',
'description' => get_string('passworddescription'),
'defaultvalue' => '',
......@@ -1276,14 +1278,16 @@ function auth_get_login_form_elements() {
),
'register' => array(
'type' => 'markup',
'value' => '<div id="login-helplinks" class="panel-footer"><small>' . $registerlink
. '<a href="' . get_config('wwwroot') . 'forgotpass.php">' . get_string('lostusernamepassword') . '</a></small></div>'
'value' => '<div id="login-helplinks" class=" text-small">' . $registerlink
. '<a href="' . get_config('wwwroot') . 'forgotpass.php">' . get_string('lostusernamepassword') . '</a></div>'
),
);
$elements = array(
'login' => array(
'type' => 'container',
'class' => 'login',
'class' => 'login form-condensed',
'isformgroup' => false,
'elements' => $elements
)
);
......@@ -1306,7 +1310,7 @@ function auth_get_login_form_elements() {
if (!empty($extraelements) && $showbasicform) {
$loginlabel = array(
'type' => 'markup',
'value' => '<strong>'.get_string('orloginvia') . '</strong>'
'value' => get_string('orloginvia')
);
$extraelements = array_merge(array('label' => $loginlabel), $extraelements);
$keys = array_keys($extraelements);
......@@ -1319,7 +1323,8 @@ function auth_get_login_form_elements() {
$extraelements = array(
'login_extra' => array(
'type' => 'container',
'class' => 'login_extra',
'class' => 'login_extra panel-footer text-small',
'isformgroup' => false,
'elements' => $extraelements
)
);
......
......@@ -123,7 +123,7 @@ if ($available = Collection::available_views($owner, $groupid, $institutionname)
$checkboxes = array();
foreach ($available as $a) {
$checkboxes['view_'.$a->id] = array(
'class' => 'btn btn-default',
'class' => 'btn drag-default-button ',
'isformgroup' => false,
'type' => 'checkbox',
'title' => $a->title,
......
......@@ -64,15 +64,15 @@ if ($forums) {
'validatecallback' => 'subscribe_forum_validate',
'successcallback' => 'subscribe_forum_submit',
'autofocus' => false,
'renderer' => 'oneline',
'renderer' => 'div',
'class' => 'form-as-button',
'elements' => array(
'submit' => array(
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn btn-default btn-xs',
'value' => $forum->subscribed ? '<span class="fa fa-lg fa-times prs text-danger"></span> ' . get_string('Unsubscribe', 'interaction.forum') : '<span class="fa fa-lg fa-star prs text-success"></span> ' . get_string('Subscribe', 'interaction.forum'),
'class' => 'btn-default btn-sm',
'renderelementsonly' => true,
'value' => $forum->subscribed ? '<span class="icon icon-lg icon-times prs text-danger"></span> ' . get_string('Unsubscribe', 'interaction.forum') : '<span class="icon icon-lg icon-star prs text-success"></span> ' . get_string('Subscribe', 'interaction.forum'),
// 'help' => $i == 0 ? true : false
'help' => false
),
'forum' => array(
......
......@@ -131,7 +131,7 @@ function globalErrorHandler(data) {
function show_login_form(submit) {
if($('ajax-login-form') == null) {
var loginForm = DIV({id: 'ajax-login-form'});
var loginForm = DIV({id: 'ajax-login-form', 'class': 'modal-dialog'});
loginForm.innerHTML = '<h2>' + get_string('login') + '</h2><a href="/">&laquo; ' + get_string('home') + '<\/a><div id="loginmessage">' + get_string('sessiontimedout') + '</div><form class="pieform" name="login" method="post" action="" id="login" onsubmit="' + submit + '(this, 42); return false;"><table cellspacing="0" border="0" class="maharatable"><tbody><tr id="login_login_username_header" class="required text"><th><label for="login_login_username">' + get_string('username') + ':<\/label><\/th><\/tr><tr id="login_login_username_container"><td><input type="text" class="required text autofocus" id="login_login_username" name="login_username" value=""><\/td><\/tr><tr><td class="description"> <\/td><\/tr><tr id="login_login_password_header" class="required password"><th><label for="login_login_password">' + get_string('password') + ':<\/label><\/th><\/tr><tr id="login_login_password_container"><td><input type="password" class="required password" id="login_login_password" name="login_password" value=""><\/td><\/tr><tr><td class="description"> <\/td><\/tr><tr id="login_submit_container"><td><input type="submit" class="submit btn btn-success" id="login_submit" name="submit" value="' + get_string('login') + '"><\/td><\/tr><\/tbody><\/table><div id="homepage"><\/div><input type="hidden" name="sesskey" value=""><input type="hidden" name="pieform_login" value=""><\/form><script type="text\/javascript">var login_btn = null;addLoadEvent(function() { connect($(\'login_submit\'), \'onclick\', function() { login_btn = \'login_submit\'; });});connect(\'login\', \'onsubmit\', function() { formStartProcessing(\'login\', login_btn); });<\/script>';
appendChildNodes(document.body, DIV({id: 'overlay'}));
appendChildNodes(document.body, loginForm);
......
......@@ -136,7 +136,8 @@ var Paginator = function(id, list, heading, script, extradata) {
listdata = data.data.html ? data.data.html : data.data.tablerows,
paginationdata = data.data.pagination;
if (listdata.length === 0) {
if (listdata === undefined || listdata.length === 0) {
listdata = '<p class="no-results">' + get_string_ajax('noresultsfound', 'mahara') + '</p>';
}
......
......@@ -52,7 +52,7 @@ function addFeedbackSuccess(form, data) {
// Check if the form is displayed inside a modal
// then close the modal
if ($j('#feedback-form').length) {
$j('#feedback-form').modal('hide');
dock.hide();
}
}
......@@ -70,32 +70,21 @@ function isTinyMceUsed() {
return (typeof(tinyMCE) != 'undefined' && typeof(tinyMCE.get('add_feedback_form_message')) != 'undefined');
}
jQuery(function($j) {
if ($j('#toggle_watchlist_link').length) {
$j('#toggle_watchlist_link').click(function (e) {
e.preventDefault();
e.stopPropagation();
addLoadEvent(function () {
if ($('toggle_watchlist_link')) {
connect('toggle_watchlist_link', 'onclick', function (e) {
e.stop();
if (typeof artefactid === 'undefined') {
artefactid = 0;
artefactid = null;
}
$j.post(config.wwwroot + 'view/togglewatchlist.json.php', {
'view': viewid,
'artefact': artefactid,
'sesskey': config.sesskey
}).done(function(data) {
if (data.message.newtext) {
var icon = '<span class="icon icon-eye prs"></span>';
if (data.message.watched) {
icon = '<span class="icon icon-eye-slash prs"></span>';
}
$j('#toggle_watchlist_link').html(icon + data.message.newtext);
displayMessage(data.message.message, 'ok', true);
}
sendjsonrequest(config.wwwroot + 'view/togglewatchlist.json.php', {'view': viewid, 'artefact': artefactid}, 'POST', function(data) {
$('toggle_watchlist_link').innerHTML = data.newtext;
});
});
}
});
jQuery(function($j) {
$j(".copyview").each(function() {
$j(this).click(function(e) {
if (e.target.href.match(/collection=(.*)/)) {
......@@ -129,4 +118,4 @@ jQuery(function($j) {
}
});
});
});
\ No newline at end of file
});
......@@ -932,25 +932,7 @@
* Trigger an empty dock
*/
function showDock(newblock, replaceContent) {
var contentArea = newblock.find('.blockinstance-content'),
content = '<div class="dock-loading text-center ptxl mtxl"><span class="text-watermark icon icon-spinner icon-pulse icon-3x"></span></div>';
// Open form here even though it's currently empty (its quicker)
newblock.find('.blockinstance-header').html(get_string('loading'));
if (replaceContent) {
contentArea.html(content);
} else {
contentArea.append(content);
contentArea.find('.block-inner').addClass('hidden');
}
// Prevent disappearing scroll bars for interfering with smooth animation
$('body, .navbar-fixed-top').width($('body').width());
$('body').addClass('modal-open modal-open-docked');
newblock.removeClass('hidden').removeClass('closed').addClass('active');
dock.show(newblock, replaceContent, false);
}
function getConfigureForm(blockinstance) {
......@@ -1144,18 +1126,7 @@
function hideDock() {
window.setTimeout(function(){
$(window).trigger('colresize');
}, 300);
$('.configure').each( function() {
$(this).removeClass('active');
$(this).addClass('closed');
});
$('body, .navbar-fixed-top').width('auto');
$('body').removeClass('modal-open modal-open-docked');
dock.hide();
}
function swapNodes(a, b) {
......
......@@ -744,6 +744,7 @@ $string['filter'] = 'Filter';
$string['expand'] = 'Expand';
$string['collapse'] = 'Collapse';
$string['more...'] = 'More...';
$string['details'] = 'details';
$string['nohelpfound'] = 'There was no help found for this item.';
$string['nohelpfoundpage'] = 'There was no help found for this page.';
$string['couldnotgethelp'] = 'An error occurred trying to retrieve the help page.';
......@@ -1195,4 +1196,5 @@ $string['noResults'] = "No results found";
$string['searching'] = "Searching...";
// Miscellaneous (please keep these alphabetized)
$string['cli_incorrect_value'] = 'Incorrect value, please retry.';
\ No newline at end of file
$string['cli_incorrect_value'] = 'Incorrect value, please retry.';
$string['version.'] = 'v.'; // version shortname, used when duplicating pages and collections
......@@ -193,15 +193,21 @@ class Collection {
* Generates a name for a newly created Collection
*/
private static function new_name($name, $ownerdata) {
$extText = get_string('version.', 'mahara');
$tempname = preg_split('/ '. $extText . '[0-9]$/', $name);
$name = $tempname[0];
$taken = get_column_sql('
SELECT name
FROM {collection}
WHERE ' . self::owner_sql($ownerdata) . "
AND name LIKE ? || '%'", array($name));
$ext = ''; $i = 0;
$ext = '';
$i = 1;
if ($taken) {
while (in_array($name . $ext, $taken)) {
$ext = ' (' . ++$i . ')';
$ext = ' ' . $extText . ++$i;
}
}
return $name . $ext;
......
......@@ -40,7 +40,7 @@ function pieform_renderer_div(Pieform $form, $element) {/*{{{*/
$inner = '';
// allow forms to be rendered without a wrapping div
if (!isset($element['renderelementsonly'])){
if (!isset($element['renderelementsonly'])) {
$prefix = '<div';
if (isset($element['name'])) {
......
......@@ -5193,7 +5193,8 @@ class View {
* Generates a title for a newly created View
*/
private static function new_title($title, $ownerdata) {
$temptitle = split(' v.[0-9]', $title);
$extText = get_string('version.', 'mahara');
$temptitle = preg_split('/ '. $extText . '[0-9]$/', $title);
$title = $temptitle[0];
$taken = get_column_sql('
......@@ -5203,11 +5204,10 @@ class View {
AND title LIKE ? || '%'", array($title));
$ext = '';
$i = 0;
$i = 1;
if ($taken) {
while (in_array($title . $ext, $taken)) {
$ext = ' v.' . ++$i;
$ext = ' ' . $extText . ++$i;
}
}
return $title . $ext;
......@@ -6091,16 +6091,16 @@ function create_view_form($group=null, $institution=null, $template=null, $colle
'type' => 'hidden',
'value' => true,
),
'submitcollection' => array(
'type' => 'hidden',
'value' => false,
),
'submit' => array(
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn btn-default',
'value' => '<span class="icon icon-plus icon-lg text-success prs"></span>' . get_string('createview', 'view'),
),
'submitcollection' => array(
'type' => 'hidden',
'value' => false,
)
)
);
if ($group) {
......@@ -6127,7 +6127,9 @@ function create_view_form($group=null, $institution=null, $template=null, $colle
'value' => $collection,
);
$form['elements']['submitcollection'] = array(
'type' => 'submit',
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn btn-sm btn-default',
'value' => get_string('copycollection', 'collection'),
);
}
......@@ -6137,6 +6139,7 @@ function create_view_form($group=null, $institution=null, $template=null, $colle
'value' => $template,
);
$form['elements']['submit']['value'] = get_string('copyview', 'view');
$form['elements']['submit']['class'] = 'btn btn-default btn-sm mrm';
$form['name'] .= $template;
}
return $form;
......
......@@ -3911,7 +3911,7 @@ function build_pagination($params) {
$output .= '<div class="lead text-small results pull-right">' . $params['count'] . ' ' . $resultsstr . '</div>';
}
$output .= '<nav><ul class="pagination pagination-xs">';
$output .= '<ul class="pagination pagination-xs">';
if ($params['limit'] && ($params['limit'] < $params['count'])) {
$pages = ceil($params['count'] / $params['limit']);
......@@ -4068,7 +4068,7 @@ function build_pagination($params) {
$strlimitoptions[] = "<option value = '$limitoptions[$i]'> $limitoptions[$i] </option>";
}
}
$output .= '</ul></nav>';
$output .= '</ul>';
$output .= '<form class="form-pagination js-pagination form-inline pagination-page-limit dropdown" action="' . hsc($params['url']) . '" method="POST">
<label for="setlimitselect" class="set-limit"> ' . $params['limittext'] . ' </label>' .
'<span class="picker input-sm"><select id="setlimitselect" class="js-pagination input-sm select form-control" name="limit"> '.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/*jslint browser: true, nomen: true, white: true */
/* global jQuery, $ */
/*
* Customisation on top of bootstrap's modal css to allow modals to become slide-in docks
*
* Works with bootstraps modal html init methods with modifications:
* * Add a modal-docked class to the modal
* * Use data-toggle="modal-docked" for the trigger (rather than data-toggle="modal")
* * Use data-dismiss="modal-docked" to the modal's close button (rather than data-dismiss="modal")
*/
var dock = {};
jQuery(function($) {
"use strict";
/*
* Control the hiding of our dock and trigger the necessary events
*/
dock.hide = function() {
window.setTimeout(function(){
$(window).trigger('colresize');
}, 300);
$('.modal-docked').each( function() {
$(this).removeClass('active');
$(this).addClass('closed');
});
$('body, .navbar-fixed-top').width('auto');
$('body').removeClass('modal-open modal-open-docked');
};
/*
* Control showing out dock and trigger the necessary events
*
* @param newblock | Object, replaceContent Boolean, hasContent Boolean (for prefilled modals)
*/
dock.show = function(newblock, replaceContent, hasContent) {
var contentArea = newblock.find('.modal-body'),
content = this.getLoadingIndicator();
// If we are filling the modal dynamically (c.f page builder)
if (hasContent) {
// Dock alreay has content
}
else {
// Open form here even though it's currently empty (its quicker)
newblock.find('.modal-title').html(get_string('loading'));
if (replaceContent) {
contentArea.html(content);
}
else {
contentArea.append(content);
contentArea.find('.block-inner').addClass('hidden');
}
}
// Prevent disappearing scroll bars from interfering with smooth animation
$('body, .navbar-fixed-top').width($('body').width());
$('body').addClass('modal-open modal-open-docked');
newblock.removeClass('hidden').removeClass('closed').addClass('active');
};
dock.getLoadingIndicator = function() {
return '<div class="modal-loading"></div>';
};
dock.init = function(){
$('[data-toggle="modal-docked"]').on('click', function(e){
e.preventDefault();
var targetID = $(this).attr('data-target'),
target = $(targetID);