You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
First of all, thank you for the work you've done. It's a great plugin. While using it as a base for my own backends, I noticed some bugs/flaws :
Renaming assets
Renaming a picture change its file by its thumbnail. It was funny to see. In do_rename() :
// Comment that and replace it// $pathAbsoluteThumbNew = str_replace($filename, 'thumbs/' . $filename, $pathAbsoluteNew);$pathAbsoluteThumbNew = str_replace($filename, 'thumbs/' . $filenameNew, $pathAbsoluteOld);
Deleting
I noticed some flaws with deleting markdown files or assets. E.g. for assets, Pico Admin deletes the file, but not the thumbnail (and doesn't edit the meta.php file). And markdown files aren't deleted at all. So I suggest a modification of do_delete() :
Errors are not translated, nor displayed. I edited several functions to return errors with the ajax response so I can display them with alert() (like you've done with do_new()). For the translation part, I wrote a simple function :
/* * Translate messages of this file as well. */privatefunctionlang($message = 'global') {
return Pico_Admin_Helper_Strings::translate('trans.' . $message);
}
I just call it with $this->lang('error.move.failed') and all the error messages are in the translation files. Pretty simple.
lang="en"
In the translation file, add :
$translations = array(
'global' => 'en',
So we can edit the templates to use it :
<htmllang="trans.global">
This way, the spell checker of the browser can work with the good language, which is great for the editor content.
pico_admin.js
Renaming assets
Why do you let the user change the extension? This just causes an unnecessary error. My suggested rename function for assets :
rename: function(pathFileFull,isDirectory){varfilename=pathFileFull.substr(pathFileFull.lastIndexOf("/")+1);// We trim the extension. PHP won't let it pass anywayvarext="."+filename.split(".").pop();filename=filename.replace(/\.[^/.]+$/,"");varnameNew=prompt((isDirectory ? PicoAdmin.labels.promptRenameDirectory : PicoAdmin.labels.promptRenameFile),filename);nameNew+=ext;if(nameNew){$.post('admin/rename',{file: pathFileFull,renameTo: nameNew},function(data){// Reload assets managerPicoAdmin.AssetsManager.init(PicoAdmin.AssetsManager.fileUrl);});}},
I saw others issues, but I was refactoring PicoAdmin for my own use, so I didn't write all of them down. Environments used: local and distant LAMP (Gandi Simple Hosting for the distant, Bitnami for the local).
The text was updated successfully, but these errors were encountered:
Hi,
First of all, thank you for the work you've done. It's a great plugin. While using it as a base for my own backends, I noticed some bugs/flaws :
Renaming assets
Renaming a picture change its file by its thumbnail. It was funny to see. In
do_rename()
:Deleting
I noticed some flaws with deleting markdown files or assets. E.g. for assets, Pico Admin deletes the file, but not the thumbnail (and doesn't edit the
meta.php
file). And markdown files aren't deleted at all. So I suggest a modification ofdo_delete()
:Translation
Errors
Errors are not translated, nor displayed. I edited several functions to return errors with the ajax response so I can display them with
alert()
(like you've done withdo_new()
). For the translation part, I wrote a simple function :I just call it with
$this->lang('error.move.failed')
and all the error messages are in the translation files. Pretty simple.lang="en"
In the translation file, add :
So we can edit the templates to use it :
This way, the spell checker of the browser can work with the good language, which is great for the editor content.
pico_admin.js
Renaming assets
Why do you let the user change the extension? This just causes an unnecessary error. My suggested
rename
function for assets :I saw others issues, but I was refactoring PicoAdmin for my own use, so I didn't write all of them down. Environments used: local and distant LAMP (Gandi Simple Hosting for the distant, Bitnami for the local).
The text was updated successfully, but these errors were encountered: