diff --git a/lang/en_utf8/data.php b/lang/en_utf8/data.php index 540f7aae3b8..ff345ce16ce 100644 --- a/lang/en_utf8/data.php +++ b/lang/en_utf8/data.php @@ -92,7 +92,7 @@ $string['file'] = 'File'; $string['filtername'] = 'Database Auto-linking'; $string['footer'] = 'Footer'; $string['forcelinkname'] = 'Forced name for the link'; -$string['fromfile'] = 'from zip file'; +$string['fromfile'] = 'Import from zip file'; $string['header'] = 'Header'; $string['headeraddtemplate'] = 'Defines the interface when editing entries'; $string['headercsstemplate'] = 'Defines local CSS styles for the other templates'; @@ -206,7 +206,7 @@ $string['updatefield'] = 'Update an existing field'; $string['uploadfile'] = 'Upload file'; $string['uploadrecords'] = 'Upload entries from a file'; $string['url'] = 'Url'; -$string['usestandard'] = 'use a preset'; +$string['usestandard'] = 'Use a preset'; $string['viewfromdate'] = 'Viewable from'; $string['viewtodate'] = 'Viewable to'; diff --git a/mod/data/preset.php b/mod/data/preset.php index eec50c0eb12..33e1aab44a2 100644 --- a/mod/data/preset.php +++ b/mod/data/preset.php @@ -1,6 +1,6 @@ libdir.'/uploadlib.php'); require_once($CFG->libdir.'/xmlize.php'); -$id = optional_param('id', 0, PARAM_INT); // course module id -$d = optional_param('d', 0, PARAM_INT); // database activity id -$action = optional_param('action', 'base', PARAM_RAW); // current action -$userid = optional_param('userid', 0, PARAM_INT); // owner of the preset -$shortname = optional_param('shortname', '', PARAM_FILE); // directory the preset is in -$file = optional_param('file', '', PARAM_FILE); // uploaded file +$id = optional_param('id', 0, PARAM_INT); // course module id +$d = optional_param('d', 0, PARAM_INT); // database activity id +$action = optional_param('action', 'base', PARAM_ALPHANUM); // current action +$fullname = optional_param('fullname', '', PARAM_PATH); // directory the preset is in +$file = optional_param('file', '', PARAM_FILE); // uploaded file + +// find out preset owner userid and shortname +$parts = explode('/', $fullname); +$userid = empty($parts[0]) ? 0 : (int)$parts[0]; +$shortname = empty($parts[1]) ? '' : $parts[1]; +unset($parts); +unset($fullname); if ($id) { if (! $cm = get_coursemodule_from_id('data', $id)) { @@ -61,27 +67,32 @@ $sesskey = sesskey(); /* Output */ data_print_header($course, $cm, $data, 'presets'); -echo '
$strwarning
"; - echo "'.$strwarning.'
'; + echo '';
-echo ''.$strexport.''; -echo ' | ';
+echo ' ';
+echo ' ';
print_footer($course);
-
-
function is_directory_a_preset($directory) {
- $directory = rtrim($directory, '/\\') . '/';
+ $directory = rtrim($directory, '/\\') . '/';
if (file_exists($directory.'singletemplate.html') &&
file_exists($directory.'listtemplate.html') &&
file_exists($directory.'listtemplateheader.html') &&
@@ -364,14 +382,13 @@ function is_directory_a_preset($directory) {
file_exists($directory.'addtemplate.html') &&
file_exists($directory.'rsstemplate.html') &&
file_exists($directory.'rsstitletemplate.html') &&
- file_exists($directory.'csstemplate.css') &&
- file_exists($directory.'jstemplate.js') &&
+ file_exists($directory.'csstemplate.css') &&
+ file_exists($directory.'jstemplate.js') &&
file_exists($directory.'preset.xml')) return true;
else return false;
}
-
function clean_preset($folder) {
if (@unlink($folder.'/singletemplate.html') &&
@unlink($folder.'/listtemplate.html') &&
@@ -429,7 +446,7 @@ function data_presets_export($course, $cm, $data) {
$presetxml = "
';
-echo ' | '.$strimport.''; -echo '';
+
+echo ' | '.$strimport.'';
helpbutton('importfromfile', '', 'data');
-echo $strfromfile.':';
echo ' | ';
-echo '';
echo ' | ';
-echo ' | ';
+
+echo ' | ';
helpbutton('usepreset', '', 'data');
-echo $strusestandard.':';
echo ' | ';
-echo ' | '; +} +echo ' '; +echo ''; +echo ''; echo ' "; + print "Deleting field $currentfield->name "; $id = $currentfield->id; if ($content = get_records('data_content', 'fieldid', $id)) { @@ -677,7 +695,7 @@ class PresetImporter { data_update_instance(addslashes_object($settings)); - if (strstr($this->folder, "/temp/")) clean_preset($this->folder); /* Removes the temporary files */ + if (strstr($this->folder, '/temp/')) clean_preset($this->folder); /* Removes the temporary files */ return true; } } | |||||||||||||