]> git.mxchange.org Git - friendica.git/commitdiff
take maxFilesize from systemsettings
authorJakobus Schürz <jakobus.schuerz@schuerz.at>
Mon, 13 Mar 2023 12:47:09 +0000 (13:47 +0100)
committerJakobus Schürz <jakobus.schuerz@schuerz.at>
Sun, 19 Mar 2023 17:52:45 +0000 (18:52 +0100)
* does not work everywhere...

mod/photos.php
src/Content/Conversation.php
src/Module/Item/Compose.php
src/Module/Post/Edit.php
src/Object/Post.php
view/templates/item/compose.tpl
view/theme/frio/templates/comment_item.tpl
view/theme/frio/templates/jot.tpl

index 050a254af381d4ce41d7c34e51cfe3a34294e68c..a8b63d12dffd60649f4ee7e6c34b79508d6bee6b 100644 (file)
@@ -1139,7 +1139,11 @@ function photos_content(App $a)
                                                '$preview' => DI::l10n()->t('Preview'),
                                                '$loading' => DI::l10n()->t('Loading...'),
                                                '$qcomment' => $qcomment,
-                                               '$rand_num' => Crypto::randomDigits(12)
+                                               '$rand_num' => Crypto::randomDigits(12),
+                                               // Dropzone
+                                               //'$max_imagesize'       => DI::config()->get('system', 'maximagesize'),
+                                               // don't know, if DI::config.. does not work here, so it is set to a manual value
+                                               '$max_imagesize' => 100000,
                                        ]);
                                }
                        }
@@ -1194,7 +1198,11 @@ function photos_content(App $a)
                                                '$submit' => DI::l10n()->t('Submit'),
                                                '$preview' => DI::l10n()->t('Preview'),
                                                '$qcomment' => $qcomment,
-                                               '$rand_num' => Crypto::randomDigits(12)
+                                               '$rand_num' => Crypto::randomDigits(12),
+                                               // Dropzone
+                                               //'$max_imagesize'       => DI::config()->get('system', 'maximagesize'),
+                                               // don't know, if DI::config.. does not work here, so it is set to a manual value
+                                               '$max_imagesize' => 200000
                                        ]);
                                }
 
@@ -1268,7 +1276,11 @@ function photos_content(App $a)
                                                        '$submit' => DI::l10n()->t('Submit'),
                                                        '$preview' => DI::l10n()->t('Preview'),
                                                        '$qcomment' => $qcomment,
-                                                       '$rand_num' => Crypto::randomDigits(12)
+                                                       '$rand_num' => Crypto::randomDigits(12),
+                                                       // Dropzone
+                                                       //'$max_imagesize'       => DI::config()->get('system', 'maximagesize'),
+                                                       // don't know, if DI::config.. does not work here, so it is set to a manual value
+                                                       '$max_imagesize' => 300000
                                                ]);
                                        }
                                }
index 249190b1add67c4630aebf2aad6551cd2b5218ff..586b0bc540c2b03f90a4966d92721f2c674c6fe3 100644 (file)
@@ -408,6 +408,11 @@ class Conversation
 
                        '$compose_link_title'  => $this->l10n->t('Open Compose page'),
                        '$always_open_compose' => $this->pConfig->get($this->session->getLocalUserId(), 'frio', 'always_open_compose', false),
+                       // Dropzone
+                       //'$max_imagesize'       => DI::config()->get('system', 'maximagesize'),
+                       // DI::config.. does not work here, so it is set to a manual value
+                       '$max_imagesize'       => 600000,
+
                ]);
 
 
index f53158b1f7f40da9ec1edea89903e4cc1d273fb4..30e2aa9d6b897399eecd68916fd0e688f434c22b 100644 (file)
@@ -240,6 +240,9 @@ class Compose extends BaseModule
                                'deny_cid'  => $contact_deny_list,
                                'deny_gid'  => $group_deny_list,
                        ]),
+
+                       // Dropzone
+                       '$max_imagesize'    => DI::config()->get('system', 'maximagesize')
                ]);
        }
 }
index 5fb339e17971b83b1b0111a8e18db1dbc108aeb1..87a0c1b9c636996725d98056f1dd1f4ed61d53d9 100644 (file)
@@ -182,6 +182,11 @@ class Edit extends BaseModule
                        '$shortpermset' => $this->t('Permissions'),
 
                        '$compose_link_title' => $this->t('Open Compose page'),
+                       // Dropzone
+                       //'$max_imagesize'       => DI::config()->get('system', 'maximagesize'),
+                       // DI::config.. does not work here, so it is set to a manual value
+                       '$max_imagesize'       => 500000,
+
                ]);
 
                return $output;
index 17c0c1f68e640b7ec608a969e8741cd800b66e9c..59617573e0e9338cad0a5d64ce8975c5736ea94d 100644 (file)
@@ -1068,7 +1068,9 @@ class Post
                                '$prompttext'  => DI::l10n()->t('Please enter a image/video/audio/webpage URL:'),
                                '$preview'     => DI::l10n()->t('Preview'),
                                '$indent'      => $indent,
-                               '$rand_num'    => Crypto::randomDigits(12)
+                               '$rand_num'    => Crypto::randomDigits(12),
+                               // Dropzone
+                               '$max_imagesize' => DI::config()->get('system', 'maximagesize'),
                        ]);
                }
 
index 21d89d5c4e7bbde339c4be68807b911559d5ca41..16ba7b477b8df60bc9aa450398ab0af2d45f0134 100644 (file)
 </div>
 <script>
        Dropzone.autoDiscover = false;
+       console.log('compose.tpl', {{$max_imagesize}} / 100000);
+       var maxis = {{$max_imagesize}} / 100000;
        var dropzoneCompose = new Dropzone( '#comment-edit-form-{{$id}}',  { 
                paramName: "userfile", // The name that will be used to transfer the file
-               maxFilesize: 6, // MB - change this to use systemsettings
+               maxFilesize: maxis, // MB
                previewsContainer: '#dz-previewsCompose',
                preventDuplicates: true,
                clickable: true,
index b57bf8a07151d10e1aa7b83c1a3694074f2a6042..cfc44ceb2ffe8dd6b47350c9fefc38284d9da9eb 100644 (file)
 
 <script>
        Dropzone.autoDiscover = false;
+       console.log('comment_item.tpl', {{$max_imagesize}} / 100000);
+       var maxis = {{$max_imagesize}} / 100000;
        var dropzone{{$id}} = new Dropzone( '#comment-edit-wrapper-{{$id}}', {
                paramName: "userfile", // The name that will be used to transfer the file
-               maxFilesize: 6, // MB - change this to use systemsettings
+               maxFilesize: maxis, // MB
                previewsContainer: '#dz-preview-{{$id}}',
                preventDuplicates: true,
                clickable: true,
index 015d967beaf75fb0164817629926b81ff4ef0f55..31db86f7cc0ac30f35587ecc884cab63492f1224 100644 (file)
@@ -181,9 +181,11 @@ can load different content into the jot moadl (e.g. the item edit jot)
 </script>
 <script>
        Dropzone.autoDiscover = false;
+       console.log('jot.tpl', {{$max_imagesize}} / 100000);
+       var maxis = {{$max_imagesize}} / 100000;
        var dropzoneJot = new Dropzone( '#jot-modal-body', {
                paramName: "userfile", // The name that will be used to transfer the file
-               maxFilesize: 6, // MB - change this to use systemsettings
+               maxFilesize: maxis, // MB
                previewsContainer: '#dz-preview-jot',
                url: "/media/photo/upload?response=url&album=",
                accept: function(file, done) {
@@ -208,7 +210,6 @@ can load different content into the jot moadl (e.g. the item edit jot)
                },
        });
 
-       //  document.onpaste = function(event){
        $('#jot-modal-body').on('paste', function(event){
                const items = (event.clipboardData || event.originalEvent.clipboardData).items;
                items.forEach((item) => {