Initial project's source code check-in.
This commit is contained in:
commit
b03b0b373f
4573 changed files with 981205 additions and 0 deletions
|
@ -0,0 +1,185 @@
|
|||
var _taskId = null;
|
||||
var _showProgressDialog = false;
|
||||
var _showCurrentStep = false;
|
||||
var _showProgressBar = false;
|
||||
var _showDialogButtons = false;
|
||||
var _dialogTitle = "";
|
||||
var _popupBehavior = null;
|
||||
|
||||
var updateTimerHandler = 0;
|
||||
var checkCompletedTasksHandler = 0;
|
||||
var tStart = null;
|
||||
var timerStopped = true;
|
||||
|
||||
function UpdateProgressTimer() {
|
||||
if(!timerStopped)
|
||||
{
|
||||
var tDate = new Date();
|
||||
var tDiff = tDate.getTime() - tStart.getTime();
|
||||
tDate.setTime(tDiff);
|
||||
|
||||
$get("progressDuration").innerHTML = PadNumber(Math.floor(tDiff / (1000 * 60 * 60))) + ":" + PadNumber(tDate.getMinutes()) + ":"
|
||||
+ PadNumber(tDate.getSeconds());
|
||||
updateTimerHandler = window.setTimeout(UpdateProgressTimer, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
function StartProgressTimer() {
|
||||
timerStopped = false;
|
||||
tStart = new Date();
|
||||
$get("progressDuration").innerHTML = "00:00:00";
|
||||
updateTimerHandler = window.setTimeout(UpdateProgressTimer, 1000);
|
||||
}
|
||||
|
||||
function StopTimer()
|
||||
{
|
||||
timerStopped = true;
|
||||
}
|
||||
|
||||
function PadNumber(num)
|
||||
{
|
||||
return (num.toString().length == 1) ? "0" + num : num;
|
||||
}
|
||||
|
||||
function EnableProgressDialog() {
|
||||
_showProgressDialog = true;
|
||||
window.setInterval(DisableProgressDialog, 10); // disable dialog with some delay
|
||||
}
|
||||
|
||||
function DisableProgressDialog() {
|
||||
_showProgressDialog = false;
|
||||
}
|
||||
|
||||
function ShowProgressDialog(title, popupBehavior)
|
||||
{
|
||||
_dialogTitle = title;
|
||||
_popupBehavior = popupBehavior;
|
||||
EnableProgressDialog();
|
||||
}
|
||||
|
||||
function ShowProgressDialogWithCallback(title)
|
||||
{
|
||||
_dialogTitle = title;
|
||||
_showCurrentStep = true;
|
||||
_showProgressBar = true;
|
||||
EnableProgressDialog();
|
||||
}
|
||||
|
||||
function ShowProgressDialogAsync(taskId, title)
|
||||
{
|
||||
_dialogTitle = title;
|
||||
_taskId = taskId;
|
||||
_showCurrentStep = true;
|
||||
_showProgressBar = true;
|
||||
_showDialogButtons = true;
|
||||
EnableProgressDialog();
|
||||
}
|
||||
|
||||
function ShowProgressDialogInternal()
|
||||
{
|
||||
if(_showProgressDialog) {
|
||||
|
||||
// close popup behavior
|
||||
if (_popupBehavior != null) {
|
||||
var popupCtrl = $find(_popupBehavior);
|
||||
if (popupCtrl != null)
|
||||
popupCtrl.hide();
|
||||
}
|
||||
|
||||
_showProgressDialog = false; // reset field
|
||||
|
||||
// set task id
|
||||
if(_taskId == null)
|
||||
{
|
||||
// get from control
|
||||
_taskId = $get(_ctrlTaskID).value;
|
||||
}
|
||||
|
||||
// set dialog title
|
||||
$get("objProgressDialogTitle").innerHTML = _dialogTitle;
|
||||
|
||||
$get("ProgressPanelArea").style.display = _showCurrentStep ? "block" : "none";
|
||||
|
||||
// buttons
|
||||
$get("objProgressDialogCommandButtons").style.display = _showDialogButtons ? "block" : "none";
|
||||
$get("PopupFormFooter").style.display = _showDialogButtons ? "block" : "none";
|
||||
|
||||
// update timer handlers
|
||||
if(updateTimerHandler)
|
||||
{
|
||||
window.clearTimeout(updateTimerHandler);
|
||||
updateTimerHandler = 0;
|
||||
}
|
||||
|
||||
// reload progress image
|
||||
$find('ModalPopupProperties').show();
|
||||
|
||||
$get("progressStartTime").innerHTML = new Date().toLocaleTimeString();
|
||||
StartProgressTimer();
|
||||
|
||||
var initialTimeout = _showDialogButtons ? 100 /* async */ : 1000 /* sync */;
|
||||
|
||||
window.setTimeout(ReloadProgressImage, 100);
|
||||
|
||||
if(_showCurrentStep)
|
||||
window.setTimeout(GetTaskProgress, initialTimeout);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function ReloadProgressImage()
|
||||
{
|
||||
$get("imgAjaxIndicator").src = $get("imgAjaxIndicator").src;
|
||||
}
|
||||
|
||||
function GetTaskProgress()
|
||||
{
|
||||
requestSimpleService = WebsitePanel.Portal.TaskManager.GetTask(
|
||||
_taskId, //params
|
||||
OnGetTaskProgressComplete, //Complete event
|
||||
OnGetTaskProgressTimeout //Timeout event
|
||||
);
|
||||
}
|
||||
|
||||
function OnGetTaskProgressComplete(task)
|
||||
{
|
||||
if(task.LastLogRecord != null)
|
||||
{
|
||||
$get('objProgressDialogStep').innerHTML = task.LastLogRecord.Text;
|
||||
}
|
||||
|
||||
// set progress indicator
|
||||
if(task.IndicatorMaximum > 0)
|
||||
$get("objProgressDialogProgressBar").style.width = task.IndicatorCurrent / task.IndicatorMaximum * 100 + "%";
|
||||
|
||||
if(task.Completed)
|
||||
{
|
||||
// switch buttons
|
||||
$get("objProgressDialogCommandButtons").style.display = "none";
|
||||
$get("objProgressDialogCloseButton").style.display = "block";
|
||||
|
||||
// stop timer
|
||||
StopTimer();
|
||||
|
||||
// hide image indicator
|
||||
$get("imgAjaxIndicator").style.display = "none";
|
||||
|
||||
// show success message
|
||||
$get('objProgressDialogStep').innerHTML = _completeMessage;
|
||||
}
|
||||
else
|
||||
{
|
||||
$find('ModalPopupProperties')._layout();
|
||||
//alert(result);
|
||||
window.setTimeout(GetTaskProgress, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
function OnGetTaskProgressTimeout(result)
|
||||
{
|
||||
alert("Timed out");
|
||||
}
|
||||
|
||||
function OnCancelProgressDialog()
|
||||
{
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
|
||||
|
||||
function makearray(n) {
|
||||
this.length = n;
|
||||
for (var i = 1; i <= n; i++) this[i] = 0;
|
||||
return this;}
|
||||
|
||||
|
||||
var asciitable = new makearray (85);
|
||||
asciitable.length=85;
|
||||
for (var i=0;i<=85;i++) asciitable[i]=" ";
|
||||
//special Characters group
|
||||
asciitable[0]="!"; asciitable[1]=";";
|
||||
asciitable[2]="#"; asciitable[3]="$";
|
||||
asciitable[4]="%"; asciitable[5]="&";
|
||||
asciitable[6]="'"; asciitable[7]="(";
|
||||
asciitable[8]=")"; asciitable[9]="*";
|
||||
asciitable[10]="+"; asciitable[11]=",";
|
||||
asciitable[12]="-"; asciitable[13]=".";
|
||||
asciitable[14]="/"; asciitable[15]="[";
|
||||
asciitable[16]="]"; asciitable[17]="^";
|
||||
asciitable[18]="_"; asciitable[19]="`";
|
||||
asciitable[20]=":"; asciitable[21]="?";
|
||||
asciitable[22]="@";
|
||||
// numbers group
|
||||
asciitable[23]="0"; asciitable[24]="1";
|
||||
asciitable[25]="2"; asciitable[26]="3";
|
||||
asciitable[27]="4"; asciitable[28]="5";
|
||||
asciitable[29]="6"; asciitable[30]="7";
|
||||
asciitable[31]="8"; asciitable[32]="9";
|
||||
// uppercase Chars
|
||||
asciitable[33]="A"; asciitable[34]="B";
|
||||
asciitable[35]="C"; asciitable[36]="D";
|
||||
asciitable[37]="E"; asciitable[38]="F";
|
||||
asciitable[39]="G"; asciitable[40]="H";
|
||||
asciitable[41]="I"; asciitable[42]="J";
|
||||
asciitable[43]="K"; asciitable[44]="L";
|
||||
asciitable[45]="M"; asciitable[46]="N";
|
||||
asciitable[47]="O"; asciitable[48]="P";
|
||||
asciitable[49]="Q"; asciitable[50]="R";
|
||||
asciitable[51]="S"; asciitable[52]="T";
|
||||
asciitable[53]="U"; asciitable[54]="V";
|
||||
asciitable[55]="W"; asciitable[56]="X";
|
||||
asciitable[57]="Y"; asciitable[58]="Z";
|
||||
// lower case Chars
|
||||
asciitable[59]="a"; asciitable[60]="b";
|
||||
asciitable[61]="c"; asciitable[62]="d";
|
||||
asciitable[63]="e"; asciitable[64]="f";
|
||||
asciitable[65]="g"; asciitable[66]="h";
|
||||
asciitable[67]="i"; asciitable[68]="j";
|
||||
asciitable[69]="k"; asciitable[70]="l";
|
||||
asciitable[71]="m"; asciitable[72]="n";
|
||||
asciitable[73]="o"; asciitable[74]="p";
|
||||
asciitable[75]="q"; asciitable[76]="r";
|
||||
asciitable[77]="s"; asciitable[78]="t";
|
||||
asciitable[79]="u"; asciitable[80]="v";
|
||||
asciitable[81]="w"; asciitable[82]="x";
|
||||
asciitable[83]="y"; asciitable[84]="z";
|
||||
|
||||
function nchar(num) {
|
||||
if ((num>=0) && (num<=84)) return asciitable[num];
|
||||
}
|
||||
|
||||
|
||||
function getRandomChars(_charsRange, _length, _target) {
|
||||
var _arr = [];
|
||||
var l1 = _charsRange[0];
|
||||
var rest = _charsRange[1] - _charsRange[0];
|
||||
//
|
||||
while (_arr.length < _length) {
|
||||
var charCode = Math.floor(Math.random() * rest);
|
||||
//
|
||||
var symbol = nchar(charCode + l1);
|
||||
// adds symbol only if it's unique
|
||||
if (_arr.toString().indexOf(symbol) == -1)
|
||||
_arr[_arr.length] = symbol;
|
||||
}
|
||||
//
|
||||
for (var i = 0; i < _length; i++)
|
||||
_target[_target.length] = _arr[i];
|
||||
}
|
||||
|
||||
function mixCharArray(_arr) {
|
||||
var _str = "";
|
||||
//
|
||||
while (_arr.length > 0){
|
||||
// get random element
|
||||
var index = Math.floor(Math.random() * (_arr.length - 1));
|
||||
// add element
|
||||
_str += _arr[index];
|
||||
// remove element from array
|
||||
var _tmp = [];
|
||||
for (var i = 0; i < _arr.length; i++) {
|
||||
if (i != index)
|
||||
_tmp[_tmp.length] = _arr[i];
|
||||
}
|
||||
_arr = _tmp;
|
||||
}
|
||||
//
|
||||
return _str;
|
||||
}
|
||||
|
||||
function GeneratePassword(_maxLength, _Upper, _Number, _Special, txt1, txt2)
|
||||
{
|
||||
if (_maxLength == 0)
|
||||
{
|
||||
alert("Your password length is set to 0. Please check your WebsitePanel Policy");
|
||||
_Upper = 0;
|
||||
_Number = 0;
|
||||
_Special = 0;
|
||||
}
|
||||
var pass = "";
|
||||
var pas_chars = [];
|
||||
var _Lower = _maxLength - _Upper - _Number - _Special;
|
||||
getRandomChars([0, 22], _Special, pas_chars);
|
||||
getRandomChars([23, 32], _Number, pas_chars);
|
||||
getRandomChars([33, 58], _Upper, pas_chars);
|
||||
getRandomChars([59, 84], _Lower, pas_chars);
|
||||
|
||||
pass = mixCharArray(pas_chars);
|
||||
|
||||
document.getElementById(txt1).value = pass;
|
||||
document.getElementById(txt2).value = pass;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue