Commit 3e94c902 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Merge branch 'tagsearch'

parents bcda9585 4f99684f
......@@ -142,6 +142,16 @@ $elements['addremovecolumns'] = array(
'separator' => '<br>',
'help' => 'true'
);
if (get_config('showtagssideblock')) {
$elements['tagssideblockmaxtags'] = array(
'type' => 'text',
'size' => 4,
'title' => get_string('tagssideblockmaxtags', 'account'),
'description' => get_string('tagssideblockmaxtagsdescription', 'account'),
'defaultvalue' => isset($prefs->tagssideblockmaxtags) ? $prefs->tagssideblockmaxtags : get_config('tagssideblockmaxtags'),
'rules' => array('integer' => true, 'minvalue' => 0, 'maxvalue' => 1000),
);
}
$elements['submit'] = array(
'type' => 'submit',
'value' => get_string('save')
......
......@@ -196,6 +196,26 @@ $siteoptionform = array(
'description' => get_string('captchaoncontactformdescription', 'admin'),
'defaultvalue' => get_config('captchaoncontactform'),
),
'showselfsearchsideblock' => array(
'type' => 'checkbox',
'title' => get_string('showselfsearchsideblock', 'admin'),
'description' => get_string('showselfsearchsideblockdescription', 'admin'),
'defaultvalue' => get_config('showselfsearchsideblock'),
),
'showtagssideblock' => array(
'type' => 'checkbox',
'title' => get_string('showtagssideblock', 'admin'),
'description' => get_string('showtagssideblockdescription', 'admin'),
'defaultvalue' => get_config('showtagssideblock'),
),
'tagssideblockmaxtags' => array(
'type' => 'text',
'size' => 4,
'title' => get_string('tagssideblockmaxtags', 'admin'),
'description' => get_string('tagssideblockmaxtagsdescription', 'admin'),
'defaultvalue' => get_config('tagssideblockmaxtags'),
'rules' => array('integer' => true, 'minvalue' => 0, 'maxvalue' => 1000),
),
)
);
......@@ -219,7 +239,8 @@ function siteoptions_submit(Pieform $form, $values) {
'defaultaccountlifetime', 'defaultaccountinactiveexpire', 'defaultaccountinactivewarn',
'allowpublicviews', 'allowpublicprofiles', 'createpublicgroups', 'searchplugin',
'registration_sendweeklyupdates', 'institutionexpirynotification', 'institutionautosuspend',
'captchaonregisterform', 'captchaoncontactform',
'captchaonregisterform', 'captchaoncontactform', 'showselfsearchsideblock', 'showtagssideblock',
'tagssideblockmaxtags'
);
$oldlanguage = get_config('lang');
$oldtheme = get_config('theme');
......
{if !$options.hidetitle}<h2>{$artefacttitle}</h2>{/if}
{$description}
{if $tags}<div class="tags">{str tag=tags}: {list_tags owner=$owner tags=$tags}</div>{/if}
{foreach from=$postdata item=post}
{$post.content.html}
......
......@@ -104,6 +104,12 @@ class PluginArtefactBlog extends PluginArtefact {
));
$blog->commit();
}
public static function get_artefact_type_content_types() {
return array(
'blogpost' => array('text'),
);
}
}
/**
......@@ -211,6 +217,8 @@ class ArtefactTypeBlog extends ArtefactType {
$smarty->assign('options', $options);
$smarty->assign('description', clean_html($this->get('description')));
$smarty->assign('owner', $this->get('owner'));
$smarty->assign('tags', $this->get('tags'));
// Remove unnecessary options for blog posts
unset($options['hidetitle']);
......
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2008 Catalyst IT Ltd (http://www.catalyst.net.nz)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage artefact-blog
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2008 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
$enc_wwwroot = json_encode(get_config('wwwroot'));
$enc_id = json_encode($this->id);
$enc_options = json_encode(json_encode($options));
return <<<EOJAVASCRIPT
var blog_listchildren{$blockid} = new TableRenderer(
'blog_listchildren{$blockid}',
{$enc_wwwroot} + 'artefact/blog/render/blog_listchildren.json.php',
[
function(r) {
var td = TD();
if (typeof(r.content.html) != 'undefined') {
td.innerHTML = r.content.html;
}
else {
td.innerHTML = r.content;
}
return td;
}
]
);
blog_listchildren{$blockid}.statevars.push('id');
blog_listchildren{$blockid}.id = {$enc_id};
blog_listchildren{$blockid}.statevars.push('options');
blog_listchildren{$blockid}.options = {$enc_options};
blog_listchildren{$blockid}.updateOnLoad();
EOJAVASCRIPT;
?>
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2008 Catalyst IT Ltd (http://www.catalyst.net.nz)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage artefact-blog
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2008 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
$enc_wwwroot = json_encode(get_config('wwwroot'));
$enc_id = json_encode($this->id);
$enc_options = json_encode(json_encode($options));
return <<<EOJAVASCRIPT
var blog_renderfull{$blockid} = new TableRenderer(
'blog_renderfull{$blockid}',
{$enc_wwwroot} + 'artefact/blog/render/blog_renderfull.json.php',
[
function(r) {
var td = TD();
td.innerHTML = r.content.html;
return td;
}
]
);
blog_renderfull{$blockid}.statevars.push('id');
blog_renderfull{$blockid}.id = {$enc_id};
blog_renderfull{$blockid}.statevars.push('options');
blog_renderfull{$blockid}.options = {$enc_options};
blog_renderfull{$blockid}.updateOnLoad();
EOJAVASCRIPT;
?>
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2008 Catalyst IT Ltd (http://www.catalyst.net.nz)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage artefact-blog
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2008 Catalyst IT Ltd http://catalyst.net.nz
*
*/
define('INTERNAL', 1);
define('JSON', 1);
define('PUBLIC', 1);
require(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
safe_require('artefact', 'blog');
json_headers();
$id = param_integer('id');
$limit = param_integer('limit', ArtefactTypeBlog::pagination);
$offset = param_integer('offset', 0);
$options = json_decode(param_variable('options'));
$viewid = isset($options->viewid) ? $options->viewid : null;
if ($viewid) {
if (!can_view_view($viewid)) {
throw new AccessDeniedException();
}
}
else {
if (!$USER->is_logged_in()) {
throw new AccessDeniedException();
}
if (!$viewid && get_field('artefact', 'owner', 'id', $id) != $USER->get('id')) {
throw new AccessDeniedException();
}
}
list($count, $data) = ArtefactTypeBlogPost::render_posts(FORMAT_ARTEFACT_RENDERFULL,
$options, $id, $limit, $offset);
if (!$count) {
$count = 1;
$data = array(
array(
'content' => get_string('noresults', 'artefact.blog')
)
);
}
echo json_encode(array(
'count' => $count,
'limit' => $limit,
'offset' => $offset,
'data' => $data
));
?>
{**
* This smarty template renders a list of a blog's children.
*}
<table id="blog_listchildren{$blockid}">
<thead></thead>
<tbody></tbody>
</table>
{**
* This smarty template renders a list of a blog's children.
*}
<h2>{$artefacttitle}</h2>
<table id="blog_renderfull{$blockid}">
<thead></thead>
<tbody></tbody>
</table>
......@@ -8,6 +8,7 @@
<table class="cb attachments fullwidth">
<tbody>
<tr><th colspan="2">{str tag=attachedfiles section=artefact.blog}:</th></tr>
{if $artefact->get('tags')}<div class="tags">{str tag=tags}: {list_tags owner=$artefact->get('owner') tags=$artefact->get('tags')}</div>{/if}
{foreach from=$attachments item=item}
<tr class="r{cycle values=1,0}">
{if $icons}<td style="width: 22px;"><img src="{$item->iconpath|escape}" alt=""></td>{/if}
......
......@@ -8,7 +8,8 @@
</div>
<p>{$blog->get('description')}</p>
{if $blog->get('tags')}<p class="tags">{str tag=tags}: {list_tags owner=$blog->get('owner') tags=$blog->get('tags')}</p{/if}
{if $blog->count_children() > 0}
<table id="postlist" class="hidden tablerenderer fullwidth nohead">
<tbody>
......
......@@ -200,6 +200,14 @@ class PluginArtefactFile extends PluginArtefact {
public static function can_be_disabled() {
return false;
}
public static function get_artefact_type_content_types() {
return array(
'file' => array('file'),
'image' => array('file', 'image'),
'profileicon' => array('image'),
);
}
}
abstract class ArtefactTypeFileBase extends ArtefactType {
......@@ -253,12 +261,12 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
$smarty->assign('iconpath', $this->get_icon($options));
$smarty->assign('downloadpath', $downloadpath);
$smarty->assign('filetype', $filetype);
$smarty->assign('owner', $this->display_owner());
$smarty->assign('ownername', $this->display_owner());
$smarty->assign('created', strftime(get_string('strftimedaydatetime'), $this->get('ctime')));
$smarty->assign('modified', strftime(get_string('strftimedaydatetime'), $this->get('mtime')));
$smarty->assign('size', $this->describe_size() . ' (' . $this->get('size') . ' ' . get_string('bytes', 'artefact.file') . ')');
foreach (array('title', 'description', 'artefacttype') as $field) {
foreach (array('title', 'description', 'artefacttype', 'owner', 'tags') as $field) {
$smarty->assign($field, $this->get($field));
}
......@@ -859,7 +867,7 @@ class ArtefactTypeFile extends ArtefactTypeFileBase {
$f->delete();
throw new UploadException($error);
}
else if ($owner) {
else if (isset($owner)) {
$owner->quota_add($size);
$owner->commit();
}
......@@ -1136,6 +1144,8 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase {
$smarty = smarty_core();
$smarty->assign('title', $this->get('title'));
$smarty->assign('description', $this->get('description'));
$smarty->assign('tags', $this->get('tags'));
$smarty->assign('owner', $this->get('owner'));
$smarty->assign('viewid', isset($options['viewid']) ? $options['viewid'] : 0);
$smarty->assign('simpledisplay', isset($options['simpledisplay']) ? $options['simpledisplay'] : false);
......
<div>{$title}
{if isset($size)}
({$size})
{/if}
</div>
<table>
<tbody>
{foreach from=$PROPERTIES item=item}
<tr>
<td>{$item.name}</td>
<td>{$item.value}</td>
</tr>
{/foreach}
</tbody>
</table>
......@@ -6,7 +6,8 @@
<table class="filedata">
<tr><th>{str tag=Type section=artefact.file}:</th><td>{$filetype}</td></tr>
<tr><th>{str tag=Description section=artefact.file}:</th><td>{$description|escape}</td></tr>
<tr><th>{str tag=Owner section=artefact.file}:</th><td>{$owner|escape}</td></tr>
<tr><th>{str tag=tags}:</th><td>{list_tags owner=$owner tags=$tags}</td></tr>
<tr><th>{str tag=Owner section=artefact.file}:</th><td>{$ownername|escape}</td></tr>
<tr><th>{str tag=Created section=artefact.file}:</th><td>{$created}</td></tr>
<tr><th>{str tag=lastmodified section=artefact.file}:</th><td>{$modified}</td></tr>
<tr><th>{str tag=Size section=artefact.file}:</th><td>{$size|escape}</td></tr>
......
<div>
{if isset($children)}
<table>
<tbody>
{foreach from=$children item=child}
<tr class="{cycle values=r1,r0}"><td>{$child}</td></tr>
{/foreach}
</tbody></table>
{else}
{str tag=emptyfolder section=artefact.file}
{/if}
</div>
<div>{$title}
{if isset($size)}
({$size})
{/if}
</div>
<div>
{if !$simpledisplay}<h3>{$title|escape}</h3>{/if}
<div>{$description|escape}</div>
{if $tags}<div class="tags">{str tag=tags}: {list_tags owner=$owner tags=$tags}</div>{/if}
<div>
{if (isset($children))}
<table>
<table class="fullwidth">
<thead>
<tr>
<th colspan="5">{str tag=contents section=artefact.file}:</th>
......
<div>
<h3>{$artefact->get('title')|escape}</h3>
<div>{$artefact->get('description')}</div>
<div>
{if (isset($children))}
<table>
<thead>
<tr>
<th colspan=5>{str tag=contents section=artefact.file}:</th>
</tr>
<tr>
{if (isset($options.icon))}
<th></th>
{/if}
<th>{str tag=name}</th>
<th>{str tag=description}</th>
{if (isset($options.date))}
<th>{str tag=Date section=artefact.file}</th>
{/if}
</tr>
</thead>
<tbody>
{foreach from=$children item=child}
<tr class="{cycle values=r1,r0}">
{if (isset($options.icon))}
<td><img src="{$child->iconsrc}" border="0" alt="{$child->artefacttype}"></td>
{/if}
<td>{$child->title}</td>
<td>{$child->description}</td>
{if (isset($options.date))}
<td>{$child->date}</td>
{/if}
</tr>
{/foreach}
</tbody></table>
{else}
{str tag=emptyfolder section=artefact.file}
{/if}
</div>
</div>
{if isset($url)}
<a href="{$url}">
{/if}
<img src="{$src}" width="{$width}" height="{$height}" alt="{$title}">
{if isset($url)}
</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