зеркало из https://github.com/mozilla/pjs.git
Fix bug 347563 - implement xforms:upload for XUL. r=aaronr+smaug
This commit is contained in:
Родитель
3c3becc715
Коммит
5c6ef4fd2a
|
@ -571,7 +571,7 @@
|
|||
|
||||
<!-- UPLOAD: DISABLED -->
|
||||
<binding id="xformswidget-upload-disabled"
|
||||
extends="chrome://xforms/content/xforms.xml#xformswidget-upload-base">
|
||||
extends="chrome://xforms/content/xforms.xml#xformswidget-upload-disabled-base">
|
||||
<content>
|
||||
<children includes="label"/>
|
||||
<html:input readonly="readonly" class="xf-value"/>
|
||||
|
@ -583,19 +583,6 @@
|
|||
</html:button>
|
||||
<children/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<method name="getControlElement">
|
||||
<body>
|
||||
return {
|
||||
get value(){ return ""; },
|
||||
set value(val){},
|
||||
set readonly(val){},
|
||||
focus: function(){}
|
||||
};
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
|
||||
|
|
|
@ -534,6 +534,97 @@
|
|||
</binding>
|
||||
|
||||
|
||||
<!-- UPLOAD: <DEFAULT> -->
|
||||
<binding id="xformswidget-upload"
|
||||
extends="chrome://xforms/content/xforms.xml#xformswidget-upload-base">
|
||||
<content>
|
||||
<children includes="label"/>
|
||||
<xul:textbox anonid="text_control"
|
||||
class="xf-value"
|
||||
readonly="readonly"
|
||||
tabindex="-1"/>
|
||||
<xul:button anonid="browse_button"
|
||||
xbl:inherits="tabindex"
|
||||
label="&xforms.upload.browsetext;"/>
|
||||
<xul:button anonid="clear_button"
|
||||
xbl:inherits="tabindex"
|
||||
label="&xforms.upload.cleartext;"/>
|
||||
<children/>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIXFormsUIWidget, nsIXFormsUploadUIElement">
|
||||
<method name="getControlElement">
|
||||
<body>
|
||||
return {
|
||||
get value() {
|
||||
return this._textControl.value;
|
||||
},
|
||||
set value(val) {
|
||||
this._textControl.value = val;
|
||||
},
|
||||
set readonly(val) {
|
||||
if (val) {
|
||||
this._browseButton.setAttribute('disabled', 'disabled');
|
||||
this._clearButton.setAttribute('disabled', 'disabled');
|
||||
} else {
|
||||
this._browseButton.removeAttribute('disabled');
|
||||
this._clearButton.removeAttribute('disabled');
|
||||
}
|
||||
},
|
||||
focus: function() {
|
||||
this._browseButton.focus();
|
||||
},
|
||||
|
||||
_browseButton: this.ownerDocument.
|
||||
getAnonymousElementByAttribute(this, 'anonid', 'browse_button'),
|
||||
_clearButton: this.ownerDocument.
|
||||
getAnonymousElementByAttribute(this, 'anonid', 'clear_button'),
|
||||
_textControl: this.ownerDocument.
|
||||
getAnonymousElementByAttribute(this, 'anonid', 'text_control'),
|
||||
};
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="command">
|
||||
switch (event.originalTarget.getAttribute("anonid")) {
|
||||
case "browse_button":
|
||||
this.uploadElement.pickFile();
|
||||
this.dispatchDOMUIEvent('DOMActivate');
|
||||
break;
|
||||
case "clear_button":
|
||||
this.uploadElement.clearFile();
|
||||
this.dispatchDOMUIEvent('DOMActivate');
|
||||
break;
|
||||
}
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
|
||||
<!-- UPLOAD: DISABLED -->
|
||||
<binding id="xformswidget-upload-disabled"
|
||||
extends="chrome://xforms/content/xforms.xml#xformswidget-upload-disabled-base">
|
||||
<content>
|
||||
<children includes="label"/>
|
||||
<xul:textbox anonid="text_control"
|
||||
class="xf-value"
|
||||
readonly="readonly"
|
||||
tabindex="-1"/>
|
||||
<xul:button anonid="browse_button"
|
||||
xbl:inherits="tabindex"
|
||||
label="&xforms.upload.browsetext;"
|
||||
disabled="true"/>
|
||||
<xul:button anonid="clear_button"
|
||||
xbl:inherits="tabindex"
|
||||
label="&xforms.upload.cleartext;"
|
||||
disabled="true"/>
|
||||
<children/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
|
||||
<!-- REPEAT -->
|
||||
<binding id="xformswidget-repeat"
|
||||
extends="chrome://xforms/content/xforms.xml#xformswidget-repeat-base">
|
||||
|
|
|
@ -89,6 +89,7 @@ xul|*:root secret:not(:disabled),
|
|||
xul|*:root textarea:not(:disabled),
|
||||
xul|*:root trigger:not(:disabled),
|
||||
xul|*:root submit:not(:disabled),
|
||||
xul|*:root upload:not(:disabled),
|
||||
xul|*:root repeat:not(:disabled),
|
||||
xul|*:root repeatitem,
|
||||
xul|*:root contextcontainer,
|
||||
|
@ -750,6 +751,10 @@ html|*:root upload {
|
|||
-moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-upload-disabled');
|
||||
}
|
||||
|
||||
xul|*:root upload {
|
||||
-moz-binding: url('chrome://xforms/content/xforms-xul.xml#xformswidget-upload-disabled');
|
||||
}
|
||||
|
||||
html|*:root upload[mozType|typelist~="http://www.w3.org/2001/XMLSchema#anyURI"],
|
||||
html|*:root upload[mozType|typelist~="http://www.w3.org/2001/XMLSchema#base64Binary"],
|
||||
html|*:root upload[mozType|typelist~="http://www.w3.org/2001/XMLSchema#hexBinary"] {
|
||||
|
@ -757,6 +762,12 @@ html|*:root upload[mozType|typelist~="http://www.w3.org/2001/XMLSchema#hexBinary
|
|||
display: inline;
|
||||
}
|
||||
|
||||
xul|*:root upload[mozType|typelist~="http://www.w3.org/2001/XMLSchema#anyURI"],
|
||||
xul|*:root upload[mozType|typelist~="http://www.w3.org/2001/XMLSchema#base64Binary"],
|
||||
xul|*:root upload[mozType|typelist~="http://www.w3.org/2001/XMLSchema#hexBinary"] {
|
||||
-moz-binding: url('chrome://xforms/content/xforms-xul.xml#xformswidget-upload');
|
||||
}
|
||||
|
||||
/* repeat widgets */
|
||||
*|*[xf|repeat-bind] {
|
||||
-moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-attr-repeat');
|
||||
|
|
|
@ -581,6 +581,24 @@
|
|||
</binding>
|
||||
|
||||
|
||||
<!-- UPLOAD: DISABLED -->
|
||||
<binding id="xformswidget-upload-disabled-base"
|
||||
extends="#xformswidget-upload-base">
|
||||
<implementation>
|
||||
<method name="getControlElement">
|
||||
<body>
|
||||
return {
|
||||
get value(){ return ""; },
|
||||
set value(val){},
|
||||
set readonly(val){},
|
||||
focus: function(){}
|
||||
};
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
|
||||
<!-- REPEAT -->
|
||||
<binding id="xformswidget-repeat-base" extends="#xformswidget-accessors">
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче