Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4163

file cancel link missing in fileupload dialog

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.6.1
    • 8.6.0, 8.6.0.1
    • Components
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      reproducing code

      <zk>
      	<zscript><![CDATA[
      		public void upload() {
      			Fileupload.get(new EventListener() {
      				public void onEvent(Event e) {
      					Clients.log(e.getMedia().getName());
      				}
      			});
      		}
      	]]></zscript>
      	<button label="trigger upload dialog" onClick="upload();"/>
      </zk>
      

      click the button to display the fileupload dialog
      add one file
      wait for the upload to finish

      Current Result

      in 8.5.2.1 the file shows upload progress and when finished remains visible with a "cancel" link

      in 8.6.0.1 the file shows upload progress and when finished disappears leaving an empty dialog

      Expected Result

      same or similar as in 8.5.2.1

      Debug Info

      this div becomes visible in 8.5 but remains invisible since 8.6

      Root Cause

      since 8.6.0 the finish function is no longer called to display the successfully uploaded file information

      Instead the cancel function is always called when a file was uploaded successfully or an error occurred

      Workaround

      manually keep track of the error state and call the expected function accordingly later

      zk.afterLoad('zul', function() {
      	var xUpload = {};
      	zk.override(zul.Upload, xUpload, {
      		error : function(msg, uuid, sid) {
      			var wgt = zk.Widget.$(uuid);
      			if(wgt) {
      				wgt._hasUploadError = true;
      			}
      			return xUpload.error.apply(this, arguments);
      		},
      		close : function(uuid, sid) {
      			var wgt = zk.Widget.$(uuid);
      			if (!wgt || !wgt._uplder) return;
      			if(wgt._hasUploadError) {
      				wgt._uplder.cancel(sid);
      			} else {
      				wgt._uplder.finish(sid);
      			}
      		}
      	});//zk.override
      });//zk.afterLoad
      

      (this is not the suggested fix, but requires little overriding to patch)

            CharlesQiu CharlesQiu
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 4 hours
                4h
                Remaining:
                Time Spent - 3 hours Remaining Estimate - 1 hour
                1h
                Logged:
                Time Spent - 3 hours Remaining Estimate - 1 hour
                3h