зеркало из https://github.com/mozilla/pjs.git
Родитель
102a47f9df
Коммит
6ee084107f
|
@ -1,108 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="xulDatePicker"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding id="datepicker" extends="xul:box" inherits="value,ondatepick">
|
||||
<!-- ::::::::::::::::: CONTENT ::::::::::::::::::::::::: -->
|
||||
<content id="content">
|
||||
<xul:hbox flex="1" id="hbox">
|
||||
<xul:textbox id="textbox"
|
||||
onkeypress="if (event.keyCode == 13) this.parentNode.parentNode.parseTextDate();"
|
||||
onblur="this.parentNode.parentNode.parentNode.parentNode.parseTextDate(true);"/>
|
||||
|
||||
<xul:menu class="datepicker-button">
|
||||
<xul:menupopup popupanchor="bottomright" popupalign="topright" onpopupshowing="this.parentNode.parentNode.parentNode.openPopup()">
|
||||
<xul:calendar onchange="this.parentNode.hidePopup(); this.parentNode.parentNode.parentNode.parentNode.update(new Date(this.value),true); "/>
|
||||
</xul:menupopup>
|
||||
</xul:menu>
|
||||
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
||||
<!-- ::::::::::::::::: INTERFACE ::::::::::::::::::::::::: -->
|
||||
<implementation>
|
||||
<property name="value"
|
||||
onset="this.update(val,false)"
|
||||
onget="return this.mValue"/>
|
||||
|
||||
<property name="ondatepick"
|
||||
onset="this.callback = val;"
|
||||
/>
|
||||
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
this.mTextBox = document.getAnonymousNodes(this)[0].childNodes[0];
|
||||
this.mPopup = document.getAnonymousNodes(this)[0].childNodes[1].childNodes[0];
|
||||
this.calendar = document.getAnonymousNodes(this)[0].childNodes[1].childNodes[0].childNodes[0];
|
||||
this.formatter= new DateFormater();
|
||||
|
||||
var val = this.getAttribute("value");
|
||||
|
||||
if (val) this.value = val;
|
||||
else this.value = new Date();
|
||||
|
||||
val = this.getAttribute("ondatepick");
|
||||
|
||||
if (val) this.callback = new Function( val );
|
||||
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<method name="update">
|
||||
<parameter name="aValue"/>
|
||||
<parameter name="refresh"/>
|
||||
<body><![CDATA[
|
||||
if (aValue == null) { // invalid date, revert to previous date
|
||||
// set textBox.value property, not attribute
|
||||
this.mTextBox.value = this.getPrettyDate(this.mValue);
|
||||
} else {
|
||||
this.mValue = aValue;
|
||||
this.mTextBox.value = this.getPrettyDate(this.mValue);
|
||||
if( this.callback && refresh != false )
|
||||
this.callback();
|
||||
}
|
||||
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="refreshDisplay">
|
||||
<body><![CDATA[
|
||||
this.calendar.refreshDisplay( );
|
||||
alert( "in refresh display" );
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="getPrettyDate">
|
||||
<parameter name="aValue"/>
|
||||
<body><![CDATA[
|
||||
return this.formatter.getShortFormatedDate(aValue);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="parseTextDate">
|
||||
<parameter name="aRefresh"/>
|
||||
<body><![CDATA[
|
||||
this.update(this.formatter.parseShortDate(this.mTextBox.value), aRefresh);
|
||||
]]></body>
|
||||
</method>
|
||||
<method name="openPopup">
|
||||
<body><![CDATA[
|
||||
this.calendar.update( this.mValue );
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
</implementation>
|
||||
|
||||
<!-- ::::::::::::::::: HANDLERS ::::::::::::::::::::::::: -->
|
||||
|
||||
<handlers>
|
||||
<handler event="bindingattached" action="this.initialize();"/>
|
||||
</handlers>
|
||||
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
Загрузка…
Ссылка в новой задаче