Commit f8703ce5 authored by Francois Marier's avatar Francois Marier
Browse files
parents 6d87c5d0 1415c9b1
......@@ -47,90 +47,92 @@ foreach (plugin_types() as $plugin) {
$plugins[$plugin]['notinstalled'] = array();
}
foreach (array_keys($plugins) as $plugin) {
if ($installed = get_records_array($plugin . '_installed')) {
foreach ($installed as $i) {
$key = $i->name;
if ($plugin == 'blocktype') {
$key = blocktype_single_to_namespaced($i->name, $i->artefactplugin);
}
$plugins[$plugin]['installed'][$key] = array();
if ($plugin == 'artefact') {
$plugins[$plugin]['installed'][$key]['types'] = array();
safe_require('artefact', $key);
if ($types = call_static_method(generate_class_name('artefact', $i->name), 'get_artefact_types')) {
foreach ($types as $t) {
$classname = generate_artefact_class_name($t);
if ($collapseto = call_static_method($classname, 'collapse_config')) {
$plugins[$plugin]['installed'][$key]['types'][$collapseto] = true;
}
else {
$plugins[$plugin]['installed'][$key]['types'][$t] =
call_static_method($classname, 'has_config');
if (table_exists(new XMLDBTable($plugin . '_installed'))) {
if ($installed = get_records_array($plugin . '_installed')) {
foreach ($installed as $i) {
$key = $i->name;
if ($plugin == 'blocktype') {
$key = blocktype_single_to_namespaced($i->name, $i->artefactplugin);
}
$plugins[$plugin]['installed'][$key] = array();
if ($plugin == 'artefact') {
$plugins[$plugin]['installed'][$key]['types'] = array();
safe_require('artefact', $key);
if ($types = call_static_method(generate_class_name('artefact', $i->name), 'get_artefact_types')) {
foreach ($types as $t) {
$classname = generate_artefact_class_name($t);
if ($collapseto = call_static_method($classname, 'collapse_config')) {
$plugins[$plugin]['installed'][$key]['types'][$collapseto] = true;
}
else {
$plugins[$plugin]['installed'][$key]['types'][$t] =
call_static_method($classname, 'has_config');
}
}
}
}
}
else {
$classname = generate_class_name($plugin, $i->name);
safe_require($plugin, $i->name);
if (call_static_method($classname, 'has_config')) {
$plugins[$plugin]['installed'][$key]['config'] = true;
}
else {
$classname = generate_class_name($plugin, $i->name);
safe_require($plugin, $i->name);
if (call_static_method($classname, 'has_config')) {
$plugins[$plugin]['installed'][$key]['config'] = true;
}
}
}
}
}
$dirhandle = opendir(get_config('docroot') . $plugin);
while (false !== ($dir = readdir($dirhandle))) {
$installed = false; // reinitialise
if (strpos($dir, '.') === 0) {
continue;
}
if (!is_dir(get_config('docroot') . $plugin . '/' . $dir)) {
continue;
}
if (array_key_exists($dir, $plugins[$plugin]['installed'])) {
$installed = true;
}
// if we're already installed keep going
// if we're an artefact plugin, we have to check for blocktypes.
if ($plugin != 'artefact' && !empty($installed)) {
continue;
}
if (empty($installed)) {
$plugins[$plugin]['notinstalled'][$dir] = array();
try {
validate_plugin($plugin, $dir);
$dirhandle = opendir(get_config('docroot') . $plugin);
while (false !== ($dir = readdir($dirhandle))) {
$installed = false; // reinitialise
if (strpos($dir, '.') === 0) {
continue;
}
catch (InstallationException $e) {
$plugins[$plugin]['notinstalled'][$dir]['notinstallable'] = $e->GetMessage();
if (!is_dir(get_config('docroot') . $plugin . '/' . $dir)) {
continue;
}
}
if ($plugin == 'artefact') { // go check it for blocks as well
$btlocation = get_config('docroot') . $plugin . '/' . $dir . '/blocktype';
if (!is_dir($btlocation)) {
if (array_key_exists($dir, $plugins[$plugin]['installed'])) {
$installed = true;
}
// if we're already installed keep going
// if we're an artefact plugin, we have to check for blocktypes.
if ($plugin != 'artefact' && !empty($installed)) {
continue;
}
$btdirhandle = opendir($btlocation);
while (false !== ($btdir = readdir($btdirhandle))) {
if (strpos($btdir, '.') === 0) {
continue;
if (empty($installed)) {
$plugins[$plugin]['notinstalled'][$dir] = array();
try {
validate_plugin($plugin, $dir);
}
catch (InstallationException $e) {
$plugins[$plugin]['notinstalled'][$dir]['notinstallable'] = $e->GetMessage();
}
if (!is_dir(get_config('docroot') . $plugin . '/' . $dir . '/blocktype/' . $btdir)) {
}
if ($plugin == 'artefact' && table_exists(new XMLDBTable('blocktype_installed'))) { // go check it for blocks as well
$btlocation = get_config('docroot') . $plugin . '/' . $dir . '/blocktype';
if (!is_dir($btlocation)) {
continue;
}
if (!array_key_exists($dir . '/' . $btdir, $plugins['blocktype']['installed'])) {
try {
if (!array_key_exists($dir, $plugins['artefact']['installed'])) {
throw new InstallationException(get_string('blocktypeprovidedbyartefactnotinstallable', 'error', $dir));
}
validate_plugin('blocktype', $dir . '/' . $btdir,
get_config('docroot') . 'artefact/' . $dir . '/blocktype/' . $btdir);
$plugins['blocktype']['notinstalled'][$dir . '/' . $btdir] = array();
$btdirhandle = opendir($btlocation);
while (false !== ($btdir = readdir($btdirhandle))) {
if (strpos($btdir, '.') === 0) {
continue;
}
catch (InstallationException $_e) {
$plugins['blocktype']['notinstalled'][$dir . '/' . $btdir]['notinstallable'] = $_e->getMessage();
if (!is_dir(get_config('docroot') . $plugin . '/' . $dir . '/blocktype/' . $btdir)) {
continue;
}
if (!array_key_exists($dir . '/' . $btdir, $plugins['blocktype']['installed'])) {
try {
if (!array_key_exists($dir, $plugins['artefact']['installed'])) {
throw new InstallationException(get_string('blocktypeprovidedbyartefactnotinstallable', 'error', $dir));
}
validate_plugin('blocktype', $dir . '/' . $btdir,
get_config('docroot') . 'artefact/' . $dir . '/blocktype/' . $btdir);
$plugins['blocktype']['notinstalled'][$dir . '/' . $btdir] = array();
}
catch (InstallationException $_e) {
$plugins['blocktype']['notinstalled'][$dir . '/' . $btdir]['notinstallable'] = $_e->getMessage();
}
}
}
}
......
......@@ -290,7 +290,13 @@ function profileform_submit(Pieform $form, $values) {
}
$smarty = smarty();
$smarty = smarty(array(), array(), array(
'mahara' => array(
'cannotremovedefaultemail',
'emailtoolong'
),
));
$smarty->assign('profileform', $profileform);
......
......@@ -783,7 +783,7 @@ function safe_require($plugintype, $pluginname, $filename='lib.php', $function='
$fullpath = get_config('docroot') . 'artefact/' . $bits[0] . '/blocktype/' . $bits[1] . '/' . $filename;
}
else {
if (get_config('installed')) {
if (table_exists(new XMLDBTable('blocktype_installed'))) {
if ($artefactplugin = get_field('blocktype_installed', 'artefactplugin', 'name', $pluginname)) {
$fullpath = get_config('docroot') . 'artefact/' . $artefactplugin . '/blocktype/' . $pluginname . '/'. $filename;
}
......
......@@ -26,7 +26,7 @@
var newEmail = {{$name}}_newrefinput.value;
if (typeof(newEmail) == 'string' && newEmail.length > 0) {
if (newEmail.length > 255) {
alert('{{str tag="emailtoolong"}}');
alert(get_string('emailtoolong'));
}
else {
appendChildNodes('{{$name}}_list', DIV({'class': 'unvalidated'},
......@@ -69,7 +69,7 @@
);
if (radio[0] && radio[0].checked) {
alert('{{str tag="cannotremovedefaultemail"}}');
alert(get_string('cannotremovedefaultemail'));
return;
}
......
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