Commit b6f1f2ab authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files
parents 7dc9c69b c797fe15
......@@ -35,6 +35,6 @@ if (!delete_records('site_menu','id',$itemid)) {
json_reply('local', get_string('deletefailed','admin'));
}
json_reply(false,get_string('deletedsuccessfully','admin'));
json_reply(false,get_string('menuitemdeleted','admin'));
?>
......@@ -29,6 +29,17 @@ define('ADMIN', 1);
define('MENUITEM','menueditor');
require(dirname(dirname(__FILE__)).'/init.php');
$strings = array('edit','delete','update','cancel','add','name','unknownerror');
$adminstrings = array('deletefailed','deletingmenuitem','savingmenuitem',
'noadminfiles','loggedinmenu','loggedoutmenu','linkedto','externallink','adminfile',
'loadingmenuitems','menuitemsloaded','failedloadingmenuitems');
foreach ($strings as $string) {
$getstring[$string] = "'" . get_string($string) . "'";
}
foreach ($adminstrings as $string) {
$getstring[$string] = "'" . get_string($string,'admin') . "'";
}
$thead = array(get_string('type','admin'),get_string('name','admin'),get_string('linkedto','admin'),'');
$ijs = "var thead = TR(null,map(partial(TH,null),['" . implode($thead,"','") . "']));\n";
$ijs .= "var externallink = '" . get_string('externallink','admin') . "';\n";
......@@ -37,17 +48,17 @@ $ijs .= "var adminfile = '" . get_string('adminfile','admin') . "';\n";
$ijs .= <<< EOJS
// Request a list of menu items from the server
function getitems() {
logDebug(get_string('loadingmenuitems','admin'));
logDebug({$getstring['loadingmenuitems']});
processingStart();
var d = loadJSONDoc('getmenuitems.json.php',{'public':selectedmenu == 'loggedoutmenu'});
d.addCallback(function(data) {
if (!data.error) {
logDebug(get_string('loadedmenuitems','admin'));
logDebug({$getstring['menuitemsloaded']});
displaymenuitems(data.menuitems);
processingStop();
}
else {
displayMessage(get_string('failedloadingmenuitems','admin'),'error');
displayMessage({$getstring['failedloadingmenuitems']},'error');
processingStop();
}
});
......@@ -67,9 +78,9 @@ function formatrow (item) {
// item has id, type, name, link, linkedto
var type = eval(item.type);
var linkedto = item.link == '' ? item.linkedto : A({'href':item.link},item.linkedto);
var del = INPUT({'type':'button','value':get_string('delete')});
var del = INPUT({'type':'button','value':{$getstring['delete']}});
del.onclick = function () { delitem(item.id); };
var edit = INPUT({'type':'button','value':get_string('edit')});
var edit = INPUT({'type':'button','value':{$getstring['edit']}});
edit.onclick = function () { edititem(item); };
var cells = map(partial(TD,null),[type,item.name,linkedto,[del,edit]]);
return TR({'id':'menuitem_'+item.id},cells);
......@@ -108,13 +119,13 @@ function editform(item) {
elink.onclick = function () { changeaddform('externallink'); };
afile.onclick = function () { changeaddform('adminfile'); };
// The save button says 'add', and there's no cancel button.
setNodeAttribute(save,'value',get_string('add'));
setNodeAttribute(save,'value',{$getstring['add']});
savecancel = [save];
}
else { // Editing an existing menu item.
// The save button says 'update' and there's a cancel button.
setNodeAttribute(save,'value',get_string('update'));
var cancel = INPUT({'type':'button','value':get_string('cancel')});
setNodeAttribute(save,'value',{$getstring['update']});
var cancel = INPUT({'type':'button','value':{$getstring['cancel']}});
cancel.onclick = closeopenedits;
savecancel = [save,cancel];
elink.onclick = function () { changeeditform(item,'externallink'); };
......@@ -128,7 +139,7 @@ function editform(item) {
var adminfiles = getadminfiles();
if (adminfiles == null) {
// There are no admin files, we don't need the select or save button
linkedto = get_string('noadminfiles','admin');
linkedto = {$getstring['noadminfiles']};
savecancel = [cancel];
}
else {
......@@ -141,7 +152,8 @@ function editform(item) {
linkedto = INPUT({'type':'text','name':'linkedto','value':item.linkedto});
setNodeAttribute(elink,'checked',true);
}
var radios = [DIV(null,elink,eval('externallink')),DIV(null,afile,eval('adminfile'))];
var radios = [DIV(null,elink,{$getstring['externallink']}),
DIV(null,afile,{$getstring['adminfile']})];
var row = TR(null,map(partial(TD,null),[radios,name,linkedto,savecancel]));
return TABLE({'width':'100%'},cols(),TBODY(null,row));
}
......@@ -213,8 +225,7 @@ function get_json_status(data) {
// Request deletion of a menu item from the db
function delitem(itemid) {
processingStart();
//displayMessage(get_string('deletingmenuitem','admin'),'info');
logDebug(get_string('deletingmenuitem','admin'));
logDebug({$getstring['deletingmenuitem']});
var d = loadJSONDoc('deletemenuitem.json.php',{'itemid':itemid});
d.addCallback(get_json_status);
}
......@@ -225,16 +236,15 @@ function saveitem(formid) {
var name = f.name.value;
var linkedto = f.linkedto.value;
if (name == '') {
displayMessage(get_string('namedfieldempty',get_string('name','admin')),'error');
displayMessage(get_string('namedfieldempty',{$getstring['name']}),'error');
return false;
}
if (linkedto == '') {
displayMessage(get_string('namedfieldempty',get_string('linkedto','admin')),'error');
displayMessage(get_string('namedfieldempty',{$getstring['linkedto']}),'error');
return false;
}
processingStart();
//displayMessage(get_string('savingmenuitem','admin'),'info');
logDebug(get_string('savingmenuitem','admin'));
logDebug({$getstring['savingmenuitem']});
var data = {'type':f.type[0].checked ? 'externallink' : 'adminfile',
'name':name,
'linkedto':linkedto,
......@@ -249,7 +259,7 @@ function saveitem(formid) {
get_json_status(data);
});
d.addErrback(function() {
displayMessage(get_string('unknownerror'),'error');
displayMessage({$getstring['unknownerror']},'error');
processingStop();
});
return false;
......@@ -282,14 +292,11 @@ EOJS;
$menulist = array('loggedinmenu', 'loggedoutmenu');
foreach ($menulist as &$menu) {
$menu = array('value' => $menu,
'name' => get_string($menu));
'name' => get_string($menu,'admin'));
}
$style = '<style type="text/css">.invisible{display:none;}</style>';
$strings = array('deletefailed','deletingmenuitem','menuitemdeleted','savingmenuitem','noadminfiles',
'edit','delete','update','cancel','add','loggedinmenu','loggedoutmenu','name',
'linkedto');
$smarty = smarty(array(),array($style),$strings);
$smarty = smarty(array(),array($style));
$smarty->assign('INLINEJAVASCRIPT',$ijs);
$smarty->assign('EDIT',get_string('edit') . ':');
$smarty->assign('MENUS',$menulist);
......
......@@ -37,6 +37,8 @@ foreach ($sitepages as $page) {
}
asort($pageoptions);
$getstring = array('discardpageedits' => "'" . get_string('discardpageedits','admin') . "'");
$f = array(
'name' => 'editsitepage',
'method' => 'post',
......@@ -104,7 +106,7 @@ var originalcontent = '';
function requestPageText(removeMessage) {
// Allow the user to abort change if changes have been made in the editor.
if (getEditorContent() != originalcontent) {
var answer = confirm(get_string('discardpageedits'));
var answer = confirm({$getstring['discardpageedits']});
if (!answer) {
$('pagename').value = oldpagename;
return;
......@@ -159,9 +161,7 @@ function onLoad() {
addLoadEvent(onLoad);
EOJS;
$jsstrings = array('discardpageedits');
$smarty = smarty($js, array(), $jsstrings);
$smarty = smarty($js);
$smarty->assign('pageeditform', $form);
$smarty->assign('INLINEJAVASCRIPT', $ijs);
$smarty->display('admin/editsitepage.tpl');
......
......@@ -136,7 +136,7 @@ function siteoptions_submit($values) {
json_reply(false, get_string('siteoptionsset','admin'));
}
$smarty = smarty(array(),array(),array('siteoptionsset','setsiteoptionsfailed'));
$smarty = smarty();
$smarty->assign('SITEOPTIONFORM',$siteoptionform);
$smarty->display('admin/options/index.tpl');
......
......@@ -75,6 +75,6 @@ else {
}
}
json_reply(false,get_string('menuitemsaved'));
json_reply(false,get_string('menuitemsaved','admin'));
?>
......@@ -19,25 +19,27 @@
-->
<TABLE NAME="artefact_internal_profile_email">
<FIELDS>
<FIELD NAME="user" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="owner" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="email" TYPE="text" NOTNULL="true" />
<FIELD NAME="verified" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="principal" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="false" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="user,email" />
<KEY NAME="userfk" TYPE="foreign" FIELDS="user" REFTABLE="usr" REFFIELDS="id" />
<KEY NAME="primary" TYPE="primary" FIELDS="owner,email" />
<KEY NAME="ownerfk" TYPE="foreign" FIELDS="owner" REFTABLE="usr" REFFIELDS="id" />
<KEY NAME="artefactfk" TYPE="foreign" FIELDS="artefact" REFTABLE="artefact" REFFIELDS="id" />
</KEYS>
</TABLE>
<TABLE NAME="artefact_internal_profile_icon">
<FIELDS>
<FIELD NAME="user" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="owner" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="filename" TYPE="text" NOTNULL="true" />
<FIELD NAME="primary" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="user,filename" />
<KEY NAME="userfk" TYPE="foreign" FIELDS="user" REFTABLE="usr" REFFIELDS="id" />
<KEY NAME="primary" TYPE="primary" FIELDS="owner,filename" />
<KEY NAME="ownerfk" TYPE="foreign" FIELDS="owner" REFTABLE="usr" REFFIELDS="id" />
</KEYS>
</TABLE>
</TABLES>
......
......@@ -86,6 +86,10 @@ $string['linkedto'] = 'Linked to';
$string['editmenus'] = 'Edit menus';
$string['menuitemsaved'] = 'Menu item saved';
$string['savingmenuitem'] = 'Saving menu item';
$string['menuitemsloaded'] = 'Menu items loaded';
$string['deletingmenuitem'] = 'Deleting menu item';
$string['menuitemdeleted'] = 'Menu item deleted';
$string['loadingmenuitems'] = 'Loading menu items';
$string['loggedinmenu'] = 'Logged in menu';
$string['loggedoutmenu'] = 'Logged out menu';
......
......@@ -208,6 +208,59 @@
<KEY NAME="subscruk" TYPE="unique" FIELDS="plugin,event,callfunction" />
</KEYS>
</TABLE>
<!-- search plugin tables -->
<TABLE NAME="search_installed">
<FIELDS>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" />
<FIELD NAME="version" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="release" TYPE="text" LENGTH="small" NOTNULL="true" />
<FIELD NAME="active" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="name" />
</KEYS>
</TABLE>
<TABLE NAME="search_config">
<FIELDS>
<FIELD NAME="plugin" TYPE="char" LENGTH="100" NOTNULL="true" />
<FIELD NAME="field" TYPE="char" LENGTH="100" NOTNULL="true" />
<FIELD NAME="value" TYPE="text" LENGTH="small" NOTNULL="true" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="plugin,field" />
<KEY NAME="pluginfk" TYPE="foreign" FIELDS="plugin" REFTABLE="search_installed" REFFIELDS="name" />
</KEYS>
</TABLE>
<TABLE NAME="search_cron">
<FIELDS>
<FIELD NAME="plugin" TYPE="char" LENGTH="255" NOTNULL="true" />
<FIELD NAME="callfunction" TYPE="char" LENGTH="255" NOTNULL="true" />
<FIELD NAME="nextrun" TYPE="datetime" NOTNULL="false" />
<FIELD NAME="minute" TYPE="char" LENGTH="25" NOTNULL="true" DEFAULT="*" />
<FIELD NAME="hour" TYPE="char" LENGTH="25" NOTNULL="true" DEFAULT="*" />
<FIELD NAME="day" TYPE="char" LENGTH="25" NOTNULL="true" DEFAULT="*" />
<FIELD NAME="month" TYPE="char" LENGTH="25" NOTNULL="true" DEFAULT="*" />
<FIELD NAME="dayofweek" TYPE="char" LENGTH="25" NOTNULL="true" DEFAULT="*" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="plugin,callfunction" />
<KEY NAME="pluginfk" TYPE="foreign" FIELDS="plugin" REFTABLE="search_installed" REFFIELDS="name" />
</KEYS>
</TABLE>
<TABLE NAME="search_event_subscription">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" SEQUENCE="true" NOTNULL="true" />
<FIELD NAME="plugin" TYPE="char" LENGTH="255" NOTNULL="true" />
<FIELD NAME="event" TYPE="char" LENGTH="50" NOTNULL="true" />
<FIELD NAME="callfunction" TYPE="char" LENGTH="255" NOTNULL="true" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
<KEY NAME="pluginfk" TYPE="foreign" FIELDS="plugin" REFTABLE="search_installed" REFFIELDS="name" />
<KEY NAME="eventfk" TYPE="foreign" FIELDS="event" REFTABLE="event_type" REFFIELDS="name" />
<KEY NAME="subscruk" TYPE="unique" FIELDS="plugin,event,callfunction" />
</KEYS>
</TABLE>
<!-- artefact plugin tables -->
<TABLE NAME="artefact_installed">
<FIELDS>
......
......@@ -642,7 +642,7 @@ function get_site_page_content($pagename) {
function plugin_types() {
static $pluginstocheck;
if (empty($pluginstocheck)) {
$pluginstocheck = array('artefact', 'auth', 'notification');
$pluginstocheck = array('artefact', 'auth', 'notification', 'search');
}
return $pluginstocheck;
}
......
......@@ -163,7 +163,6 @@ function set_profile_field($userid, $field, $value) {
safe_require('artefact', 'internal');
$classname = generate_artefact_class_name($field);
$profile = new $classname(0, array('owner' => $userid));
$profile->set('owner', $userid);
$profile->set('title', $value);
$profile->commit();
......
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
/**
* The internal authentication method, which authenticates users against the
* The internal search plugin which searches against the
* Mahara database.
*/
class PluginSearchInternal extends PluginSearch {
......
<?php
/**
* This program is part of Mahara
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package mahara
* @subpackage search-internal
* @author Martyn Smith <martyn@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
$config->version = 2006111600;
$config->release = '0.1';
?>
\ No newline at end of file
......@@ -30,7 +30,7 @@ defined('INTERNAL') || die();
* Base search class. Provides a common interface with which searches can be
* carried out.
*/
abstract class PluginSearch {
abstract class PluginSearch extends Plugin {
/**
* Given a query string and limits, return an array of matching users
......
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