This commit is contained in:
@@ -67,6 +67,28 @@ namespace rockfishCore.Controllers
|
|||||||
return Json(new { msg = ex.Message, error = 1 });
|
return Json(new { msg = ex.Message, error = 1 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[HttpPost("isspam/{account}/{id}")]
|
||||||
|
public JsonResult IsSpam([FromRoute] string account, [FromRoute] uint id)
|
||||||
|
{
|
||||||
|
|
||||||
|
RfMail.rfMailAccount acct = RfMail.rfMailAccount.support;
|
||||||
|
if (account.Contains("sales"))
|
||||||
|
{
|
||||||
|
acct = RfMail.rfMailAccount.sales;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
RfMail.HandleSpamMessage(id, acct);
|
||||||
|
return Json(new { msg = "message processed as spam", ok = 1 });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return Json(new { msg = ex.Message, error = 1 });
|
||||||
|
}
|
||||||
|
}
|
||||||
// //------------------------------------------------------
|
// //------------------------------------------------------
|
||||||
|
|
||||||
public class dtoReplyMessageItem
|
public class dtoReplyMessageItem
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using MailKit.Net.Imap;
|
|||||||
using MailKit.Search;
|
using MailKit.Search;
|
||||||
using MailKit;
|
using MailKit;
|
||||||
using MimeKit;
|
using MimeKit;
|
||||||
|
using MimeKit.Utils;
|
||||||
|
|
||||||
namespace rockfishCore.Util
|
namespace rockfishCore.Util
|
||||||
{
|
{
|
||||||
@@ -108,6 +109,8 @@ namespace rockfishCore.Util
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void SendMessage(string MessageFrom, string MessageTo, string MessageSubject, string MessageBody,
|
public static void SendMessage(string MessageFrom, string MessageTo, string MessageSubject, string MessageBody,
|
||||||
bool trackDeliveryStatus = false, string CustomHeader = "", string CustomHeaderValue = "")
|
bool trackDeliveryStatus = false, string CustomHeader = "", string CustomHeaderValue = "")
|
||||||
{
|
{
|
||||||
@@ -151,6 +154,51 @@ namespace rockfishCore.Util
|
|||||||
}//send message
|
}//send message
|
||||||
|
|
||||||
|
|
||||||
|
#region handle spam message
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Forward a message to the isspam@ayanova.com address and then erase it
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="spamMessageId"></param>
|
||||||
|
/// <param name="replyFromAccount"></param>
|
||||||
|
public static void HandleSpamMessage(uint spamMessageId, rfMailAccount replyFromAccount)
|
||||||
|
{
|
||||||
|
using (var client = new ImapClient())
|
||||||
|
{
|
||||||
|
// Accept all SSL certificates
|
||||||
|
client.ServerCertificateValidationCallback = (s, c, h, e) => true;
|
||||||
|
client.Connect(MAIL_IMAP_ADDRESS, MAIL_IMAP_PORT);
|
||||||
|
// Note: since we don't have an OAuth2 token, disable
|
||||||
|
// the XOAUTH2 authentication mechanism.
|
||||||
|
client.AuthenticationMechanisms.Remove("XOAUTH2");
|
||||||
|
if (replyFromAccount == rfMailAccount.support)
|
||||||
|
{
|
||||||
|
client.Authenticate(MAIL_ACCOUNT_SUPPORT, MAIL_ACCOUNT_PASSWORD_SUPPORT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
client.Authenticate(MAIL_ACCOUNT_SALES, MAIL_ACCOUNT_PASSWORD_SALES);
|
||||||
|
}
|
||||||
|
|
||||||
|
var spamFolder = client.GetFolder("Spam");
|
||||||
|
|
||||||
|
if (spamFolder != null){
|
||||||
|
client.Inbox.Open(FolderAccess.ReadWrite);
|
||||||
|
client.Inbox.MoveTo(new UniqueId(spamMessageId), spamFolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
client.Disconnect(true);
|
||||||
|
}
|
||||||
|
}//spaminator
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void ReplyMessage(uint replyToMessageId, rfMailAccount replyFromAccount, string replyBody,
|
public static void ReplyMessage(uint replyToMessageId, rfMailAccount replyFromAccount, string replyBody,
|
||||||
bool replyToAll, bool trackDeliveryStatus = false, string CustomHeader = "", string CustomHeaderValue = "")
|
bool replyToAll, bool trackDeliveryStatus = false, string CustomHeader = "", string CustomHeaderValue = "")
|
||||||
{
|
{
|
||||||
@@ -522,7 +570,7 @@ namespace rockfishCore.Util
|
|||||||
{
|
{
|
||||||
// Accept all SSL certificates
|
// Accept all SSL certificates
|
||||||
client.ServerCertificateValidationCallback = (s, c, h, e) => true;
|
client.ServerCertificateValidationCallback = (s, c, h, e) => true;
|
||||||
//client.Connect(MAIL_IMAP_ADDRESS, MAIL_IMAP_PORT, true);
|
//client.Connect(MAIL_IMAP_ADDRESS, MAIL_IMAP_PORT, true);
|
||||||
client.Connect(MAIL_IMAP_ADDRESS, MAIL_IMAP_PORT);
|
client.Connect(MAIL_IMAP_ADDRESS, MAIL_IMAP_PORT);
|
||||||
// Note: since we don't have an OAuth2 token, disable
|
// Note: since we don't have an OAuth2 token, disable
|
||||||
// the XOAUTH2 authentication mechanism.
|
// the XOAUTH2 authentication mechanism.
|
||||||
|
|||||||
2
wwwroot/css/materialdesignicons.min.css
vendored
2
wwwroot/css/materialdesignicons.min.css
vendored
File diff suppressed because one or more lines are too long
7
wwwroot/css/materialdesignicons.min.css.map
Normal file
7
wwwroot/css/materialdesignicons.min.css.map
Normal file
File diff suppressed because one or more lines are too long
@@ -11,16 +11,16 @@
|
|||||||
<title>Rockfish loading....</title>
|
<title>Rockfish loading....</title>
|
||||||
|
|
||||||
<!-- ICONS / MANIFEST -->
|
<!-- ICONS / MANIFEST -->
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?rfv=6.2">
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?rfv=6.3">
|
||||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png?rfv=6.2">
|
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png?rfv=6.3">
|
||||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png?rfv=6.2">
|
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png?rfv=6.3">
|
||||||
<link rel="manifest" href="/manifest.json?rfv=6.2">
|
<link rel="manifest" href="/manifest.json?rfv=6.3">
|
||||||
<link rel="mask-icon" href="/safari-pinned-tab.svg?rfv=6.2" color="#5bbad5">
|
<link rel="mask-icon" href="/safari-pinned-tab.svg?rfv=6.3" color="#5bbad5">
|
||||||
<meta name="theme-color" content="#ffffff">
|
<meta name="theme-color" content="#ffffff">
|
||||||
|
|
||||||
|
|
||||||
<!-- 3rd party components fonts and icons -->
|
<!-- 3rd party components fonts and icons -->
|
||||||
<link href="css/materialdesignicons.min.css?rfv=6.2" media="all" rel="stylesheet" type="text/css" />
|
<link href="css/materialdesignicons.min.css?rfv=6.3" media="all" rel="stylesheet" type="text/css" />
|
||||||
|
|
||||||
<!--BOOTSTRAP-->
|
<!--BOOTSTRAP-->
|
||||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB"
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB"
|
||||||
@@ -29,60 +29,60 @@
|
|||||||
crossorigin="anonymous"> -->
|
crossorigin="anonymous"> -->
|
||||||
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/app.css?rfv=6.2" type="text/css" />
|
<link rel="stylesheet" href="css/app.css?rfv=6.3" type="text/css" />
|
||||||
<link rel="stylesheet" href="css/mdi-bs4-compat.css?rfv=6.2" type="text/css" />
|
<link rel="stylesheet" href="css/mdi-bs4-compat.css?rfv=6.3" type="text/css" />
|
||||||
<!-- <script src="js/lib/jquery-3.2.1.min.js"></script> -->
|
<!-- <script src="js/lib/jquery-3.2.1.min.js"></script> -->
|
||||||
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
|
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
|
|
||||||
<!-- third-party javascript -->
|
<!-- third-party javascript -->
|
||||||
<script src="js/lib/page.js?rfv=6.2"></script>
|
<script src="js/lib/page.js?rfv=6.3"></script>
|
||||||
<script src="js/lib/jquery.event.gevent.js?rfv=6.2"></script>
|
<script src="js/lib/jquery.event.gevent.js?rfv=6.3"></script>
|
||||||
<script src="js/lib/jquery.gzserialize.js?rfv=6.2"></script>
|
<script src="js/lib/jquery.gzserialize.js?rfv=6.3"></script>
|
||||||
<script src="js/lib/handlebars.runtime-v4.0.5.js?rfv=6.2"></script>
|
<script src="js/lib/handlebars.runtime-v4.0.5.js?rfv=6.3"></script>
|
||||||
<script src="js/lib/store.min.js?rfv=6.2"></script>
|
<script src="js/lib/store.min.js?rfv=6.3"></script>
|
||||||
<script src="js/lib/jquery.autocomplete.min.js?rfv=6.2"></script>
|
<script src="js/lib/jquery.autocomplete.min.js?rfv=6.3"></script>
|
||||||
<script src="js/lib/moment.min.js?rfv=6.2"></script>
|
<script src="js/lib/moment.min.js?rfv=6.3"></script>
|
||||||
|
|
||||||
<!-- our javascript -->
|
<!-- our javascript -->
|
||||||
|
|
||||||
<!-- <script src="js/index.js?rfv=6.2"></script> -->
|
<!-- <script src="js/index.js?rfv=6.3"></script> -->
|
||||||
<script src="js/index.js" asp-append-version="true"></script>
|
<script src="js/index.js" asp-append-version="true"></script>
|
||||||
|
|
||||||
<script src="js/app.util.js?rfv=6.2"></script>
|
<script src="js/app.util.js?rfv=6.3"></script>
|
||||||
<script src="js/app.api.js?rfv=6.2"></script>
|
<script src="js/app.api.js?rfv=6.3"></script>
|
||||||
<script src="js/app.utilB.js?rfv=6.2"></script>
|
<script src="js/app.utilB.js?rfv=6.3"></script>
|
||||||
<script src="js/app.nav.js?rfv=6.2"></script>
|
<script src="js/app.nav.js?rfv=6.3"></script>
|
||||||
<script src="js/app.shell.js?rfv=6.2"></script>
|
<script src="js/app.shell.js?rfv=6.3"></script>
|
||||||
<script src="js/app.fourohfour.js?rfv=6.2"></script>
|
<script src="js/app.fourohfour.js?rfv=6.3"></script>
|
||||||
<script src="js/app.authenticate.js?rfv=6.2"></script>
|
<script src="js/app.authenticate.js?rfv=6.3"></script>
|
||||||
<script src="js/app.customers.js?rfv=6.2"></script>
|
<script src="js/app.customers.js?rfv=6.3"></script>
|
||||||
<script src="js/app.customerEdit.js?rfv=6.2"></script>
|
<script src="js/app.customerEdit.js?rfv=6.3"></script>
|
||||||
<script src="js/app.customerSites.js?rfv=6.2"></script>
|
<script src="js/app.customerSites.js?rfv=6.3"></script>
|
||||||
<script src="js/app.customerSiteEdit.js?rfv=6.2"></script>
|
<script src="js/app.customerSiteEdit.js?rfv=6.3"></script>
|
||||||
<script src="js/app.purchases.js?rfv=6.2"></script>
|
<script src="js/app.purchases.js?rfv=6.3"></script>
|
||||||
<script src="js/app.purchaseEdit.js?rfv=6.2"></script>
|
<script src="js/app.purchaseEdit.js?rfv=6.3"></script>
|
||||||
<script src="js/app.license.js?rfv=6.2"></script>
|
<script src="js/app.license.js?rfv=6.3"></script>
|
||||||
<script src="js/app.licenseTemplates.js?rfv=6.2"></script>
|
<script src="js/app.licenseTemplates.js?rfv=6.3"></script>
|
||||||
<script src="js/app.licenseRequestEdit.js?rfv=6.2"></script>
|
<script src="js/app.licenseRequestEdit.js?rfv=6.3"></script>
|
||||||
<script src="js/app.licenses.js?rfv=6.2"></script>
|
<script src="js/app.licenses.js?rfv=6.3"></script>
|
||||||
<script src="js/app.licenseView.js?rfv=6.2"></script>
|
<script src="js/app.licenseView.js?rfv=6.3"></script>
|
||||||
<script src="js/app.reportData.js?rfv=6.2"></script>
|
<script src="js/app.reportData.js?rfv=6.3"></script>
|
||||||
<script src="js/app.reportDataProdEmail.js?rfv=6.2"></script>
|
<script src="js/app.reportDataProdEmail.js?rfv=6.3"></script>
|
||||||
<script src="js/app.reportDataExpires.js?rfv=6.2"></script>
|
<script src="js/app.reportDataExpires.js?rfv=6.3"></script>
|
||||||
<script src="js/app.search.js?rfv=6.2"></script>
|
<script src="js/app.search.js?rfv=6.3"></script>
|
||||||
<script src="js/app.subscription.js?rfv=6.2"></script>
|
<script src="js/app.subscription.js?rfv=6.3"></script>
|
||||||
<script src="js/app.subnotify.js?rfv=6.2"></script>
|
<script src="js/app.subnotify.js?rfv=6.3"></script>
|
||||||
<script src="js/app.templates.js?rfv=6.2"></script>
|
<script src="js/app.templates.js?rfv=6.3"></script>
|
||||||
<script src="js/app.templateEdit.js?rfv=6.2"></script>
|
<script src="js/app.templateEdit.js?rfv=6.3"></script>
|
||||||
<script src="js/app.inbox.js?rfv=6.2"></script>
|
<script src="js/app.inbox.js?rfv=6.3"></script>
|
||||||
<script src="js/app.mailEdit.js?rfv=6.2"></script>
|
<script src="js/app.mailEdit.js?rfv=6.3"></script>
|
||||||
<script src="js/app.rfcaseEdit.js?rfv=6.2"></script>
|
<script src="js/app.rfcaseEdit.js?rfv=6.3"></script>
|
||||||
<script src="js/app.rfcases.js?rfv=6.2"></script>
|
<script src="js/app.rfcases.js?rfv=6.3"></script>
|
||||||
<script src="js/app.rfsettings.js?rfv=6.2"></script>
|
<script src="js/app.rfsettings.js?rfv=6.3"></script>
|
||||||
|
|
||||||
<!-- handlebars templates -->
|
<!-- handlebars templates -->
|
||||||
<script src="js/templates/templates.js?rfv=6.2"></script>
|
<script src="js/templates/templates.js?rfv=6.3"></script>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 2.1 MiB After Width: | Height: | Size: 2.7 MiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -7,154 +7,182 @@
|
|||||||
|
|
||||||
/*global $, app */
|
/*global $, app */
|
||||||
|
|
||||||
app.mailEdit = (function () {
|
app.mailEdit = (function() {
|
||||||
'use strict';
|
"use strict";
|
||||||
//---------------- BEGIN MODULE SCOPE VARIABLES --------------
|
//---------------- BEGIN MODULE SCOPE VARIABLES --------------
|
||||||
var
|
var stateMap = {},
|
||||||
stateMap = {},
|
onSend,
|
||||||
onSave, onDelete, onSend,
|
onSpam,
|
||||||
configModule, initModule;
|
configModule,
|
||||||
//----------------- END MODULE SCOPE VARIABLES ---------------
|
initModule;
|
||||||
|
//----------------- END MODULE SCOPE VARIABLES ---------------
|
||||||
|
|
||||||
|
//------------------- BEGIN EVENT HANDLERS -------------------
|
||||||
|
|
||||||
//------------------- BEGIN EVENT HANDLERS -------------------
|
///////////////////////////////////
|
||||||
|
// SEND A REPLY OR NEW MESSAGE
|
||||||
|
//
|
||||||
|
onSend = function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
///////////////////////////////////
|
$.gevent.publish("app-clear-error");
|
||||||
// SEND A REPLY OR NEW MESSAGE
|
|
||||||
//
|
|
||||||
onSend = function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
$.gevent.publish('app-clear-error');
|
//get form data
|
||||||
|
var formData = $("form").serializeArray({
|
||||||
|
checkboxesAsBools: true
|
||||||
|
});
|
||||||
|
|
||||||
//get form data
|
//var submitData = {composition:$("#composition").val()};
|
||||||
var formData = $("form").serializeArray({
|
var submitData = app.utilB.objectifyFormDataArray(formData);
|
||||||
checkboxesAsBools: true
|
|
||||||
});
|
|
||||||
|
|
||||||
//var submitData = {composition:$("#composition").val()};
|
//is this a new record?
|
||||||
var submitData = app.utilB.objectifyFormDataArray(formData);
|
if (stateMap.id != "new") {
|
||||||
|
//put id into the form data
|
||||||
|
// submitData.id = stateMap.id;
|
||||||
|
|
||||||
//is this a new record?
|
app.api.create(
|
||||||
if (stateMap.id != 'new') {
|
"mail/reply/" +
|
||||||
//put id into the form data
|
stateMap.context.params.mail_account +
|
||||||
// submitData.id = stateMap.id;
|
"/" +
|
||||||
|
stateMap.context.params.mail_id,
|
||||||
|
submitData,
|
||||||
|
function(res) {
|
||||||
|
if (res.error) {
|
||||||
|
$.gevent.publish("app-show-error", res.msg);
|
||||||
|
} else {
|
||||||
|
page("#!/inbox");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
alert("STUB: New message composition not implemented yet");
|
||||||
|
// //it's a new record - create
|
||||||
|
// app.api.create('customer', submitData, function (res) {
|
||||||
|
// if (res.error) {
|
||||||
|
// $.gevent.publish('app-show-error',res.msg);
|
||||||
|
// } else {
|
||||||
|
// page('#!/inbox');
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
app.api.create('mail/reply/' +
|
return false;
|
||||||
stateMap.context.params.mail_account +
|
};
|
||||||
'/' + stateMap.context.params.mail_id, submitData, function (res) {
|
|
||||||
if (res.error) {
|
///////////////////////////////////
|
||||||
$.gevent.publish('app-show-error', res.msg);
|
// SPAM HANDLER
|
||||||
} else {
|
//
|
||||||
page('#!/inbox');
|
onSpam = function(event) {
|
||||||
}
|
event.preventDefault();
|
||||||
});
|
|
||||||
|
$.gevent.publish("app-clear-error");
|
||||||
|
|
||||||
|
//is this a new record?
|
||||||
|
if (stateMap.id == "new") {
|
||||||
|
alert("New message spam handling makes no sense - figure it out!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
app.api.create(
|
||||||
|
"mail/isspam/" +
|
||||||
|
stateMap.context.params.mail_account +
|
||||||
|
"/" +
|
||||||
|
stateMap.context.params.mail_id,
|
||||||
|
null,
|
||||||
|
function(res) {
|
||||||
|
if (res.error) {
|
||||||
|
$.gevent.publish("app-show-error", res.msg);
|
||||||
} else {
|
} else {
|
||||||
alert("STUB: New message composition not implemented yet");
|
page("#!/inbox");
|
||||||
// //it's a new record - create
|
|
||||||
// app.api.create('customer', submitData, function (res) {
|
|
||||||
// if (res.error) {
|
|
||||||
// $.gevent.publish('app-show-error',res.msg);
|
|
||||||
// } else {
|
|
||||||
// page('#!/inbox');
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
return false;
|
//-------------------- END EVENT HANDLERS --------------------
|
||||||
};
|
|
||||||
|
|
||||||
//ONDELETE
|
//------------------- BEGIN PUBLIC METHODS -------------------
|
||||||
//
|
|
||||||
//removed
|
|
||||||
|
|
||||||
//-------------------- END EVENT HANDLERS --------------------
|
//CONFIGMODULE
|
||||||
|
//
|
||||||
|
configModule = function(context) {
|
||||||
|
stateMap.context = context.context;
|
||||||
|
if (stateMap.context.params.id) {
|
||||||
|
stateMap.id = stateMap.context.params.id;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//------------------- BEGIN PUBLIC METHODS -------------------
|
//INITMODULE
|
||||||
|
//
|
||||||
|
initModule = function($container) {
|
||||||
|
if (typeof $container === "undefined") {
|
||||||
|
$container = $("#app-shell-main-content");
|
||||||
|
}
|
||||||
|
|
||||||
|
$container.html(Handlebars.templates["app.mailEdit"]({}));
|
||||||
|
// stateMap.replyMode = false;
|
||||||
|
// if (stateMap.context.querystring.endsWith('reply')) {
|
||||||
|
// stateMap.replyMode = true;
|
||||||
|
// }
|
||||||
|
|
||||||
//CONFIGMODULE
|
app.nav.contextClear();
|
||||||
//
|
app.nav.contextAddLink("inbox/", "Inbox", "inbox");
|
||||||
configModule = function (context) {
|
|
||||||
stateMap.context = context.context;
|
//id should always have a value, either a record id or the keyword 'new' for making a new object
|
||||||
if (stateMap.context.params.id) {
|
if (stateMap.id != "new") {
|
||||||
stateMap.id = stateMap.context.params.id;
|
//fetch existing record
|
||||||
|
app.api.get(
|
||||||
|
"mail/preview/" +
|
||||||
|
stateMap.context.params.mail_account +
|
||||||
|
"/" +
|
||||||
|
stateMap.context.params.mail_folder +
|
||||||
|
"/" +
|
||||||
|
stateMap.context.params.mail_id,
|
||||||
|
function(res) {
|
||||||
|
if (res.error) {
|
||||||
|
// app.nav.contextClear();
|
||||||
|
// app.nav.contextAddLink("inbox/", "Inbox", "inbox");
|
||||||
|
$.gevent.publish("app-show-error", res.msg);
|
||||||
|
} else {
|
||||||
|
//fill out form
|
||||||
|
// app.nav.contextClear();
|
||||||
|
//app.nav.contextAddLink("inbox/", "Inbox", "inbox");
|
||||||
|
$("#message").text(res.preview);
|
||||||
|
if (res.isKeyRequest) {
|
||||||
|
app.nav.contextAddLink(
|
||||||
|
"licenseRequestEdit/" + res.id,
|
||||||
|
"Make",
|
||||||
|
"key"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$("#composition").text("\n\n- John\nwww.ayanova.com");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
);
|
||||||
|
|
||||||
//INITMODULE
|
$("#btn-send").bind("click", onSend);
|
||||||
//
|
|
||||||
initModule = function ($container) {
|
|
||||||
if (typeof $container === 'undefined') {
|
|
||||||
$container = $('#app-shell-main-content');
|
|
||||||
}
|
|
||||||
|
|
||||||
$container.html(Handlebars.templates['app.mailEdit']({}));
|
//Context menu
|
||||||
// stateMap.replyMode = false;
|
app.nav.contextAddButton("btn-generate", "IsSpam", "axe", onSpam);
|
||||||
// if (stateMap.context.querystring.endsWith('reply')) {
|
} else {
|
||||||
// stateMap.replyMode = true;
|
//NEW email options
|
||||||
// }
|
var $group = $("#sendToGroup");
|
||||||
|
$group.removeClass("invisible");
|
||||||
|
|
||||||
app.nav.contextClear();
|
// app.nav.contextClear();
|
||||||
app.nav.contextAddLink("inbox/", "Inbox", "inbox");
|
// app.nav.contextAddLink("inbox/", "Inbox", "inbox");
|
||||||
|
// app.nav.contextAddButton('btn-send', 'Send', 'send', onSend);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//id should always have a value, either a record id or the keyword 'new' for making a new object
|
// RETURN PUBLIC METHODS
|
||||||
if (stateMap.id != 'new') {
|
//
|
||||||
|
return {
|
||||||
//fetch existing record
|
configModule: configModule,
|
||||||
app.api.get(
|
initModule: initModule
|
||||||
'mail/preview/' +
|
};
|
||||||
stateMap.context.params.mail_account +
|
//------------------- END PUBLIC METHODS ---------------------
|
||||||
'/' + stateMap.context.params.mail_folder +
|
})();
|
||||||
'/' + stateMap.context.params.mail_id, function (res) {
|
|
||||||
if (res.error) {
|
|
||||||
// app.nav.contextClear();
|
|
||||||
// app.nav.contextAddLink("inbox/", "Inbox", "inbox");
|
|
||||||
$.gevent.publish('app-show-error', res.msg);
|
|
||||||
} else {
|
|
||||||
//fill out form
|
|
||||||
// app.nav.contextClear();
|
|
||||||
//app.nav.contextAddLink("inbox/", "Inbox", "inbox");
|
|
||||||
$('#message').text(res.preview);
|
|
||||||
if(res.isKeyRequest){
|
|
||||||
app.nav.contextAddLink("licenseRequestEdit/" + res.id, "Make", "key");
|
|
||||||
}else{
|
|
||||||
$('#composition').text("\n\n- John\nwww.ayanova.com");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#btn-send').bind('click', onSend);
|
|
||||||
|
|
||||||
//Context menu
|
|
||||||
|
|
||||||
//app.nav.contextAddButton('btn-send', 'Send reply', 'send', onSend);
|
|
||||||
|
|
||||||
// app.nav.contextAddButton('btn-generate', 'Build', 'key', onReply);
|
|
||||||
// app.nav.contextAddLink("customerSites/" + stateMap.id, "Sites", "city");//url title icon
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
//NEW email options
|
|
||||||
var $group = $("#sendToGroup");
|
|
||||||
$group.removeClass("invisible");
|
|
||||||
|
|
||||||
// app.nav.contextClear();
|
|
||||||
// app.nav.contextAddLink("inbox/", "Inbox", "inbox");
|
|
||||||
// app.nav.contextAddButton('btn-send', 'Send', 'send', onSend);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// RETURN PUBLIC METHODS
|
|
||||||
//
|
|
||||||
return {
|
|
||||||
configModule: configModule,
|
|
||||||
initModule: initModule
|
|
||||||
};
|
|
||||||
//------------------- END PUBLIC METHODS ---------------------
|
|
||||||
}());
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user