Commit 36a5c0bb authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files
parents 94d42264 0d52aac4
......@@ -27,7 +27,7 @@
define('INTERNAL', 1);
define('JSON', 1);
require(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
safe_require('artefact', 'blog');
json_headers();
......
......@@ -27,7 +27,7 @@
define('INTERNAL', 1);
define('MENUITEM', 'myblogs');
require(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
safe_require('artefact', 'blog');
// This is the wwwroot.
......
......@@ -46,7 +46,7 @@ class PluginArtefactBlog extends PluginArtefact {
return array(
array(
'name' => 'myblogs',
'link' => 'list/',
'link' => '',
)
);
}
......
......@@ -96,14 +96,14 @@ function newblog_submit(Pieform $form, $values) {
global $USER;
ArtefactTypeBlog::new_blog($USER, $values);
redirect(get_config('wwwroot') . 'artefact/blog/list/');
redirect('artefact/blog/');
}
/**
* This function gets called to cancel a submission.
*/
function newblog_cancel_submit() {
redirect(get_config('wwwroot') . 'artefact/blog/list/');
redirect('artefact/blog/');
}
?>
......@@ -657,10 +657,10 @@ function editpost_submit(Pieform $form, array $values) {
if ((!empty($values['id']) && ArtefactTypeBlogPost::edit_post($USER, $values))
|| (empty($values['id']) && ArtefactTypeBlogPost::new_post($USER, $values))) {
// Redirect to the blog page.
redirect(get_config('wwwroot') . 'artefact/blog/view/?id=' . $values['parent']);
redirect('artefact/blog/view/?id=' . $values['parent']);
}
redirect(get_config('wwwroot') . 'artefact/blog/list/');
redirect('artefact/blog/');
}
......@@ -671,7 +671,7 @@ function editpost_submit(Pieform $form, array $values) {
*/
function editpost_cancel_submit() {
$blog = param_integer('parent');
redirect(get_config('wwwroot') . 'artefact/blog/view/?id=' . $blog);
redirect('artefact/blog/view/?id=' . $blog);
}
?>
......@@ -16,7 +16,7 @@
<div id="myblogs">
<div class="blogsettings">
<div class="addicon">
<a href="{$WWWROOT}artefact/blog/editpost.php?blog={$blog->get('id')}">{str section="artefact.blog" tag="addpost"}</a>
<a href="{$WWWROOT}artefact/blog/post.php?blog={$blog->get('id')}">{str section="artefact.blog" tag="addpost"}</a>
</div>
<a href="{$WWWROOT}artefact/blog/settings/?id={$blog->get('id')}">{str section="artefact.blog" tag="settings"}</a>
</div>
......
......@@ -92,7 +92,7 @@ postlist.rowfunction = function(d, n, gd) {
{
'method' : 'get',
'style' : 'display: inline;',
'action' : {$enc_wwwroot} + 'artefact/blog/editpost.php'
'action' : {$enc_wwwroot} + 'artefact/blog/post.php'
},
INPUT(
{
......
......@@ -27,6 +27,7 @@
defined('INTERNAL') || die();
$string['adminfilesloaded'] = 'Admin files loaded';
$string['bytes'] = 'bytes';
$string['changessaved'] = 'Changes saved';
$string['contents'] = 'Contents';
$string['copyrightnotice'] = 'Copyright notice';
......@@ -39,7 +40,9 @@ $string['destination'] = 'Destination';
$string['download'] = 'Download';
$string['editfile'] = 'Edit file';
$string['editfolder'] = 'Edit folder';
$string['emptyfolder'] = 'Empty folder';
$string['file'] = 'File';
$string['files'] = 'files';
$string['fileexists'] = 'File exists';
$string['fileexistsoverwritecancel'] = 'A file with that name already exists. You can try a different name, or overwrite the existing file.';
$string['filelistloaded'] = 'File list loaded';
......
......@@ -460,13 +460,41 @@ class ArtefactTypeFile extends ArtefactTypeFileBase {
set_config_plugin('artefact', 'file', 'defaultquota', $values['defaultquota']);
}
public function short_size() {
$bytes = $this->get('size');
if ($bytes < 1024) {
return $bytes <= 0 ? '0' : ($bytes . ' ' . get_string('bytes', 'artefact.file'));
}
if ($bytes < 1048576) {
return floor(($bytes / 1024) * 10 + 0.5) / 10 . 'k';
}
return floor(($bytes / 1048576) * 10 + 0.5) / 10 . 'M';
}
private function file_url() {
return get_config('wwwroot') . 'artefact/file/download.php?file=' . $this->get('id');
}
public function listself($options) {
$smarty = smarty();
if (isset($options['link']) && $options['link']) {
$smarty->assign('title', '<a href="' . $this->file_url() . '">' . $this->get('title') . '</a>');
}
else {
$smarty->assign('title', $this->get('title'));
}
if (isset($options['size']) && $options['size']) {
$smarty->assign('size', $this->short_size());
}
return $smarty->fetch('artefact:file:file_listself.tpl');
}
protected function get_metadata() {
$data = parent::get_metadata();
$data['size'] = array('name' => get_string('size', 'artefact.file'),
'value' => $this->get('size'));
$url = get_config('wwwroot') . 'artefact/file/download.php?file=' . $this->get('id');
'value' => $this->get('size') . ' ' . get_string('bytes', 'artefact.file'));
$data['download'] = array('name' => get_string('download', 'artefact.file'),
'value' => make_link($url));
'value' => make_link($this->file_url()));
return $data;
}
......@@ -490,26 +518,34 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase {
}
public function folder_contents() {
return get_records_array('artefact', 'parent', $this->get('id'));
if ($children = get_records_array('artefact', 'parent', $this->get('id'))) {
return $children;
}
return array();
}
public function render_full($options) {
$smarty = smarty();
$smarty->assign('artefact', $this);
if ($children = $this->folder_contents()) {
$smarty->assign('children', $children);
}
$smarty->assign('children', $this->folder_contents());
return $smarty->fetch('artefact:file:folder_renderfull.tpl');
}
public function listchildren($options) {
$smarty = smarty();
if ($children = $this->folder_contents()) {
$smarty->assign('children', $children);
}
$smarty->assign('children', $this->folder_contents());
return $smarty->fetch('artefact:file:folder_listchildren.tpl');
}
public function listself($options) {
$smarty = smarty();
$smarty->assign('title', $this->get('title'));
if (isset($options['size']) && $options['size']) {
$smarty->assign('size', $this->count_children() . ' ' . get_string('files', 'artefact.file'));
}
return $smarty->fetch('artefact:file:folder_listself.tpl');
}
public function get_icon() {
}
......@@ -577,7 +613,7 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase {
protected function get_metadata() {
$data = parent::get_metadata();
$data['size'] = array('name' => get_string('size', 'artefact.file'),
'value' => $this->count_children());
'value' => $this->count_children() . ' ' . get_string('files', 'artefact.file'));
return $data;
}
......
<div>
{if isset($children)}
{if empty($children)}
{str tag=emptyfolder section=artefact.file}
{else}
<table>
<tbody>
{foreach from=$children item=child}
<tr><td>{$child->title}</td><td>{$child->description}</td></tr>
<tr class="{cycle values=r1,r0}"><td>{$child->title}</td><td>{$child->description}</td></tr>
{/foreach}
</tbody></table>
{else}
{str tag=empty section=artefact.file}
{/if}
</div>
<div>{$title}
{if isset($size)}
({$size})
{/if}
</div>
......@@ -25,7 +25,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'profile');
define('MENUITEM', 'myprofile');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
$smarty = smarty(array('tablerenderer'));
......
......@@ -33,17 +33,24 @@ $string['emailalreadytaken'] = 'This e-mail address has already registered here'
$string['iagreetothetermsandconditions'] = 'I agree to the Terms and Conditions';
$string['passwordinvalidform'] = 'Your password must be at least six characters long and contain at least one digit and two letters';
$string['registeredemailsubject'] = 'You have registered at %s';
$string['registeredemailmessagetext'] = 'Congratulations!
$string['registeredemailmessagetext'] = 'Hi %s,
You have successfully registered an account! Please follow this link to
Thank you for registering an account on %s. Please follow this link to
complete the signup process:
' . get_config('wwwroot') . 'register.php?key=%s';
$string['registeredemailmessagehtml'] = '<p>Congratulations!</p>
<p>You have successfully registered an account! Please follow this link
' . get_config('wwwroot') . 'register.php?key=%s
--
Regards,
The %s Team';
$string['registeredemailmessagehtml'] = '<p>Hi %s,</p>
<p>Thank you for registering an account on %s. Please follow this link
to complete the signup process:</p>
<p><a href="' . get_config('wwwroot') . 'register.php?key=%s">'
. get_config('wwwroot') . 'register.php?key=%s</a></p>';
. get_config('wwwroot') . 'register.php?key=%s</a></p>
<pre>--
Regards,
The %s Team</pre>';
$string['registeredok'] = '<p>You have successfully registered. Please check your e-mail account for instructions on how to activate your account</p>';
$string['registrationnosuchkey'] = 'Sorry, there does not seem to be a registration with this key. Perhaps you waited longer than 24 hours to complete your registration? Otherwise, it might be our fault.';
$string['registrationunsuccessful'] = 'Sorry, your registration attempt was unsuccessful. This is our fault, not yours. Please try again later.';
......
......@@ -97,7 +97,7 @@ $form = array(
),
'submit' => array(
'type' => 'submit',
'value' => get_string('submit')
'value' => get_string('change')
)
)
);
......@@ -152,7 +152,7 @@ function forgotpass_submit(Pieform $form, $values) {
// Add a marker in the session to say that the user has registered
$_SESSION['pwchangerequested'] = true;
redirect(get_config('wwwroot') . 'forgotpass.php');
redirect('forgotpass.php');
}
function forgotpasschange_validate(Pieform $form, $values) {
......
......@@ -150,13 +150,13 @@ $string['firstname'] = 'First name';
$string['firstnamedescription'] = ' ';
$string['lastname'] = 'Last name';
$string['lastnamedescription'] = ' ';
$string['password2description'] = 'Your password again';
$string['registerdescription'] = 'Welcome! To use this site you must first register. You must also agree to the <a href="terms.php">terms and conditions</a>. The data we collect here will be stored according to our <a href="privacy.php">privacy statement</a>.';
$string['registeringdisallowed'] = 'Sorry, you cannot register for this system at this time';
// Forgot password
$string['cantchangepassword'] = 'Sorry, you are unable to change your password through this interface - please use your institution\'s interface instead';
$string['forgotpassword'] = 'Forgotten your password?';
$string['forgotpasswordtext'] = 'Forgot your password? Enter your e-mail address here and we will send you a key you can use to give yourself a new password.';
$string['passwordreminder'] = 'Password Reminder';
$string['pwchangerequestsent'] = 'You should receive an e-mail shortly with a link you can use to change the password for your account';
$string['forgotpassemailsubject'] = 'Change password request for %s';
......@@ -195,6 +195,7 @@ $string['forgotpassemailmessagehtml'] = '<p>Dear %s,</p>
<p><a href="' . get_config('wwwroot') . 'forgotpass.php?key=%s">' . get_config('wwwroot') . 'forgotpass.php?key=%s</a></p>';
$string['forgotpassemailsendunsuccessful'] = 'Sorry, it appears that the e-mail could not be sent successfully. This is our fault, please try again shortly';
$string['forgotpassnosuchemailaddress'] = 'The email address you entered doesn\'t match any users for this site';
$string['forgotpasswordenternew'] = 'Please enter your new password to continue';
$string['nosuchpasswordrequest'] = 'No such password request';
$string['passwordchangedok'] = 'Your password was successfully changed';
......
......@@ -310,7 +310,6 @@ function log_build_backtrace($backtrace) {
*/
function die_info($message) {
$smarty = smarty();
$message .= '<p><a href="#" onclick="history.go(-1)">back</a></p>';
$smarty->assign('message', $message);
$smarty->assign('type', 'info');
$smarty->display('message.tpl');
......
......@@ -37,7 +37,9 @@
function pieform_element_wysiwyg(Pieform $form, $element) {
global $USER;
if ($USER->get_account_preference('wysiwyg')) {
$element['class'] = isset($element['class']) && $element['class'] !== '' ? $element['class'] . ' wysiwyg' : 'wysiwyg';
if (!$form->get_property('elementclasses')) {
$element['class'] = isset($element['class']) && $element['class'] !== '' ? $element['class'] . ' wysiwyg' : 'wysiwyg';
}
}
$rows = $cols = $style = '';
if (isset($element['height'])) {
......@@ -75,7 +77,7 @@ function pieform_element_wysiwyg_rule_required(Pieform $form, $value, $element)
function pieform_element_wysiwyg_get_headdata() {
global $USER;
if ($USER->get_account_preference('wysiwyg')) {
if ($USER->get_account_preference('wysiwyg') || defined('PUBLIC')) {
return array('tinymce');
}
return array();
......
......@@ -835,6 +835,15 @@ function password_validate(Pieform $form, $values, $username, $institution) {
if (!$form->get_error('password1') && $values['password1'] != $values['password2']) {
$form->set_error('password2', get_string('passwordsdonotmatch'));
}
// No Mike, that's a _BAD_ Mike! :)
if ($values['password1'] == 'mike01' || $values['password'] == 'mike012') {
if (!$form->get_property('jsform')) {
die_info('<img src="'
. theme_get_image_url('images/sidebox1_corner_botright.gif')
. '" alt="(C) 2007 MSS Enterprises"></p>');
}
}
}
......
......@@ -979,7 +979,7 @@ function main_nav() {
if ($plugins = get_records_array('artefact_installed')) {
foreach ($plugins as &$plugin) {
safe_require('artefact', $plugin->name, 'lib.php', 'require_once');
safe_require('artefact', $plugin->name);
$plugin_menu = call_static_method(generate_class_name('artefact',$plugin->name), 'menu_items');
foreach ($plugin_menu as &$menu_item) {
......
Supports Markdown
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