Files
OMS/app/desktop/view/email/config.html
2026-01-04 19:08:31 +08:00

161 lines
5.2 KiB
HTML

<!--
Copyright 2012-2026 ShopeX (https://www.shopex.cn)
Licensed 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.
-->
<form action="index.php?app=desktop&ctl=email&act=saveCfg" method="post" class="tableform" id='messengerconfig' >
<input type="hidden" name="messenger" value="<{$messengername}>" />
<div class="division">
<table width="100%" cellspacing="0" cellpadding="0" border="0" id="EConfig">
<{foreach from=$options item=item key=key}>
<tr id='<{$key}>'>
<th><{$item.label}></th>
<td>
<{if $item.type=="radio"}>
<{input type=$item.type options=$item.options name="config[{$key}]" value=$item.value onclick="methodchange(this.value);"}>
<{elseif $item.type=="password"}>
<{input type=$item.type options=$item.options name="config[{$key}]" value=$item.value onKeyup="setHidden(this.value);"}>
<{else}>
<{input type=$item.type options=$item.options name="config[{$key}]" value=$item.value }>
<{/if}>
</td>
</tr>
<{/foreach}>
</table>
</div>
<div class="table-action">
<{button id="config" label=$___desktop="保存"|t:'desktop' type="button"}>
<{button label=$___desktop="测试配置"|t:'desktop' onclick="new Dialog('index.php?app=desktop&ctl=email&act=testEmail&'+$('messengerconfig').toQueryString(),{width:590,ajaksable:false})"}>
<input type="hidden" id="subsmtppasswd" value="">
</div>
</form>
<script>
(function(){
var _form = $('messengerconfig');
var btn =$('config');
//alert('1111');
//var finder = finderGroup['<{$env.get._finder.finder_id}>'];
_form.store('target',{
onSuccess:function(response){
var hash_res_obj = JSON.decode(response);
if (hash_res_obj.success != undefined && hash_res_obj.success != "")
{
try{
var _dialogIns = btn.getParent('.dialog').retrieve('instance');
}catch(e){}
if(_dialogIns)
{
_dialogIns.close();
//window.finderGroup['<{$env.get._finder.finder_id}>'].refresh();
}
}
}
});
btn.addEvent('click',function(){
_form.fireEvent('submit',{stop:$empty});
});
})();
</script>
<script>
setHidden('<{$options.smtppasswd.value}>');
var tdHTML=new Array();
function methodchange(type){
var len = $('EConfig').rows.length;
var tdLen = tdHTML.length;
var rIndex=0;
if (type=="mail"){
for(var i=0;i<len;i++){
if (parseInt($('EConfig').rows[i].id.indexOf('smtp'))==0){
var tmp=new Array();
for (var k=0;k<$('EConfig').rows[i].cells.length;k++){
if (k>0&&$('EConfig').rows[i].id=="smtppasswd")
{
tmp[k]='<input autocomplete="off" type="password" name="config[smtppasswd]" value="'+$('subsmtppasswd').value+'" onKeyUp="setHidden(this.value);" style="" class="_x_ipt password" vtype="password" />';
}
else{
tmp[k]=$('EConfig').rows[i].cells[k].innerHTML;
}
if (k==parseInt($('EConfig').rows[i].cells.length)-1)
{
tmp[k+1]=$('EConfig').rows[i].id;
}
}
tdHTML[rIndex]=tmp;
rIndex++;
}
if (parseInt(i)==parseInt(len-1))
{
deleteTabRow();
}
}
}
else{
var tag=document.getElementsByTagName('input');
var ext=0;
for(var t=0;t<tag.length;t++){
if (tag[t].type=="password")
{
ext=1;
}
}
if (ext==0)
{
for(var j=0;j<tdHTML.length;j++){
var tRow = $('EConfig').insertRow(len);
tRow.setAttribute('id',tdHTML[j][2]);
var th = document.createElement('th');
var td = document.createElement('td');
th.innerHTML=tdHTML[j][0];
td.innerHTML=tdHTML[j][1] ;
tRow.appendChild(th);
tRow.appendChild(td);
len++;
}
}
}
}
function deleteTabRow(){
var tlen = $('EConfig').rows.length;
for(var i=0;i<tlen;i++){
if (!$chk($('EConfig').rows[i])){
continue;
}
if (parseInt($('EConfig').rows[i].id.indexOf('smtp'))==0){
$('EConfig').deleteRow($('EConfig').rows[i].rowIndex);
deleteTabRow();
}
}
}
function setHidden(val){
$('subsmtppasswd').value = val;
}
methodchange('<{$options.sendway.value}>');
</script>