Index: lib/locallib.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/locallib.php,v retrieving revision 1.10 diff -u -r1.10 locallib.php --- lib/locallib.php 17 Aug 2007 19:09:19 -0000 1.10 +++ lib/locallib.php 15 Jan 2008 00:31:07 -0000 @@ -48,6 +48,45 @@ * with $oldversion set to 0, so that all the updates run. * * + * Local capabilities + * ------------------ + * + * If your local customisations require their own capabilities, use + * + * local/db/access.php + * + * You should create an array called $local_capabilities, which looks like: + * + * $local_capabilities = array( + * 'local/component:capability' => array( + * 'captype' => 'read', + * 'contextlevel' => CONTEXT_SYSTEM, + * ), + * ); + * + * + * Local language support + * ---------------------- + * + * Moodle supports looking in the local/ directory for language files. + * Say your local language file related to a new feature called foo, + * You would create: + * local/foo/lang/en_utf8/local_foo.php + * and then call strings like get_string('key', 'local_foo'); + * + * + * Local admin menu items + * ---------------------- + * + * It is possible to add new items to the admin_tree block. + * To do this, create a file, local/localsettings.php + * which can access the $ADMIN variable directly and add things to id. + * You might do something like: + * $ADMIN->add('root', new admin_category('foo', get_string('key','local_foo'))); + * $ADMIN->add('foo', new admin_externalpage($name, $title, $url, $cap); + * + * + * * Course deletion * --------------- * @@ -99,6 +138,9 @@ $db->debug=true; if (xmldb_local_upgrade($CFG->local_version)) { $db->debug=false; + if (!update_capabilities('local')) { + error('Could not set up the local capabilities'); + } if (set_config('local_version', $local_version)) { notify(get_string('databasesuccess'), 'notifysuccess'); notify(get_string('databaseupgradelocal', '', $local_version), 'notifysuccess'); Index: lib/accesslib.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/accesslib.php,v retrieving revision 1.421.2.41 diff -u -r1.421.2.41 accesslib.php --- lib/accesslib.php 8 Jan 2008 15:04:04 -0000 1.421.2.41 +++ lib/accesslib.php 15 Jan 2008 00:31:08 -0000 @@ -3141,6 +3141,9 @@ if ($component == 'moodle') { $storedcaps = get_records_select('capabilities', "name LIKE 'moodle/%:%'"); + } else if ($component == 'local') { + $storedcaps = get_records_select('capabilities', + "name LIKE 'local/%:%'"); } else { $storedcaps = get_records_select('capabilities', "name LIKE '$component:%'"); @@ -3810,6 +3813,10 @@ $string = get_string($stringname, 'gradereport_'.$componentname); break; + case 'local': + $string = get_string($stringname, 'local_'.$componentname); + break; + default: $string = get_string($stringname); break; @@ -3835,6 +3842,9 @@ } else if (preg_match('|^block/|', $component)) { $langname = str_replace('/', '_', $component); $string = get_string('blockname', $langname); + } else if (preg_match('|^local|', $component)) { + $langname = str_replace('/', '_', $component); + $string = get_string('local'); } else { $string = get_string('coresystem'); } Index: lang/en_utf8/moodle.php =================================================================== RCS file: /cvsroot/moodle/moodle/lang/en_utf8/moodle.php,v retrieving revision 1.141.2.16 diff -u -r1.141.2.16 moodle.php --- lang/en_utf8/moodle.php 13 Jan 2008 12:30:17 -0000 1.141.2.16 +++ lang/en_utf8/moodle.php 15 Jan 2008 00:31:08 -0000 @@ -828,6 +828,7 @@ $string['listfiles'] = 'List of files in $a'; $string['listofallpeople'] = 'List of all people'; $string['livelogs'] = 'Live logs from the past hour'; +$string['local'] = 'Local'; $string['locale'] = 'en_AU.UTF-8'; $string['location'] = 'Location'; $string['log_excel_date_format'] = 'yyyy mmmm d h:mm';