Commit b5b7d92d authored by Nigel McNie's avatar Nigel McNie
Browse files

Merge commit 'origin/master' into theme-1.2

Conflicts:

	htdocs/admin/upgrade.php
	htdocs/artefact/file/theme/raw/index.tpl
parents 00dc9b61 aadff244
......@@ -80,7 +80,7 @@ if ($authobj->authname == 'internal') {
'type' => 'text',
'defaultvalue' => $USER->get('username'),
'title' => get_string('changeusername', 'account'),
'description' => get_string('changeusernamedesc', 'account', get_config('sitename')),
'description' => get_string('changeusernamedesc', 'account', hsc(get_config('sitename'))),
);
}
......
......@@ -276,7 +276,7 @@ $style = '<style type="text/css">.invisible{display:none;}</style>';
$smarty = smarty(array(), array($style));
$smarty->assign('INLINEJAVASCRIPT', $ijs);
$smarty->assign('MENUS', $menulist);
$smarty->assign('descriptionstrargs', array('<a href="' . get_config('wwwroot') . 'admin/site/files.php">', '</a>'));
$smarty->assign('descriptionstrargs', array('<a href="' . get_config('wwwroot') . 'artefact/file/sitefiles.php">', '</a>'));
$smarty->assign('heading', get_string('linksandresourcesmenu', 'admin'));
$smarty->display('admin/site/menu.tpl');
......
......@@ -48,6 +48,18 @@ $loadingicon = $THEME->get_url('images/loading.gif');
$successicon = $THEME->get_url('images/success.gif');
$failureicon = $THEME->get_url('images/failure.gif');
// Remove all files in the smarty cache
require_once('file.php');
$basedir = get_config('dataroot') . 'smarty/compile/';
$dh = new DirectoryIterator($basedir);
foreach ($dh as $themedir) {
if ($themedir->isDot()) continue;
$themedirname = $basedir . $themedir->getFilename();
rmdirr($themedirname);
clearstatcache();
check_dir_exists($themedirname);
}
$loadingstring = json_encode(get_string('upgradeloading', 'admin'));
$installsuccessstring = json_encode(get_string('installsuccess', 'admin'));
$successstring = json_encode(get_string('upgradesuccesstoversion', 'admin'));
......
......@@ -175,13 +175,7 @@ class PluginBlocktypeBlogpost extends PluginBlocktype {
$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;
$artefact->description = str_shorten_html($artefact->description, 50, true);
return $artefact;
}
......
......@@ -71,7 +71,7 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
return get_string('typeremoved', 'blocktype.file/internalmedia');
}
$callbacks = self::get_all_filetype_players();
$result .= '<div class="mediaplayer-container"><div class="mediaplayer">' . call_static_method('PluginBlocktypeInternalmedia', $callbacks[$mimetypefiletypes[$mimetype]], $artefact, $instance, $width, $height) . '</div></div>';
$result .= '<div class="mediaplayer-container center"><div class="mediaplayer">' . call_static_method('PluginBlocktypeInternalmedia', $callbacks[$mimetypefiletypes[$mimetype]], $artefact, $instance, $width, $height) . '</div></div>';
return $result;
}
......
......@@ -89,17 +89,12 @@ class HtmlExportFile extends HtmlExportArtefactPlugin {
* Puts all profile icons in the static/profileicons/ directory
*/
private function populate_profileicons() {
$madeprofileiconsdir = false;
$profileiconsdir = $this->exporter->get('exportdir') . '/' . $this->exporter->get('rootdir') . '/static/profileicons/';
$removekeys = array();
foreach ($this->artefactdata as $artefactid => $artefact) {
if ($artefact->get('artefacttype') == 'profileicon') {
$removekeys[] = $artefactid;
if (!$madeprofileiconsdir) {
check_dir_exists($profileiconsdir);
}
if (!copy($artefact->get_path(), $profileiconsdir . PluginExportHtml::sanitise_path($artefact->get('title')))) {
throw new SystemException("Unable to copy profile icon $artefactid into export");
}
......
......@@ -123,7 +123,6 @@ function pieform_element_filebrowser(Pieform $form, $element) {
{$prefix}.filedata = {$fileliststr};";
if ($config['select']) {
$initjs .= "{$prefix}.selecteddata = {$selectedliststr};";
$initjs .= "forEach(getElementsByTagAndClassName('button', 'unselect', '{$prefix}_selectlist'), function (elem) { removeElementClass(elem, 'hidden'); });";
}
$_PIEFORM_FILEBROWSERS[$prefix]['views_js'] = $initjs;
......@@ -353,16 +352,18 @@ function pieform_element_filebrowser_get_value(Pieform $form, $element) {
// If we got to this point, the doupdate function couldn't select or unselect a file,
// so we need to let it go through to the form's submit function to deal with.
if ($result['select']) {
if (!empty($result['select'])) {
if ($element['config']['selectone']) {
$selected = array($result['select']);
}
else {
$selected = is_array($selected) ? $selected : array();
$selected[] = $result['select'];
if (!in_array($result['select'], $selected)) {
$selected[] = $result['select'];
}
}
}
else if ($result['unselect']) {
else if (!empty($result['unselect'])) {
$selected = is_array($selected) ? array_diff($selected, array($result['unselect'])) : array();
}
}
......
......@@ -185,11 +185,26 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
replaceChildNodes($('uploadstatusline'+data.uploadnumber), newmessage);
}
this.hide_edit_form = function () {
var editrow = $(self.id + '_edit_row');
if (!hasElementClass(editrow, 'hidden')) {
addElementClass(editrow, 'hidden');
// Reconnect the old edit button to open the form
forEach(getElementsByTagAndClassName('input', 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);
connect(elem, 'onclick', self.edit_form);
}
});
}
}
this.edit_form = function (e) {
e.stop();
// In IE, this.value is set to the button text
var id = getNodeAttribute(this, 'name').replace(/.*_edit\[(\d+)\]$/, '$1');
addElementClass(self.id + '_edit_row', 'hidden');
self.hide_edit_form();
$(self.id + '_edit_heading').innerHTML = self.filedata[id].artefacttype == 'folder' ? get_string('editfolder') : get_string('editfile');
$(self.id + '_edit_title').value = self.filedata[id].title;
$(self.id + '_edit_description').value = self.filedata[id].description == null ? '' : self.filedata[id].description;
......@@ -207,6 +222,17 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
var this_row = getFirstParentByTagAndClassName(this, 'tr');
insertSiblingNodesAfter(this_row, edit_row);
removeElementClass(edit_row, 'hidden');
// Make the edit button close the form again
disconnectAll(this);
connect(this, 'onclick', function (e) {
e.stop();
addElementClass(self.id + '_edit_row', 'hidden');
disconnectAll(this);
connect(this, 'onclick', self.edit_form);
return false;
});
return false;
}
......@@ -214,26 +240,28 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
this.browse_init = function () {
if (self.config.edit) {
forEach(getElementsByTagAndClassName('button', null, 'filelist'), function (elem) {
forEach(getElementsByTagAndClassName('input', null, 'filelist'), function (elem) {
var name = getNodeAttribute(elem, 'name').match(new RegExp('^' + self.id + "_([a-z]+)\\[(\\d+)\\]$"));
if (name[1] == 'edit') {
connect(elem, 'onclick', self.edit_form);
}
else if (name[1] == 'delete') {
var id = name[2];
if (self.filedata[id].attachcount > 0) {
connect(elem, 'onclick', function (e) {
if (!confirm(get_string('detachfilewarning', self.filedata[id].attachcount))) {
e.stop();
return false;
}
});
if (name && name[1]) {
if (name[1] == 'edit') {
connect(elem, 'onclick', self.edit_form);
}
else if (name[1] == 'delete') {
var id = name[2];
if (self.filedata[id].attachcount > 0) {
connect(elem, 'onclick', function (e) {
if (!confirm(get_string('detachfilewarning', self.filedata[id].attachcount))) {
e.stop();
return false;
}
});
}
}
}
});
connect(self.id + '_edit_cancel', 'onclick', function (e) {
e.stop();
addElementClass(self.id + '_edit_row', 'hidden');
self.hide_edit_form();
return false;
});
connect(self.id + '_edit_artefact', 'onclick', self.edit_submit);
......@@ -379,14 +407,14 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
return false;
});
}
forEach(getElementsByTagAndClassName('button', 'unselect', self.id + '_selectlist'), function (elem) {
forEach(getElementsByTagAndClassName('input', 'unselect', self.id + '_selectlist'), function (elem) {
connect(elem, 'onclick', self.unselect);
});
self.connect_select_buttons();
}
this.connect_select_buttons = function () {
forEach(getElementsByTagAndClassName('button', 'select', 'filelist'), function (elem) {
forEach(getElementsByTagAndClassName('input', 'select', 'filelist'), function (elem) {
var id = elem.name.replace(/.*_select\[(\d+)\]$/, '$1');
if (self.selecteddata[id]) {
addElementClass(elem, 'hidden');
......@@ -426,7 +454,6 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
rows = [];
self.selecteddata = {};
}
// var remove = BUTTON({'type':'submit', 'class':'button small unselect', 'name':'unselect[' + id + ']', 'value':id}, get_string('remove')); // IE problem ?
var remove = INPUT({'type': 'submit', 'class':'button small unselect', 'name':self.id+'_unselect[' + id + ']', 'value':get_string('remove')});
connect(remove, 'onclick', self.unselect);
appendChildNodes(tbody, TR({'class': 'r' + rows.length % 2 + (highlight ? ' highlight-file' : '')},
......@@ -517,16 +544,3 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
}
/*
// Check if there's already a file attached to the post with the given name
function fileattached(filename) {
return some(map(function (e) { return e.childNodes[1]; }, attached.tbody.childNodes),
function (cell) { return scrapeText(cell) == filename; });
}
// Check if there's already a file attached to the post with the given id
function fileattached_id(id) {
return some(attached.tbody.childNodes, function (r) { return getNodeAttribute(r,'id') == id; });
}
*/
......@@ -123,49 +123,6 @@ class PluginArtefactFile extends PluginArtefact {
public static function jsstrings($type) {
static $jsstrings = array(
'file' => array(
'mahara' => array(
'cancel',
'delete',
'edit',
'Permissions',
'republish',
'tags',
'view',
),
'artefact.file' => array(
'copyrightnotice',
'create',
'createfolder',
'deletefile?',
'deletefolder?',
'Description',
'destination',
'editfile',
'editfolder',
'File',
'fileexistsoverwritecancel',
'filenamefieldisrequired',
'home',
'Name',
'namefieldisrequired',
'nofilesfound',
'overwrite',
'savechanges',
'timeouterror',
'title',
'titlefieldisrequired',
'unlinkthisfilefromblogposts?',
'upload',
'uploadfile',
'uploadfileexistsoverwritecancel',
'uploadingfiletofolder',
'youmustagreetothecopyrightnotice',
),
'group' => array(
'Role',
),
),
'filebrowser' => array(
'mahara' => array(
'remove',
......
......@@ -18,8 +18,8 @@
<tbody>
{foreach from=$children item=child}
<tr class="{cycle values=r1,r0}">
<td><img src="{$child->iconsrc}" border="0" alt="{$child->artefacttype|escape}"></td>
<td><a href="{$WWWROOT}view/artefact.php?artefact={$child->id|escape}&amp;view={$viewid|escape}" title="{$child->hovertitle}">{$child->title}</a></td>
<td><img src="{$child->iconsrc|escape}" border="0" alt="{$child->artefacttype|escape}"></td>
<td><a href="{$WWWROOT}view/artefact.php?artefact={$child->id|escape}&amp;view={$viewid|escape}" title="{$child->hovertitle|escape}">{$child->title|escape}</a></td>
<td>{$child->description|escape}</td>
{if !$simpledisplay}
<td>{$child->date}</td>
......
......@@ -63,8 +63,7 @@
{/if}
<tr>
<td colspan=2>
<button type="submit" name="{$prefix}_update[{$fileinfo->id}]" id="{$prefix}_edit_artefact" value="{$fileinfo->id}">{str tag=savechanges section=artefact.file}</button>
<input type="button" class="button hidden" name="replace" value="{str tag=overwrite}" />
<input type="submit" name="{$prefix}_update[{$fileinfo->id}]" id="{$prefix}_edit_artefact" value="{str tag=savechanges section=artefact.file}" />
<input type="submit" class="button" name="{$prefix}_canceledit" id="{$prefix}_edit_cancel" value="{str tag=cancel}" />
</td>
</tr>
......
......@@ -40,11 +40,11 @@
<td>{$file->mtime}</td>
<td>
{if $editable && !$file->isparent}
{if !isset($file->can_edit) || $file->can_edit !== 0}<button type="submit" name="{$prefix}_edit[{$file->id}]" value="{$file->id}">{str tag=edit}</button>{/if}
{if $file->childcount == 0}<button type="submit" name="{$prefix}_delete[{$file->id}]" value="{$file->id}">{str tag=delete}</button>{/if}
{if !isset($file->can_edit) || $file->can_edit !== 0}<input type="submit" name="{$prefix}_edit[{$file->id}]" value="{str tag=edit}" />{/if}
{if $file->childcount == 0}<input type="submit" name="{$prefix}_delete[{$file->id}]" value="{str tag=delete}" />{/if}
{/if}
{if $selectable && $file->artefacttype != 'folder' && $publishable}
<button type="submit" class="select small" name="{$prefix}_select[{$file->id}]" id="{$prefix}_select_{$file->id}" value="{$file->id}">{str tag=select}</button>
<input type="submit" class="select small" name="{$prefix}_select[{$file->id}]" id="{$prefix}_select_{$file->id}" value="{str tag=select}" />
{/if}
</td>
</tr>
......
......@@ -20,8 +20,7 @@
</td>
<td>{$file->description|escape}</td>
<td>
<noscript><button type="submit" class="button small unselect" name="{$prefix}_unselect[{$file->id}]" value="{$file->id}">{str tag=remove}</button></noscript>
<button type="button" class="button small unselect hidden" name="{$prefix}_unselect[{$file->id}]" value="{$file->id}">{str tag=remove}</button>
<input type="submit" class="button small unselect" name="{$prefix}_unselect[{$file->id}]" value="{str tag=remove}" />
<input type="hidden" name="{$prefix}_selected[{$file->id}]" value="{$file->id}">
</td>
</tr>
......
{include file="header.tpl"}
{if $institution}
{$institutionselector}
{/if}
{str tag='fileinstructions' section='artefact.file'}
<div id="myfiles">
<div id="uploader"></div>
<table id="filelist" class="hidden tablerenderer fullwidth">
<thead><tr>
<th></th>
<th>{str tag=Name section=artefact.file}</th>
<th>{str tag=Description section=artefact.file}</th>
<th>{str tag=Size section=artefact.file}</th>
<th>{str tag=Date section=artefact.file}</th>
<th></th>
</tr></thead>
<tbody><tr><th></th></tr></tbody>
</table>
</div>
{include file="footer.tpl"}
......@@ -5,5 +5,5 @@
<th><label for="{$elementname}_{$artefact->id}" title="{$artefact->title|strip_tags|substr:0:60|escape}">{str tag=$artefact->artefacttype section=artefact.resume}</label></th>
</tr>
<tr>
<td>{if $artefact->description}{$artefact->description}{/if}</td>
<td>{$artefact->description|str_shorten_html}</td>
</tr>
......@@ -128,9 +128,8 @@ abstract class Auth {
if (in_array($name, $approved_members)) {
return $this->{$name};
}
if (isset($this->config['name'])) {
return $this->config['name'];
if (isset($this->config[$name])) {
return $this->config[$name];
}
return null;
}
......@@ -266,6 +265,18 @@ abstract class Auth {
return true;
}
/**
* Called when a user is being logged in, after the main authentication routines.
*
* You can use $USER->login() to perform any additional tasks, for example
* to set a cookie that another application can read, or pull some data
* from somewhere.
*
* This method has no parameters and needs no return value
*/
public function login() {
}
/**
* Called when a user is being logged out, either by clicking a logout
* link, their session timing out or some other method where their session
......
......@@ -907,6 +907,10 @@ class LiveUser extends User {
$this->reset_institutions();
$this->reset_grouproles();
$this->commit();
// finally, after all is done, call the (maybe non existant) hook on their auth plugin
$authobj = AuthFactory::create($authinstance);
$authobj->login();
}
/**
......
......@@ -390,6 +390,7 @@ class BlockInstance {
'message' => get_string('blockinstanceconfiguredsuccessfully', 'view'),
'data' => $this->render_editing(false, false, $form->submitted_by_js()),
'blockid' => $this->get('id'),
'viewid' => $this->get('view'),
);
$redirect = '/view/blocks.php?id=' . $this->get('view');
......@@ -709,13 +710,27 @@ class BlockInstance {
return true;
}
// Get list of allowed artefacts
require_once('view.php');
$searchdata = array(
'extraselect' => 'id IN (' . join(',', $artefacts) . ')',
);
list($allowed, $count) = View::get_artefactchooser_artefacts(
$searchdata,
$this->get_view()->get('group'),
$this->get_view()->get('institution'),
true
);
$va = new StdClass;
$va->view = $this->get('view');
$va->block = $this->id;
foreach ($artefacts as $id) {
$va->artefact = $id;
insert_record('view_artefact', $va);
if (isset($allowed[$id])) {
$va->artefact = $id;
insert_record('view_artefact', $va);
}
}
db_commit();
......
......@@ -72,7 +72,7 @@ class PluginExportHtml extends PluginExport {
$this->rootdir = 'portfolio-for-' . self::text_to_path($user->get('username'));
// Create basic required directories
foreach (array('files', 'views', 'static', 'static/smilies') as $directory) {
foreach (array('files', 'views', 'static', 'static/smilies', 'static/profileicons') as $directory) {
$directory = "{$this->exportdir}/{$this->rootdir}/{$directory}/";
if (!check_dir_exists($directory)) {
throw new SystemException("Couldn't create the temporary export directory $directory");
......
......@@ -8,7 +8,7 @@
{include file="interaction:forum:simplepost.tpl" post=$post groupadmins=$groupadmins nosubject=true}
{/if}
<div class="postbtns">
{if $moderator || !$closed}<a href="{$WWWROOT}interaction/forum/editpost.php?parent={$post->id|escape}" id="btn-reply">{str tag="Reply" section=interaction.forum}</a>{/if}
{if $moderator || ($membership && !$closed)}<a href="{$WWWROOT}interaction/forum/editpost.php?parent={$post->id|escape}" id="btn-reply">{str tag="Reply" section=interaction.forum}</a>{/if}
{if ($moderator || !$closed) && $post->canedit} | {/if}
{if $post->canedit}<a href="{$WWWROOT}interaction/forum/editpost.php?id={$post->id|escape}" id="btn-edit"> {str tag="edit"}</a>{/if}
{if $moderator && $post->parent} | <a href="{$WWWROOT}interaction/forum/deletepost.php?id={$post->id|escape}" id="btn-delete"> {str tag="delete"}</a>{/if}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment