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

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 {
}
}
/**
/**
* This function creates a new blog post.
*
......@@ -965,7 +964,7 @@ class ArtefactTypeBlogPost extends ArtefactType {
'value' => $published,
),'submit' => array(
'type' => 'submit',
'class' => 'publish',
'class' => 'publish btn btn-success btn-xs',
'value' => $strchangepoststatus,
'help' => true,
),
......@@ -988,9 +987,8 @@ class ArtefactTypeBlogPost extends ArtefactType {
'help' => true,
),
'submit' => array(
'type' => 'image',
'src' => $THEME->get_image_url('btn_deleteremove'),
'alt' => get_string('deletespecific', 'mahara', $title),
'type' => 'submit',
'class' => 'input-as-icon icon-trash',
'elementtitle' => get_string('delete'),
'confirm' => get_string('deleteblogpost?', 'artefact.blog'),
'value' => get_string('delete'),
......
......@@ -57,6 +57,7 @@ $form = pieform(array(
'licensing_advanced' => license_form_el_advanced(null),
'submit' => array(
'type' => 'submitcancel',
'class' => 'btn btn-success',
'value' => array(
get_string('createblog', 'artefact.blog'),
get_string('cancel', 'artefact.blog')
......
......@@ -163,6 +163,7 @@ $form = pieform(array(
),
'submitpost' => array(
'type' => 'submitcancel',
'class' => 'btn btn-success',
'value' => array(get_string('savepost', 'artefact.blog'), get_string('cancel')),
'goto' => get_config('wwwroot') . 'artefact/blog/view/index.php?id=' . $blog,
)
......
......@@ -75,6 +75,7 @@ $form = pieform(array(
'licensing_advanced' => license_form_el_advanced($blog),
'submit' => array(
'type' => 'submitcancel',
'class' => 'btn btn-success',
'value' => array(
get_string('savesettings', 'artefact.blog'),
get_string('cancel', 'artefact.blog')
......
......@@ -250,7 +250,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
addElementClass(editrow, 'hidden');
// Reconnect the old edit button to open the form
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+)\\]$"));
if (name && name[1] && name[1] == 'edit') {
disconnectAll(elem);
......@@ -267,6 +267,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
// In IE, this.value is set to the button text
var id = getNodeAttribute(this, 'name').replace(/.*_edit\[(\d+)\]$/, '$1');
if (!self.hide_edit_form()) {
return;
}
......@@ -340,7 +341,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
this.browse_init = function () {
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+)\\]$"));
if (name && name[1]) {
if (name[1] == 'edit') {
......@@ -493,7 +494,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
return false;
}
});
ul.append($j('<li>').append(link));
ul.append($j('<li><span class="glyphicon glyphicon-share-alt prm"></span>').append(link));
}
else {
movefoldercount --;
......@@ -515,7 +516,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
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;
return ul;
......@@ -747,7 +748,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
}
};
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);
filelink = ''
if (self.filedata[id].artefacttype == 'folder') {
......@@ -760,7 +761,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
TD(null, IMG({'src':self.filedata[id].icon})),
TD(null, filelink),
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
......
......@@ -201,10 +201,10 @@ function get_desired_fields(&$allfields, $desiredfields, $section) {
global $USER;
if ($section == 'about') {
$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>';
$descr = get_string('aboutprofilelinkdescription', 'artefact.internal', get_config('wwwroot') . 'view/blocks.php?id=' . $r->id);
$descr .= get_string('aboutdescription', 'artefact.internal');
$descr = '<div class="about-text">' . get_string('aboutprofilelinkdescription', 'artefact.internal', get_config('wwwroot') . 'view/blocks.php?id=' . $r->id);
$descr .= '<p>' . get_string('aboutdescription', 'artefact.internal') . '</p></div>';
}
else {
$label = '';
......@@ -213,6 +213,7 @@ function get_desired_fields(&$allfields, $desiredfields, $section) {
$return = array(
"{$section}description" => array(
'type' => 'html',
'class' => 'form-group',
'labelhtml' => $label,
'value' => $descr,
)
......
......@@ -93,6 +93,7 @@ else {
$editform = array(
'name' => 'editprofileform',
'class' => 'form-editprofile',
'plugintype' => 'artefact',
'pluginname' => 'internal',
'elements' => array(
......@@ -102,6 +103,7 @@ else {
),
'profiletype' => array(
'type' => 'select',
'class' => 'select-socialprofile',
'title' => get_string('profiletype', 'artefact.internal'),
'options' => $socialnetworkoptions,
'allowother' => true,
......@@ -119,6 +121,7 @@ else {
),
'submit' => array(
'type' => 'submitcancel',
'class' => 'btn btn-success',
'value' => array(get_string('save'), get_string('cancel')),
'goto' => get_config('wwwroot') . '/artefact/internal/index.php?fs=social',
),
......
......@@ -222,7 +222,7 @@ $deleteall = pieform(array(
),
'submit' => array(
'type' => 'submit',
'class' => 'btn btn-success btn-deleteall',
'class' => 'btn btn-danger btn-deleteall',
'value' => get_string('deleteallnotifications', 'activity'),
'confirm' => get_string('reallydeleteallnotifications', 'activity'),
),
......
......@@ -195,7 +195,7 @@ $deleteall = pieform(array(
),
'submit' => array(
'type' => 'submit',
'class' => 'btn btn-success btn-deleteall',
'class' => 'btn btn-danger btn-deleteall',
'value' => get_string('deleteallnotifications', 'activity'),
'confirm' => get_string('reallydeleteallnotifications', 'activity'),
),
......
......@@ -2079,13 +2079,13 @@ function simple_resumefield_form($defaults, $goto, $options = array()) {
),
$t . 'submit' => array(
'type' => 'submitcancel',
'class' => 'js-hidden',
'class' => 'js-hidden btn btn-success',
'value' => array(get_string('save'), get_string('cancel')),
'goto' => get_config('wwwroot') . $goto,
),
$t . 'edit' => array(
'type' => 'button',
'class' => 'nojs-hidden-block openedit',
'class' => 'nojs-hidden-block openedit btn btn-success',
'value' => get_string('edit'),
),
),
......
......@@ -218,7 +218,20 @@ function formGlobalError(form, data) {
// Message related functions
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 */
......@@ -751,7 +764,6 @@ function keepElementInViewport(element) {
// this function takes an existing input element and augments it
function augment_tags_control(elem, returnContainer) {
elem = getElement(elem);
var tagContainer = DIV({'class':'showtags'});
// setElementDimensions(tagContainer, {'w': getElementDimensions(elem).w});
var showLink = A({'href':''},get_string('showtags'));
......@@ -812,7 +824,7 @@ function augment_tags_control(elem, returnContainer) {
var help = getFirstElementByTagAndClassName('span', 'help', elem.parentNode);
var newNode = DIV();
var newNode = DIV({'class':'tag-wrapper'});
swapDOM(elem, newNode);
appendChildNodes(newNode, tagContainer, elem, ' ', help);
};
......
......@@ -154,7 +154,7 @@ function pieform_element_select(Pieform $form, $element) {
$other_attrib['class'] = 'hidden';
$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"'
. $form->element_attributes($other_attrib)
. $other_value
......
......@@ -647,6 +647,7 @@ EOF;
$sideblocks[] = array(
'name' => 'profile',
'id' => 'sb-profile',
'class' => 'user-panel',
'weight' => -20,
'data' => profile_sideblock()
);
......@@ -676,6 +677,7 @@ EOF;
$sideblocks[] = array(
'name' => 'progressbar',
'id' => 'sb-progressbar',
'class' => 'progressbar',
'weight' => -8,
'data' => progressbar_sideblock(),
);
......@@ -686,6 +688,7 @@ EOF;
$sideblocks[] = array(
'name' => 'progressbar',
'id' => 'sb-progressbar',
'class' => 'progressbar',
'weight' => -8,
'data' => progressbar_sideblock(true),
);
......
......@@ -24,7 +24,7 @@
vertical-align: top;
}
/* Post list */
#blogdescription {
/*#blogdescription {
margin: 0 0 10px 0;
}
#postlist {
......@@ -43,8 +43,8 @@
}
.attachments input.unselect {
font-size: .9167em;
}
}*/
/* Insert Image Dialog */
#img_src[disabled=""] {
background-color: #F0F0EE;
}*/
\ No newline at end of file
}
\ No newline at end of file
{include file="header.tpl"}
<div class="text-right">
<a class="btn btn-success" href="{$WWWROOT}artefact/blog/new/index.php">{str section="artefact.blog" tag="addblog"}</a>
</div>
<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>
</div>
<div id="myblogs" class="rel">
{if !$blogs->data}
<div>{str tag=youhavenoblogs section=artefact.blog}</div>
......
{foreach from=$posts item=post}
<div id="posttitle_{$post->id}" class="{if $post->published}published{else}draft{/if} listrow">
<div class="pull-right">
<span id="poststatus{$post->id}" class="poststatus">
{if $post->published}
{str tag=published section=artefact.blog}
{else}
{str tag=draft section=artefact.blog}
{/if}
</span>
<span id="changepoststatus{$post->id}" class="changepoststatus">
{if !$post->locked}
{$post->changepoststatus|safe}
{/if}
</span>
<span class="controls">
{if $post->locked}
{str tag=submittedforassessment section=view}
{else}
<form name="edit_{$post->id}" action="{$WWWROOT}artefact/blog/post.php">
<input type="hidden" name="id" value="{$post->id}">
<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>
{$post->delete|safe}
{/if}
</span>
</div>
<h2>{$post->title}</h2>
<div id="postdetails_{$post->id}" class="postdetails postdate">
{str tag=postedon section=artefact.blog} {$post->ctime}
<div id="posttitle_{$post->id}" class="{if $post->published}published{else}draft{/if} post">
<div class="post-heading">
<h2>{$post->title}</h2>
<div class="post-menu">
<span id="poststatus{$post->id}" class="poststatus">
{if $post->published}
{str tag=published section=artefact.blog}
{else}
{str tag=draft section=artefact.blog}
{/if}
</span>
<span id="changepoststatus{$post->id}" class="changepoststatus">
{if !$post->locked}
{$post->changepoststatus|safe}
{/if}
</span>
<span class="controls">
{if $post->locked}
{str tag=submittedforassessment section=view}
{else}
<form name="edit_{$post->id}" action="{$WWWROOT}artefact/blog/post.php">
<input type="hidden" name="id" value="{$post->id}">
<button type="submit" class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-pencil"></span>
<span class="sr-only">{str(tag=editspecific arg1=$post->title)|escape:html|safe}</span>
</button>
</form>
{$post->delete|safe}
{/if}
</span>
</div>
<div id="postdetails_{$post->id}" class="postdetails postdate">
{str tag=postedon section=artefact.blog} {$post->ctime}
</div>
</div>
<div id="postdescription_{$post->id}" class="postdescription">
<div id="postdescription_{$post->id}" class="postdescription ptl">
{$post->description|clean_html|safe}
</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->files}
<div id="postfiles_{$post->id}" class="table-responsive">
<table class="cb attachments fullwidth table table-striped">
<thead class="expandable-head">
<tr>
<td colspan="2">
<a class="toggle" href="#">{str tag=attachedfiles section=artefact.blog}</a>
<span class="pull-right">
<span class="glyphicon glyphicon-paperclip"></span>
<span class="sr-only">{str tag=Attachments section=artefact.resume}</span>
{$post->files|count}
</span>
</td>
</tr>
</thead>
<tbody class="expandable-body">
<div id="postfiles_{$post->id}">
<div class="attachments">
<div class="attachment-heading">
<span class="badge">
{$post->files|count}
</span>
<a class="attach-files" data-toggle="collapse" href="#attach_{$post->id}" aria-expanded="false">
{str tag=attachedfiles section=artefact.blog}
<span class="glyphicon glyphicon-chevron-down"></span>
</a>
</div>
<div class="collapse files" id="attach_{$post->id}">
{foreach from=$post->files item=file}
<tr class="{cycle values='r1,r0'}">
<td class="icon-container"><img src="{$file->icon}" alt=""></td>
<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>
<div class="detail">{$file->description}</div></td>
</tr>
<div class="attached-file {cycle values='r1,r0'}">
<h3 class="title">
<a href="{$WWWROOT}artefact/file/download.php?file={$file->attachment}">{$file->title}</a>
</h3>
<div class="file-detail">
<img src="{$file->icon}" alt="">
<span class="file-size">
({$file->size|display_size})
</span>
</div>
{if $file->description}
<div class="file-description">
<p class="description">
{$file->description}
</p>
</div>
{/if}
</div>
{/foreach}
</tbody>
</table>
</div>
</div>
</div>
{/if}
</div>
......
{include file="header.tpl"}
<div class="text-right btn-top-right">
<a class="btn btn-success addpost" href="{$WWWROOT}artefact/blog/post.php?blog={$blog->get('id')}">{str section="artefact.blog" tag="addpost"}</a>
{if !$blog->get('locked')}
<a class="btn btn-default settings" href="{$WWWROOT}artefact/blog/settings/index.php?id={$blog->get('id')}">{str section="artefact.blog" tag="settings"}</a>
{/if}
</div>
<div id="myblogs" class="rel">
<div class="text-right">
<a class="btn btn-success addpost" href="{$WWWROOT}artefact/blog/post.php?blog={$blog->get('id')}">{str section="artefact.blog" tag="addpost"}</a>
{if !$blog->get('locked')}
<a class="btn btn-success settings" href="{$WWWROOT}artefact/blog/settings/index.php?id={$blog->get('id')}">{str section="artefact.blog" tag="settings"}</a>
{/if}
</div>
<div id="blogdescription">{clean_html($blog->get('description'))|safe}</div>
{if $blog->get('tags')}<div class="tags">{str tag=tags}: {list_tags owner=$blog->get('owner') tags=$blog->get('tags')}</div>{/if}
......
<tr id="{$prefix}_edit_row"{if !$fileinfo} class="hidden editrow"{/if}>
<td></td>
<td></td>
<td colspan="5" class="fileedittablewrap">
<table class="fileedittable">
<tbody>
<tr>
<th colspan="2" id="{$prefix}_edit_heading" class="edit-heading">
<div class="fileedittable">
<div>
<div id="{$prefix}_edit_heading" class="edit-heading">
{if $fileinfo}{if $fileinfo->artefacttype == 'folder'}{str tag=editfolder section=artefact.file}{else}{str tag=editfile section=artefact.file}{/if}{/if}
</th>
</tr>
<tr class="required">
<th><label for="{$prefix}_edit_title">{str tag=name}<span class="requiredmarker"> *</span></label></th>
<td><input type="text" class="text" name="{$prefix}_edit_title" id="{$prefix}_edit_title" value="{$fileinfo->title}" size="40" /></td>
</tr>
</div>
</div>
<div class="required form-group">
<label for="{$prefix}_edit_title">{str tag=name}<span class="requiredmarker"> *</span>
</label>
<input type="text" class="text" name="{$prefix}_edit_title" id="{$prefix}_edit_title" value="{$fileinfo->title}"/>
</div>
{if $fileinfo->artefacttype != 'profileicon'}
<tr>
<th><label for="{$prefix}_edit_description">{str tag=description}</label></th>
<td><input type="text" class="text" name="{$prefix}_edit_description" id="{$prefix}_edit_description" value="{$fileinfo->description}" size="40" /></td>
</tr>
<div class="form-group">
<label for="{$prefix}_edit_description">{str tag=description}</label>
<input type="text" class="text" name="{$prefix}_edit_description" id="{$prefix}_edit_description" value="{$fileinfo->description}" size="40" />
</div>
{/if}
<tr class="tags">
<th><label for="{$prefix}_edit_tags">{str tag=tags}</label></th>
<td>
<input name="{$prefix}_edit_tags" size="40" id="{$prefix}_edit_tags" value="{foreach from=$fileinfo->tags item=tag name=tags}{if !$.foreach.tags.first}, {/if}{$tag}{/foreach}" />
<div class="tags form-group">
<label for="{$prefix}_edit_tags">{str tag=tags}</label>
<input name="{$prefix}_edit_tags" id="{$prefix}_edit_tags" class="text" type="text" value="{foreach from=$fileinfo->tags item=tag name=tags}{if !$.foreach.tags.first}, {/if}{$tag}{/foreach}" />
<span>{contextualhelp plugintype='artefact' pluginname='file' section='tags'}</span>
</td>
</tr>
<tr>
<td></td>
<td class="description">{str tag=tagsdescprofile}</td>
</tr>
<div class="description">{str tag=tagsdescprofile}</div>
</div>
{if $groupinfo}
<tr>
<th><strong>{str tag=Permissions}</strong></th>
<td>
<table class="editpermissions">
<tbody>
<tr>
<th>{str tag=Role section=group}</th>
<div>
<div>
<strong>{str tag=Permissions}</strong>
</div>
<div>
<div class="editpermissions">
<div>
<div>{str tag=Role section=group}</div>
{foreach from=$groupinfo.perm item=permname}
<th>{$permname}</th>
<div>{$permname}</div>
{/foreach}
</tr>
</div>
{foreach from=$groupinfo.roles item=role key=r}
<tr>
<td>{$role->display}</td>
<div>
<div>{$role->display}</div>
{foreach from=$groupinfo.perm item=whocares key=permid}
{if $fileinfo}
<td><label for="{$prefix}_permission_{$r}_{$permid}">{str tag=changerolepermissions section=group arg1=$permid arg2=$r}</label>
<input type="checkbox" class="permission" id="{$prefix}_permission_{$r}_{$permid}" name="{$prefix}_permission:{$r}:{$permid}"{if $fileinfo->permissions.$r.$permid} checked{/if}{if $r == 'admin'} disabled{/if} /></td>
<div class="checkbox form-group">
<label for="{$prefix}_permission_{$r}_{$permid}">{str tag=changerolepermissions section=group arg1=$permid arg2=$r}</label>
<input type="checkbox" class="permission checkbox" id="{$prefix}_permission_{$r}_{$permid}" name="{$prefix}_permission:{$r}:{$permid}"{if $fileinfo->permissions.$r.$permid} checked{/if}{if $r == 'admin'} disabled{/if} />
</div>
{else}
<td><label for="{$prefix}_permission_{$r}_{$permid}">{str tag=changerolepermissions section=group arg1=$permid arg2=$r}</label>
<input type="checkbox" class="permission" id="{$prefix}_permission_{$r}_{$permid}" name="{$prefix}_permission:{$r}:{$permid}" {if $r == 'admin'} checked disabled{/if}/></td>
<div class="checkbox form-group">
<label for="{$prefix}_permission_{$r}_{$permid}">{str tag=changerolepermissions section=group arg1=$permid arg2=$r}</label>
<input type="checkbox" class="permission checkbox" id="{$prefix}_permission_{$r}_{$permid}" name="{$prefix}_permission:{$r}:{$permid}" {if $r == 'admin'} checked disabled{/if}/>
</div>
{/if}
{/foreach}
</tr>
</div>
{/foreach}
</tbody>
</table>
</td>
</tr>
</div>
</div>
</div>
{/if}
{license_form_files($prefix, 'edit')}
<tr>
<th><label for="{$prefix}_edit_allowcomments">{str tag=allowcomments section=artefact.comment}</label></th>
<td><input type="checkbox" name="{$prefix}_edit_allowcomments" id="{$prefix}_edit_allowcomments" {if $fileinfo->allowcomments}checked {/if}/></td>
</tr>
<tr>
<td></td>
<td>
<input class="submit btn btn-success" type="submit" name="{$prefix}_update[{$fileinfo->id}]" id="{$prefix}_edit_artefact" value="{str tag=savechanges section=artefact.file}" />
<div class="checkbox form-group">
<label for="{$prefix}_edit_allowcomments">{str tag=allowcomments section=artefact.comment}</label>
<input type="checkbox" class="checkbox" name="{$prefix}_edit_allowcomments" id="{$prefix}_edit_allowcomments" {if $fileinfo->allowcomments}checked {/if}/>
</div>
<div>
<div>