blob: bb319308027415b5f28db90d4afce84b012729d9 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<library>
<!---
This class shows a invitation window with clicking button which is located in video and audio panel.
-->
<!-- placeholder
label: send invitation
-->
<class name="inviteMainWindow" extends="labelExplorerBox" labelid="214"
docking="true" closable="false" width="464" x="200" y="100" height="465">
<attribute name="roomType" value="conference" type="string" />
<attribute name="baseUrl" value="http://www.denic.de" type="string" />
<attribute name="currentHash" value="" type="string" />
<attribute name="display" value="false" type="boolean" />
<attribute name="addTimezoneItemsDelegate" value="null"/>
<attribute name="firstname" value="null"/>
<attribute name="lastname" value="null"/>
<attribute name="email" value="null"/>
<handler name="oninit">
<![CDATA[
this.setAttribute('visibility', 'hidden');
this.baseUrl = canvas.getAppBaseUrl();
if( $debug ) Debug.write("this.baseUrl: ", this.baseUrl);
if (addTimezoneItemsDelegate == null) {
addTimezoneItemsDelegate = new LzDelegate(this, "addTimezoneItems");
lz.Timer.addTimer(addTimezoneItemsDelegate, 2000);
}
]]>
</handler>
<method name="addTimezoneItems" args="ignore=null">
<![CDATA[
var itemCount = _timeZone.cblist.getNumItems();
if ( itemCount < canvas.timeZones.length) {
for (var i = itemCount; i < Math.min(itemCount + 30, canvas.timeZones.length); ++i) {
_timeZone.addItem(canvas.timeZones[i], canvas.timeZones[i]);
}
} else {
lz.Timer.removeTimer(addTimezoneItemsDelegate);
addTimezoneItemsDelegate = null;
}
if ($debug) Debug.write(":: addTimezoneItems :: ", itemCount);
lz.Timer.resetTimer(addTimezoneItemsDelegate, 500);
]]>
</method>
<handler name="onvisible" args="v">
<![CDATA[
if (v) {
this.setOffset(canvas.stdTimeOffset);
this._recipient.setAttribute('text', '');
this._message.setAttribute('text', '');
this._password.setAttribute('text', '');
this._ispasswordProtected.setValue(false);
this._timeFrom.setAttribute('text', getStringTime());
this._timeTo.setAttribute('text', getStringTime());
lz.ModeManager.makeModal(this);
if (!canvas.isConference){
this.roomType = "restricted"; //FIXME
}
for (var eg in this.subviews) {
this.subviews[eg].setAttribute('enabled', true);
}
_password.setAttribute('enabled', _ispasswordProtected.value);
var period = _valid.value == 2;
_valid_from.setAttribute('enabled', period);
_timeFrom.setAttribute('enabled', period);
_valid_to.setAttribute('enabled', period);
_timeTo.setAttribute('enabled', period);
_timeZone.setAttribute('enabled', period);
_url.setAttribute('enabled', false);
} else {
lz.ModeManager.release(this);
}
]]>
</handler>
<method name="setOffset" args="std_time_offset">
<![CDATA[
var std_time_offset = Math.round(std_time_offset);
var timeZoneJavaFormat = "Etc/GMT";
if (std_time_offset > 0) {
timeZoneJavaFormat += "+"+std_time_offset;
} else {
timeZoneJavaFormat += "-"+std_time_offset;
}
if ($debug) Debug.write("timeZoneJavaFormat :: ",timeZoneJavaFormat);
var tItem = this._timeZone.getItem(timeZoneJavaFormat);
if (tItem != null) {
this._timeZone.selectItem(timeZoneJavaFormat);
} else {
this._timeZone.selectItemAt(0);
}
this._languages.selectItem(canvas.language_id);
]]>
</method>
<!-- label: recipient -->
<labelTextWidthTooltip name="_recepientLbl" y="24" width="120" labelid="216" labelLabelid="1597" />
<customEdittext name="_recipient" width="340" x="120" y="22" regexpLabelid="1597">
<handler name="onblur">
<![CDATA[
var addr = parent.replaceAll(parent.replaceAll(getText(), "'", ""), "\"", "");
if ($debug) Debug.write("addr: ", addr);
var idx1 = addr.indexOf("<"), idx2 = addr.indexOf(">");
if (idx1 > -1 && idx2 > -1 && idx2 > idx1) {
parent.email = parent.trim(addr.substring(idx1 + 1, idx2));
var s = parent.trim(addr.substring(0, idx1));
var idx = s.indexOf(" ");
if (idx > -1) {
parent.firstname = s.substring(0, idx);
parent.lastname = s.substring(idx + 1);
} else {
parent.firstname = s;
}
} else {
parent.email = addr;
}
if ($debug) Debug.write("[first, last, email]: ", getText(), idx1, idx2, parent.firstname, parent.lastname, parent.email);
this.regExpCheckId = canvas.doRegExpCheck(parent.email, this.emailRegEx);
if(this.callDelegate == null) {
this.callDelegate = new LzDelegate(this, "checkRegExpResult");
}
lz.Timer.resetTimer(this.callDelegate, 50);
]]>
</handler>
<handler name="onafterCheck">
if (!isvalidInput) {
this.setAttribute('text', "");
parent.email = null;
parent.firstname = null;
parent.lastname = null;
}
</handler>
</customEdittext>
<method name="trim" args="s">
<![CDATA[
var str = "" + s, begin = 0, end = str.length - 1;
while (begin <= end && str.charCodeAt(begin) == 32) { ++begin; }
while (end > begin && str.charCodeAt(end) == 32) { --end; }
return str.substr(begin, end - begin + 1);
]]>
</method>
<method name="replaceAll" args="s,f,r">
<![CDATA[
var str = s;
while (str.indexOf(f) > -1) { str = str.replace(f, r); }
return str;
]]>
</method>
<!-- label: subject -->
<labelText labelid="215" y="52" width="120" />
<customEdittext name="_subject" labelid="532" width="340" enabled="false" x="120" y="52" />
<!-- label: message -->
<labelText labelid="217" y="82" width="120" />
<!--
<customEdittext name="_message" width="340" x="120" y="82" height="100"
multiline="true" />
-->
<customScrollEdittext name="_message" width="340" x="120" y="82" height="100" />
<!-- label: password protected -->
<labelCheckbox name="_ispasswordProtected" y="192" fontsize="11" x="4" labelid="524" />
<!-- label: password -->
<labelText labelid="525" y="220" x="4" fgcolor="${ ((!parent._ispasswordProtected.value) ? 0xCCCCCC : 0x000000 ) }" />
<customEdittext name="_password" enabled="${ parent._ispasswordProtected.value }" password="true"
width="340" x="120" y="218" />
<!-- label: validity period -->
<labelText labelid="526" y="252" width="120" />
<radiogroup name="_valid" x="120" y="256" layout="class:simplelayout; axis:x">
<!-- label: endless -->
<labelRadioButton value="1" labelid="527" fontsize="11" />
<!-- label: period -->
<labelRadioButton value="2" labelid="528" fontsize="11" />
<!-- label: one-time -->
<labelRadioButton value="3" labelid="529" fontsize="11" />
</radiogroup>
<!-- label: valid from -->
<labelText x="4" labelid="530" y="284" fgcolor="${ ((parent._valid.value==2) ? 0x000000 : 0xCCCCCC ) }" />
<dateField x="120" y="282" name="_valid_from" setDefaultToday="true" enabled="${ parent._valid.value == 2 }" />
<customEdittext name="_timeFrom" enabled="${ parent._valid.value == 2 }"
width="50" x="232" y="282" text="$once{ getStringTime() }" regexpType="time" />
<!-- label: valid to -->
<labelText x="4" labelid="531" y="314" fgcolor="${ ((parent._valid.value==2) ? 0x000000 : 0xCCCCCC ) }" />
<dateField x="120" y="314" name="_valid_to" setDefaultToday="true" additionalDay="1" enabled="${ (parent._valid.value == 2) }" />
<customEdittext name="_timeTo" enabled="${ parent._valid.value == 2 }"
width="50" x="232" y="314" text="$once{ getStringTime() }" regexpType="time" />
<labelText labelid="1143" width="200" y="344" fgcolor="${ ((parent._valid.value==2) ? 0x000000 : 0xCCCCCC ) }" x="4" />
<resetCombobox name="_timeZone" editable="false" y="344" width="270" x="120"
enabled="${ parent._valid.value == 2 }" fontsize="11" style="componentStyle"/>
<labelText labelid="59" width="200" y="374" x="4" />
<resetCombobox name="_languages" editable="false" y="374" width="270" x="120" fontsize="11" style="componentStyle">
<labeldTextListItem datapath="languagesSet:/item" text="$path{ 'name/text()' }" value="$path{ 'language_id/text()' }"/>
</resetCombobox>
<customEdittext name="_url" enabled="false" width="$once{ parent.width - 10 }" x="5" y="405" text=""/>
<simpleLabelButton name="generate" labelid="1526" x="$once{ parent.width-440 }" width="170" y="$once{ parent.height-26 }">
<handler name="onclick">
<![CDATA[
if (parent.email == null) {
new lz.errorPopup(canvas.main_content._content.inner,{error:canvas.getLabelName(519)});
return;
}
parent.display = true;
parent.sendInvitationHash.doCall();
]]>
</handler>
</simpleLabelButton>
<!-- label: send -->
<simpleLabelButton name="send" labelid="218" x="$once{ parent.width-260 }" width="120" y="$once{ parent.height-26 }">
<handler name="onclick">
<![CDATA[
if (parent.email == null) {
new lz.errorPopup(canvas.main_content._content.inner,{error:canvas.getLabelName(519)});
return;
}
for (var eg in this.parent.subviews) {
this.parent.subviews[eg].setAttribute('enabled', false);
}
if (parent.display) {
parent.sendInvitationByHash.doCall();
} else {
parent.sendInvitationHash.doCall();
}
]]>
</handler>
</simpleLabelButton>
<!-- label: cancel -->
<simpleLabelButton labelid="219" x="$once{ parent.width-130 }" width="120" y="$once{ parent.height-26 }">
<handler name="onclick">
parent.setAttribute('visibility', 'hidden');
</handler>
</simpleLabelButton>
<netRemoteCallHib name="sendInvitationByHash" funcname="invitationservice.sendInvitationByHash" remotecontext="$once{ canvas.thishib }" >
<netparam name="SID"><method name="getValue">return canvas.sessionId;</method></netparam>
<netparam name="invitationHash"><method name="getValue">return this.parent.parent.currentHash;</method></netparam>
<netparam name="message"><method name="getValue">return this.parent.parent._message.getText();</method></netparam>
<netparam name="subject"><method name="getValue">return this.parent.parent._subject.getText();</method></netparam>
<netparam name="language_id"><method name="getValue">return parent.parent._languages.getValue();</method></netparam>
<handler name="ondata" args="value">
<![CDATA[
if (value != null) {
parent.setAttribute('visibility', 'hidden');
} else {
new lz.errorPopup(canvas.main_content._content.inner,{error:value});
}
]]>
</handler>
</netRemoteCallHib>
<netRemoteCallHib name="sendInvitationHash" funcname="invitationservice.sendInvitationHash" remotecontext="$once{ canvas.thishib }" >
<netparam name="sid"><method name="getValue">return canvas.sessionId;</method></netparam>
<netparam name="firstname"><method name="getValue">return parent.parent.firstname</method></netparam>
<netparam name="lastname"><method name="getValue">return parent.parent.lastname</method></netparam>
<netparam name="message"><method name="getValue">return this.parent.parent._message.getText();</method></netparam>
<netparam name="email"><method name="getValue">return parent.parent.email;</method></netparam>
<netparam name="subject"><method name="getValue">return this.parent.parent._subject.getText();</method></netparam>
<netparam name="roomid"><method name="getValue">return hib.currentroomid;</method></netparam>
<netparam name="conferencedomain"><method name="getValue">return hib.conferencedomain;</method></netparam>
<netparam name="ispasswordProtected"><method name="getValue">return parent.parent._ispasswordProtected.value;</method></netparam>
<netparam name="password"><method name="getValue">return parent.parent._password.getText();</method></netparam>
<netparam name="valid"><method name="getValue">return parent.parent._valid.value;</method></netparam>
<netparam name="validFromDate"><method name="getValue">return parent.parent._valid_from.getDate();</method></netparam>
<netparam name="validFromTime"><method name="getValue">return parent.parent._timeFrom.getText();</method></netparam>
<netparam name="validToDate"><method name="getValue">return parent.parent._valid_to.getDate();</method></netparam>
<netparam name="validToTime"><method name="getValue">return parent.parent._timeTo.getText();</method></netparam>
<netparam name="language_id"><method name="getValue">return parent.parent._languages.getValue();</method></netparam>
<netparam name="jNameTimeZone"><method name="getValue">return parent.parent._timeZone.getValue();</method></netparam>
<netparam name="sendMail"><method name="getValue">return !parent.parent.display;</method></netparam>
<handler name="ondata" args="value">
<![CDATA[
//The onResult-Handler will be called be the rtmpconnection
if ($debug) Debug.write("sendInvitationHash : ",value);
if ($debug) Debug.write("sendInvitationHash : ", (typeof value));
if (typeof value == "object") {
if (parent.display) {
parent.send.setAttribute('enabled', true);
parent._message.setAttribute('enabled', true);
parent._subject.setAttribute('enabled', true);
parent._languages.setAttribute('enabled', true);
parent.currentHash = value.hash;
parent._url.setAttribute('text', parent.baseUrl + "?invitationHash=" + parent.currentHash + "&language=" + parent._languages.getValue());
} else {
parent.setAttribute('visibility', 'hidden');
}
} else {
new lz.errorPopup(canvas.main_content._content.inner,{error:value});
}
]]>
</handler>
</netRemoteCallHib>
</class>
</library>