]> git.mxchange.org Git - friendica-addons.git/commitdiff
js_upload: use empty string if no newalbum or album input element is found (#712)
authorrabuzarus <rabuzarus@t-online.de>
Mon, 20 Aug 2018 04:25:35 +0000 (06:25 +0200)
committerHypolite Petovan <mrpetovan@eml.cc>
Mon, 20 Aug 2018 04:25:35 +0000 (00:25 -0400)
js_upload/js_upload.php

index b1373ffce19635dcb1903e58a88298a458e60117..28903f87e9028e9589b5fd52880c425a34da7748 100644 (file)
@@ -96,25 +96,31 @@ function createUploader() {
                debug: true,
                sizeLimit: $maximagesize,
                onSubmit: function(id,filename) {
-                       if (typeof acl!="undefined"){
+                       var newalbumElm = document.getElementById('photos-upload-newalbum');
+                       var albumElm = document.getElementById('photos-upload-album-select');
+
+                       var newalbum = newalbumElm ? newalbumElm.value : "";
+                       var album = albumElm ? albumElm.value : "";
+
+                       if (typeof acl != "undefined"){
                                uploader.setParams( {
-                                       newalbum                :       document.getElementById('photos-upload-newalbum').value,
-                                       album                   :       document.getElementById('photos-upload-album-select').value,
-                                       not_visible     :   document.getElementById('photos-upload-noshare').checked,
-                                       group_allow             :       acl.allow_gid.join(','),
-                                       contact_allow   :       acl.allow_cid.join(','),
-                                       group_deny              :       acl.deny_gid.join(','),
-                                       contact_deny    :       acl.deny_cid.join(',')
+                                       newalbum      : newalbum,
+                                       album         : album,
+                                       not_visible   : document.getElementById('photos-upload-noshare').checked,
+                                       group_allow   : acl.allow_gid.join(','),
+                                       contact_allow : acl.allow_cid.join(','),
+                                       group_deny    : acl.deny_gid.join(','),
+                                       contact_deny  : acl.deny_cid.join(',')
                                });
                        } else {
                                uploader.setParams( {
-                                       newalbum                :       document.getElementById('photos-upload-newalbum').value,
-                                       album                   :       document.getElementById('photos-upload-album-select').value,
-                                       not_visible     :   document.getElementById('photos-upload-noshare').checked,
-                                       group_allow             :       getSelected(document.getElementById('group_allow')).join(','),
-                                       contact_allow   :       getSelected(document.getElementById('contact_allow')).join(','),
-                                       group_deny              :       getSelected(document.getElementById('group_deny')).join(','),
-                                       contact_deny    :       getSelected(document.getElementById('contact_deny')).join(',')
+                                       newalbum      : newalbum,
+                                       album         : album,
+                                       not_visible   : document.getElementById('photos-upload-noshare').checked,
+                                       group_allow   : getSelected(document.getElementById('group_allow')).join(','),
+                                       contact_allow : getSelected(document.getElementById('contact_allow')).join(','),
+                                       group_deny    : getSelected(document.getElementById('group_deny')).join(','),
+                                       contact_deny  : getSelected(document.getElementById('contact_deny')).join(',')
                                });
                        }
                }