This commit is contained in:
184
wwwroot/js/app.ravLicense.js
Normal file
184
wwwroot/js/app.ravLicense.js
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
/*
|
||||||
|
* app.license.js
|
||||||
|
* License key generator
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*jslint browser : true, continue : true,
|
||||||
|
devel : true, indent : 2, maxerr : 50,
|
||||||
|
newcap : true, nomen : true, plusplus : true,
|
||||||
|
regexp : true, sloppy : true, vars : false,
|
||||||
|
white : true
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*global $, app */
|
||||||
|
|
||||||
|
app.ravLicense = (function () {
|
||||||
|
'use strict';
|
||||||
|
//---------------- BEGIN MODULE SCOPE VARIABLES --------------
|
||||||
|
var
|
||||||
|
|
||||||
|
stateMap = {},
|
||||||
|
configModule, initModule, onGenerate, onSelectAllAddOns;
|
||||||
|
//----------------- END MODULE SCOPE VARIABLES ---------------
|
||||||
|
|
||||||
|
//------------------- BEGIN UTILITY METHODS ------------------
|
||||||
|
//-------------------- END UTILITY METHODS -------------------
|
||||||
|
/*
|
||||||
|
public class dtoRavLicense
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
public string RegisteredTo { get; set; }
|
||||||
|
[Required]
|
||||||
|
public Guid DbId { get; set; }
|
||||||
|
[Required]
|
||||||
|
public long LicenseExpiration { get; set; }
|
||||||
|
[Required]
|
||||||
|
public long MaintenanceExpiration { get; set; }
|
||||||
|
[Required]
|
||||||
|
public List<dtoLicenseFeature> Features { get; set; }
|
||||||
|
[Required]
|
||||||
|
public long SiteId { get; set; }
|
||||||
|
}
|
||||||
|
public class dtoLicenseFeature
|
||||||
|
{
|
||||||
|
dtoLicenseFeature()
|
||||||
|
{
|
||||||
|
Count = 0;
|
||||||
|
}
|
||||||
|
//name of feature / product
|
||||||
|
public string Feature { get; set; }
|
||||||
|
//Optional count for items that require it
|
||||||
|
public long Count { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
//------------------- BEGIN EVENT HANDLERS -------------------
|
||||||
|
onGenerate = function (event) {
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
$.gevent.publish('app-clear-error');
|
||||||
|
//get form data
|
||||||
|
var formData = $("form").serializeArray({
|
||||||
|
checkboxesAsBools: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var submitData = app.utilB.objectifyFormDataArray(formData);
|
||||||
|
|
||||||
|
app.api.createRavLicense(submitData, function (res) {
|
||||||
|
if (res.error) {
|
||||||
|
$.gevent.publish('app-show-error', res.msg);
|
||||||
|
} else {
|
||||||
|
$('#key').val(res);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return false; //prevent default
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
onSelectAllAddOns = function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
$('#wbi').prop('checked', true);
|
||||||
|
$('#mbi').prop('checked', true);
|
||||||
|
$('#ri').prop('checked', true);
|
||||||
|
$('#qbi').prop('checked', true);
|
||||||
|
$('#qboi').prop('checked', true);
|
||||||
|
$('#pti').prop('checked', true);
|
||||||
|
$('#quickNotification').prop('checked', true);
|
||||||
|
$('#exportToXls').prop('checked', true);
|
||||||
|
$('#outlookSchedule').prop('checked', true);
|
||||||
|
$('#oli').prop('checked', true);
|
||||||
|
$('#importExportCSVDuplicate').prop('checked', true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return false; //prevent default
|
||||||
|
};
|
||||||
|
|
||||||
|
// onTemplates = function(event) {
|
||||||
|
// event.preventDefault();
|
||||||
|
// alert("STUB: templates");
|
||||||
|
|
||||||
|
|
||||||
|
// return false; //prevent default
|
||||||
|
// };
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------- END EVENT HANDLERS --------------------
|
||||||
|
|
||||||
|
//------------------- BEGIN PUBLIC METHODS -------------------
|
||||||
|
//CONFIGMODULE
|
||||||
|
//
|
||||||
|
configModule = function (context) {
|
||||||
|
stateMap.context = context.context;
|
||||||
|
if (stateMap.context.params.id) {
|
||||||
|
stateMap.id = stateMap.context.params.id;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//INITMODULE
|
||||||
|
//
|
||||||
|
initModule = function ($container) {
|
||||||
|
if (typeof $container === 'undefined') {
|
||||||
|
$container = $('#app-shell-main-content');
|
||||||
|
}
|
||||||
|
$container.html(Handlebars.templates['app.ravLicense']({}));
|
||||||
|
|
||||||
|
|
||||||
|
//case 3233 customer list
|
||||||
|
//Fill customer list combo
|
||||||
|
var customerList = {};
|
||||||
|
|
||||||
|
|
||||||
|
//get customers
|
||||||
|
app.api.get('customer/list', function (res) {
|
||||||
|
if (res.error) {
|
||||||
|
$.gevent.publish('app-show-error', res.msg);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
var html = '<option value="0"><TRIAL></option>';
|
||||||
|
|
||||||
|
for (var i = 0, len = res.length; i < len; ++i) {
|
||||||
|
html += ('<option value="' + res[i]['id'] + '">' + res[i]['name'] + '</option>');
|
||||||
|
customerList[res[i]['id']] = res[i]['name'];
|
||||||
|
}
|
||||||
|
$('#customerId').append(html);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//Context menu
|
||||||
|
app.nav.contextClear();
|
||||||
|
|
||||||
|
////app.nav.setContextTitle("License");
|
||||||
|
|
||||||
|
//make context menu
|
||||||
|
|
||||||
|
|
||||||
|
//Context menu
|
||||||
|
app.nav.contextClear();
|
||||||
|
app.nav.contextAddButton('btn-generate', 'Make', 'key', onGenerate);
|
||||||
|
app.nav.contextAddButton('btn-select-all-addons', 'All', 'check-all', onSelectAllAddOns);
|
||||||
|
// app.nav.contextAddLink("licenseRequests/", "Requests", "voice");
|
||||||
|
app.nav.contextAddLink("licenseTemplates/", "", "layers");
|
||||||
|
//case 3233
|
||||||
|
app.nav.contextAddLink("licenses/", "List", "");
|
||||||
|
|
||||||
|
|
||||||
|
//set all date inputs to today plus one year
|
||||||
|
var oneYearFromNow = moment().add(1, 'years').toISOString().substring(0, 10);
|
||||||
|
var oneMonthFromNow = moment().add(1, 'months').toISOString().substring(0, 10);
|
||||||
|
$('input[type="date"]').val(oneYearFromNow);
|
||||||
|
$('#lockoutDate').val(oneMonthFromNow);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// return public methods
|
||||||
|
return {
|
||||||
|
configModule: configModule,
|
||||||
|
initModule: initModule
|
||||||
|
};
|
||||||
|
//------------------- END PUBLIC METHODS ---------------------
|
||||||
|
}());
|
||||||
183
wwwroot/js/templates/app.ravLicense.handlebars
Normal file
183
wwwroot/js/templates/app.ravLicense.handlebars
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
<div>
|
||||||
|
<form id="frm" method="post" action="index.html">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-check">
|
||||||
|
<label class="form-check-label" for="keyWillLockout">
|
||||||
|
<input class="form-check-input" type="checkbox" name="keyWillLockout" id="keyWillLockout"> Expiring test key</label>
|
||||||
|
</div>
|
||||||
|
<input class="form-control" type="date" id="lockoutDate" name="lockoutDate" value="">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-check">
|
||||||
|
<label class="form-check-label" for="isLite">
|
||||||
|
<input class="form-check-input" type="checkbox" name="isLite" id="isLite"> AyaNova LITE</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="licenseType">License type</label>
|
||||||
|
<select class="form-control" name="licenseType">
|
||||||
|
<option value="new">New</option>
|
||||||
|
<option value="addon">Renewal / Add-on</option>
|
||||||
|
<option value="licensedTrial">Licensed trial</option>
|
||||||
|
<option value="webRequestedTrial">Web requested trial</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="registeredTo">Registered to</label>
|
||||||
|
<input class="form-control" type="text" id="registeredTo" name="registeredTo" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="customerId">Customer</label>
|
||||||
|
<select class="form-control" id="customerId" name="customerId" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="emailAddress">Email address</label>
|
||||||
|
<input class="form-control" type="text" id="emailAddress" name="emailAddress" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="users">Users</label>
|
||||||
|
<select class="form-control" name="users">
|
||||||
|
<option value="1">1</option>
|
||||||
|
<option value="5">5</option>
|
||||||
|
<option value="10">10</option>
|
||||||
|
<option value="15">15</option>
|
||||||
|
<option value="20">20</option>
|
||||||
|
<option value="50">50</option>
|
||||||
|
<option value="999">999</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="supportExpiresDate">Support expires</label>
|
||||||
|
<input class="form-control" type="date" id="supportExpiresDate" name="supportExpiresDate" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-check">
|
||||||
|
<label class="form-check-label" for="wbi">
|
||||||
|
<input class="form-check-input" type="checkbox" name="wbi" id="wbi"> WBI
|
||||||
|
</label>
|
||||||
|
<input class="form-control" type="date" id="wbiSupportExpiresDate" name="wbiSupportExpiresDate" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-check">
|
||||||
|
<label class="form-check-label" for="mbi">
|
||||||
|
<input class="form-check-input" type="checkbox" name="mbi" id="mbi"> MBI
|
||||||
|
</label>
|
||||||
|
<input class="form-control" type="date" id="mbiSupportExpiresDate" name="mbiSupportExpiresDate" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-check">
|
||||||
|
<label class="form-check-label" for="ri">
|
||||||
|
<input class="form-check-input" type="checkbox" name="ri" id="ri"> RI
|
||||||
|
</label>
|
||||||
|
<input class="form-control" type="date" id="riSupportExpiresDate" name="riSupportExpiresDate" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-check">
|
||||||
|
<label class="form-check-label" for="qbi">
|
||||||
|
<input class="form-check-input" type="checkbox" name="qbi" id="qbi"> QBI
|
||||||
|
</label>
|
||||||
|
<input class="form-control" type="date" id="qbiSupportExpiresDate" name="qbiSupportExpiresDate" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-check">
|
||||||
|
<label class="form-check-label" for="qboi">
|
||||||
|
<input class="form-check-input" type="checkbox" name="qboi" id="qboi"> QBOI
|
||||||
|
</label>
|
||||||
|
<input class="form-control" type="date" id="qboiSupportExpiresDate" name="qboiSupportExpiresDate" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-check">
|
||||||
|
<label class="form-check-label" for="pti">
|
||||||
|
<input class="form-check-input" type="checkbox" name="pti" id="pti"> PTI
|
||||||
|
</label>
|
||||||
|
<input class="form-control" type="date" id="ptiSupportExpiresDate" name="ptiSupportExpiresDate" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-check">
|
||||||
|
<label class="form-check-label" for="quickNotification">
|
||||||
|
<input class="form-check-input" type="checkbox" name="quickNotification" id="quickNotification"> Quick notification</label>
|
||||||
|
<input class="form-control" type="date" id="quickNotificationSupportExpiresDate" name="quickNotificationSupportExpiresDate"
|
||||||
|
value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-check">
|
||||||
|
<label class="form-check-label" for="exportToXls">
|
||||||
|
<input class="form-check-input" type="checkbox" name="exportToXls" id="exportToXls"> Export to XLS</label>
|
||||||
|
<input class="form-control" type="date" id="exportToXlsSupportExpiresDate" name="exportToXlsSupportExpiresDate" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-check">
|
||||||
|
<label class="form-check-label" for="outlookSchedule">
|
||||||
|
<input class="form-check-input" type="checkbox" name="outlookSchedule" id="outlookSchedule"> Outlook Schedule</label>
|
||||||
|
<input class="form-control" type="date" id="outlookScheduleSupportExpiresDate" name="outlookScheduleSupportExpiresDate" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-check">
|
||||||
|
<label class="form-check-label" for="oli">
|
||||||
|
<input class="form-check-input" type="checkbox" name="oli" id="oli"> OLI
|
||||||
|
</label>
|
||||||
|
<input class="form-control" type="date" id="oliSupportExpiresDate" name="oliSupportExpiresDate" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-check">
|
||||||
|
<label class="form-check-label" for="importExportCSVDuplicate">
|
||||||
|
<input class="form-check-input" type="checkbox" name="importExportCSVDuplicate" id="importExportCSVDuplicate"> Import / export CSV duplicate</label>
|
||||||
|
<input class="form-control" type="date" id="importExportCSVDuplicateSupportExpiresDate" name="importExportCSVDuplicateSupportExpiresDate"
|
||||||
|
value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="key">Key</label>
|
||||||
|
<textarea class="form-control" id="key" name="key" rows="10" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="app-frm-buttons">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user