<script type="text/javascript" src="<{$STATIC_URL}>js/jquery.simplemodal.js" type="text/javascript"></script>
<script type="text/javascript">
$j(document).ready(function(){
Invite.bindServices();
<{if $list || $error}>
Invite.open(false, false, true);
<{elseif $error}>
Invite.open();
<{/if}>
});
Invite = {
formId: 'invForm',
modalId: 'basicModalContent',
UPLOAD_TYPE_CSV: 'csv',
UPLOAD_TYPE_LDIF: 'ldif',
select: function(){
var boxes = $j('.invEmails :checked[name="emails[]"]');
if(!boxes.length){
alert('You have not selected any email');
return false;
}
var strReceivers = '';
for (var i=0; i<boxes.length; i++) {
strReceivers += boxes[i].value + ",\n";
}
this.addToTextarea(strReceivers);
this.close();
},
addToTextarea: function(txt){
var currTxt = $j('#receivers').val();
if(currTxt.length){
currTxt += ', ';
}
$j('#receivers').val(
currTxt + '' + txt
);
},
reset: function(){
$j('#receivers').val('');
},
open: function(logoClass, name, isAjax){
var logo = $j('#inviteLogo');
logo[0].className = '';
logo.addClass(logoClass);
$j('#modalTitle').html('<{$title}>');
$j('#modalDescription').html('<{$description}>');
if (!isAjax) {
$j('#loginForm').show();
$j('#list').html('');
}
$j('#basicModalContent').modal();
$j('#currService').html('' + name);
$j('.serviceName').val(name);
$j('#email').val('');
$j('#password').val('');
if (name == 'Outlook' || name == 'Thunderbird') {
$j('#fieldsForm').hide();
$j('#uploadFile').show();
if (name == 'Outlook') {
$j('#uploadType').val(this.UPLOAD_TYPE_CSV);
} else {
$j('#uploadType').val(this.UPLOAD_TYPE_LDIF);
}
} else {
$j('#uploadType').val('');
$j('#fieldsForm').show();
$j('#uploadFile').hide();
}
},
close: function(){
$j('#services').val(0);
$j('#importError').html('');
$j('.modalClose').trigger('click');
$j('#ozpanel_please_wait').hide();
this.clearError();
},
submit: function(){
$j('#loginForm').show();
$j('#list').hide().html('');
$j('#importError').html('');
var form = $j('#' + this.formId);
var url = form.attr('action');
var serviceName = $j('#currService').html();
$j('#ozpanel_please_wait').show();
if ($j('#uploadType').val() == '') {
$j.post(url, form.serialize() + '&serviceName=' + encodeURIComponent(serviceName),
function(data, textStatus){
$j('#ozpanel_please_wait').hide();
$j('#list').html(data);
if ($j('#list').find('.error').html() == null) {
$j('#list').show();
} else {
$j('#list').html('');
$j('#importError').html(data);
}
}
);
} else {
form.submit();
}
return false;
},
clearError: function(){
$j('.error').html('');
},
bindServices: function(){
var _self = this;
$j('#services').change(function(){
if(this.value != 0){
_self.open(this.value, this.options[this.selectedIndex].innerHTML);
}
});
}
};
</script>
<div id="inviteform" class="invitebox">
<form method="post" id="sendInviteForm" name="sendInviteForm" action="<{$HOME_URL}>invite/send">
<div class="wrap">
<dl class="invList">
<dt><label>Von:</label></dt>
<dd><{$memberName}></dd>
<dt><label>An:</label><span style="color:#777777;">(mehrere E-Mail Adressen durch Kommata trennen)</span></dt>
<dd><textarea name="receivers" id="receivers" rows="4" cols="6"></textarea></dd>
<dt><label>Einladungstext:</label><span style="color:#777777;">(optional)</span></dt>
<dd><textarea name="msg" id="msg" rows="4" cols="6"></textarea></dd>
<dt> </dt>
<dd style="width:100%;">
<span class="button" style="margin-left:5px;">
<input style="width:90px;" type="button" onclick="Invite.reset()" value="Abbrechen"/>
</span>
<span class="button">
<input style="width:90px;" type="submit" value="Einladen"/>
</span>
</dd>
</dl>
</div>
</form>
</div>
<div>
<{include file="invite/service_logos.tpl"}>
</div>
<{include file="invite/modal.tpl"}>