Jump to content

Recommended Posts

  • Administrators
Posted

airmail_logo.png

AIRMail beta2

New Features

1 - Drop down of all pilots for "To" field when sending new AIRMail

2 - Option in dropdown of "NOTAM" which sends the AIRmail to all pilots of the airline

3 - Streamlined code to only use pilotid in the db so if a pilot switches airlines or the airline changes it's code the pilots AIRMail will still be available

4 - Function to delete sent items out of your sent items list

5 - Function to show pilot if there is new AIRMail waiting (With Animated Image!)

6 - Added function to insert "No Subject" in the subject line when an AIRMail is sent so it can still be opened by the receiving pilot(s)

7 - Function added to deny sending AIRmail with the "To" field empty

To Use the "You Have Mail" function place the following code where you would like the notice to appear, it will only appear if the pilot is logged in.

<?php MainController::Run('Mail', 'checkmail'); ?>

To Install

1 - Download the attached package

2 - Unzip the folder and place the files in their appropriate places in your phpVMS install

3 - Run the sql file in your phpVMS database using phpmyadmin or similar

(If you have been testing the first version you will have to drop the existing airmail table and replace it with the new file, many changes have been made since the first beta and the new edition will not work within the old db table)

4 - Create a link on your site for your pilots to access their AIRMail

<a href="<?php echo SITE_URL ?>/index.php/Mail/inbox">AIRMail</a>

Please let me know of any bugs you find and any other additional functions that may be beneficial to the addon.

AIRMail.zipFetching info...

Posted

Ok This one is working, good job.  I am not sure its a good idea for all pilots to have the ability to mail all.  Not sure if thats a feature for just admins.  Some of code was real sloppy, found quite a few mistakes, this may be an issue for you beginners trying to modify the templates. But over all it functions well. One other issue is you didn't use the mail_send. tpl this time, I liked it better so I reincorporated it.

  • Administrators
Posted

Roger has a good point in that only admins should have the option to mail all pilots at one time "NOTAM". Attached is a new mail_new.tpl file that includes a function to only allow admins to have the NOTAM option in their dropdown when creating a new mail -

If you have already modified the mail_new.tpl file you will want to find -

<option value="all">NOTAM (All Pilots)</option>
<?php

Was on lines 25 and 26 of the original

and replace it with -

<?php if(PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN))
{
?>
	<option value="all">NOTAM (All Pilots)</option>
<?php
}

mail_new.zipFetching info...

  • Administrators
Posted

ACCESS_ADMIN will allow anyone who has access to the admin panel. If you use FULL_ADMIN, that will only allow true administrators to do that. But if someone has access to edit schedules, they get ACCESS_ADMIN and EDIT_SCHEDULES, but they're not a full administrator, so you might want to change that depending on what you want

Posted

I could not help but notice, if you send out a message to all pilots, it messages the sender as well. This is not actually necessary and takes up extra sql resources. Is there any way to make it so that it does NOT send a Message to the sender?

Posted

Have been using it actively, its working great.

I have one request: Since im responsible for giving some support, my inbox is big. Adding a archive or custom folders would be great for me.

  • Administrators
Posted
  Quote

Gentle bump here.  ;D

I will include an option for this in the next version as I believe that it is a good option for the admin, but some may want to have this return confirmation when a NOTAM is sent.

If you would like to change it now to permenatly not send the copy to the admin sending the NOTAM you can ->

1 - Open Mail.php in the Mail module folder

2 - Find lines 89 through 95

foreach ($everyone as $allpilots)
{
	$sql="INSERT INTO airmail (who_to, who_from, subject, message, date, time, notam)
	VALUES ('$allpilots->pilotid', '$who_from', '$subject', '$newmessage', NOW(), NOW(), '$notam')";
	$notam = $notam+1;
	DB::query($sql);
}

And change that section to

foreach ($everyone as $allpilots)
{
	if ($allpilots->pilotid == $who_from)
		{
		}
	else
		{
		$sql="INSERT INTO airmail (who_to, who_from, subject, message, date, time, notam)
		VALUES ('$allpilots->pilotid', '$who_from', '$subject', '$newmessage', NOW(), NOW(), '$notam')";
		$notam = $notam+1;
		DB::query($sql);
		}
}

That should make it so there is no NOTAM sent back to the person sending it, you should still be able to see it in your sent items list.

I will also build in a qualifier to not send any mail to an inactive pilot in the next version as well.

  • Administrators
Posted
  Quote

I could not help but notice, if you send out a message to all pilots, it messages the sender as well. This is not actually necessary and takes up extra sql resources. Is there any way to make it so that it does NOT send a Message to the sender?

That wouldn't really have an appreciable affect, but it might be good for just having it work that way

Posted

Well, I was kind of thinking that since It shows up in the sent messages box then there is no need to have another taking up database room even as minute as it may be. It's like phpBB sending a private notice to new users and they have never logged in. I allways added the mod to make it only send a pm AFTER they logged in for the first time to save on databse.

There's that mode of thinking of mine again  ;D  It is hard to shake off.

  • Administrators
Posted
  Quote

Well, I was kind of thinking that since It shows up in the sent messages box then there is no need to have another taking up database room even as minute as it may be. It's like phpBB sending a private notice to new users and they have never logged in. I allways added the mod to make it only send a pm AFTER they logged in for the first time to save on databse.

There's that mode of thinking of mine again  ;D  It is hard to shake off.

The message showing up in the sent messages box is the same message as you are seeing in the inbox, it is not two seperate lines in the database. The app uses some of the qualifiers in the row in order to show it as both an incoming and outgoing message.

Posted

Hi this looks excellent!  However in my testing I've found that if I delete a mail without opening it, the "You Have Mail" still shows, even if there's nothing in my Inbox.

Also he's a bit of code that I've changed to make the "You have mail" linked back to the Inbox as I've put the checkmail function up in the header which you may or may not want to use:

Edit mail_check.tpl, and replace the 2 lines that begin with "echo" with:

?><a href="<?php echo SITE_URL ?>/index.php/Mail/inbox"><?php echo 'You Have New Mail <img src="'.SITE_URL.'/mailimages/new_mail.gif" border="0" />';?></a><?php

Make sure you backup your original file 1st in case you try this and don't like it.  It'll also put the mailbox image on the same line as the text rather than above.  If you want to use this and still have the mailbox above the text let me know and I'll post the code.

EDIT: It appears the mail_new.tpl that enables admins only to send messages breaks new mail functionality in version 700.  I've managed to fix it now.  Please note this is for version 700 ONLY, any version with admin groups need not use this:

Using the original mail_new.tpl from beta2, replace the line:

<option value="all">NOTAM (All Pilots)</option>

with:

<?php if(Auth::UserInGroup('Administrators'))
{
?>
<option value="all">NOTAM (All Pilots)</option>
<?php
}
?>

Will

  • Administrators
Posted
  Quote
Hi this looks excellent!  However in my testing I've found that if I delete a mail without opening it, the "You Have Mail" still shows, even if there's nothing in my Inbox.

Good catch!  :)

To fix this open MailDataClass.php in core/common and find line 55 ->

$upd = "UPDATE airmail SET deleted_state=1 WHERE id='$mailid'";

and change it to ->

$upd = "UPDATE airmail SET deleted_state=1, read_state=1 WHERE id='$mailid'";

When you now delete an unread mail item it will also show it in the database as a read item and will not trigger the "You Have Mail" function. I will include this change in the next version.

Posted

Another quick problem I've seen - when replying to airmail, it inserts "< BR >< BR >"  but doesn't actually parse it, so all the message is on one line.  Also in a new message it doesn't take into account carriage returns, so again it shows all on one line.

  • 2 weeks later...
Posted

Hey simpilot , i swear your coding is the best , i love it . Now small question is there any way i cant post how many messages they have and the link to to check that messages, I want that to be in my Pilot Center. Please reply back telling me how to do it . Thank you

Ex: how can you disply the last 5mails or 1 or 2 or 3 for example like latest pilots so i put it

under you got mail

  • Administrators
Posted

@pouzo,

If you want to show how many AIRmail's are waiting instead of the image you can ->

1 - open mail_check.tpl - unless you have changed it, it should look like this ->

<center>
<?php
    if ($items > 0)
	{
		echo '<img src="'.SITE_URL.'/mailimages/new_mail.gif" border="0" /><br />';
		echo 'You Have Mail';
	}
	else
	{
		echo 'You have no new mail';
	}
?>
</center>

2 - change it to

<center>
<?php
    if ($items > 0)
	{
		echo 'You Have '.$items.' New Mail Items';
	}
	else
	{
		echo 'You have no new mail';
	}
?>
</center>

That should get the result you are looking for.

You can call it anywhere in the template using -

<?php MainController::Run('Mail', 'checkmail'); ?>

I am not sure what you are looking for with the second request. When you go to your inbox it gives you a list of your mail... let me know what you are trying to do.

Posted

Hey man, Thank you so much for the reply , it works like a charm , I added the link so if they have a mail they can click on it and check their new mail.

<center>
<?php
    if ($items > 0)
	{
		echo '<a href="index.php/Mail/inbox">You Have '.$items.' New Mail Items </a>';
	}
	else
	{
		echo 'You have no new mail';
	}
?>
</center>

  • Administrators
Posted
  Quote

I'm not showing the drop down menu with the pilot IDs. When I send an email  , I get a message " You must select a recipient" when I sent out a test email.

Hi Eddie - did you update all the files from the first beta with the files for the second one? The first version did not have a drop down for pilots. Also, what version phpVMS are you running, I think I may have to do some work to adhere to the newer beta structure for modules.

Posted

<style>

.left {

width: 200px;

float: left;

min-height: 300px;

padding: 15px 0 15px 5px;

}

.right {

margin-left: 210px;

}

</style>

<div class="left">

<?php Template::Show ('mail_menu.tpl'); ?>

</div>

<div class="right">

<center>

<table bgcolor="#000000" cellspacing="1" cellpadding="5" border="0">

<form method="post" action="<?php echo SITE_URL?>/index.php/Mail/send">

<input type="hidden" name="who_from" value="<?php echo Auth::$userinfo->pilotid ?>" />

<tr bgcolor="#cccccc">

<td>

<b>To:</b>

<select type="text" name="who_to">

<option value="">Select a pilot</option>

<?php if(PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN))

  {

  ?>

      <option value="all">NOTAM (All Pilots)</option>

  <?php

  }

foreach($allpilots as $pilots)

{

echo '<option value="'.$pilots->pilotid.'">'.$pilots->firstname.' '.$pilots->lastname.' - '.PilotData::GetPilotCode($pilots->code, $pilots->pilotid).'</option>';

}

?>

</select>

</td>

<td><b>Subject:<input type="text" name="subject"></b></td>

</tr>

<tr bgcolor="#eeeeee">

<td colspan="2"><b>Message:</b><br /><br />

<textarea name="message" rows="10" cols="60"></textarea></td></tr>

<tr bgcolor="#cccccc">

<td colspan="2">

<input type="submit" value="Send AIRmail">

</td>

</tr>

</form>

</table>

</center>

</div>

<br />

<center><b><font size="1.5px">AIRmail © 2009 <a href="http://www.simpilotgroup.com">simpilotgroup.com</a></font></b></center>

<br />

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...