Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'MDL-33946_label_dndupload_text' of git://github.com/dav…

…osmith/moodle
  • Loading branch information...
commit b4f110f1a40f5e85cb87c2e613ecb91d67fa326d 2 parents aa9f48e + 5efae68
@nebgor nebgor authored
Showing with 13 additions and 4 deletions.
  1. +1 −0  mod/label/lang/en/label.php
  2. +12 −4 mod/label/lib.php
View
1  mod/label/lang/en/label.php
@@ -31,6 +31,7 @@
$string['dndresizeheight'] = 'Resize drag and drop height';
$string['dndresizewidth'] = 'Resize drag and drop width';
$string['dnduploadlabel'] = 'Add image to course page';
+$string['dnduploadlabeltext'] = 'Add text to course page';
$string['label:addinstance'] = 'Add a new label';
$string['labeltext'] = 'Label text';
$string['modulename'] = 'Label';
View
16 mod/label/lib.php
@@ -207,18 +207,24 @@ function label_supports($feature) {
* @return array containing details of the files / types the mod can handle
*/
function label_dndupload_register() {
+ $strdnd = get_string('dnduploadlabel', 'mod_label');
if (get_config('label', 'dndmedia')) {
$mediaextensions = file_get_typegroup('extension', 'web_image');
- $strdnd = get_string('dnduploadlabel', 'mod_label');
$files = array();
foreach ($mediaextensions as $extn) {
$extn = trim($extn, '.');
$files[] = array('extension' => $extn, 'message' => $strdnd);
}
- return array('files' => $files);
+ $ret = array('files' => $files);
} else {
- return array();
+ $ret = array();
}
+
+ $strdndtext = get_string('dnduploadlabeltext', 'mod_label');
+ return array_merge($ret, array('types' => array(
+ array('identifier' => 'text/html', 'message' => $strdndtext),
+ array('identifier' => 'text', 'message' => $strdndtext)
+ )));
}
/**
@@ -256,6 +262,8 @@ function label_dndupload_handle($uploadinfo) {
$data->intro = file_save_draft_area_files($uploadinfo->draftitemid, $context->id, 'mod_label', 'intro', 0,
null, $data->intro);
}
+ } else if (!empty($uploadinfo->content)) {
+ $data->intro = $uploadinfo->content;
}
return label_add_instance($data, null);
@@ -333,4 +341,4 @@ function label_generate_resized_image(stored_file $file, $maxwidth, $maxheight)
} else {
return $img;
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.