Commit 0d5637a6 authored by Pat Kira's avatar Pat Kira Committed by Aaron Wells
Browse files

Profile files, journals, and resumes (bootstrap)

Bug 1465107: Use Bootstrap CSS Framework
Style profile file page
Refinements
Style profile file browser
Style journal page
Edit journal page (work in progrerss)
Tidy up sideblock and blockinstances
Style edit journal view (completed)
Style resume introduction page

Change-Id: I662d8120952c371f7dec57ecf7cd84978c5177d2
parent 29c6d7ae
...@@ -894,7 +894,6 @@ class ArtefactTypeBlogPost extends ArtefactType { ...@@ -894,7 +894,6 @@ class ArtefactTypeBlogPost extends ArtefactType {
} }
} }
/**
/** /**
* This function creates a new blog post. * This function creates a new blog post.
* *
...@@ -965,7 +964,7 @@ class ArtefactTypeBlogPost extends ArtefactType { ...@@ -965,7 +964,7 @@ class ArtefactTypeBlogPost extends ArtefactType {
'value' => $published, 'value' => $published,
),'submit' => array( ),'submit' => array(
'type' => 'submit', 'type' => 'submit',
'class' => 'publish', 'class' => 'publish btn btn-success btn-xs',
'value' => $strchangepoststatus, 'value' => $strchangepoststatus,
'help' => true, 'help' => true,
), ),
...@@ -988,9 +987,8 @@ class ArtefactTypeBlogPost extends ArtefactType { ...@@ -988,9 +987,8 @@ class ArtefactTypeBlogPost extends ArtefactType {
'help' => true, 'help' => true,
), ),
'submit' => array( 'submit' => array(
'type' => 'image', 'type' => 'submit',
'src' => $THEME->get_image_url('btn_deleteremove'), 'class' => 'input-as-icon icon-trash',
'alt' => get_string('deletespecific', 'mahara', $title),
'elementtitle' => get_string('delete'), 'elementtitle' => get_string('delete'),
'confirm' => get_string('deleteblogpost?', 'artefact.blog'), 'confirm' => get_string('deleteblogpost?', 'artefact.blog'),
'value' => get_string('delete'), 'value' => get_string('delete'),
......
...@@ -57,6 +57,7 @@ $form = pieform(array( ...@@ -57,6 +57,7 @@ $form = pieform(array(
'licensing_advanced' => license_form_el_advanced(null), 'licensing_advanced' => license_form_el_advanced(null),
'submit' => array( 'submit' => array(
'type' => 'submitcancel', 'type' => 'submitcancel',
'class' => 'btn btn-success',
'value' => array( 'value' => array(
get_string('createblog', 'artefact.blog'), get_string('createblog', 'artefact.blog'),
get_string('cancel', 'artefact.blog') get_string('cancel', 'artefact.blog')
......
...@@ -163,6 +163,7 @@ $form = pieform(array( ...@@ -163,6 +163,7 @@ $form = pieform(array(
), ),
'submitpost' => array( 'submitpost' => array(
'type' => 'submitcancel', 'type' => 'submitcancel',
'class' => 'btn btn-success',
'value' => array(get_string('savepost', 'artefact.blog'), get_string('cancel')), 'value' => array(get_string('savepost', 'artefact.blog'), get_string('cancel')),
'goto' => get_config('wwwroot') . 'artefact/blog/view/index.php?id=' . $blog, 'goto' => get_config('wwwroot') . 'artefact/blog/view/index.php?id=' . $blog,
) )
......
...@@ -75,6 +75,7 @@ $form = pieform(array( ...@@ -75,6 +75,7 @@ $form = pieform(array(
'licensing_advanced' => license_form_el_advanced($blog), 'licensing_advanced' => license_form_el_advanced($blog),
'submit' => array( 'submit' => array(
'type' => 'submitcancel', 'type' => 'submitcancel',
'class' => 'btn btn-success',
'value' => array( 'value' => array(
get_string('savesettings', 'artefact.blog'), get_string('savesettings', 'artefact.blog'),
get_string('cancel', 'artefact.blog') get_string('cancel', 'artefact.blog')
......
...@@ -250,7 +250,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) { ...@@ -250,7 +250,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
addElementClass(editrow, 'hidden'); addElementClass(editrow, 'hidden');
// Reconnect the old edit button to open the form // Reconnect the old edit button to open the form
if (editrow.previousSibling) { if (editrow.previousSibling) {
forEach(getElementsByTagAndClassName('input', null, editrow.previousSibling), function (elem) { forEach(getElementsByTagAndClassName('button', null, editrow.previousSibling), function (elem) {
var name = getNodeAttribute(elem, 'name').match(new RegExp('^' + self.id + "_([a-z]+)\\[(\\d+)\\]$")); var name = getNodeAttribute(elem, 'name').match(new RegExp('^' + self.id + "_([a-z]+)\\[(\\d+)\\]$"));
if (name && name[1] && name[1] == 'edit') { if (name && name[1] && name[1] == 'edit') {
disconnectAll(elem); disconnectAll(elem);
...@@ -267,6 +267,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) { ...@@ -267,6 +267,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
// In IE, this.value is set to the button text // In IE, this.value is set to the button text
var id = getNodeAttribute(this, 'name').replace(/.*_edit\[(\d+)\]$/, '$1'); var id = getNodeAttribute(this, 'name').replace(/.*_edit\[(\d+)\]$/, '$1');
if (!self.hide_edit_form()) { if (!self.hide_edit_form()) {
return; return;
} }
...@@ -340,7 +341,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) { ...@@ -340,7 +341,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
this.browse_init = function () { this.browse_init = function () {
if (self.config.edit || self.config.editmeta) { if (self.config.edit || self.config.editmeta) {
forEach(getElementsByTagAndClassName('input', null, self.id + '_filelist'), function (elem) { forEach(getElementsByTagAndClassName('button', null, self.id + '_filelist'), function (elem) {
var name = getNodeAttribute(elem, 'name').match(new RegExp('^' + self.id + "_([a-z]+)\\[(\\d+)\\]$")); var name = getNodeAttribute(elem, 'name').match(new RegExp('^' + self.id + "_([a-z]+)\\[(\\d+)\\]$"));
if (name && name[1]) { if (name && name[1]) {
if (name[1] == 'edit') { if (name[1] == 'edit') {
...@@ -493,7 +494,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) { ...@@ -493,7 +494,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
return false; return false;
} }
}); });
ul.append($j('<li>').append(link)); ul.append($j('<li><span class="glyphicon glyphicon-share-alt prm"></span>').append(link));
} }
else { else {
movefoldercount --; movefoldercount --;
...@@ -515,7 +516,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) { ...@@ -515,7 +516,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
self.move_list = null; self.move_list = null;
} }
}); });
ul.append($j('<li>').append(cancellink)); ul.append($j('<li><span class="glyphicon glyphicon-remove-circle prm"></span>').append(cancellink));
self.move_list = ul; self.move_list = ul;
return ul; return ul;
...@@ -747,7 +748,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) { ...@@ -747,7 +748,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
} }
}; };
if (!existed) { if (!existed) {
var remove = INPUT({'type': 'submit', 'class':'button submit unselect', 'name':self.id+'_unselect[' + id + ']', 'value':get_string('remove')}); var remove = INPUT({'type': 'submit', 'class':'button submit unselect btn btn-danger btn-xs', 'name':self.id+'_unselect[' + id + ']', 'value':get_string('remove')});
connect(remove, 'onclick', self.unselect); connect(remove, 'onclick', self.unselect);
filelink = '' filelink = ''
if (self.filedata[id].artefacttype == 'folder') { if (self.filedata[id].artefacttype == 'folder') {
...@@ -760,7 +761,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) { ...@@ -760,7 +761,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
TD(null, IMG({'src':self.filedata[id].icon})), TD(null, IMG({'src':self.filedata[id].icon})),
TD(null, filelink), TD(null, filelink),
TD({'class':'filedescription'}, self.filedata[id].description), TD({'class':'filedescription'}, self.filedata[id].description),
TD({'class':'right s'}, remove, INPUT({'type':'hidden', 'class':'hidden', 'id':self.id+'_selected[' + id + ']', 'name':self.id+'_selected[' + id + ']', 'value':id})) TD({'class':'text-center s'}, remove, INPUT({'type':'hidden', 'class':'hidden', 'id':self.id+'_selected[' + id + ']', 'name':self.id+'_selected[' + id + ']', 'value':id}))
)); ));
} }
// Display the list // Display the list
......
...@@ -201,10 +201,10 @@ function get_desired_fields(&$allfields, $desiredfields, $section) { ...@@ -201,10 +201,10 @@ function get_desired_fields(&$allfields, $desiredfields, $section) {
global $USER; global $USER;
if ($section == 'about') { if ($section == 'about') {
$r = get_record_select('view', 'type = ? AND owner = ?', array('profile', $USER->id), 'id'); $r = get_record_select('view', 'type = ? AND owner = ?', array('profile', $USER->id), 'id');
$label = '<div id="profileicon" class="profile-icon pseudolabel pull-left"><a href="' . get_config('wwwroot') . 'artefact/file/profileicons.php"><img src="' $label = '<div id="profileicon" class="profile-icon pseudolabel"><a href="' . get_config('wwwroot') . 'artefact/file/profileicons.php"><img src="'
. profile_icon_url($USER, 100, 100) . '" alt="' . get_string("editprofileicon", "artefact.file") . '"></a></div>'; . profile_icon_url($USER, 100, 100) . '" alt="' . get_string("editprofileicon", "artefact.file") . '"></a></div>';
$descr = get_string('aboutprofilelinkdescription', 'artefact.internal', get_config('wwwroot') . 'view/blocks.php?id=' . $r->id); $descr = '<div class="about-text">' . get_string('aboutprofilelinkdescription', 'artefact.internal', get_config('wwwroot') . 'view/blocks.php?id=' . $r->id);
$descr .= get_string('aboutdescription', 'artefact.internal'); $descr .= '<p>' . get_string('aboutdescription', 'artefact.internal') . '</p></div>';
} }
else { else {
$label = ''; $label = '';
...@@ -213,6 +213,7 @@ function get_desired_fields(&$allfields, $desiredfields, $section) { ...@@ -213,6 +213,7 @@ function get_desired_fields(&$allfields, $desiredfields, $section) {
$return = array( $return = array(
"{$section}description" => array( "{$section}description" => array(
'type' => 'html', 'type' => 'html',
'class' => 'form-group',
'labelhtml' => $label, 'labelhtml' => $label,
'value' => $descr, 'value' => $descr,
) )
......
...@@ -93,6 +93,7 @@ else { ...@@ -93,6 +93,7 @@ else {
$editform = array( $editform = array(
'name' => 'editprofileform', 'name' => 'editprofileform',
'class' => 'form-editprofile',
'plugintype' => 'artefact', 'plugintype' => 'artefact',
'pluginname' => 'internal', 'pluginname' => 'internal',
'elements' => array( 'elements' => array(
...@@ -102,6 +103,7 @@ else { ...@@ -102,6 +103,7 @@ else {
), ),
'profiletype' => array( 'profiletype' => array(
'type' => 'select', 'type' => 'select',
'class' => 'select-socialprofile',
'title' => get_string('profiletype', 'artefact.internal'), 'title' => get_string('profiletype', 'artefact.internal'),
'options' => $socialnetworkoptions, 'options' => $socialnetworkoptions,
'allowother' => true, 'allowother' => true,
...@@ -119,6 +121,7 @@ else { ...@@ -119,6 +121,7 @@ else {
), ),
'submit' => array( 'submit' => array(
'type' => 'submitcancel', 'type' => 'submitcancel',
'class' => 'btn btn-success',
'value' => array(get_string('save'), get_string('cancel')), 'value' => array(get_string('save'), get_string('cancel')),
'goto' => get_config('wwwroot') . '/artefact/internal/index.php?fs=social', 'goto' => get_config('wwwroot') . '/artefact/internal/index.php?fs=social',
), ),
......
...@@ -222,7 +222,7 @@ $deleteall = pieform(array( ...@@ -222,7 +222,7 @@ $deleteall = pieform(array(
), ),
'submit' => array( 'submit' => array(
'type' => 'submit', 'type' => 'submit',
'class' => 'btn btn-success btn-deleteall', 'class' => 'btn btn-danger btn-deleteall',
'value' => get_string('deleteallnotifications', 'activity'), 'value' => get_string('deleteallnotifications', 'activity'),
'confirm' => get_string('reallydeleteallnotifications', 'activity'), 'confirm' => get_string('reallydeleteallnotifications', 'activity'),
), ),
......
...@@ -195,7 +195,7 @@ $deleteall = pieform(array( ...@@ -195,7 +195,7 @@ $deleteall = pieform(array(
), ),
'submit' => array( 'submit' => array(
'type' => 'submit', 'type' => 'submit',
'class' => 'btn btn-success btn-deleteall', 'class' => 'btn btn-danger btn-deleteall',
'value' => get_string('deleteallnotifications', 'activity'), 'value' => get_string('deleteallnotifications', 'activity'),
'confirm' => get_string('reallydeleteallnotifications', 'activity'), 'confirm' => get_string('reallydeleteallnotifications', 'activity'),
), ),
......
...@@ -2079,13 +2079,13 @@ function simple_resumefield_form($defaults, $goto, $options = array()) { ...@@ -2079,13 +2079,13 @@ function simple_resumefield_form($defaults, $goto, $options = array()) {
), ),
$t . 'submit' => array( $t . 'submit' => array(
'type' => 'submitcancel', 'type' => 'submitcancel',
'class' => 'js-hidden', 'class' => 'js-hidden btn btn-success',
'value' => array(get_string('save'), get_string('cancel')), 'value' => array(get_string('save'), get_string('cancel')),
'goto' => get_config('wwwroot') . $goto, 'goto' => get_config('wwwroot') . $goto,
), ),
$t . 'edit' => array( $t . 'edit' => array(
'type' => 'button', 'type' => 'button',
'class' => 'nojs-hidden-block openedit', 'class' => 'nojs-hidden-block openedit btn btn-success',
'value' => get_string('edit'), 'value' => get_string('edit'),
), ),
), ),
......
...@@ -218,7 +218,20 @@ function formGlobalError(form, data) { ...@@ -218,7 +218,20 @@ function formGlobalError(form, data) {
// Message related functions // Message related functions
function makeMessage(message, type) { function makeMessage(message, type) {
return DIV({'class': type +' alert alert-success'}, message);
switch (type) {
case 'ok':
return DIV({'class': type +' alert alert-success'}, message);
break;
case 'error':
return DIV({'class': type +' alert alert-danger'}, message);
break;
case 'warning':
return DIV({'class': type +' alert alert-warning'}, message);
break;
default:
return DIV({'class': type +' alert alert-info'}, message);
}
} }
/* Appends a status message to the end of elemid */ /* Appends a status message to the end of elemid */
...@@ -751,7 +764,6 @@ function keepElementInViewport(element) { ...@@ -751,7 +764,6 @@ function keepElementInViewport(element) {
// this function takes an existing input element and augments it // this function takes an existing input element and augments it
function augment_tags_control(elem, returnContainer) { function augment_tags_control(elem, returnContainer) {
elem = getElement(elem); elem = getElement(elem);
var tagContainer = DIV({'class':'showtags'}); var tagContainer = DIV({'class':'showtags'});
// setElementDimensions(tagContainer, {'w': getElementDimensions(elem).w}); // setElementDimensions(tagContainer, {'w': getElementDimensions(elem).w});
var showLink = A({'href':''},get_string('showtags')); var showLink = A({'href':''},get_string('showtags'));
...@@ -812,7 +824,7 @@ function augment_tags_control(elem, returnContainer) { ...@@ -812,7 +824,7 @@ function augment_tags_control(elem, returnContainer) {
var help = getFirstElementByTagAndClassName('span', 'help', elem.parentNode); var help = getFirstElementByTagAndClassName('span', 'help', elem.parentNode);
var newNode = DIV(); var newNode = DIV({'class':'tag-wrapper'});
swapDOM(elem, newNode); swapDOM(elem, newNode);
appendChildNodes(newNode, tagContainer, elem, ' ', help); appendChildNodes(newNode, tagContainer, elem, ' ', help);
}; };
......
...@@ -154,7 +154,7 @@ function pieform_element_select(Pieform $form, $element) { ...@@ -154,7 +154,7 @@ function pieform_element_select(Pieform $form, $element) {
$other_attrib['class'] = 'hidden'; $other_attrib['class'] = 'hidden';
$other_value = ''; $other_value = '';
} }
$result .= '<label for="' . $element['id'] . '_other" class="accessible-hidden">' . get_string('licenseotherurl') . '</label>' $result .= '<label for="' . $element['id'] . '_other" class="accessible-hidden sr-only">' . get_string('licenseotherurl') . '</label>'
. '<input type="text"' . '<input type="text"'
. $form->element_attributes($other_attrib) . $form->element_attributes($other_attrib)
. $other_value . $other_value
......
...@@ -647,6 +647,7 @@ EOF; ...@@ -647,6 +647,7 @@ EOF;
$sideblocks[] = array( $sideblocks[] = array(
'name' => 'profile', 'name' => 'profile',
'id' => 'sb-profile', 'id' => 'sb-profile',
'class' => 'user-panel',
'weight' => -20, 'weight' => -20,
'data' => profile_sideblock() 'data' => profile_sideblock()
); );
...@@ -676,6 +677,7 @@ EOF; ...@@ -676,6 +677,7 @@ EOF;
$sideblocks[] = array( $sideblocks[] = array(
'name' => 'progressbar', 'name' => 'progressbar',
'id' => 'sb-progressbar', 'id' => 'sb-progressbar',
'class' => 'progressbar',
'weight' => -8, 'weight' => -8,
'data' => progressbar_sideblock(), 'data' => progressbar_sideblock(),
); );
...@@ -686,6 +688,7 @@ EOF; ...@@ -686,6 +688,7 @@ EOF;
$sideblocks[] = array( $sideblocks[] = array(
'name' => 'progressbar', 'name' => 'progressbar',
'id' => 'sb-progressbar', 'id' => 'sb-progressbar',
'class' => 'progressbar',
'weight' => -8, 'weight' => -8,
'data' => progressbar_sideblock(true), 'data' => progressbar_sideblock(true),
); );
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
vertical-align: top; vertical-align: top;
} }
/* Post list */ /* Post list */
#blogdescription { /*#blogdescription {
margin: 0 0 10px 0; margin: 0 0 10px 0;
} }
#postlist { #postlist {
...@@ -43,8 +43,8 @@ ...@@ -43,8 +43,8 @@
} }
.attachments input.unselect { .attachments input.unselect {
font-size: .9167em; font-size: .9167em;
} }*/
/* Insert Image Dialog */ /* Insert Image Dialog */
#img_src[disabled=""] { #img_src[disabled=""] {
background-color: #F0F0EE; background-color: #F0F0EE;
}*/ }
\ No newline at end of file \ No newline at end of file
{include file="header.tpl"} {include file="header.tpl"}
<div class="text-right"> <div class="text-right btn-top-right">
<a class="btn btn-success" href="{$WWWROOT}artefact/blog/new/index.php">{str section="artefact.blog" tag="addblog"}</a> <a class="btn btn-success" href="{$WWWROOT}artefact/blog/new/index.php">{str section="artefact.blog" tag="addblog"}</a>
</div> </div>
<div id="myblogs" class="rel"> <div id="myblogs" class="rel">
{if !$blogs->data} {if !$blogs->data}
<div>{str tag=youhavenoblogs section=artefact.blog}</div> <div>{str tag=youhavenoblogs section=artefact.blog}</div>
......
{foreach from=$posts item=post} {foreach from=$posts item=post}
<div id="posttitle_{$post->id}" class="{if $post->published}published{else}draft{/if} listrow"> <div id="posttitle_{$post->id}" class="{if $post->published}published{else}draft{/if} post">
<div class="pull-right"> <div class="post-heading">
<span id="poststatus{$post->id}" class="poststatus"> <h2>{$post->title}</h2>
{if $post->published} <div class="post-menu">
{str tag=published section=artefact.blog} <span id="poststatus{$post->id}" class="poststatus">
{else} {if $post->published}
{str tag=draft section=artefact.blog} {str tag=published section=artefact.blog}
{/if} {else}
</span> {str tag=draft section=artefact.blog}
<span id="changepoststatus{$post->id}" class="changepoststatus"> {/if}
{if !$post->locked} </span>
{$post->changepoststatus|safe} <span id="changepoststatus{$post->id}" class="changepoststatus">
{/if} {if !$post->locked}
</span> {$post->changepoststatus|safe}
<span class="controls"> {/if}
{if $post->locked} </span>
{str tag=submittedforassessment section=view} <span class="controls">
{else} {if $post->locked}
<form name="edit_{$post->id}" action="{$WWWROOT}artefact/blog/post.php"> {str tag=submittedforassessment section=view}
<input type="hidden" name="id" value="{$post->id}"> {else}
<input type="image" src="{theme_url filename="images/btn_edit.png"}" alt="{str(tag=editspecific arg1=$post->title)|escape:html|safe}" title="{str tag=edit}"> <form name="edit_{$post->id}" action="{$WWWROOT}artefact/blog/post.php">
</form> <input type="hidden" name="id" value="{$post->id}">
{$post->delete|safe} <button type="submit" class="btn btn-default btn-xs">
{/if} <span class="glyphicon glyphicon-pencil"></span>
</span> <span class="sr-only">{str(tag=editspecific arg1=$post->title)|escape:html|safe}</span>
</div> </button>
<h2>{$post->title}</h2> </form>
<div id="postdetails_{$post->id}" class="postdetails postdate"> {$post->delete|safe}
{str tag=postedon section=artefact.blog} {$post->ctime} {/if}
</span>
</div>
<div id="postdetails_{$post->id}" class="postdetails postdate">
{str tag=postedon section=artefact.blog} {$post->ctime}
</div>
</div> </div>
<div id="postdescription_{$post->id}" class="postdescription">
<div id="postdescription_{$post->id}" class="postdescription ptl">
{$post->description|clean_html|safe} {$post->description|clean_html|safe}
</div> </div>
{if $post->tags}<div id="posttags_{$post->id}" class="tags">{str tag=tags}: {list_tags owner=$post->author tags=$post->tags}</div>{/if} {if $post->tags}<div id="posttags_{$post->id}" class="tags">{str tag=tags}: {list_tags owner=$post->author tags=$post->tags}</div>{/if}
{if $post->files} {if $post->files}
<div id="postfiles_{$post->id}" class="table-responsive"> <div id="postfiles_{$post->id}">
<table class="cb attachments fullwidth table table-striped"> <div class="attachments">
<thead class="expandable-head"> <div class="attachment-heading">
<tr> <span class="badge">
<td colspan="2"> {$post->files|count}
<a class="toggle" href="#">{str tag=attachedfiles section=artefact.blog}</a> </span>
<span class="pull-right"> <a class="attach-files" data-toggle="collapse" href="#attach_{$post->id}" aria-expanded="false">
<span class="glyphicon glyphicon-paperclip"></span> {str tag=attachedfiles section=artefact.blog}
<span class="sr-only">{str tag=Attachments section=artefact.resume}</span> <span class="glyphicon glyphicon-chevron-down"></span>
{$post->files|count} </a>
</span> </div>
</td> <div class="collapse files" id="attach_{$post->id}">
</tr>
</thead>
<tbody class="expandable-body">
{foreach from=$post->files item=file} {foreach from=$post->files item=file}
<tr class="{cycle values='r1,r0'}"> <div class="attached-file {cycle values='r1,r0'}">
<td class="icon-container"><img src="{$file->icon}" alt=""></td> <h3 class="title">
<td><h3 class="title"><a href="{$WWWROOT}artefact/file/download.php?file={$file->attachment}">{$file->title}</a> <span class="description">({$file->size|display_size})</span></h3> <a href="