minor - added require field for subject when you send a message - partial CT#190

skala
Cristian Fasanando 16 years ago
parent 94a816eeb8
commit e342de37a4
  1. 5
      main/inc/lib/message.lib.php
  2. 13
      main/messages/send_message.php
  3. 10
      main/messages/send_message_to_userfriend.inc.php
  4. 12
      main/social/groups.php
  5. 7
      main/social/message_for_group_form.inc.php

@ -213,7 +213,10 @@ class MessageManager
}
}
if ($total_filesize > intval(api_get_setting('message_max_upload_filesize'))) {
// validating fields
if (empty($subject)) {
return get_lang('YouShouldWriteASubject');
} else if ($total_filesize > intval(api_get_setting('message_max_upload_filesize'))) {
return sprintf(get_lang("FilesSizeExceedsX"),format_file_size(api_get_setting('message_max_upload_filesize')));
}

@ -49,15 +49,14 @@ if ($panel_id == 2 || $panel_id == 4 ) {
<dd><a href="javascript:void(0)" onclick="change_panel('1','<?php echo $user_id; ?>')"><?php echo api_xml_http_response_encode(get_lang('SendMessage'));?></a></dd>
</dl>
<?php
}elseif($panel_id == 5 && empty($content_message)) {
}elseif($panel_id == 5 && empty($subject_message)) {
?>
<div id="display_response_id" style="height:200px;">
<?php echo api_xml_http_response_encode(get_lang('To')); ?> :&nbsp;&nbsp;&nbsp;&nbsp;<?php echo api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName'])); ?>
<br />
<br /><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br /><input id="txt_subject_id" type="text" style="width:300px;"><br/>
<br /><?php echo api_xml_http_response_encode(get_lang('Message')); ?> :<br /><textarea id="txt_area_invite" rows="4" cols="40"></textarea>
<?php echo api_xml_http_response_encode(get_lang('YouShouldWriteAMessage')); ?><br />
<br />
<br /><span style="color:red">*</span><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br /><input id="txt_subject_id" type="text" style="width:300px;"><br/>
<br /><?php echo api_xml_http_response_encode(get_lang('Message')); ?> :<br /><textarea id="txt_area_invite" rows="3" cols="40"></textarea>
<?php echo Display::display_error_message(api_xml_http_response_encode(get_lang('YouShouldWriteASubject'))); ?>
<button class="save" type="button" value="<?php echo api_xml_http_response_encode(get_lang('SendMessage')); ?>" onclick="action_database_panel('5','<?php echo $user_id;?>')">
<?php echo api_xml_http_response_encode(get_lang('SendMessage')) ?></button>
</div>
@ -68,7 +67,7 @@ if ($panel_id==4 && !empty($content_message)) {
$subject_message=null;
}
SocialManager::send_invitation_friend_user($user_id,$subject_message,$content_message);
} elseif ($panel_id==5 && !empty($content_message) ) {
} elseif ($panel_id==5 && !empty($subject_message) ) {
SocialManager::send_invitation_friend_user($user_id,$subject_message,$content_message);
}
?>
?>

@ -49,10 +49,11 @@ if ( isset($_REQUEST['user_friend']) ) {
<div id="display_response_id" style="height:200px;">
<?php echo api_xml_http_response_encode(get_lang('To')); ?> :&nbsp;&nbsp;&nbsp;&nbsp;<?php echo api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName'])); ?>
<br />
<br /><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br /><input id="txt_subject_id" type="text" style="width:300px;"><br/>
<br /><?php echo api_xml_http_response_encode(get_lang('Message')); ?> :<br /><textarea id="txt_area_invite" rows="4" cols="40"></textarea>
<br /><span style="color:red">*</span><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br /><input id="txt_subject_id" type="text" style="width:300px;"><br/>
<br /><?php echo api_xml_http_response_encode(get_lang('Message')); ?> :<br /><textarea id="txt_area_invite" rows="3" cols="40"></textarea>
<div><span style="color:red">*</span><?php echo get_lang('FieldRequired') ?></div>
<br />
<button class="save" type="button" value="<?php echo api_xml_http_response_encode(get_lang('SendMessage')); ?>" onclick="action_database_panel('5','<?php echo $userfriend_id;?>')"><?php echo api_xml_http_response_encode(get_lang('SendMessage')) ?></button>
<button class="save" type="button" value="<?php echo api_xml_http_response_encode(get_lang('SendMessage')); ?>" onclick="action_database_panel('5','<?php echo $userfriend_id;?>')"><?php echo api_xml_http_response_encode(get_lang('SendMessage')) ?></button>
</div>
<?php
} else {
@ -64,8 +65,7 @@ if ( isset($_REQUEST['user_friend']) ) {
<button class="save" type="button" value="<?php echo api_xml_http_response_encode(get_lang('SocialAddToFriends')); ?>" onclick="action_database_panel('4','<?php echo $userfriend_id;?>')" >
<?php echo api_xml_http_response_encode(get_lang('SendInvitation')) ?></button>
</div>
<?php
}
<?php }
}
?>
</dl>

@ -60,6 +60,14 @@ function add_image_form() {
}
}
function validate_text_empty (str,msg) {
var str = str.replace(/^\s*|\s*$/g,"");
if (str.length == 0) {
alert(msg);
return true;
}
}
jQuery(document).ready(function() {
$(".head").click(function() {
$(this).next().slideToggle("fast");
@ -82,7 +90,6 @@ jQuery(document).ready(function() {
return false;
}).next().hide();
});
</script>';
$interbreadcrumb[]= array ('url' =>'profile.php','name' => get_lang('Social'));
@ -108,7 +115,8 @@ if (isset($_POST['token']) && $_POST['token'] === $_SESSION['sec_token']) {
} else {
$res = MessageManager::send_message(0, $title, $content, $_FILES, '', $group_id, $parent_id);
}
// display error messages
if (is_string($res)) {
Display::display_error_message($res);
}

@ -72,7 +72,7 @@ if (!empty($group_id) && $allowed_action) {
$user_info=api_get_user_info($userfriend_id);
echo api_xml_http_response_encode(get_lang('To')); ?> :&nbsp;&nbsp;&nbsp;&nbsp;<?php echo api_xml_http_response_encode($to_group); ?>
<br />
<br /><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br />
<br /><span style="color:red">*</span><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br />
<input id="txt_subject_id" name="title" type="text" style="width:450px;" value="<?php echo $subject ?>"><br/>
<br /><?php echo api_xml_http_response_encode(get_lang('Message')); ?> :<br />
<?php
@ -86,9 +86,10 @@ if (!empty($group_id) && $allowed_action) {
?>
<br /><br /><?php echo api_xml_http_response_encode(get_lang('AttachmentFiles')); ?> :<br />
<span id="filepaths"><div id="filepath_1"><input type="file" name="attach_1" size="20" /></div></span>
<div id="link-more-attach"><a href="javascript://" onclick="return add_image_form()"><?php echo get_lang('AddOneMoreFile') ?></a>&nbsp;(<?php echo api_xml_http_response_encode(sprintf(get_lang('MaximunFileSizeX'),format_file_size(api_get_setting('message_max_upload_filesize')))) ?>)</div>
<div id="link-more-attach"><a href="javascript://" onclick="return add_image_form()"><?php echo get_lang('AddOneMoreFile') ?></a>&nbsp;(<?php echo api_xml_http_response_encode(sprintf(get_lang('MaximunFileSizeX'),format_file_size(api_get_setting('message_max_upload_filesize')))) ?>)</div>
<br />
<button class="save" type="submit" value="<?php echo api_xml_http_response_encode(get_lang('SendMessage')); ?>"><?php echo api_xml_http_response_encode(get_lang('SendMessage')) ?></button>
<button class="save" onclick="if(validate_text_empty(this.form.title.value,'<?php echo get_lang('YouShouldWriteASubject')?>')){return false;}" type="submit" value="<?php echo api_xml_http_response_encode(get_lang('SendMessage')); ?>"><?php echo api_xml_http_response_encode(get_lang('SendMessage')) ?></button>
<div><span style="color:red">*</span><?php echo get_lang('FieldRequired') ?></div>
<?php } ?>
</dl>
</td>

Loading…
Cancel
Save