Javascripts localization implementation and html dist => src changes

pull/539/head
Alen BOHCELYAN 2017-02-13 18:05:49 +00:00 committed by Alen BOHCELYAN
parent f034d15aa2
commit 363ab116f4
12 changed files with 102 additions and 102 deletions

View File

@ -3,7 +3,7 @@ var doPoll = true;
// statuses is a helper map to point result statuses to ui classes // statuses is a helper map to point result statuses to ui classes
var statuses = { var statuses = {
"Email Sent": { "Email Sent"): {
slice: "ct-slice-donut-sent", slice: "ct-slice-donut-sent",
legend: "ct-legend-sent", legend: "ct-legend-sent",
label: "label-success", label: "label-success",
@ -84,12 +84,12 @@ function dismiss() {
// Deletes a campaign after prompting the user // Deletes a campaign after prompting the user
function deleteCampaign() { function deleteCampaign() {
swal({ swal({
title: "Are you sure?", title: T("Are you sure?"),
text: "This will delete the campaign. This can't be undone!", text: T("This will delete the campaign. This can't be undone!"),
type: "warning", type: "warning",
animation: false, animation: false,
showCancelButton: true, showCancelButton: true,
confirmButtonText: "Delete Campaign", confirmButtonText: T("Delete Campaign"),
confirmButtonColor: "#428bca", confirmButtonColor: "#428bca",
reverseButtons: true, reverseButtons: true,
allowOutsideClick: false, allowOutsideClick: false,
@ -106,8 +106,8 @@ function deleteCampaign() {
} }
}).then(function() { }).then(function() {
swal( swal(
'Campaign Deleted!', T('Campaign Deleted!'),
'This campaign has been deleted!', T('This campaign has been deleted!'),
'success' 'success'
); );
$('button:contains("OK")').on('click', function() { $('button:contains("OK")').on('click', function() {
@ -119,12 +119,12 @@ function deleteCampaign() {
// Completes a campaign after prompting the user // Completes a campaign after prompting the user
function completeCampaign() { function completeCampaign() {
swal({ swal({
title: "Are you sure?", title: T("Are you sure?"),
text: "Gophish will stop processing events for this campaign", text: T("Gophish will stop processing events for this campaign"),
type: "warning", type: "warning",
animation: false, animation: false,
showCancelButton: true, showCancelButton: true,
confirmButtonText: "Complete Campaign", confirmButtonText: T("Complete Campaign"),
confirmButtonColor: "#428bca", confirmButtonColor: "#428bca",
reverseButtons: true, reverseButtons: true,
allowOutsideClick: false, allowOutsideClick: false,
@ -141,12 +141,12 @@ function completeCampaign() {
} }
}).then(function() { }).then(function() {
swal( swal(
'Campaign Completed!', T('Campaign Completed!'),
'This campaign has been completed!', T('This campaign has been completed!'),
'success' 'success'
); );
$('#complete_button')[0].disabled = true; $('#complete_button')[0].disabled = true;
$('#complete_button').text('Completed!') $('#complete_button').text(T('Completed!'))
doPoll = false; doPoll = false;
}) })
} }
@ -209,17 +209,17 @@ function replay(event_idx) {
/* Ensure we know where to send the user */ /* Ensure we know where to send the user */
// Prompt for the URL // Prompt for the URL
swal({ swal({
title: 'Where do you want the credentials submitted to?', title: T('Where do you want the credentials submitted to?'),
input: 'text', input: 'text',
showCancelButton: true, showCancelButton: true,
inputPlaceholder: "http://example.com/login", inputPlaceholder: T("http://example.com/login"),
inputValue: url || "", inputValue: url || "",
inputValidator: function(value) { inputValidator: function(value) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
if (value) { if (value) {
resolve(); resolve();
} else { } else {
reject('Invalid URL.'); reject(T('Invalid URL.'));
} }
}); });
} }
@ -246,8 +246,8 @@ function renderTimeline(data) {
"position": data[5] "position": data[5]
} }
results = '<div class="timeline col-sm-12 well well-lg">' + results = '<div class="timeline col-sm-12 well well-lg">' +
'<h6>Timeline for ' + escapeHtml(record.first_name) + ' ' + escapeHtml(record.last_name) + '<h6>'+ T('Timeline for') + ' + escapeHtml(record.first_name) + ' ' + escapeHtml(record.last_name) +
'</h6><span class="subtitle">Email: ' + escapeHtml(record.email) + '</span>' + '</h6><span class="subtitle">' + T('Email') + ': ' + escapeHtml(record.email) + '</span>' +
'<div class="timeline-graph col-sm-6">' '<div class="timeline-graph col-sm-6">'
$.each(campaign.timeline, function(i, event) { $.each(campaign.timeline, function(i, event) {
if (!event.email || event.email == record.email) { if (!event.email || event.email == record.email) {
@ -257,19 +257,19 @@ function renderTimeline(data) {
results += results +=
' <div class="timeline-icon ' + statuses[event.message].label + '">' + ' <div class="timeline-icon ' + statuses[event.message].label + '">' +
' <i class="fa ' + statuses[event.message].icon + '"></i></div>' + ' <i class="fa ' + statuses[event.message].icon + '"></i></div>' +
' <div class="timeline-message">' + escapeHtml(event.message) + ' <div class="timeline-message">' + T(escapeHtml(event.message)) +
' <span class="timeline-date">' + moment(event.time).format('MMMM Do YYYY h:mm a') + '</span>' ' <span class="timeline-date">' + moment(event.time).format('MMMM Do YYYY h:mm a') + '</span>'
if (event.details) { if (event.details) {
if (event.message == "Submitted Data") { if (event.message == "Submitted Data") {
results += '<div class="timeline-replay-button"><button onclick="replay(' + i + ')" class="btn btn-success">' results += '<div class="timeline-replay-button"><button onclick="replay(' + i + ')" class="btn btn-success">'
results += '<i class="fa fa-refresh"></i> Replay Credentials</button></div>' results += '<i class="fa fa-refresh"></i> '+ T('Replay Credentials') + '</button></div>'
results += '<div class="timeline-event-details"><i class="fa fa-caret-right"></i> View Details</div>' results += '<div class="timeline-event-details"><i class="fa fa-caret-right"></i>' + T('View Details') + '</div>'
} }
details = JSON.parse(event.details) details = JSON.parse(event.details)
if (details.payload) { if (details.payload) {
results += '<div class="timeline-event-results">' results += '<div class="timeline-event-results">'
results += ' <table class="table table-condensed table-bordered table-striped">' results += ' <table class="table table-condensed table-bordered table-striped">'
results += ' <thead><tr><th>Parameter</th><th>Value(s)</tr></thead><tbody>' results += ' <thead><tr><th>' + T('Parameter') + '</th><th>' + T('Value(s)') + '</tr></thead><tbody>'
$.each(Object.keys(details.payload), function(i, param) { $.each(Object.keys(details.payload), function(i, param) {
if (param == "rid") { if (param == "rid") {
return true; return true;
@ -283,9 +283,9 @@ function renderTimeline(data) {
results += '</div>' results += '</div>'
} }
if (details.error) { if (details.error) {
results += '<div class="timeline-event-details"><i class="fa fa-caret-right"></i> View Details</div>' results += '<div class="timeline-event-details"><i class="fa fa-caret-right"></i> '+ T('View Details') + '</div>'
results += '<div class="timeline-event-results">' results += '<div class="timeline-event-results">'
results += '<span class="label label-default">Error</span> ' + details.error results += '<span class="label label-default">'+ T('Error') + '</span> ' + details.error
results += '</div>' results += '</div>'
} }
} }
@ -312,7 +312,7 @@ function poll() {
/* Update the timeline */ /* Update the timeline */
var timeline_data = { var timeline_data = {
series: [{ series: [{
name: "Events", name: T("Events"),
data: [] data: []
}] }]
} }
@ -345,7 +345,7 @@ function poll() {
meta: status, meta: status,
value: count value: count
}) })
$("#email_chart_legend").append('<li><span class="' + statuses[status].legend + '"></span>' + status + '</li>') $("#email_chart_legend").append('<li><span class="' + statuses[status].legend + '"></span>' + T(status) + '</li>')
}) })
var email_chart = $("#email_chart") var email_chart = $("#email_chart")
if (email_chart.get(0).__chartist__) { if (email_chart.get(0).__chartist__) {
@ -364,7 +364,7 @@ function poll() {
$.each(campaign.results, function(j, result) { $.each(campaign.results, function(j, result) {
if (result.id == rid) { if (result.id == rid) {
var label = statuses[result.status].label || "label-default"; var label = statuses[result.status].label || "label-default";
rowData[6] = "<span class=\"label " + label + "\">" + result.status + "</span>" rowData[6] = "<span class=\"label " + label + "\">" + T(result.status) + "</span>"
resultsTable.row(i).data(rowData).draw(false) resultsTable.row(i).data(rowData).draw(false)
if (row.child.isShown()) { if (row.child.isShown()) {
row.child(renderTimeline(row.data())) row.child(renderTimeline(row.data()))
@ -412,7 +412,7 @@ function load() {
$("#loading").hide() $("#loading").hide()
$("#campaignResults").show() $("#campaignResults").show()
// Set the title // Set the title
$("#page-title").text("Results for " + c.name) $("#page-title").text(T("Results for") + " " + c.name)
if (c.status == "Completed") { if (c.status == "Completed") {
$('#complete_button')[0].disabled = true; $('#complete_button')[0].disabled = true;
$('#complete_button').text('Completed!'); $('#complete_button').text('Completed!');
@ -437,7 +437,7 @@ function load() {
// Setup our graphs // Setup our graphs
var timeline_data = { var timeline_data = {
series: [{ series: [{
name: "Events", name: T("Events"),
data: [] data: []
}] }]
} }
@ -497,7 +497,7 @@ function load() {
escapeHtml(result.last_name) || "", escapeHtml(result.last_name) || "",
escapeHtml(result.email) || "", escapeHtml(result.email) || "",
escapeHtml(result.position) || "", escapeHtml(result.position) || "",
"<span class=\"label " + label + "\">" + result.status + "</span>" "<span class=\"label " + label + "\">" + T(result.status) + "</span>"
]).draw() ]).draw()
if (!email_series_data[result.status]) { if (!email_series_data[result.status]) {
email_series_data[result.status] = 1 email_series_data[result.status] = 1
@ -539,7 +539,7 @@ function load() {
meta: status, meta: status,
value: count value: count
}) })
$("#email_chart_legend").append('<li><span class="' + statuses[status].legend + '"></span>' + status + '</li>') $("#email_chart_legend").append('<li><span class="' + statuses[status].legend + '"></span>' + T(status) + '</li>')
}) })
var timeline_chart = new Chartist.Line('#timeline_chart', timeline_data, timeline_opts) var timeline_chart = new Chartist.Line('#timeline_chart', timeline_data, timeline_opts)
timeline_chart.on('draw', function(data) { timeline_chart.on('draw', function(data) {
@ -567,7 +567,7 @@ function load() {
cidx = $point.attr('meta') cidx = $point.attr('meta')
html = "Event: " + campaign.timeline[cidx].message html = "Event: " + campaign.timeline[cidx].message
if (campaign.timeline[cidx].email) { if (campaign.timeline[cidx].email) {
html += '<br>' + "Email: " + escapeHtml(campaign.timeline[cidx].email) html += '<br>' + T("Email:") + " " + escapeHtml(campaign.timeline[cidx].email)
} }
$toolTip.html(html).show() $toolTip.html(html).show()
}); });
@ -671,7 +671,7 @@ function load() {
}) })
.error(function() { .error(function() {
$("#loading").hide() $("#loading").hide()
errorFlash(" Campaign not found!") errorFlash(T("Campaign not found!"))
}) })
} }
$(document).ready(function() { $(document).ready(function() {

View File

@ -14,12 +14,12 @@ var campaign = {}
// Launch attempts to POST to /campaigns/ // Launch attempts to POST to /campaigns/
function launch() { function launch() {
swal({ swal({
title: "Are you sure?", title: T("Are you sure?"),
text: "This will schedule the campaign to be launched.", text: T("This will schedule the campaign to be launched."),
type: "question", type: "question",
animation: false, animation: false,
showCancelButton: true, showCancelButton: true,
confirmButtonText: "Launch", confirmButtonText: T("Launch"),
confirmButtonColor: "#428bca", confirmButtonColor: "#428bca",
reverseButtons: true, reverseButtons: true,
allowOutsideClick: false, allowOutsideClick: false,
@ -61,8 +61,8 @@ function launch() {
} }
}).then(function() { }).then(function() {
swal( swal(
'Campaign Scheduled!', T('Campaign Scheduled!'),
'This campaign has been scheduled for launch!', T('This campaign has been scheduled for launch!'),
'success' 'success'
); );
$('button:contains("OK")').on('click', function() { $('button:contains("OK")').on('click', function() {
@ -90,12 +90,12 @@ function sendTestEmail() {
} }
} }
btnHtml = $("#sendTestModalSubmit").html() btnHtml = $("#sendTestModalSubmit").html()
$("#sendTestModalSubmit").html('<i class="fa fa-spinner fa-spin"></i> Sending') $("#sendTestModalSubmit").html('<i class="fa fa-spinner fa-spin"></i> '+ T('Sending'))
// Send the test email // Send the test email
api.send_test_email(test_email_request) api.send_test_email(test_email_request)
.success(function(data) { .success(function(data) {
$("#sendTestEmailModal\\.flashes").empty().append("<div style=\"text-align:center\" class=\"alert alert-success\">\ $("#sendTestEmailModal\\.flashes").empty().append("<div style=\"text-align:center\" class=\"alert alert-success\">\
<i class=\"fa fa-check-circle\"></i> Email Sent!</div>") <i class=\"fa fa-check-circle\"></i> " + T('Email Sent!') + "</div>")
$("#sendTestModalSubmit").html(btnHtml) $("#sendTestModalSubmit").html(btnHtml)
}) })
.error(function(data) { .error(function(data) {
@ -118,12 +118,12 @@ function dismiss() {
function deleteCampaign(idx) { function deleteCampaign(idx) {
swal({ swal({
title: "Are you sure?", title: T("Are you sure?"),
text: "This will delete the campaign. This can't be undone!", text: T("This will delete the campaign. This can't be undone!"),
type: "warning", type: "warning",
animation: false, animation: false,
showCancelButton: true, showCancelButton: true,
confirmButtonText: "Delete " + campaigns[idx].name, confirmButtonText: T("Delete") + " " + campaigns[idx].name,
confirmButtonColor: "#428bca", confirmButtonColor: "#428bca",
reverseButtons: true, reverseButtons: true,
allowOutsideClick: false, allowOutsideClick: false,
@ -140,8 +140,8 @@ function deleteCampaign(idx) {
} }
}).then(function() { }).then(function() {
swal( swal(
'Campaign Deleted!', T('Campaign Deleted!'),
'This campaign has been deleted!', T('This campaign has been deleted!'),
'success' 'success'
); );
$('button:contains("OK")').on('click', function() { $('button:contains("OK")').on('click', function() {
@ -154,7 +154,7 @@ function setupOptions() {
api.groups.get() api.groups.get()
.success(function(groups) { .success(function(groups) {
if (groups.length == 0) { if (groups.length == 0) {
modalError("No groups found!") modalError(T("No groups found!"))
return false; return false;
} else { } else {
var group_s2 = $.map(groups, function(obj) { var group_s2 = $.map(groups, function(obj) {
@ -162,7 +162,7 @@ function setupOptions() {
return obj return obj
}); });
$("#users.form-control").select2({ $("#users.form-control").select2({
placeholder: "Select Groups", placeholder: T("Select Groups"),
data: group_s2, data: group_s2,
}); });
} }
@ -170,7 +170,7 @@ function setupOptions() {
api.templates.get() api.templates.get()
.success(function(templates) { .success(function(templates) {
if (templates.length == 0) { if (templates.length == 0) {
modalError("No templates found!") modalError(T("No templates found!"))
return false return false
} else { } else {
var template_s2 = $.map(templates, function(obj) { var template_s2 = $.map(templates, function(obj) {
@ -178,7 +178,7 @@ function setupOptions() {
return obj return obj
}); });
$("#template.form-control").select2({ $("#template.form-control").select2({
placeholder: "Select a Template", placeholder: T("Select a Template"),
data: template_s2, data: template_s2,
}); });
} }
@ -186,7 +186,7 @@ function setupOptions() {
api.pages.get() api.pages.get()
.success(function(pages) { .success(function(pages) {
if (pages.length == 0) { if (pages.length == 0) {
modalError("No pages found!") modalError(T("No pages found!"))
return false return false
} else { } else {
var page_s2 = $.map(pages, function(obj) { var page_s2 = $.map(pages, function(obj) {
@ -194,7 +194,7 @@ function setupOptions() {
return obj return obj
}); });
$("#page.form-control").select2({ $("#page.form-control").select2({
placeholder: "Select a Landing Page", placeholder: T("Select a Landing Page"),
data: page_s2, data: page_s2,
}); });
} }
@ -202,7 +202,7 @@ function setupOptions() {
api.SMTP.get() api.SMTP.get()
.success(function(profiles) { .success(function(profiles) {
if (profiles.length == 0) { if (profiles.length == 0) {
modalError("No profiles found!") modalError(T("No profiles found!"))
return false return false
} else { } else {
var profile_s2 = $.map(profiles, function(obj) { var profile_s2 = $.map(profiles, function(obj) {
@ -210,7 +210,7 @@ function setupOptions() {
return obj return obj
}); });
$("#profile.form-control").select2({ $("#profile.form-control").select2({
placeholder: "Select a Sending Profile", placeholder: T("Select a Sending Profile"),
data: profile_s2, data: profile_s2,
}); });
} }
@ -226,7 +226,7 @@ function copy(idx) {
// Set our initial values // Set our initial values
api.campaignId.get(campaigns[idx].id) api.campaignId.get(campaigns[idx].id)
.success(function(campaign) { .success(function(campaign) {
$("#name").val("Copy of " + campaign.name) $("#name").val(T("Copy of") + " " + campaign.name)
if (!campaign.template.id) { if (!campaign.template.id) {
$("#template").select2({ $("#template").select2({
placeholder: campaign.template.name placeholder: campaign.template.name
@ -314,14 +314,14 @@ $(document).ready(function() {
campaignTable.row.add([ campaignTable.row.add([
escapeHtml(campaign.name), escapeHtml(campaign.name),
moment(campaign.created_date).format('MMMM Do YYYY, h:mm:ss a'), moment(campaign.created_date).format('MMMM Do YYYY, h:mm:ss a'),
"<span class=\"label " + label + "\">" + campaign.status + "</span>", "<span class=\"label " + label + "\">" + T(campaign.status) + "</span>",
"<div class='pull-right'><a class='btn btn-primary' href='/campaigns/" + campaign.id + "' data-toggle='tooltip' data-placement='left' title='View Results'>\ "<div class='pull-right'><a class='btn btn-primary' href='/campaigns/" + campaign.id + "' data-toggle='tooltip' data-placement='left' title='" + T('View Results') + "'>\
<i class='fa fa-bar-chart'></i>\ <i class='fa fa-bar-chart'></i>\
</a>\ </a>\
<span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Copy Campaign' onclick='copy(" + i + ")'>\ <span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='" + T('Copy Campaign') + "' onclick='copy(" + i + ")'>\
<i class='fa fa-copy'></i>\ <i class='fa fa-copy'></i>\
</button></span>\ </button></span>\
<button class='btn btn-danger' onclick='deleteCampaign(" + i + ")' data-toggle='tooltip' data-placement='left' title='Delete Campaign'>\ <button class='btn btn-danger' onclick='deleteCampaign(" + i + ")' data-toggle='tooltip' data-placement='left' title='" + T('Delete Campaign') + "'>\
<i class='fa fa-trash-o'></i>\ <i class='fa fa-trash-o'></i>\
</button></div>" </button></div>"
]).draw() ]).draw()
@ -333,7 +333,7 @@ $(document).ready(function() {
}) })
.error(function() { .error(function() {
$("#loading").hide() $("#loading").hide()
errorFlash("Error fetching campaigns") errorFlash(T("Error fetching campaigns"))
}) })
// Select2 Defaults // Select2 Defaults
$.fn.select2.defaults.set("width", "100%"); $.fn.select2.defaults.set("width", "100%");

View File

@ -10,7 +10,7 @@ var labels = {
} }
function deleteCampaign(idx) { function deleteCampaign(idx) {
if (confirm(T("Delete ") + campaigns[idx].name + "?")) { if (confirm(T("Delete") + " " + campaigns[idx].name + "?")) {
api.campaignId.delete(campaigns[idx].id) api.campaignId.delete(campaigns[idx].id)
.success(function(data) { .success(function(data) {
successFlash(data.message) successFlash(data.message)
@ -90,11 +90,11 @@ $(document).ready(function() {
}) })
average = Math.floor(average / data.total); average = Math.floor(average / data.total);
average_data.series.push({ average_data.series.push({
meta: "Unsuccessful Phishes", meta: T("Unsuccessful Phishes"),
value: 100 - average value: 100 - average
}) })
average_data.series.push({ average_data.series.push({
meta: "Successful Phishes", meta: T("Successful Phishes"),
value: average value: average
}) })
// Build the charts // Build the charts
@ -135,7 +135,7 @@ $(document).ready(function() {
var $point = $(this) var $point = $(this)
value = $point.attr('ct:value') || 0 value = $point.attr('ct:value') || 0
cidx = $point.attr('ct:meta') cidx = $point.attr('ct:meta')
$toolTip.html(campaigns[cidx].name + '<br>' + "Successes: " + value.toString() + "%").show(); $toolTip.html(campaigns[cidx].name + '<br>' + T("Successes:" + " " + value.toString() + "%").show();
}); });
$chart.on('mouseleave', '.ct-point', function() { $chart.on('mouseleave', '.ct-point', function() {
@ -156,6 +156,6 @@ $(document).ready(function() {
} }
}) })
.error(function() { .error(function() {
errorFlash("Error fetching campaigns") errorFlash(T("Error fetching campaigns"))
}) })
}) })

View File

@ -18,7 +18,7 @@ function save(idx) {
page.id = pages[idx].id page.id = pages[idx].id
api.pageId.put(page) api.pageId.put(page)
.success(function(data) { .success(function(data) {
successFlash("Page edited successfully!") successFlash(T("Page edited successfully!"))
load() load()
dismiss() dismiss()
}) })
@ -26,7 +26,7 @@ function save(idx) {
// Submit the page // Submit the page
api.pages.post(page) api.pages.post(page)
.success(function(data) { .success(function(data) {
successFlash("Page added successfully!") successFlash(T("Page added successfully!"))
load() load()
dismiss() dismiss()
}) })
@ -49,7 +49,7 @@ function dismiss() {
} }
function deletePage(idx) { function deletePage(idx) {
if (confirm("Delete " + pages[idx].name + "?")) { if (confirm(T("Delete") + " " + pages[idx].name + "?")) {
api.pageId.delete(pages[idx].id) api.pageId.delete(pages[idx].id)
.success(function(data) { .success(function(data) {
successFlash(data.message) successFlash(data.message)
@ -61,7 +61,7 @@ function deletePage(idx) {
function importSite() { function importSite() {
url = $("#url").val() url = $("#url").val()
if (!url) { if (!url) {
modalError("No URL Specified!") modalError(T("No URL Specified!"))
} else { } else {
api.clone_site({ api.clone_site({
url: url, url: url,
@ -104,7 +104,7 @@ function copy(idx) {
}) })
$("#html_editor").ckeditor() $("#html_editor").ckeditor()
var page = pages[idx] var page = pages[idx]
$("#name").val("Copy of " + page.name) $("#name").val(T("Copy of") + " " + page.name)
$("#html_editor").val(page.html) $("#html_editor").val(page.html)
} }
@ -133,13 +133,13 @@ function load() {
pagesTable.row.add([ pagesTable.row.add([
escapeHtml(page.name), escapeHtml(page.name),
moment(page.modified_date).format('MMMM Do YYYY, h:mm:ss a'), moment(page.modified_date).format('MMMM Do YYYY, h:mm:ss a'),
"<div class='pull-right'><span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Edit Page' onclick='edit(" + i + ")'>\ "<div class='pull-right'><span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='" + T("Edit Page") + "' onclick='edit(" + i + ")'>\
<i class='fa fa-pencil'></i>\ <i class='fa fa-pencil'></i>\
</button></span>\ </button></span>\
<span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Copy Page' onclick='copy(" + i + ")'>\ <span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='" + T("Copy Page") + "' onclick='copy(" + i + ")'>\
<i class='fa fa-copy'></i>\ <i class='fa fa-copy'></i>\
</button></span>\ </button></span>\
<button class='btn btn-danger' data-toggle='tooltip' data-placement='left' title='Delete Page' onclick='deletePage(" + i + ")'>\ <button class='btn btn-danger' data-toggle='tooltip' data-placement='left' title='" + T("Delete Page") + "' onclick='deletePage(" + i + ")'>\
<i class='fa fa-trash-o'></i>\ <i class='fa fa-trash-o'></i>\
</button></div>" </button></div>"
]).draw() ]).draw()
@ -151,7 +151,7 @@ function load() {
}) })
.error(function() { .error(function() {
$("#loading").hide() $("#loading").hide()
errorFlash("Error fetching pages") errorFlash(T("Error fetching pages"))
}) })
} }

View File

@ -18,12 +18,12 @@ function sendTestEmail() {
} }
} }
btnHtml = $("#sendTestModalSubmit").html() btnHtml = $("#sendTestModalSubmit").html()
$("#sendTestModalSubmit").html('<i class="fa fa-spinner fa-spin"></i> Sending') $("#sendTestModalSubmit").html('<i class="fa fa-spinner fa-spin"></i> ' + T('Sending'))
// Send the test email // Send the test email
api.send_test_email(test_email_request) api.send_test_email(test_email_request)
.success(function(data) { .success(function(data) {
$("#sendTestEmailModal\\.flashes").empty().append("<div style=\"text-align:center\" class=\"alert alert-success\">\ $("#sendTestEmailModal\\.flashes").empty().append("<div style=\"text-align:center\" class=\"alert alert-success\">\
<i class=\"fa fa-check-circle\"></i> Email Sent!</div>") <i class=\"fa fa-check-circle\"></i> " + T("Email Sent!") + "</div>")
$("#sendTestModalSubmit").html(btnHtml) $("#sendTestModalSubmit").html(btnHtml)
}) })
.error(function(data) { .error(function(data) {
@ -47,7 +47,7 @@ function save(idx) {
profile.id = profiles[idx].id profile.id = profiles[idx].id
api.SMTPId.put(profile) api.SMTPId.put(profile)
.success(function(data) { .success(function(data) {
successFlash("Profile edited successfully!") successFlash(T("Profile edited successfully!"))
load() load()
dismiss() dismiss()
}) })
@ -58,7 +58,7 @@ function save(idx) {
// Submit the profile // Submit the profile
api.SMTP.post(profile) api.SMTP.post(profile)
.success(function(data) { .success(function(data) {
successFlash("Profile added successfully!") successFlash(T("Profile added successfully!"))
load() load()
dismiss() dismiss()
}) })
@ -81,7 +81,7 @@ function dismiss() {
} }
function deleteProfile(idx) { function deleteProfile(idx) {
if (confirm("Delete " + profiles[idx].name + "?")) { if (confirm(T("Delete") + " " + profiles[idx].name + "?")) {
api.SMTPId.delete(profiles[idx].id) api.SMTPId.delete(profiles[idx].id)
.success(function(data) { .success(function(data) {
successFlash(data.message) successFlash(data.message)
@ -113,7 +113,7 @@ function copy(idx) {
}) })
var profile = {} var profile = {}
profile = profiles[idx] profile = profiles[idx]
$("#name").val("Copy of " + profile.name) $("#name").val(T("Copy of") + " " + profile.name)
$("#interface_type").val(profile.interface_type) $("#interface_type").val(profile.interface_type)
$("#from").val(profile.from_address) $("#from").val(profile.from_address)
$("#host").val(profile.host) $("#host").val(profile.host)
@ -145,13 +145,13 @@ function load() {
escapeHtml(profile.name), escapeHtml(profile.name),
profile.interface_type, profile.interface_type,
moment(profile.modified_date).format('MMMM Do YYYY, h:mm:ss a'), moment(profile.modified_date).format('MMMM Do YYYY, h:mm:ss a'),
"<div class='pull-right'><span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Edit Profile' onclick='edit(" + i + ")'>\ "<div class='pull-right'><span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='" + T("Edit Profile") + "' onclick='edit(" + i + ")'>\
<i class='fa fa-pencil'></i>\ <i class='fa fa-pencil'></i>\
</button></span>\ </button></span>\
<span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Copy Profile' onclick='copy(" + i + ")'>\ <span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='" + T("Copy Profile") + "' onclick='copy(" + i + ")'>\
<i class='fa fa-copy'></i>\ <i class='fa fa-copy'></i>\
</button></span>\ </button></span>\
<button class='btn btn-danger' data-toggle='tooltip' data-placement='left' title='Delete Profile' onclick='deleteProfile(" + i + ")'>\ <button class='btn btn-danger' data-toggle='tooltip' data-placement='left' title='" + T("Delete Profile") + "' onclick='deleteProfile(" + i + ")'>\
<i class='fa fa-trash-o'></i>\ <i class='fa fa-trash-o'></i>\
</button></div>" </button></div>"
]).draw() ]).draw()
@ -163,7 +163,7 @@ function load() {
}) })
.error(function() { .error(function() {
$("#loading").hide() $("#loading").hide()
errorFlash("Error fetching profiles") errorFlash(T("Error fetching profiles"))
}) })
} }

View File

@ -46,7 +46,7 @@ function save(idx) {
template.id = templates[idx].id template.id = templates[idx].id
api.templateId.put(template) api.templateId.put(template)
.success(function(data) { .success(function(data) {
successFlash("Template edited successfully!") successFlash(T("Template edited successfully!"))
load() load()
dismiss() dismiss()
}) })
@ -57,7 +57,7 @@ function save(idx) {
// Submit the template // Submit the template
api.templates.post(template) api.templates.post(template)
.success(function(data) { .success(function(data) {
successFlash("Template added successfully!") successFlash(T("Template added successfully!"))
load() load()
dismiss() dismiss()
}) })
@ -78,7 +78,7 @@ function dismiss() {
} }
function deleteTemplate(idx) { function deleteTemplate(idx) {
if (confirm("Delete " + templates[idx].name + "?")) { if (confirm(T("Delete") + " " + templates[idx].name + "?")) {
api.templateId.delete(templates[idx].id) api.templateId.delete(templates[idx].id)
.success(function(data) { .success(function(data) {
successFlash(data.message) successFlash(data.message)
@ -204,7 +204,7 @@ function copy(idx) {
attachments: [] attachments: []
} }
template = templates[idx] template = templates[idx]
$("#name").val("Copy of " + template.name) $("#name").val(T("Copy of") + " " + template.name)
$("#subject").val(template.subject) $("#subject").val(template.subject)
$("#html_editor").val(template.html) $("#html_editor").val(template.html)
$("#text_editor").val(template.text) $("#text_editor").val(template.text)
@ -236,7 +236,7 @@ function importEmail() {
raw = $("#email_content").val() raw = $("#email_content").val()
convert_links = $("#convert_links_checkbox").prop("checked") convert_links = $("#convert_links_checkbox").prop("checked")
if (!raw) { if (!raw) {
modalError("No Content Specified!") modalError(T("No Content Specified!"))
} else { } else {
$.ajax({ $.ajax({
method: "POST", method: "POST",
@ -282,13 +282,13 @@ function load() {
templateTable.row.add([ templateTable.row.add([
escapeHtml(template.name), escapeHtml(template.name),
moment(template.modified_date).format('MMMM Do YYYY, h:mm:ss a'), moment(template.modified_date).format('MMMM Do YYYY, h:mm:ss a'),
"<div class='pull-right'><span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Edit Template' onclick='edit(" + i + ")'>\ "<div class='pull-right'><span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='" + T("Edit Template") + "' onclick='edit(" + i + ")'>\
<i class='fa fa-pencil'></i>\ <i class='fa fa-pencil'></i>\
</button></span>\ </button></span>\
<span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Copy Template' onclick='copy(" + i + ")'>\ <span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='" + T("Copy Template") + "' onclick='copy(" + i + ")'>\
<i class='fa fa-copy'></i>\ <i class='fa fa-copy'></i>\
</button></span>\ </button></span>\
<button class='btn btn-danger' data-toggle='tooltip' data-placement='left' title='Delete Template' onclick='deleteTemplate(" + i + ")'>\ <button class='btn btn-danger' data-toggle='tooltip' data-placement='left' title='" + T("Delete Template") + "' onclick='deleteTemplate(" + i + ")'>\
<i class='fa fa-trash-o'></i>\ <i class='fa fa-trash-o'></i>\
</button></div>" </button></div>"
]).draw() ]).draw()
@ -300,7 +300,7 @@ function load() {
}) })
.error(function() { .error(function() {
$("#loading").hide() $("#loading").hide()
errorFlash("Error fetching templates") errorFlash(T("Error fetching templates"))
}) })
} }

View File

@ -22,7 +22,7 @@ function save(id) {
group.id = id group.id = id
api.groupId.put(group) api.groupId.put(group)
.success(function(data) { .success(function(data) {
successFlash("Group updated successfully!") successFlash(T("Group updated successfully!"))
load() load()
dismiss() dismiss()
$("#modal").modal('hide') $("#modal").modal('hide')
@ -35,7 +35,7 @@ function save(id) {
// to /groups // to /groups
api.groups.post(group) api.groups.post(group)
.success(function(data) { .success(function(data) {
successFlash("Group added successfully!") successFlash(T("Group added successfully!"))
load() load()
dismiss() dismiss()
$("#modal").modal('hide') $("#modal").modal('hide')
@ -82,7 +82,7 @@ function edit(id) {
}) })
.error(function() { .error(function() {
errorFlash("Error fetching group") errorFlash(T("Error fetching group"))
}) })
} }
// Handle file uploads // Handle file uploads
@ -93,7 +93,7 @@ function edit(id) {
var acceptFileTypes = /(csv|txt)$/i; var acceptFileTypes = /(csv|txt)$/i;
var filename = data.originalFiles[0]['name'] var filename = data.originalFiles[0]['name']
if (filename && !acceptFileTypes.test(filename.split(".").pop())) { if (filename && !acceptFileTypes.test(filename.split(".").pop())) {
modalError("Unsupported file extension (use .csv or .txt)") modalError(T("Unsupported file extension (use .csv or .txt)"))
return false; return false;
} }
data.submit(); data.submit();
@ -117,7 +117,7 @@ function deleteGroup(id) {
console.log('wat'); console.log('wat');
return return
} }
if (confirm("Delete " + group.name + "?")) { if (confirm(T("Delete") + " " + group.name + "?")) {
api.groupId.delete(id) api.groupId.delete(id)
.success(function(data) { .success(function(data) {
successFlash(data.message) successFlash(data.message)
@ -194,7 +194,7 @@ function load() {
} }
}) })
.error(function() { .error(function() {
errorFlash("Error fetching groups") errorFlash(T("Error fetching groups"))
}) })
} }

View File

@ -159,5 +159,5 @@
"Campaign not found!": "{{T "Campaign not found!"}}", "Campaign not found!": "{{T "Campaign not found!"}}",
} }
</script> </script>
<script src="/js/dist/app/campaign_results.min.js"></script> <script src="/js/src/app/campaign_results.js"></script>
{{end}} {{end}}

View File

@ -175,5 +175,5 @@
"Error fetching campaigns": "{{T "Error fetching campaigns"}}" "Error fetching campaigns": "{{T "Error fetching campaigns"}}"
} }
</script> </script>
<script src="/js/dist/app/campaigns.min.js"></script> <script src="/js/src/app/campaigns.js"></script>
{{end}} {{end}}

View File

@ -99,5 +99,5 @@
"Error fetching campaigns": "{{T "Error fetching campaigns"}}" "Error fetching campaigns": "{{T "Error fetching campaigns"}}"
} }
</script> </script>
<script src="/js/dist/app/dashboard.min.js"></script> <script src="/js/src/app/dashboard.js"></script>
{{end}} {{end}}

View File

@ -149,5 +149,5 @@
</script> </script>
<script src="/js/ckeditor/ckeditor.js"></script> <script src="/js/ckeditor/ckeditor.js"></script>
<script src="/js/ckeditor/adapters/jquery.js"></script> <script src="/js/ckeditor/adapters/jquery.js"></script>
<script src="/js/dist/app/sending_profiles.min.js"></script> <script src="/js/src/app/sending_profiles.js"></script>
{{end}} {{end}}

View File

@ -168,5 +168,5 @@
</script> </script>
<script src="/js/src/vendor/ckeditor/ckeditor.js"></script> <script src="/js/src/vendor/ckeditor/ckeditor.js"></script>
<script src="/js/src/vendor/ckeditor/adapters/jquery.js"></script> <script src="/js/src/vendor/ckeditor/adapters/jquery.js"></script>
<script src="/js/dist/app/templates.min.js"></script> <script src="/js/src/app/templates.js"></script>
{{end}} {{end}}