421 lines
8.4 KiB
Smarty
421 lines
8.4 KiB
Smarty
{* INCLUDE HEADER CODE *}
|
|
|
|
{include file="header_modal.tpl"}
|
|
|
|
{literal}
|
|
|
|
<style>
|
|
|
|
.modal-content{background:black;}
|
|
|
|
.frmSearch {border: 1px solid #a8d4b1;background-color: #c6f7d0;margin: 2px 0px;padding:40px;border-radius:4px;}
|
|
|
|
#country-list{float:left;list-style:none;margin-top:-3px;padding:0;width:190px;position: absolute;}
|
|
|
|
#country-list li{padding: 10px; background: #fa3200; border-bottom: #fa3200 1px solid;}
|
|
|
|
#country-list li:hover{background:#000000;cursor: pointer;}
|
|
|
|
#search-box{padding: 10px;border: #a8d4b1 1px solid;border-radius:4px;}
|
|
|
|
</style>
|
|
|
|
{/literal}
|
|
|
|
|
|
|
|
{* $Id: user_messages_new.tpl 235 2009-11-13 04:30:39Z phil $ *}
|
|
|
|
|
|
|
|
|
|
|
|
<br />
|
|
|
|
|
|
|
|
{* JAVASCRIPT FOR CREATING SUGGESTION BOX *}
|
|
|
|
{literal}
|
|
|
|
<script type="text/javascript">
|
|
|
|
<!--
|
|
|
|
var tos = new Array();
|
|
|
|
window.addEvent('domready', function(){
|
|
|
|
var options = {
|
|
|
|
script:"misc_js.php?task=suggest_friend&limit=5&",
|
|
|
|
varname:"input",
|
|
|
|
json:true,
|
|
|
|
shownoresults:false,
|
|
|
|
maxresults:5,
|
|
|
|
blurtrigger:true,
|
|
|
|
callback: function (obj) {
|
|
|
|
{/literal}{if $setting.setting_username}obj.id = obj.value;{/if}{literal}
|
|
|
|
if(obj.id != '' && tos.indexOf(obj.id) == -1 && tos.length < {/literal}{$user->level_info.level_message_recipients}{literal}) { checkUser(obj); } else { $('to_display').value = ''; }
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var as_json = new bsn.AutoSuggest('to_display', options);
|
|
|
|
|
|
|
|
{/literal}{if $to_user != ""}{literal}
|
|
|
|
tos.splice(tos.length, 0, '{/literal}{$to_id}{literal}');
|
|
|
|
var newDiv = document.createElement('div');
|
|
|
|
newDiv.id = 'to_{/literal}{$to_id}{literal}';
|
|
|
|
newDiv.innerHTML = "{/literal}{$to_user}{literal}<!--<img src='./images/icons/action_delete2.gif' class='icon' style='cursor:pointer;' onClick='removeTo(\"{/literal}{$to_id}{literal}\")' border='0'>-->";
|
|
|
|
$('tos').insertBefore(newDiv, $('to_display'));
|
|
|
|
{/literal}{/if}{literal}
|
|
|
|
});
|
|
|
|
window.addEvent('load', function(){
|
|
|
|
setTimeout("{/literal}{if $to_user == ""}$('to_display').focus();{else}$('subject').focus();{/if}{literal}", "300");
|
|
|
|
});
|
|
|
|
function addTo(obj) {
|
|
|
|
tos.splice(tos.length, 0, obj.id);
|
|
|
|
var newDiv = document.createElement('div');
|
|
|
|
newDiv.id = 'to_'+obj.id;
|
|
|
|
newDiv.innerHTML = obj.value+"<!--<img src='./images/icons/action_delete2.gif' class='icon' style='cursor:pointer;' onClick='removeTo(\""+obj.id+"\")' border='0'>-->";
|
|
|
|
$('tos').insertBefore(newDiv, $('to_display'));
|
|
|
|
$('to_display').value = '';
|
|
|
|
}
|
|
|
|
function removeTo(id) {
|
|
|
|
tos.splice(tos.indexOf(id), 1);
|
|
|
|
$('tos').removeChild($('to_'+id));
|
|
|
|
}
|
|
|
|
function fillToIds() {
|
|
|
|
$('to').value = tos.join(';');
|
|
|
|
}
|
|
|
|
function checkUser(obj) {
|
|
|
|
var url = 'misc_js.php?task={/literal}{if $user->level_info.level_message_allow == 1}check_friend{else}check_user{/if}{literal}&input='+obj.id;
|
|
|
|
var request = new Request.JSON({secure: false, url: url,
|
|
|
|
onComplete: function(jsonObj) {
|
|
|
|
if(jsonObj.user_exists == 1) {
|
|
|
|
addTo(obj);
|
|
|
|
} else {
|
|
|
|
$('to_display').value = '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).send();
|
|
|
|
}
|
|
|
|
|
|
|
|
// THIS FUNCTION PREVENTS THE ENTER KEY FROM SUBMITTING THE FORM
|
|
|
|
function noenter(e) {
|
|
|
|
if (window.event) keycode = window.event.keyCode;
|
|
|
|
else if (e) keycode = e.which;
|
|
|
|
if(keycode == 13) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// THIS FUNCTION SHOWS THE ERROR OR SUCCESS MESSAGE
|
|
|
|
function messageSent(is_error, error_message) {
|
|
|
|
if(is_error != 0) {
|
|
|
|
$('error_div').style.display = 'block';
|
|
|
|
$('error_message').innerHTML = error_message;
|
|
|
|
} else {
|
|
|
|
$('form_div').style.display = 'none';
|
|
|
|
$('success_div').style.display = 'block';
|
|
|
|
setTimeout(function(){closemodal();}, "1000");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//-->
|
|
|
|
</script>
|
|
|
|
{/literal}
|
|
|
|
|
|
|
|
|
|
|
|
<div id='success_div' style='display: none;'><br>{lang_print id=804}</div>
|
|
|
|
|
|
|
|
<div id='form_div'>
|
|
|
|
<div style='text-align:left; padding-left: 10px;'>
|
|
|
|
Create your new message with the form below.<br />
|
|
|
|
|
|
|
|
Your message will be sent to all group members.
|
|
|
|
|
|
|
|
{* SHOW ERRORS *}
|
|
|
|
<div id='error_div' style='display: none;'>
|
|
|
|
<br>
|
|
|
|
<table cellpadding='0' cellspacing='0'>
|
|
|
|
<tr><td class='error'>
|
|
|
|
<img src='./images/error.gif' border='0' class='icon'> <span id='error_message'></span>
|
|
|
|
</td></tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
<script src="/include/js/jquery.form.js"></script>
|
|
{literal}
|
|
<script>
|
|
|
|
i=0;
|
|
|
|
function checkmail(){
|
|
if(i==0){
|
|
//jQuery("#form1").submit();
|
|
}
|
|
i=1;
|
|
closemodal();
|
|
}
|
|
jQuery(document).ready(function() {
|
|
|
|
jQuery('form input').keydown(function (e) {
|
|
if (e.keyCode == 13) {
|
|
selectUser(jQuery("#search-box").val());
|
|
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
return false;
|
|
}
|
|
});
|
|
|
|
jQuery('#form1').ajaxForm({
|
|
success: function(){
|
|
jQuery('#form_div').hide();
|
|
jQuery('#success_div').show();
|
|
setTimeout(closemodal, 5000);
|
|
|
|
}
|
|
});
|
|
jQuery("#search-box").keyup(function(){
|
|
jQuery.ajax({
|
|
type: "POST",
|
|
url: "misc_js.php?task=find_users&input="+jQuery(this).val(),
|
|
data:'input='+jQuery(this).val(),
|
|
beforeSend: function(){
|
|
jQuery("#search-box").css("background","#FFF url(LoaderIcon.gif) no-repeat 165px");
|
|
},
|
|
success: function(data){
|
|
jQuery("#suggesstion-box").show();
|
|
jQuery("#suggesstion-box").html(data);
|
|
jQuery("#search-box").css("background","#FFF");
|
|
}
|
|
});
|
|
});
|
|
});
|
|
//To select country name
|
|
function selectUser(val) {
|
|
|
|
who=jQuery("#to").val();
|
|
|
|
whoarray=who.split(",");
|
|
alreadyin=0;
|
|
for(var i = 0; i < whoarray.length; i++){
|
|
if(val==whoarray[i]){alreadyin=1;}
|
|
}
|
|
|
|
if(alreadyin==0){
|
|
if(who==""){
|
|
jQuery("#to").val(val);
|
|
}else{
|
|
jQuery("#to").val(who+","+val);
|
|
}
|
|
jQuery("#toshow").append(val+"<br>");
|
|
}
|
|
who=jQuery("#to").val();
|
|
whoarray1=who.split(",");
|
|
if(whoarray1.length=={/literal}{$user->level_info.level_message_recipients}{literal})
|
|
{
|
|
jQuery("#search-box").attr("disabled", "disabled");
|
|
}
|
|
|
|
jQuery("#suggesstion-box").hide();
|
|
|
|
|
|
jQuery("#search-box").val("");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function fillToIds() {
|
|
jQuery("#submit1").prop( "disabled", true );
|
|
jQuery("#submit2").prop( "disabled", true );
|
|
return checkmail();
|
|
}
|
|
|
|
|
|
</script>{/literal}
|
|
<form action='user_messages_new_group.php' method='POST' autocomplete="off" id="form1" onsubmit="jQuery('#massgroupmessagesend').prop('disabled', true);">
|
|
|
|
<table cellpadding='0' cellspacing='0'>
|
|
|
|
<tr>
|
|
|
|
<td class='form1'>{lang_print id=601}</td>
|
|
|
|
<td class='form2' valign='bottom' align='left'><b><a href='{$url->url_create('profile',$user->user_info.user_username)}' target='_parent'>{$user->user_displayname}</a></b></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class='form1' valign='top'>{lang_print id=790}</td>
|
|
|
|
<td class='form2' valign='top' align='left' style='position: relative;'>
|
|
|
|
<div id='tos' style='border: none;font-family: arial, verdana, serif;font-size: 12px;vertical-align: middle;padding-left: 2px;width:178px;'>
|
|
|
|
Group
|
|
|
|
</div>
|
|
|
|
<input type='hidden' name='to' id='to' value=''>
|
|
|
|
<input type='hidden' name='group' id='group' value='{$group}'>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class='form1'>{lang_print id=520}</td>
|
|
|
|
<td class='form2' align='left'><input type='text' disabled class='text' name='subject1' id='subject1' value='Message from group: {$group1->group_info.group_title}' size='30' maxlength='100' style="color:white;"><input type='hidden' class='text' name='subject' id='subject' value='Message from group: {$group1->group_info.group_title}' size='30' maxlength='100' style="color:white;"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class='form1'>{lang_print id=521}</td>
|
|
|
|
<td class='form2' align='left'><textarea rows='10' cols='50' style='width:350px;' name='message'>{$message}</textarea></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class='form1'> </td>
|
|
|
|
<td class='form2' align='left'>
|
|
|
|
<table cellpadding='0' cellspacing='0'>
|
|
|
|
<tr>
|
|
|
|
<td><input type='submit' class='button' value='{lang_print id=791}' id="massgroupmessagesend"> </td>
|
|
|
|
<input type='hidden' name='task' value='send'>
|
|
|
|
<td><input type='button' class='button' value='{lang_print id=39}' onClick='closemodal();'></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html> |