blob: b60055ca6b9370da7783ed95b1e1c5be0cbdac6d [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>
<!--- User Profile edit panel in the useradmin leftblock. Private class only for useradmin -->
<class name="userAdminValueForm" extends="baseContentSaveView">
<!--- recordContent-id -->
<attribute name="user_id" value="0" type="number" />
<!--handlers -->
<handler name="onsavecompleted" >
//this.getUserById.doCall();
</handler>
<handler name="onreload" >
if (this.user_id!=0) this.getUserById.doCall();
</handler>
<handler name="onnew">
<![CDATA[
this.user_id=0;
this.level.selectItemAt(0);
this.username.setAttribute('text','');
this.firstname.setAttribute('text','');
this.lastname.setAttribute('text','');
this.email.setAttribute('text','');
this.phone.setAttribute('text','');
this.sendSMS.setValue(false);
this.age.setAttribute('text','');
this.street.setAttribute('text','');
this.house.setAttribute('text','');
this.zip.setAttribute('text','');
this.town.setAttribute('text','');
this.userpass1.setAttribute('text','');
var defaultstate = canvas.getCountryRecord(1);
this.state.addAndSelectItem(defaultstate.name,defaultstate.state_id);
this.adress_comment.setAttribute('text','');
this.status.selectItem(String('1'));
this.forceTimeZoneCheck.setValue(false);
var t = this;
function getTimeZoneOffsetCallback(returnValue) {
if ($debug) Debug.write("getTimeZoneOffsetCallback ",returnValue);
var std_time_offset = Number(returnValue);
t.setOffset(std_time_offset);
}
getTimeZoneOffset(this);
this._organisationslist.clearList();
this.userOffers.setAttribute('text',"");
this.userSearchs.setAttribute('text',"");
this.showContactData.selectItem("3");
this.languages.selectItem(String('1'));
]]>
</handler>
<method name="callback" args="returnValue">
if ($debug) Debug.write("getTimeZoneOffset callback ",returnValue);
var std_time_offset = Number(returnValue);
this.setOffset(std_time_offset);
</method>
<method name="setOffset" args="std_time_offset">
<![CDATA[
var timeZoneJavaFormat = "Etc/GMT";
if (std_time_offset > 0) {
timeZoneJavaFormat += "+"+std_time_offset;
} else {
timeZoneJavaFormat += "-"+std_time_offset;
}
if ($debug) Debug.write("timeZoneJavaFormat :: ",timeZoneJavaFormat);
this._timeZone.selectItem(timeZoneJavaFormat);
]]>
</method>
<handler name="ondelete" >
if (this.user_id!=0){
this.deleteUserAdmin.doCall();
}
</handler>
<!-- methods -->
<method name="initValueFieldsByObject" args="obj">
this.user_id = obj.user_id;
if (this.user_id!=0){
if ($debug) Debug.write("this.getUserById this.user_id",this.user_id);
this.getUserById.doCall();
}
</method>
<method name="initFields" args="obj">
<![CDATA[
if (obj == null) {
return;
}
this.level.selectItem(String(obj.level_id));
this.username.setAttribute('text',obj.login);
this.firstname.setAttribute('text', canvas.getNotNullString(obj.firstname));
this.lastname.setAttribute('text', canvas.getNotNullString(obj.lastname));
this.userpass1.setAttribute('text','');
this.email.setAttribute('text', canvas.getNotNullString(obj.adresses.email));
this.phone.setAttribute('text', canvas.getNotNullString(obj.adresses.phone));
this.sendSMS.setValue(obj["sendSMS"] && obj.sendSMS!= null && obj.sendSMS);
this.age.setAttribute('text',parseDateToString(obj.age));
this.street.setAttribute('text', canvas.getNotNullString(obj.adresses.street));
this.house.setAttribute('text', canvas.getNotNullString(obj.adresses.additionalname));
this.zip.setAttribute('text', canvas.getNotNullString(obj.adresses.zip));
this.town.setAttribute('text', canvas.getNotNullString(obj.adresses.town));
this.state.addAndSelectItem(obj.adresses.states.name,String(obj.adresses.states.state_id));
this.adress_comment.setAttribute('text', canvas.getNotNullString(obj.adresses.comment));
this.status.selectItem(String(obj.status));
this.salutation.selectItem(String(obj.salutations_id));
this._timeZone.selectItem(String(obj.omTimeZone.jname));
this.languages.selectItem(String(obj.language_id));
if (obj["forceTimeZoneCheck"] && obj.forceTimeZoneCheck!= null) {
if (obj.forceTimeZoneCheck) {
this.forceTimeZoneCheck.setValue(true);
} else {
this.forceTimeZoneCheck.setValue(false);
}
} else {
this.forceTimeZoneCheck.setValue(false);
}
this._organisationslist.clearList();
for (var i=0;i<obj.organisation_users.length;i++){
this._organisationslist.addItem(obj.organisation_users[i].organisation.name,obj.organisation_users[i].organisation.organisation_id);
}
if (obj.userOffers != null) {
this.userOffers.setAttribute('text',obj.userOffers);
} else {
this.userOffers.setAttribute('text',"");
}
if (obj.userSearchs != null) {
this.userSearchs.setAttribute('text',obj.userSearchs);
} else {
this.userSearchs.setAttribute('text',"");
}
if (obj.showContactData != null && obj.showContactDataToContacts != null) {
if (obj.showContactData) {
this.showContactData.selectItem("1");
} else if (obj.showContactDataToContacts) {
this.showContactData.selectItem("2");
} else {
this.showContactData.selectItem("3");
}
}
]]>
</method>
<!-- remotecalls -->
<netRemoteCallHib name="getUserById" funcname="userservice.getUserById"
remotecontext="$once{ canvas.thishib }" >
<netparam><method name="getValue"> return canvas.sessionId; </method></netparam>
<netparam><method name="getValue">return parent.parent.user_id;</method></netparam>
<handler name="ondata" args="value">
if($debug) Debug.write("[admin]userValueForm/getUserById: ",value);
parent.initFields(value);
</handler>
</netRemoteCallHib>
<netRemoteCallHib name="deleteUserAdmin" funcname="userservice.deleteUserAdmin"
remotecontext="$once{ canvas.thishib }" activeErrorHandler="true">
<netparam><method name="getValue"> return canvas.sessionId; </method></netparam>
<netparam><method name="getValue"> return parent.parent.user_id; </method></netparam>
<handler name="ondata" args="value">
//Debug.write("deleteUserAdmin ",value);
//this.parent.destroy();
if (value>0){
this.parent.parent._turnoverlist.oncallnext.sendEvent();
this.parent.onnew.sendEvent();
}
</handler>
</netRemoteCallHib>
<netRemoteCallHib name="saveOrUpdateUser" funcname="userservice.saveOrUpdateUser"
remotecontext="$once{ canvas.thishib }" registerObject="true" activeErrorHandler="false" >
<attribute name="sendObject" value="null" />
<!-- gets called by Observer -->
<method name="prepareCall">
this.sendObject=new Array();
this.sendObject["user_idClient"] = this.parent.user_id;
this.sendObject["login"] = this.parent.username.getText();
this.sendObject["password"] = this.parent.userpass1.getText();
this.sendObject["firstname"] = this.parent.firstname.getText();
this.sendObject["lastname"] = this.parent.lastname.getText();
this.sendObject["email"] = this.parent.email.getText();
this.sendObject["phone"] = this.parent.phone.getText();
this.sendObject["sendSMS"] = parent.sendSMS.getValue();
this.sendObject["street"] = this.parent.street.getText();
this.sendObject["additionalname"] = this.parent.house.getText();
this.sendObject["zip"] = this.parent.zip.getText();
this.sendObject["town"] = this.parent.town.getText();
this.sendObject["states_id"] = this.parent.state.getValue();
this.sendObject["comment"] = this.parent.adress_comment.getText();
this.sendObject["telefon"] = '';
this.sendObject["fax"] = '';
var date = this.parent.age.getText();
if (date.length>0) date = parseStringToDate(date);
this.sendObject["userage"] = date;
this.sendObject["mobil"] = '';
this.sendObject["availible"] = 0;
this.sendObject["status"] = Number(this.parent.status.getValue());
this.sendObject["level_id"] = Number(this.parent.level.getValue());
this.sendObject["salutations_id"] = Number(this.parent.salutation.getValue());
this.sendObject["jNameTimeZone"] = parent._timeZone.getValue();
this.sendObject["language_id"] = parent.languages.getValue();
this.sendObject["forceTimeZoneCheck"] = parent.forceTimeZoneCheck.getValue();
this.sendObject["organisations"] = this.parent._organisationslist.getAllItems();
this.sendObject["userOffers"] = parent.userOffers.getText();
this.sendObject["userSearchs"] = parent.userSearchs.getText();
var showContactData = Number(parent.showContactData.getValue());
if (showContactData == 1) {
this.sendObject["showContactData"] = true;
this.sendObject["showContactDataToContacts"] = true;
} else if (showContactData == 2) {
this.sendObject["showContactData"] = false;
this.sendObject["showContactDataToContacts"] = true;
} else if (showContactData == 3) {
this.sendObject["showContactData"] = false;
this.sendObject["showContactDataToContacts"] = false;
}
if ($debug) Debug.write("prepareCall: ",this.sendObject);
</method>
<netparam><method name="getValue"> return canvas.sessionId; </method></netparam>
<netparam><method name="getValue">return parent.sendObject;</method></netparam>
<handler name="ondata" args="val">
<![CDATA[
if ($debug) Debug.write("saveOrUpdateUser ondata: ",val);
if (val>0){
var obj = new Array();
obj["user_id"] = val;
this.parent.initValueFieldsByObject(obj);
if (this.parent._organisationslist.getAllItems().length < 1)
{
new lz.rpcErrorDialog(canvas.main_content._content.inner,{errorid:-23});
}
this.parent.parent._turnoverlist.oncallnext.sendEvent();
}
]]>
</handler>
</netRemoteCallHib>
<!-- content -->
<labelText labelid="143" width="200" y="40" resize="false" fontstyle="bold" />
<labelText labelid="132" width="200" y="70" resize="false" x="2"/>
<customEdittext name="username" y="70" x="120" width="270" />
<labelText labelid="133" width="200" y="100" resize="false" x="2"/>
<customEdittext name="userpass1" y="100" password="true" x="120" width="270" />
<labelText labelid="135" width="200" y="130" resize="false" x="2"/>
<resetCombobox name="salutation" width="100" y="130" x="120" editable="false" fontsize="11">
<handler name="oninit" >
<![CDATA[
for (var i=0;i<canvas.salutationsInitValues.length;i++){
this.addItem(canvas.salutationsInitValues[i].label.value,canvas.salutationsInitValues[i].salutations_id);
}
this.selectItem(String(canvas.salutationsInitValues[0].salutations_id));
]]>
</handler>
</resetCombobox>
<customEdittext name="firstname" y="130" x="230" width="160" />
<labelText labelid="136" width="200" y="160" resize="false" x="2"/>
<customEdittext name="lastname" y="160" x="120" width="270" />
<labelText labelid="1143" width="200" y="190" resize="false" x="2"/>
<resetCombobox name="_timeZone" editable="false" y="190" width="270" x="120"
fontsize="11" style="componentStyle">
<labeldTextListItem datapath="timeZoneSet:/item" text="$path{ 'frontEndLabel/text()' }"
value="$path{ 'jname/text()' }" />
</resetCombobox>
<labelText labelid="111" width="300" y="220" resize="false" x="2"/>
<resetCombobox name="languages" width="270" y="220" x="120" editable="false">
<labeldTextListItem datapath="languagesSet:/item" text="$path{ 'name/text()' }"
value="$path{ 'language_id/text()' }" />
<handler name="oninit">
var g = canvas.getUserData();
if($debug) Debug.write("checkLoginData/g: ",g);
if (g["userlang"]!=null) {
this.selectItem(g["userlang"]);
} else {
this.selectItem(String(canvas.thishib.userlang));
}
</handler>
</resetCombobox>
<view resource="messagebox_info_rsc" x="0" y="250" />
<labelText labelid="1149" x="24" y="250" fontstyle="italic"
multiline="true" width="364" />
<labelText labelid="1148" width="200" y="280" resize="false" x="2"/>
<labelCheckbox name="forceTimeZoneCheck" width="270" y="280" x="130" fontsize="11" />
<labelText labelid="137" width="200" y="310" resize="false" x="2"/>
<customEdittext name="email" y="310" x="120" width="270" regexpType="email" />
<labelText labelid="607" width="200" y="340" resize="false" x="2"/>
<customEdittext name="phone" y="340" x="120" width="170" />
<labelText labelid="1503" width="200" y="340" resize="false" x="300"/>
<labelCheckbox name="sendSMS" width="170" y="340" x="370" fontsize="11" />
<labelText labelid="138" width="200" y="370" resize="false" x="2"/>
<dateField name="age" y="370" x="120" width="270" />
<labelText labelid="139" width="200" y="400" resize="false" x="2"/>
<customEdittext name="street" y="400" x="120" width="220" />
<customEdittext name="house" y="400" x="350" width="40" />
<labelText labelid="140" width="200" y="430" resize="false" x="2"/>
<customEdittext name="zip" y="430" x="120" width="70" />
<customEdittext name="town" y="430" x="200" width="190" />
<labelText labelid="141" width="200" y="460" resize="false" x="2"/>
<dynamicCombobox name="state" width="270" y="460" x="120"
text="Switzerland" value="204" />
<labelText labelid="158" width="200" y="490" resize="false" x="2"/>
<resetCombobox name="status" width="270" y="490" x="120" editable="false" fontsize="11">
<handler name="oninit" >
<![CDATA[
this.addItem(canvas.getLabelName(159),'0');
this.addItem(canvas.getLabelName(160),'1');
this.selectItem('0');
]]>
</handler>
</resetCombobox>
<labelText labelid="169" width="200" y="520" resize="false" x="2"/>
<resetCombobox name="level" width="270" y="520" x="120" editable="false" fontsize="11">
<handler name="oninit" >
<![CDATA[
this.addItem(canvas.getLabelName(166),'1');
this.addItem(canvas.getLabelName(167),'2');
this.addItem(canvas.getLabelName(168),'3');
this.addItem(canvas.getLabelName(1311),'4');
this.selectItem('1');
]]>
</handler>
</resetCombobox>
<labelText labelid="142" width="200" y="550" resize="false" x="2"/>
<customScrollEdittext name="adress_comment" y="550" x="120" width="270"
height="70" />
<labelText labelid="161" width="200" y="630" resize="false" x="2"/>
<simpleValueList name="_organisationslist" y="630" x="120" width="270" height="100"
multiselect="true" />
<blueButton width="20" height="20" resourceItem="edit_add_rsc"
x_insetResource="2" y_insetResource="2" y="632" x="396"
width_insetResource="16" height_insetResource="16">
<handler name="onclick">
this.parent.addOrganisationToUser();
</handler>
<labelTooltip labelid="172" />
</blueButton>
<method name="addOrganisationToUser">
//if (this.user_id!=0)
new lz.chooseOrganisationWindow(parent,{refObj:this,item_id:this.user_id});
</method>
<blueButton width="20" height="20" resourceItem="button_cancel_rsc"
x_insetResource="2" y_insetResource="2" y="632" x="416"
width_insetResource="16" height_insetResource="16">
<handler name="onclick">
new lz.confirmDeleteWindow(canvas.main_content._content.inner,{refObj:this});
</handler>
<method name="confirmDelete">
if (this.parent._organisationslist._selected!=null)
for (var i in this.parent._organisationslist._selected) this.parent._organisationslist.removeItem(this.parent._organisationslist._selected[i].value);
</method>
<labelTooltip labelid="176" />
</blueButton>
<!-- SIP Account Data -->
<labelText labelid="893" width="200" y="770" resize="false"
x="0" fontstyle="bold" />
<view resource="messagebox_info_rsc" x="0" y="790" />
<labelText labelid="894" x="24" y="790" fontstyle="italic"
multiline="true" width="364" />
<!-- Community Settings -->
<labelText labelid="1159" width="200" y="950" resize="false"
x="0" fontstyle="bold" />
<radiogroup name="showContactData" layout="class:simplelayout;axis:y;spacing:2" y="980" x="10">
<labelRadioButton labelid="1160" value="1" />
<labelRadioButton labelid="1168" value="2" />
<labelRadioButton labelid="1169" value="3" />
</radiogroup>
<labelText labelid="1162" width="200" y="1040" resize="false" x="2"/>
<customScrollEdittext name="userOffers" y="1040" x="120" width="270"
height="100" />
<labelText labelid="1163" width="200" y="1150" resize="false" x="2"/>
<customScrollEdittext name="userSearchs" y="1150" x="120" width="270"
height="100" />
<view y="1440" />
</class>
</library>