Browse Source

CP Files manager, display loading data animation, uploading caption

Vova Tkach 5 years ago
parent
commit
469a4372a4

+ 4 - 0
engine/assets/cp.scripts.js

@@ -7771,6 +7771,7 @@
 								<div class="dialog-data"></div> \
 								<div class="dialog-data"></div> \
 							</div> \
 							</div> \
 							<div class="modal-footer"> \
 							<div class="modal-footer"> \
+								<button type="button" class="btn btn-success upload" disabled>Uploading...</button> \
 								<input class="form-control" type="file" id="fmfiles" name="fmfiles" onchange="fave.FilesManagerUploadFile();" style="font-size:12px;background-color:#28a745;border-color:#28a745;color:#fff;cursor:pointer;" multiple=""> \
 								<input class="form-control" type="file" id="fmfiles" name="fmfiles" onchange="fave.FilesManagerUploadFile();" style="font-size:12px;background-color:#28a745;border-color:#28a745;color:#fff;cursor:pointer;" multiple=""> \
 								<button type="button" class="btn btn-primary folder" onclick="fave.FilesManagerNewFolderClick();" disabled>New folder</button> \
 								<button type="button" class="btn btn-primary folder" onclick="fave.FilesManagerNewFolderClick();" disabled>New folder</button> \
 								<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> \
 								<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> \
@@ -7853,6 +7854,7 @@
 
 
 			FilesManagerLoadData: function(path) {
 			FilesManagerLoadData: function(path) {
 				fave.FilesManagerEnableDisableButtons(true);
 				fave.FilesManagerEnableDisableButtons(true);
+				$('#sys-modal-files-manager .dialog-data').html('<div class="fm-loading"></div>');
 				$.ajax({
 				$.ajax({
 					type: "POST",
 					type: "POST",
 					url: '/cp/',
 					url: '/cp/',
@@ -7890,6 +7892,7 @@
 				if(file_el.files.length <= 0) return;
 				if(file_el.files.length <= 0) return;
 
 
 				fave.FilesManagerEnableDisableButtons(true);
 				fave.FilesManagerEnableDisableButtons(true);
+				$('#sys-modal-files-manager').addClass('uploading');
 
 
 				var fd = new FormData();
 				var fd = new FormData();
 				fd.append('action', 'files-upload');
 				fd.append('action', 'files-upload');
@@ -7918,6 +7921,7 @@
 					}
 					}
 				}).always(function() {
 				}).always(function() {
 					file_el.value = '';
 					file_el.value = '';
+					$('#sys-modal-files-manager').removeClass('uploading');
 					fave.FilesManagerEnableDisableButtons(false);
 					fave.FilesManagerEnableDisableButtons(false);
 				});
 				});
 			},
 			},

File diff suppressed because it is too large
+ 0 - 0
engine/assets/cp.scripts.js.go


+ 23 - 0
engine/assets/cp.styles.css

@@ -1165,6 +1165,29 @@ ul.pagination {
 	display: block;
 	display: block;
 }
 }
 
 
+#sys-modal-files-manager #fmfiles {
+	display: block;
+}
+
+#sys-modal-files-manager button.upload {
+	display: none;
+	width: 100%;
+}
+
+#sys-modal-files-manager.uploading #fmfiles {
+	display: none;
+}
+
+#sys-modal-files-manager.uploading button.upload {
+	display: block;
+}
+
+.fm-loading {
+	min-width: 99px;
+	min-height: 99px;
+	background: #fff url(/assets/cp/img-load.gif) no-repeat 50% 50% !important;
+}
+
 /* Fix for bootstrap select */
 /* Fix for bootstrap select */
 .dropdown.bootstrap-select {
 .dropdown.bootstrap-select {
 	position: relative;
 	position: relative;

File diff suppressed because it is too large
+ 0 - 0
engine/assets/cp.styles.css.go


+ 14 - 1
engine/modules/module_files_act_list.go

@@ -29,6 +29,8 @@ func (this *Modules) RegisterAction_FilesList() *Action {
 		str_dirs := ""
 		str_dirs := ""
 		str_files := ""
 		str_files := ""
 
 
+		nothing := true
+
 		if files, err := filepath.Glob(start_dir); err == nil {
 		if files, err := filepath.Glob(start_dir); err == nil {
 			for _, file := range files {
 			for _, file := range files {
 				file_name := file
 				file_name := file
@@ -38,6 +40,9 @@ func (this *Modules) RegisterAction_FilesList() *Action {
 				}
 				}
 
 
 				if utils.IsDir(file) {
 				if utils.IsDir(file) {
+					if nothing {
+						nothing = false
+					}
 					actions := builder.DataTableAction(&[]builder.DataTableActionRow{
 					actions := builder.DataTableAction(&[]builder.DataTableActionRow{
 						{
 						{
 							Icon:   assets.SysSvgIconView,
 							Icon:   assets.SysSvgIconView,
@@ -54,6 +59,9 @@ func (this *Modules) RegisterAction_FilesList() *Action {
 					})
 					})
 					str_dirs += `<tr class="dir"><td class="col_name"><a href="javascript:fave.FilesManagerLoadData(\'` + pf_path + file_name + `/` + `\');"><span class="text-dotted">` + html.EscapeString(file_name) + `</span></a></td><td class="col_type"><b>DIR</b></td><td class="col_action">` + actions + `</td></tr>`
 					str_dirs += `<tr class="dir"><td class="col_name"><a href="javascript:fave.FilesManagerLoadData(\'` + pf_path + file_name + `/` + `\');"><span class="text-dotted">` + html.EscapeString(file_name) + `</span></a></td><td class="col_type"><b>DIR</b></td><td class="col_action">` + actions + `</td></tr>`
 				} else {
 				} else {
+					if nothing {
+						nothing = false
+					}
 					actions := builder.DataTableAction(&[]builder.DataTableActionRow{
 					actions := builder.DataTableAction(&[]builder.DataTableActionRow{
 						{
 						{
 							Icon:   assets.SysSvgIconView,
 							Icon:   assets.SysSvgIconView,
@@ -95,7 +103,12 @@ func (this *Modules) RegisterAction_FilesList() *Action {
 			str_dirs = `<tr class="dir"><td class="col_name"><a href="javascript:fave.FilesManagerLoadDataUp(\'` + pf_path + `\');">..</a></td><td class="col_type">&nbsp;</td><td class="col_action">&nbsp;</td></tr>` + str_dirs
 			str_dirs = `<tr class="dir"><td class="col_name"><a href="javascript:fave.FilesManagerLoadDataUp(\'` + pf_path + `\');">..</a></td><td class="col_type">&nbsp;</td><td class="col_action">&nbsp;</td></tr>` + str_dirs
 		}
 		}
 
 
-		table := `<table class="table data-table table-striped table-bordered table-hover table_fm_files"><thead><tr><th class="col_name">File name</th><th class="col_type">Size</th><th class="col_action">Action</th></tr></thead><tbody>` + str_dirs + str_files + `</tbody></table>`
+		str_nothing := ``
+		if nothing {
+			str_nothing = `<tr><td colspan="50">No data</td></tr>`
+		}
+
+		table := `<table class="table data-table table-striped table-bordered table-hover table_fm_files"><thead><tr><th class="col_name">File name</th><th class="col_type">Size</th><th class="col_action">Action</th></tr></thead><tbody>` + str_dirs + str_files + str_nothing + `</tbody></table>`
 		wrap.Write(`$('#sys-modal-files-manager .dialog-data').html('` + table + `');`)
 		wrap.Write(`$('#sys-modal-files-manager .dialog-data').html('` + table + `');`)
 
 
 		// Enable buttons
 		// Enable buttons

Some files were not shown because too many files changed in this diff