From richfaces-svn-commits at lists.jboss.org Wed Jan 12 11:11:26 2011 Content-Type: multipart/mixed; boundary="===============1017194605446190083==" MIME-Version: 1.0 From: richfaces-svn-commits at lists.jboss.org To: richfaces-svn-commits at lists.jboss.org Subject: [richfaces-svn-commits] JBoss Rich Faces SVN: r20965 - trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces. Date: Wed, 12 Jan 2011 11:11:26 -0500 Message-ID: <201101121611.p0CGBQL8022750@svn01.web.mwc.hst.phx2.redhat.com> --===============1017194605446190083== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: konstantin.mishin Date: 2011-01-12 11:11:26 -0500 (Wed, 12 Jan 2011) New Revision: 20965 Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/fi= leupload.js Log: RF-7841 Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richf= aces/fileupload.js =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/f= ileupload.js 2011-01-12 12:56:03 UTC (rev 20964) +++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/f= ileupload.js 2011-01-12 16:11:26 UTC (rev 20965) @@ -25,6 +25,8 @@ = var UID_ALT =3D "rf_fu_uid_alt"; = + var FAKE_PATH =3D "C:\\fakepath\\"; + var ITEM_HTML =3D '
'; @@ -101,10 +103,19 @@ = __addItem: function() { var fileName =3D this.input.val(); + if (!navigator.platform.indexOf("Win")) { + fileName =3D fileName.match(/[^\\]*$/)[0]; + } else { + if (!fileName.indexOf(FAKE_PATH)) { + fileName =3D fileName.substr(FAKE_PATH.length); + } else { + fileName =3D fileName.match(/[^\/]*$/)[0]; + } + } if (this.__accept(fileName) && (!this.noDuplicate || !this.__isFileA= lreadyAdded(fileName))) { this.input.hide(); this.input.unbind("change", this.addProxy); - var item =3D new Item(this); + var item =3D new Item(this, fileName); this.list.append(item.getJQuery()); this.items.push(item); this.input =3D this.cleanInput.clone(); @@ -222,10 +233,10 @@ } }); = - var Item =3D function(fileUpload) { + var Item =3D function(fileUpload, fileName) { this.fileUpload =3D fileUpload; this.input =3D fileUpload.input; - this.model =3D {name: this.input.val(), state: ITEM_STATE.NEW}; + this.model =3D {name: fileName, state: ITEM_STATE.NEW}; }; = jQuery.extend(Item.prototype, { --===============1017194605446190083==--