client/js/renderer/nodeeditor.js
changeset 385 29dcaa4c1748
parent 384 6a7930a0d4d1
child 420 22393cbf4467
--- a/client/js/renderer/nodeeditor.js	Wed Feb 11 12:33:19 2015 +0100
+++ b/client/js/renderer/nodeeditor.js	Thu Feb 19 11:37:56 2015 +0100
@@ -20,7 +20,7 @@
                 '<% if (options.show_node_editor_image) { %><div class="Rk-Edit-ImgWrap"><div class="Rk-Edit-ImgPreview"><img src="<%-node.image || node.image_placeholder%>" />' +
                 '<% if (node.clip_path) { %><svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 1 1" preserveAspectRatio="none"><path style="stroke-width: .02; stroke:red; fill-opacity:.3; fill:red;" d="<%- node.clip_path %>"/></svg><% }%>' +
                 '</div></div><p><label><%-renkan.translate("Image URL:")%></label><div><a class="Rk-Edit-Image-Del" href="#"></a><input class="Rk-Edit-Image" type="text" value="<%-node.image%>"/></div></p>' +
-                '<p><label><%-renkan.translate("Choose Image File:")%></label><input class="Rk-Edit-Image-File" type="file" accept="image/*"/></p><% } %>' +
+                '<% if (options.allow_image_upload) { %><p><label><%-renkan.translate("Choose Image File:")%></label><input class="Rk-Edit-Image-File" type="file" accept="image/*"/></p><% }%><% } %>' +
                 '<% if (options.show_node_editor_creator && node.has_creator) { %><p><span class="Rk-Editor-Label"><%-renkan.translate("Created by:")%></span> <span class="Rk-UserColor" style="background:<%-node.created_by_color%>;"></span><%- shortenText(node.created_by_title, 25) %></p><% } %>' +
                 '<% if (options.change_shapes) { %><p><label><%-renkan.translate("Shapes available")%>:</label> <select class="Rk-Edit-Shape">' +
                 '<option class="Rk-Edit-Vocabulary-Property" value="circle"<% if (node.shape === "circle") { %> selected<% } %>><%- renkan.translate("Circle") %></option>' +
@@ -126,25 +126,27 @@
 
                 this.editor_$.find("input, textarea, select").on("change keyup paste", onFieldChange);
 
-                this.editor_$.find(".Rk-Edit-Image-File").change(function() {
-                    if (this.files.length) {
-                        var f = this.files[0],
-                        fr = new FileReader();
-                        if (f.type.substr(0,5) !== "image") {
-                            alert(_this.renkan.translate("This file is not an image"));
-                            return;
+                if(_this.options.allow_image_upload) {
+                    this.editor_$.find(".Rk-Edit-Image-File").change(function() {
+                        if (this.files.length) {
+                            var f = this.files[0],
+                            fr = new FileReader();
+                            if (f.type.substr(0,5) !== "image") {
+                                alert(_this.renkan.translate("This file is not an image"));
+                                return;
+                            }
+                            if (f.size > (_this.options.uploaded_image_max_kb * 1024)) {
+                                alert(_this.renkan.translate("Image size must be under ") + _this.options.uploaded_image_max_kb + _this.renkan.translate("KB"));
+                                return;
+                            }
+                            fr.onload = function(e) {
+                                _this.editor_$.find(".Rk-Edit-Image").val(e.target.result);
+                                onFieldChange();
+                            };
+                            fr.readAsDataURL(f);
                         }
-                        if (f.size > (_this.options.uploaded_image_max_kb * 1024)) {
-                            alert(_this.renkan.translate("Image size must be under ") + _this.options.uploaded_image_max_kb + _this.renkan.translate("KB"));
-                            return;
-                        }
-                        fr.onload = function(e) {
-                            _this.editor_$.find(".Rk-Edit-Image").val(e.target.result);
-                            onFieldChange();
-                        };
-                        fr.readAsDataURL(f);
-                    }
-                });
+                    });
+                }
                 this.editor_$.find(".Rk-Edit-Title")[0].focus();
 
                 var _picker = _this.editor_$.find(".Rk-Edit-ColorPicker");