take maxFilesize from systemsettings

* does not work everywhere...
This commit is contained in:
Jakobus Schürz 2023-03-13 13:47:09 +01:00
parent 359ad6ff5a
commit be2afac60d
8 changed files with 40 additions and 8 deletions

View file

@ -1139,7 +1139,11 @@ function photos_content(App $a)
'$preview' => DI::l10n()->t('Preview'), '$preview' => DI::l10n()->t('Preview'),
'$loading' => DI::l10n()->t('Loading...'), '$loading' => DI::l10n()->t('Loading...'),
'$qcomment' => $qcomment, '$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'), '$submit' => DI::l10n()->t('Submit'),
'$preview' => DI::l10n()->t('Preview'), '$preview' => DI::l10n()->t('Preview'),
'$qcomment' => $qcomment, '$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'), '$submit' => DI::l10n()->t('Submit'),
'$preview' => DI::l10n()->t('Preview'), '$preview' => DI::l10n()->t('Preview'),
'$qcomment' => $qcomment, '$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
]); ]);
} }
} }

View file

@ -408,6 +408,11 @@ class Conversation
'$compose_link_title' => $this->l10n->t('Open Compose page'), '$compose_link_title' => $this->l10n->t('Open Compose page'),
'$always_open_compose' => $this->pConfig->get($this->session->getLocalUserId(), 'frio', 'always_open_compose', false), '$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,
]); ]);

View file

@ -240,6 +240,9 @@ class Compose extends BaseModule
'deny_cid' => $contact_deny_list, 'deny_cid' => $contact_deny_list,
'deny_gid' => $group_deny_list, 'deny_gid' => $group_deny_list,
]), ]),
// Dropzone
'$max_imagesize' => DI::config()->get('system', 'maximagesize')
]); ]);
} }
} }

View file

@ -182,6 +182,11 @@ class Edit extends BaseModule
'$shortpermset' => $this->t('Permissions'), '$shortpermset' => $this->t('Permissions'),
'$compose_link_title' => $this->t('Open Compose page'), '$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; return $output;

View file

@ -1068,7 +1068,9 @@ class Post
'$prompttext' => DI::l10n()->t('Please enter a image/video/audio/webpage URL:'), '$prompttext' => DI::l10n()->t('Please enter a image/video/audio/webpage URL:'),
'$preview' => DI::l10n()->t('Preview'), '$preview' => DI::l10n()->t('Preview'),
'$indent' => $indent, '$indent' => $indent,
'$rand_num' => Crypto::randomDigits(12) '$rand_num' => Crypto::randomDigits(12),
// Dropzone
'$max_imagesize' => DI::config()->get('system', 'maximagesize'),
]); ]);
} }

View file

@ -97,9 +97,11 @@
</div> </div>
<script> <script>
Dropzone.autoDiscover = false; Dropzone.autoDiscover = false;
console.log('compose.tpl', {{$max_imagesize}} / 100000);
var maxis = {{$max_imagesize}} / 100000;
var dropzoneCompose = new Dropzone( '#comment-edit-form-{{$id}}', { var dropzoneCompose = new Dropzone( '#comment-edit-form-{{$id}}', {
paramName: "userfile", // The name that will be used to transfer the file 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', previewsContainer: '#dz-previewsCompose',
preventDuplicates: true, preventDuplicates: true,
clickable: true, clickable: true,

View file

@ -67,9 +67,11 @@
<script> <script>
Dropzone.autoDiscover = false; 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}}', { var dropzone{{$id}} = new Dropzone( '#comment-edit-wrapper-{{$id}}', {
paramName: "userfile", // The name that will be used to transfer the file 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}}', previewsContainer: '#dz-preview-{{$id}}',
preventDuplicates: true, preventDuplicates: true,
clickable: true, clickable: true,

View file

@ -181,9 +181,11 @@ can load different content into the jot moadl (e.g. the item edit jot)
</script> </script>
<script> <script>
Dropzone.autoDiscover = false; Dropzone.autoDiscover = false;
console.log('jot.tpl', {{$max_imagesize}} / 100000);
var maxis = {{$max_imagesize}} / 100000;
var dropzoneJot = new Dropzone( '#jot-modal-body', { var dropzoneJot = new Dropzone( '#jot-modal-body', {
paramName: "userfile", // The name that will be used to transfer the file 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', previewsContainer: '#dz-preview-jot',
url: "/media/photo/upload?response=url&album=", url: "/media/photo/upload?response=url&album=",
accept: function(file, done) { 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){ $('#jot-modal-body').on('paste', function(event){
const items = (event.clipboardData || event.originalEvent.clipboardData).items; const items = (event.clipboardData || event.originalEvent.clipboardData).items;
items.forEach((item) => { items.forEach((item) => {