Commit 74b5a5e0 authored by Naomi Guyer's avatar Naomi Guyer Committed by Aaron Wells
Browse files

Page Builder and BUG fixes (bootstrap)

Bug 1465107: Use Bootstrap CSS Framework

Change-Id: I332f8f2ea0c317b5171fe9163912c760f6bc2c77
parent 5fba0303
......@@ -59,8 +59,6 @@ if (!isset($options[$type])) {
require_once('activity.php');
$activitylist = activitylist_html($type);
$star = json_encode($THEME->get_image_url('star'));
$readicon = json_encode($THEME->get_image_url('readusermessage'));
$strread = json_encode(get_string('read', 'activity'));
$javascript = <<<JAVASCRIPT
......
......@@ -206,7 +206,8 @@ if (!empty($institutions) &&
'defaultvalue' => $USER->studentid,
),
'submit' => array(
'type' => 'submit',
'class' => 'btn btn-success',
'type' => 'submit',
'value' => get_string('sendrequest'),
),
)
......
......@@ -101,10 +101,9 @@ foreach ($iframesources as $url => $name) {
'value' => $url,
),
'submit' => array(
'type' => 'image',
'src' => $THEME->get_image_url('btn_deleteremove'),
'alt' => get_string('deletespecific', 'mahara', $name),
'elementtitle' => get_string('delete'),
'type' => 'submit',
'value' => get_string('deletespecific', 'mahara', $name),
'confirm' => get_string('confirmdeletemenuitem', 'admin'),
),
),
......
......@@ -60,7 +60,7 @@ $calendar = array(
'tabindex' => false,
'type' => 'calendar',
'title' => get_string('date'),
'imagefile' => $THEME->get_image_url('btn_calendar'),
'imagefile' => $THEME->get_url('images/calendar.png'),
'defaultvalue' => strtotime($search->loggedindate),
'caloptions' => array(
'showsTime' => true,
......@@ -77,7 +77,7 @@ $calendarform = new Pieform(array(
$calendarform->include_plugin('element', 'calendar');
$loggedindate = pieform_element_calendar($calendarform, $calendar);
$searchParams = $search; //store search as it's about to change
$searchParams = $search; //store search as it's about to change
list($html, $columns, $pagination, $search) = build_admin_user_search_results($search, $offset, $limit);
......
......@@ -1066,7 +1066,7 @@ class ArtefactTypeAnnotationfeedback extends ArtefactType {
$form = array(
'name' => 'add_annotation_feedback_form_' . $blockid,
'method' => 'post',
'class' => 'js-hidden hidden add_annotation_feedback_form',
'class' => 'add_annotation_feedback_form',
'plugintype' => 'artefact',
'pluginname' => 'annotation',
'jsform' => true,
......@@ -1092,6 +1092,7 @@ class ArtefactTypeAnnotationfeedback extends ArtefactType {
}
$form['elements']['message'] = array(
'type' => 'wysiwyg',
'class' => 'pt0',
'title' => get_string('Annotationfeedback', 'artefact.annotation'),
'rows' => 5,
'cols' => 80,
......@@ -1131,6 +1132,7 @@ class ArtefactTypeAnnotationfeedback extends ArtefactType {
}
$form['elements']['submit'] = array(
'type' => 'submitcancel',
'class' => 'btn btn-default',
'value' => array(get_string('placeannotationfeedback', 'artefact.annotation'), get_string('cancel')),
'goto' => '/' . $view->get_url(false),
);
......
......@@ -148,8 +148,6 @@ $extrastylesheets = array('style/views.css');
if ($artefact->get('allowcomments') && ( $USER->is_logged_in() || (!$USER->is_logged_in() && get_config('anonymouscomments')))) {
$addfeedbackform = pieform(ArtefactTypeComment::add_comment_form(false, $artefact->get('approvecomments')));
$extrastylesheets[] = 'style/jquery.rating.css';
$javascript[] = 'jquery.rating';
}
$objectionform = pieform(objection_form());
if ($notrudeform = notrude_form()) {
......
......@@ -38,6 +38,16 @@ class PluginBlocktypeBlog extends PluginBlocktype {
return array('blog' => 10000);
}
//{$WWWROOT}artefact/blog/post.php?blog={$blogid
public static function get_link(BlockInstance $instance) {
$configdata = $instance->get('configdata');
if (!empty($configdata['artefactid'])) {
$data = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $configdata['artefactid'] . '&view=' . $instance->get('view');
return sanitize_url($data);
}
}
public static function render_instance(BlockInstance $instance, $editing=false) {
global $exporter;
$configdata = $instance->get('configdata');
......@@ -201,28 +211,6 @@ class PluginBlocktypeBlog extends PluginBlocktype {
);
}
/**
* Optional method. If specified, allows the blocktype class to munge the
* artefactchooser element data before it's templated
*/
//public static function artefactchooser_get_element_data($artefact) {
// static $blognames = array();
// if (!isset($blognames[$artefact->parent])) {
// $blognames[$artefact->parent] = get_field('artefact', 'title', 'id', $artefact->parent);
// }
// $artefact->blog = $blognames[$artefact->parent];
// $ellipsis = '';
// $artefact->description = trim(strip_tags($artefact->description));
// if (strlen($artefact->description) > 100) {
// $ellipsis = '…';
// }
// $artefact->description = substr($artefact->description, 0, 100) . $ellipsis;
// return $artefact;
//}
public static function default_copy_type() {
return 'nocopy';
}
......
......@@ -72,6 +72,7 @@ class PluginArtefactBlog extends PluginArtefact {
return array(
'type' => 'fieldset',
'name' => 'advanced',
'class' => 'first last',
'collapsible' => true,
'collapsed' => false,
'legend' => get_string('moreoptions', 'artefact.blog'),
......@@ -445,12 +446,13 @@ class ArtefactTypeBlog extends ArtefactType {
'value' => $id,
),
'submit' => array(
'type' => 'submit',
'class' => 'input-as-icon icon-trash',
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn btn-default btn-sm',
'alt' => get_string('deletespecific', 'mahara', $title),
'elementtitle' => get_string('delete'),
'confirm' => $confirm,
'value' => get_string('delete'),
'value' => '<span class="fa fa-trash text-danger prs"></span> ' .get_string('delete'),
),
),
));
......@@ -942,17 +944,17 @@ class ArtefactTypeBlogPost extends ArtefactType {
$published = $post->published;
}
if ($published) {
$strchangepoststatus = get_string('unpublish', 'artefact.blog');
$strchangepoststatus = '<span class="prs fa fa-times text-danger"></span> ' .get_string('unpublish', 'artefact.blog');
}
else {
$strchangepoststatus = get_string('publish', 'artefact.blog');
$strchangepoststatus = '<span class="prs fa fa-check text-success"></span> ' . get_string('publish', 'artefact.blog');
}
return pieform(array(
'name' => 'changepoststatus_' . $id,
'jssuccesscallback' => 'changepoststatus_success',
'successcallback' => 'changepoststatus_submit',
'jsform' => true,
'renderer' => 'oneline',
'renderer' => 'div',
'elements' => array(
'changepoststatus' => array(
'type' => 'hidden',
......@@ -962,10 +964,10 @@ class ArtefactTypeBlogPost extends ArtefactType {
'type' => 'hidden',
'value' => $published,
),'submit' => array(
'type' => 'submit',
'class' => 'publish btn btn-success btn-xs',
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn btn-default btn-sm publish',
'value' => $strchangepoststatus,
'help' => true,
),
),
));
......@@ -978,7 +980,8 @@ class ArtefactTypeBlogPost extends ArtefactType {
'successcallback' => 'delete_submit',
'jsform' => true,
'jssuccesscallback' => 'delete_success',
'renderer' => 'oneline',
'renderer' => 'div',
'class' => 'form-as-button pull-left',
'elements' => array(
'delete' => array(
'type' => 'hidden',
......@@ -986,11 +989,12 @@ class ArtefactTypeBlogPost extends ArtefactType {
'help' => true,
),
'submit' => array(
'type' => 'submit',
'class' => 'input-as-icon icon-trash',
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn btn-default btn-sm',
'elementtitle' => get_string('delete'),
'confirm' => get_string('deleteblogpost?', 'artefact.blog'),
'value' => get_string('delete'),
'value' => '<span class="fa fa-trash text-danger"></span><span class="btn-title pls">' .get_string('delete') . '</span>',
),
),
));
......
......@@ -127,7 +127,6 @@ $form = pieform(array(
'licensing_advanced' => license_form_el_advanced(isset($blogpostobj) ? $blogpostobj : null),
'filebrowser' => array(
'type' => 'filebrowser',
'class' => 'filebrowser',
'title' => get_string('attachments', 'artefact.blog'),
'folder' => $folder,
'highlight' => $highlight,
......
......@@ -85,17 +85,19 @@ $strchangepoststatuspublish = json_encode(get_string('publish', 'artefact.blog')
$strchangepoststatusunpublish = json_encode(get_string('unpublish', 'artefact.blog'));
$js = <<<EOF
function changepoststatus_success(form, data) {
if ($('changepoststatus_' + data.id + '_currentpoststatus').value == 0) {
console.log($('changepoststatus_' + data.id + '_currentpoststatus'));
if ($('changepoststatus_' + data.id + '_currentpoststatus').value === "0") {
removeElementClass($('posttitle_' + data.id), 'draft');
addElementClass($('posttitle_' + data.id), 'published');
$('poststatus' + data.id).innerHTML = {$strpublished};
$('changepoststatus_' + data.id + '_submit').value = {$strchangepoststatusunpublish};
$('changepoststatus_' + data.id + '_submit').innerHTML = '<span class="prs fa fa-times text-danger"></span> ' + {$strchangepoststatusunpublish};
}
else {
removeElementClass($('posttitle_' + data.id), 'published');
addElementClass($('posttitle_' + data.id), 'draft');
$('poststatus' + data.id).innerHTML = {$strdraft};
$('changepoststatus_' + data.id + '_submit').value = {$strchangepoststatuspublish};
$('changepoststatus_' + data.id + '_submit').innerHTML = '<span class="prs fa fa-check text-success"></span>' + {$strchangepoststatuspublish};
}
}
function delete_success(form, data) {
......
......@@ -11,6 +11,6 @@
defined('INTERNAL') || die();
$string['title'] = 'Feedback';
$string['description'] = 'A block to display feedback';
$string['ineditordescription1'] = 'Feedback for this page will be displayed here rather than at the bottom of the page.';
$string['title'] = 'Comments';
$string['description'] = 'A block to display comments';
$string['ineditordescription1'] = 'Comments for this page will be displayed here rather than at the bottom of the page.';
......@@ -22,6 +22,7 @@ class PluginBlocktypeComment extends SystemBlocktype {
}
public static function get_title() {
return get_string('title', 'blocktype.comment/comment');
}
......@@ -40,9 +41,7 @@ class PluginBlocktypeComment extends SystemBlocktype {
public static function render_instance(BlockInstance $instance, $editing=false) {
global $USER;
if ($editing) {
return get_string('ineditordescription1', 'blocktype.comment/comment');
}
// Feedback list pagination requires limit/offset params
$limit = param_integer('limit', 10);
$offset = param_integer('offset', 0);
......@@ -80,6 +79,13 @@ class PluginBlocktypeComment extends SystemBlocktype {
$smarty->assign('enablecomments', 1);
$smarty->assign('addfeedbackpopup', $addfeedbackpopup);
}
if ($editing) {
$smarty->assign('editing', get_string('ineditordescription1', 'blocktype.comment/comment'));
}
$html = $smarty->fetch('blocktype:comment:comment.tpl');
return $html;
}
......
......@@ -180,8 +180,8 @@ function edit_comment_notify($view, $author, $owner) {
activity_occurred('maharamessage', $data);
}
$stylesheets = array('style/jquery.rating.css');
$smarty = smarty(array('jquery.rating'), array(), array(), array('stylesheets' => $stylesheets));
$smarty = smarty(array(), array(), array(), array());
$smarty->assign('PAGEHEADING', TITLE);
$smarty->assign('strdescription', get_string('editcommentdescription', 'artefact.comment', $maxage));
$smarty->assign('form', $form);
......
......@@ -733,7 +733,6 @@ class ArtefactTypeComment extends ArtefactType {
$form = array(
'name' => 'add_feedback_form',
'method' => 'post',
'class' => 'js-hidden',
'plugintype' => 'artefact',
'pluginname' => 'comment',
'jsform' => true,
......@@ -797,7 +796,8 @@ class ArtefactTypeComment extends ArtefactType {
}
$form['elements']['submit'] = array(
'type' => 'submitcancel',
'value' => array(get_string('placefeedback', 'artefact.comment'), get_string('cancel')),
'class' => 'btn btn-default',
'value' => array(get_string('Comment', 'artefact.comment'), get_string('cancel')),
);
return $form;
}
......@@ -805,31 +805,34 @@ class ArtefactTypeComment extends ArtefactType {
public static function make_public_form($id) {
return array(
'name' => 'make_public',
'renderer' => 'oneline',
'renderer' => 'div',
'class' => 'form-as-button',
'elements' => array(
'comment' => array('type' => 'hidden', 'value' => $id),
'submit' => array(
'type' => 'submit',
'class' => 'quiet',
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn btn-link btn-xs',
'name' => 'make_public_submit',
'value' => get_string('makepublic', 'artefact.comment'),
'value' => '<span class="fa fa-lock text-default prs"></span>' . get_string('makepublic', 'artefact.comment'),
),
),
);
}
public static function delete_comment_form($id) {
global $THEME;
global $THEME;
return array(
'name' => 'delete_comment',
'renderer' => 'oneline',
'renderer' => 'div',
'class' => 'form-as-button',
'elements' => array(
'comment' => array('type' => 'hidden', 'value' => $id),
'submit' => array(
'type' => 'image',
'src' => $THEME->get_image_url('btn_deleteremove'),
'value' => get_string('delete'),
'elementtitle' => get_string('delete'),
'type' => 'button',
'usebuttontag' => true,
'class' => 'btn btn-link btn-sm',
'value' => '<span class="fa fa-trash fa-lg text-danger"></span> <span class="sr-only">' . get_string('delete') . '</span>',
'confirm' => get_string('reallydeletethiscomment', 'artefact.comment'),
'name' => 'delete_comment_submit',
),
......@@ -906,7 +909,7 @@ class ArtefactTypeComment extends ArtefactType {
return array(
'name' => 'commentconfig',
'elements' => $elements,
'renderer' => 'table'
'renderer' => 'div'
);
}
......
......@@ -48,6 +48,7 @@ class PluginBlocktypeFiledownload extends PluginBlocktype {
'description' => $artefact->get('description'),
'size' => $artefact->get('size'),
'ctime' => $artefact->get('ctime'),
'artefacttype' => $artefact->get('artefacttype'),
'iconsrc' => call_static_method(
generate_artefact_class_name($artefact->get('artefacttype')),
'get_icon',
......@@ -82,7 +83,16 @@ class PluginBlocktypeFiledownload extends PluginBlocktype {
safe_require('artefact', 'file');
$instance->set('artefactplugin', 'file');
return array(
'artefactids' => self::filebrowser_element($instance, (isset($configdata['artefactids'])) ? $configdata['artefactids'] : null),
'artefactfieldset' => array(
'type' => 'fieldset',
'collapsible' => true,
'collapsed' => true,
'legend' => get_string('Files', 'blocktype.file/filedownload'),
'class' => 'last mtl',
'elements' => array(
'artefactid' => self::filebrowser_element($instance, (isset($configdata['artefactids'])) ? $configdata['artefactids'] : null)
)
)
);
}
......@@ -95,6 +105,7 @@ class PluginBlocktypeFiledownload extends PluginBlocktype {
'blocktype' => 'filedownload',
'limit' => 10,
'selectone' => false,
'selectmodal' => true,
'artefacttypes' => array('file', 'image', 'profileicon'),
'template' => 'artefact:file:artefactchooser-element.tpl',
);
......@@ -113,6 +124,7 @@ class PluginBlocktypeFiledownload extends PluginBlocktype {
$element['title'] = get_string('Files', 'blocktype.file/filedownload');
$element['name'] = 'artefactids';
$element['config']['selectone'] = false;
$element['config']['selectmodal'] = true;
return $element;
}
......
......@@ -126,7 +126,16 @@ class PluginBlocktypeFolder extends PluginBlocktype {
safe_require('artefact', 'file');
$instance->set('artefactplugin', 'file');
$elements = array(
'artefactid' => self::filebrowser_element($instance, (isset($configdata['artefactid'])) ? array($configdata['artefactid']) : null),
'artefactfieldset' => array(
'type' => 'fieldset',
'collapsible' => true,
'collapsed' => true,
'legend' => get_string('Folders', 'artefact.file'),
'class' => 'last select-file mtl',
'elements' => array(
'artefactid' => self::filebrowser_element($instance, (isset($configdata['artefactid'])) ? array($configdata['artefactid']) : null),
)
),
'sortorder' => array(
'type' => 'select',
'labelhtml' => get_string('sortorder'),
......
......@@ -42,7 +42,6 @@ class PluginBlocktypeGallery extends PluginBlocktype {
public static function get_instance_config_javascript(BlockInstance $instance) {
return array(
'js/configform.js',
'js/slideshow.js',
);
}
......@@ -668,6 +667,7 @@ class PluginBlocktypeGallery extends PluginBlocktype {
$element['class'] = $class;
}
$element['config']['selectone'] = false;
$element['config']['selectmodal'] = true;
$element['filters'] = array(
'artefacttype' => array('image', 'profileicon'),
);
......
......@@ -64,7 +64,16 @@ class PluginBlocktypeHtml extends PluginBlocktype {
safe_require('artefact', 'file');
$instance->set('artefactplugin', 'file');
return array(
'artefactid' => self::filebrowser_element($instance, (isset($configdata['artefactid'])) ? array($configdata['artefactid']) : null),
'artefactfieldset' => array(
'type' => 'fieldset',
'collapsible' => true,
'collapsed' => true,
'legend' => get_string('file', 'artefact.file'),
'class' => 'last select-file mtl',
'elements' => array(
'artefactid' => self::filebrowser_element($instance, (isset($configdata['artefactid'])) ? array($configdata['artefactid']) : null),
)
),
);
}
......
......@@ -79,8 +79,19 @@ class PluginBlocktypeImage extends PluginBlocktype {
$configdata = $instance->get('configdata');
safe_require('artefact', 'file');
$instance->set('artefactplugin', 'file');
$filebrowser = self::filebrowser_element($instance, (isset($configdata['artefactid'])) ? array($configdata['artefactid']) : null);
return array(
'artefactid' => self::filebrowser_element($instance, (isset($configdata['artefactid'])) ? array($configdata['artefactid']) : null),
'artefactfieldset' => array(
'type' => 'fieldset',
'collapsible' => true,
'collapsed' => true,
'legend' => get_string('image'),
'class' => 'last select-file mtl',
'elements' => array(
'artefactid' => $filebrowser
)
),
'showdescription' => array(
'type' => 'switchbox',
'title' => get_string('showdescription', 'blocktype.file/image'),
......@@ -106,6 +117,7 @@ class PluginBlocktypeImage extends PluginBlocktype {
$element['name'] = 'artefactid';
$element['accept'] = 'image/*';
$element['config']['selectone'] = true;
$element['config']['selectmodal'] = true;
$element['filters'] = array(
'artefacttype' => array('image', 'profileicon'),
);
......@@ -120,6 +132,7 @@ class PluginBlocktypeImage extends PluginBlocktype {
'defaultvalue' => $default,
'blocktype' => 'image',
'limit' => 10,
'selectmodal' => true,
'artefacttypes' => array('image', 'profileicon'),
'template' => 'artefact:file:artefactchooser-element.tpl',
);
......@@ -136,5 +149,4 @@ class PluginBlocktypeImage extends PluginBlocktype {
public static function default_copy_type() {
return 'full';
}
}
......@@ -57,7 +57,7 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
return get_string('typeremoved', 'blocktype.file/internalmedia');
}
$callbacks = self::get_all_filetype_players();
$result .= '<div class="mediaplayer-container center"><div class="mediaplayer">' . call_static_method('PluginBlocktypeInternalmedia', $callbacks[$mimetypefiletypes[$mimetype]], $artefact, $instance, $width, $height) . '</div></div>';
$result .= '<div class="mediaplayer-container panel-body"><div class="mediaplayer">' . call_static_method('PluginBlocktypeInternalmedia', $callbacks[$mimetypefiletypes[$mimetype]], $artefact, $instance, $width, $height) . '</div></div>';
if ($artefactid) {
require_once(get_config('docroot') . 'artefact/comment/lib.php');
......@@ -89,8 +89,18 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
$configdata = $instance->get('configdata');
safe_require('artefact', 'file');
$instance->set('artefactplugin', 'file');
$filebrowser = self::filebrowser_element($instance, (isset($configdata['artefactid'])) ? array($configdata['artefactid']) : null);
return array(
'artefactid' => self::filebrowser_element($instance, (isset($configdata['artefactid'])) ? array($configdata['artefactid']) : null),
'artefactfieldset' => array(
'type' => 'fieldset',
'collapsible' => true,
'collapsed' => true,
'legend' => get_string('media', 'blocktype.file/internalmedia'),
'class' => 'last select-file mtl',
'elements' => array(
'artefactid' => $filebrowser
)
),
'width' => array(
'type' => 'text',
'title' => get_string('width'),
......@@ -268,7 +278,7 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
'allowscriptaccess' => 'never',
'allownetworking' => 'never'
);
$html = '<a href="' . $url . '">' . hsc($artefact->get('title')) . '</a><br>
$html = '<a class="media-link" href="' . $url . '">' . hsc($artefact->get('title')) . '</a><br>
<span class="blocktype_internalmedia_mp3" id="' . $id . '">('
. get_string('flashanimation', 'blocktype.file/internalmedia') . ')</span>
<script type="application/javascript">
......@@ -306,6 +316,7 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
$baseurl = $baseurlpath . 'artefact/file/blocktype/internalmedia/';
$playerurl = $baseurl . 'mahara-flashplayer/mahara-flashplayer.swf';
$filesize = round($artefact->get('size') / 1000000, 2) . 'MB';
$autohide = 'true';
$type = '';
$audio = '';
......@@ -320,10 +331,11 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
}';
}
$html = '<a href="' . $url . '">' . hsc($artefact->get('title')) . '</a><br>
<span class="blocktype_internalmedia_mp3" id="' . $id . '" style="display:block;width:'.$width.'px;height:'.$height.'px;"></span>
<span id="' . $id . '_h">' . get_string('flashanimation', 'blocktype.file/internalmedia') . '</span>
<script type="application/javascript">
$html = '<span class="blocktype_internalmedia_mp3" id="' . $id . '" style="display:block;width:'.$width.'px;height:'.$height.'px;"></span>';
$html .= '<span id="' . $id . '_h">' . get_string('flashanimation', 'blocktype.file/internalmedia') . '</span>';
$html .= '<div class="ptm"><span class="fa fa-download prs"></span><span class="sr-only">'.get_string('Download', 'artefact.internal').'</span><a class="media-link" href="' . $url . '">' . hsc($artefact->get('title')) . '</a>';
$html .= '<span class="text-muted"> ['.$filesize.'] </span></div>';
$html .= '<script type="application/javascript">
flowplayer("'.$id.'", "'.$playerurl.'", {
clip: {
url: "'.$escapedurl.'",
......@@ -361,7 +373,7 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
$mimetype = $artefact->get('filetype');
$autostart = 'false';
return '<a href="' . $url . '">' . hsc($artefact->get('title')) . '</a><br>'
return '<a class="media-link" href="' . $url . '">' . hsc($artefact->get('title')) . '</a><br>'
. '<span class="blocktype_internalmedia_real">
<script type="application/javascript">
//<![CDATA[
......@@ -394,7 +406,7 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
$mimetype = 'video/x-ms-wmv'; // hardcode this
$autostart = 'false';
return '<a href="' . $url . '">' . hsc($artefact->get('title')) . '</a><br>'
return '<a class="media-link" href="' . $url . '">' . hsc($artefact->get('title')) . '</a><br>'