1
0
mirror of https://github.com/misterunknown/ifm.git synced 2025-08-15 12:33:59 +02:00

Fix error messages

Signed-off-by: Marco Dickert <marco@misterunknown.de>
This commit is contained in:
Marco Dickert
2020-12-30 06:17:36 +01:00
parent 6698c5ce4b
commit 822027c3a3
2 changed files with 6 additions and 9 deletions

View File

@@ -102,10 +102,10 @@ function IFM(params) {
*/ */
this.rebuildFileTable = function( data ) { this.rebuildFileTable = function( data ) {
if( data.status == "ERROR" ) { if( data.status == "ERROR" ) {
this.showMessage( data.message, "e" ); self.showMessage( data.message, "e" );
return; return;
} else if ( ! Array.isArray( data ) ) { } else if ( ! Array.isArray( data ) ) {
this.showMessage( self.i18n.invalid_data, "e" ); self.showMessage( self.i18n.invalid_data, "e" );
return; return;
} }
data.forEach( function( item ) { data.forEach( function( item ) {
@@ -2037,15 +2037,12 @@ function IFM(params) {
// handle window.onbeforeunload // handle window.onbeforeunload
window.onbeforeunload = self.onbeforeunloadHandler; window.onbeforeunload = self.onbeforeunloadHandler;
/*
// load initial file table // load initial file table
if( window.location.hash ) { if( window.location.hash ) {
self.changeDirectory( decodeURIComponent( window.location.hash.substring( 1 ) ) ); self.changeDirectory( decodeURIComponent( window.location.hash.substring( 1 ) ) );
} else { } else {
this.refreshFileTable(); this.refreshFileTable();
} }
*/
console.log("Finished initialisation without file table");
}; };
this.init = function(id) { this.init = function(id) {

View File

@@ -340,7 +340,7 @@ f00bar;
usort($dirs, [$this, "sortByName"]); usort($dirs, [$this, "sortByName"]);
usort($files, [$this, "sortByName"]); usort($files, [$this, "sortByName"]);
return ["data" => array_merge($dirs, $files)]; return array_merge($dirs, $files);
} }
private function getItemInformation($name) { private function getItemInformation($name) {
@@ -533,11 +533,11 @@ f00bar;
if (empty($err)) { if (empty($err)) {
return [ return [
"status" => "OK", "status" => "OK",
"message" => ($d['action'] == "copy" ? $this->l('copy_success') : $this->l['move_success'] ), "message" => ($d['action'] == "copy" ? $this->l('copy_success') : $this->l('move_success')),
"errflag" => "1" "errflag" => "1"
]; ];
} else { } else {
$errmsg = ($d['action'] == "copy" ? $this->l('copy_error') : $this->l['move_error'] ) . "<ul>"; $errmsg = ($d['action'] == "copy" ? $this->l('copy_error') : $this->l('move_error')) . "<ul>";
foreach ($err as $item) foreach ($err as $item)
$errmsg .= "<li>".$item."</li>"; $errmsg .= "<li>".$item."</li>";
$errmsg .= "</ul>"; $errmsg .= "</ul>";
@@ -553,7 +553,7 @@ f00bar;
if ($d['dirname'] == "" || !$this->isFilenameValid($d['dirname'])) if ($d['dirname'] == "" || !$this->isFilenameValid($d['dirname']))
throw new IFMException($this->l('invalid_dir')); throw new IFMException($this->l('invalid_dir'));
if (@mkdir($dn)) if (@mkdir($d['dirname']))
return ["status" => "OK", "message" => $this->l('folder_create_success')]; return ["status" => "OK", "message" => $this->l('folder_create_success')];
else else
throw new IFMException($this->l('folder_create_error').". ".error_get_last()['message']); throw new IFMException($this->l('folder_create_error').". ".error_get_last()['message']);