Commit 6519eb4a authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Change admin files to site files

parent 8155575f
......@@ -26,14 +26,14 @@
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configsite/adminfiles');
define('MENUITEM', 'configsite/sitefiles');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'adminfiles');
define('SECTION_PAGE', 'sitefiles');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
safe_require('artefact', 'file');
define('TITLE', get_string('adminfiles', 'admin'));
define('TITLE', get_string('sitefiles', 'admin'));
$copyright = get_field('site_content', 'content', 'name', 'uploadcopyright');
$wwwroot = get_config('wwwroot');
......@@ -52,7 +52,7 @@ $smarty = smarty(array('tablerenderer',
'artefact/file/js/file.js'));
$smarty->assign('INLINEJAVASCRIPT', $javascript);
$smarty->assign('descriptionstrargs', array('<a href="' . get_config('wwwroot') . 'admin/site/menu.php">', '</a>'));
$smarty->assign('heading', get_string('adminfiles', 'admin'));
$smarty->assign('heading', get_string('sitefiles', 'admin'));
$smarty->display('admin/site/files.tpl');
?>
......@@ -50,7 +50,7 @@ if ($menuitems) {
$r['id'] = $i->id;
$r['name'] = $i->title;
if (empty($i->url) && !empty($i->file)) {
$r['type'] = 'adminfile';
$r['type'] = 'sitefile';
$r['linkedto'] = get_config('wwwroot') . 'artefact/file/download.php?file=' . $i->file;
$r['linktext'] = $i->filename;
$r['file'] = $i->file;
......
......@@ -36,8 +36,8 @@ define('TITLE', get_string('linksandresourcesmenu', 'admin'));
$strings = array('edit','delete','update','cancel','add','name','unknownerror');
$adminstrings = array('confirmdeletemenuitem', 'deletefailed','deletingmenuitem','savingmenuitem',
'noadminfiles','loggedinmenu','loggedoutmenu','linkedto','externallink','adminfile',
'loadingmenuitems','menuitemsloaded','failedloadingadminfiles',
'nositefiles','loggedinmenu','loggedoutmenu','linkedto','externallink','sitefile',
'loadingmenuitems','menuitemsloaded','failedloadingsitefiles',
'failedloadingmenuitems');
foreach ($strings as $string) {
$getstring[$string] = json_encode(get_string($string));
......@@ -49,7 +49,7 @@ foreach ($adminstrings as $string) {
$thead = array(json_encode(get_string('type', 'admin')), json_encode(get_string('name', 'admin')), json_encode(get_string('linkedto', 'admin')), '""');
$ijs = "var thead = TR(null,map(partial(TH,null),[" . implode($thead,",") . "]));\n";
$ijs .= "var externallink = " . json_encode(get_string('externallink', 'admin')) . ";\n";
$ijs .= "var adminfile = " . json_encode(get_string('adminfile','admin')) . ";\n";
$ijs .= "var sitefile = " . json_encode(get_string('sitefile','admin')) . ";\n";
$ijs .= <<< EOJS
// Request a list of menu items from the server
......@@ -115,7 +115,7 @@ function editform(item) {
// item has id, type, name, link, linkedto
// The form has two radio buttons to select the type, external link or admin file
var elink = INPUT({'type':'radio','class':'radio','name':'type'+item.id,'value':'externallink'});
var afile = INPUT({'type':'radio','class':'radio','name':'type'+item.id,'value':'adminfile'});
var afile = INPUT({'type':'radio','class':'radio','name':'type'+item.id,'value':'sitefile'});
// Either a save, a cancel button, or both.
var savecancel = [];
......@@ -135,7 +135,7 @@ function editform(item) {
item.linkedto = '';
item.name = '';
connect(elink, 'onclick', function () { changeaddform('externallink'); });
connect(afile, 'onclick', function () { changeaddform('adminfile'); });
connect(afile, 'onclick', function () { changeaddform('sitefile'); });
// The save button says 'add', and there's no cancel button.
setNodeAttribute(save,'value',{$getstring['add']});
savecancel = [save];
......@@ -148,16 +148,16 @@ function editform(item) {
connect(cancel, 'onclick', closeopenedits);
savecancel = [save,cancel];
connect(elink, 'onclick', function () { changeeditform(item,'externallink'); });
connect(afile, 'onclick', function () { changeeditform(item,'adminfile'); });
connect(afile, 'onclick', function () { changeeditform(item,'sitefile'); });
}
// A text field for the name
var name = INPUT({'type':'text','class':'text','id':'name'+item.id,'value':item.name});
if (item.type == 'adminfile') {
if (item.type == 'sitefile') {
if (adminfiles == null) {
// There are no admin files, we don't need the select or save button
linkedto = {$getstring['noadminfiles']};
linkedto = {$getstring['nositefiles']};
savecancel = [cancel];
}
else {
......@@ -180,7 +180,7 @@ function editform(item) {
setNodeAttribute(elink,'checked',true);
}
var radios = [DIV(null, LABEL(null,elink,{$getstring['externallink']}), contextualHelpIcon(null, null, 'core', 'admin', null, 'adminexternallink')),
DIV(null, LABEL(null,afile,{$getstring['adminfile']}), contextualHelpIcon(null, null, 'core', 'admin', null, 'adminadminfile'))];
DIV(null, LABEL(null,afile,{$getstring['sitefile']}), contextualHelpIcon(null, null, 'core', 'admin', null, 'adminsitefile'))];
var row = TR({'id':'row'+item.id, 'class':rowtype},
map(partial(TD,null),[radios,name,linkedto,savecancel]));
return row;
......@@ -242,7 +242,7 @@ function saveitem(itemid) {
return false;
}
var data = {'type':eval('f.type'+itemid+'[0].checked') ? 'externallink' : 'adminfile',
var data = {'type':eval('f.type'+itemid+'[0].checked') ? 'externallink' : 'sitefile',
'name':name,
'linkedto':linkedto,
'itemid':itemid,
......
......@@ -39,7 +39,7 @@ $itemid = param_variable('itemid');
$public = (int) param_boolean('public');
$data = new StdClass;
if ($type == 'adminfile') {
if ($type == 'sitefile') {
// Get file id.
$data->file = $linkedto;
}
......
......@@ -28,7 +28,7 @@ defined('INTERNAL') || die();
$string['pluginname'] = 'Files';
$string['adminfilesloaded'] = 'Admin files loaded';
$string['sitefilesloaded'] = 'Site files loaded';
$string['bytes'] = 'bytes';
$string['changessaved'] = 'Changes saved';
$string['contents'] = 'Contents';
......
......@@ -70,8 +70,8 @@ $string['editsitepages'] = 'Edit site pages';
$string['editsitepagesdescription'] = 'Edit the content of various pages around the site';
$string['linksandresourcesmenu'] = 'Links and Resources Menu';
$string['linksandresourcesmenudescription'] = 'Manage the links and files within the Links and Resources Menu';
$string['adminfiles'] = 'Admin Files';
$string['adminfilesdescription'] = 'Upload and administer files that can be put in the Links and Resources Menu';
$string['sitefiles'] = 'Site Files';
$string['sitefilesdescription'] = 'Upload and administer files that can be put in the Links and Resources Menu';
$string['networking'] = 'Networking';
$string['networkingdescription'] = 'Configure networking for Mahara';
......@@ -150,7 +150,7 @@ $string['termsandconditions'] = 'Terms and Conditions';
$string['uploadcopyright'] = 'Upload Copyright Statement';
// Links and resources menu editor
$string['adminfile'] = 'Admin file';
$string['sitefile'] = 'Site file';
$string['adminpublicdirname'] = 'public'; // Name of the directory in which to store public admin files
$string['adminpublicdirdescription'] = 'Files accessible by logged out users';
$string['badmenuitemtype'] = 'Unknown item type';
......@@ -169,7 +169,7 @@ $string['menuitemdeleted'] = 'Item deleted';
$string['menuitemsaved'] = 'Item saved';
$string['menuitemsloaded'] = 'Items loaded';
$string['name'] = 'Name';
$string['noadminfiles'] = 'No admin files available';
$string['nositefiles'] = 'No site files available';
$string['public'] = 'public';
$string['savingmenuitem'] = 'Saving item';
$string['type'] = 'Type';
......
<h3>Admin Files</h3>
<p>The Admin Files area works in nearly the same way as the main site's My Files area. Files uploaded to this area are available to any logged in user and where placed in the 'public' folder, are available to any user with the correct URL.</p>
<h3>Site Files</h3>
<p>The Site Files area works in nearly the same way as the main site's My Files area. Files uploaded to this area are available to any logged in user and where placed in the 'public' folder, are available to any user with the correct URL.</p>
<h3>Admin file</h3>
<p>You can use a file stored in the Admin File area as a resource. The display name for the file should be entered into the Name field and the desired file selected from the Linked to dropdown list.</p>
<h3>Site file</h3>
<p>You can use a file stored in the Site File area as a resource. The display name for the file should be entered into the Name field and the desired file selected from the Linked to dropdown list.</p>
......@@ -1393,18 +1393,24 @@ function admin_nav() {
'title' => get_string('linksandresourcesmenu', 'admin'),
'weight' => 30,
),
array(
'path' => 'configsite/adminfiles',
'url' => 'admin/site/files.php',
'title' => get_string('adminfiles', 'admin'),
'weight' => 40,
),
array(
'path' => 'configsite/networking',
'url' => 'admin/site/networking.php',
'title' => get_string('networking', 'admin'),
'weight' => 40,
),
array(
'path' => 'configsite/siteviews',
'url' => 'admin/site/views.php',
'title' => get_string('siteviews', 'admin'),
'weight' => 50,
),
array(
'path' => 'configsite/sitefiles',
'url' => 'admin/site/files.php',
'title' => get_string('sitefiles', 'admin'),
'weight' => 60,
),
array(
'path' => 'configusers',
'url' => 'admin/users/search.php',
......
......@@ -32,7 +32,7 @@
<li><strong><a href="{$WWWROOT}admin/site/options.php">{str tag=siteoptions section=admin}</a></strong> - {str tag=siteoptionsdescription section=admin}</li>
<li><strong><a href="{$WWWROOT}admin/site/pages.php">{str tag=editsitepages section=admin}</a></strong> - {str tag=editsitepagesdescription section=admin}</li>
<li><strong><a href="{$WWWROOT}admin/site/menu.php">{str tag=linksandresourcesmenu section=admin}</a></strong> - {str tag=linksandresourcesmenudescription section=admin}</li>
<li><strong><a href="{$WWWROOT}admin/site/files.php">{str tag=adminfiles section=admin}</a></strong> - {str tag=adminfilesdescription section=admin}</li>
<li><strong><a href="{$WWWROOT}admin/site/files.php">{str tag=sitefiles section=admin}</a></strong> - {str tag=sitefilesdescription section=admin}</li>
<li><strong><a href="{$WWWROOT}admin/site/networking.php">{str tag=networking section=admin}</a></strong> - {str tag=networkingdescription section=admin}</li>
</ul>
</li>
......
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