Created
April 19, 2022 10:36
-
-
Save HanSalka/54d6e5e8fde8dd7a52e18aa5b960e560 to your computer and use it in GitHub Desktop.
gridWithStateFeature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('../lib/system/core.php'); | |
require_once('lib/system/Master.php'); | |
if (!$g_Permissions->PKTracks()) | |
header("Location: /SyriansoftWebSiteV2/logoff.php"); | |
include_once("config.php"); | |
include(PHPGRID_LIBPATH . "inc/jqgrid_dist.php"); | |
global $g_Principal; | |
$lang = GetLanguage(); | |
$langQueryParam = $_GET['lang']; | |
if (!empty($langQueryParam)) { | |
$lang = $langQueryParam; | |
SaveLanguage($lang); | |
} | |
$Action; | |
$masterStyle = ""; | |
$userNameHtml = ""; | |
$currentURL = urlencode($_SERVER['REQUEST_URI']); | |
$pageTitle = LoadIEString('PKTRACKS'); | |
$pageTitleLogo = Path::MapThemeNeutralImageLocal('login64.png'); | |
$refreshDataIcon = Path::MapThemeNeutralImageLocal('refresh.png'); | |
$deleteBtnLabel = LoadString('DELETE'); | |
$newBtnLabel = LoadString('NEW'); | |
$editBtnLabel = LoadString('EDIT'); | |
$activateBtnLabel = LoadString('ACTIVATE'); | |
$deactivateBtnLabel = LoadString('DEACTIVATE'); | |
$cancelBtnLabel = LoadString('CANCEL'); | |
$okBtnLabel = LoadString("OK"); | |
$activateConfirmMsg = LoadString('ACTIVATE_CONFIRM_MSG,Activate selected record?'); | |
$activateSingleRowErrorMsg = LoadString('ACTIVATE_SINGLEROW_ERRMSG,Please select single record to activate.'); | |
$activateNoRowErrorMsg = LoadString('ACTIVATE_NOROW_ERRMSG,Please select a record to activate.'); | |
$deactivateConfirmMsg = LoadString('DEACTIVATE_CONFIRM_MSG,Deactivate selected record?'); | |
$deactivateSingleRowErrorMsg = LoadString('DEACTIVATE_SINGLEROW_ERRMSG,Please select single record to deactivate.'); | |
$deactivateNoRowErrorMsg = LoadString('DEACTIVATE_NOROW_ERRMSG,Please select a record to deactivate.'); | |
$editSingleRowErrorMsg = LoadString('EDIT_SINGLEROW_ERRMSG,Please select single record to edit.'); | |
$editNoRowErrorMsg = LoadString('EDIT_NOROW_ERRMSG,Please select a record to edit.'); | |
$deleteConfirmMsg = LoadString('DELETE_CONFIRM_MSG,Delete selected record(s)?'); | |
$deleteNoRowErrorMsg = LoadString('DELETE_NOROW_ERRMSG,Please select record(s) to delete.'); | |
$unexportedKeyLabel = LoadString('UNEXPORTED_PKS'); | |
$newKeyLabel = LoadString('NEW_KEYS'); | |
$ipKeyConflict = LoadString('IPC_CONF'); | |
$ipkeyTrackConflictByCountry = LoadString('PKT_CONF'); | |
$exportKeyLabel = LoadString('EXPORT_TRACKS'); | |
$sqlCmd = ""; | |
$timeIntervalSecond = LoadString('DP_SECOND,second'); | |
$timeIntervalMinute = LoadString('DP_MINUTE,min'); | |
$timeIntervalHour = LoadString('DP_HOUR,hr'); | |
$timeIntervalDay = LoadString('DP_DAY,day'); | |
$timeIntervalWeek = LoadString('DP_WEEK,wk'); | |
$timeIntervalMonth = LoadString('DP_MONTH,mon'); | |
$timeIntervalYear = LoadString('DP_YEAR,year'); | |
$sqlCmdTemplate = 'SELECT CASE WHEN TIMESTAMPDIFF(SECOND,PK.CreatedOn,UTC_TIMESTAMP()) BETWEEN 0 AND 60 THEN CONCAT(TIMESTAMPDIFF(SECOND,PK.CreatedOn,UTC_TIMESTAMP()), " {S}") WHEN TIMESTAMPDIFF(minute,PK.CreatedOn,UTC_TIMESTAMP()) BETWEEN 0 AND 60 THEN CONCAT(TIMESTAMPDIFF(minute,PK.CreatedOn,UTC_TIMESTAMP()), " {min}") WHEN TIMESTAMPDIFF(HOUR,PK.CreatedOn,UTC_TIMESTAMP()) BETWEEN 0 AND 23 THEN CONCAT(TIMESTAMPDIFF(HOUR,PK.CreatedOn,UTC_TIMESTAMP())," {H}") WHEN TIMESTAMPDIFF(DAY,PK.CreatedOn,UTC_TIMESTAMP()) BETWEEN 0 AND 7 THEN CONCAT(TIMESTAMPDIFF(DAY,PK.CreatedOn,UTC_TIMESTAMP())," {D}") WHEN TIMESTAMPDIFF(WEEK,PK.CreatedOn,UTC_TIMESTAMP()) BETWEEN 0 AND 8 THEN CONCAT(TIMESTAMPDIFF(WEEK,PK.CreatedOn,UTC_TIMESTAMP())," {W}") WHEN TIMESTAMPDIFF(MONTH,PK.CreatedOn,UTC_TIMESTAMP()) BETWEEN 0 AND 12 THEN CONCAT(TIMESTAMPDIFF(MONTH,PK.CreatedOn,UTC_TIMESTAMP())," {M}") WHEN TIMESTAMPDIFF(YEAR,PK.CreatedOn,UTC_TIMESTAMP()) BETWEEN 0 AND 4 THEN CONCAT(TIMESTAMPDIFF(YEAR,PK.CreatedOn,UTC_TIMESTAMP())," {Y}") ELSE DATE_FORMAT(PK.CreatedOn,"%Y-%m-%d %H:%i:%S") END AS CreateOnFormat, CASE WHEN TIMESTAMPDIFF(SECOND,PK.UpdatedOn,UTC_TIMESTAMP()) BETWEEN 0 AND 60 THEN CONCAT(TIMESTAMPDIFF(SECOND,PK.UpdatedOn,UTC_TIMESTAMP()), " {S}") WHEN TIMESTAMPDIFF(minute,PK.UpdatedOn,UTC_TIMESTAMP()) BETWEEN 0 AND 60 THEN CONCAT(TIMESTAMPDIFF(minute,PK.UpdatedOn,UTC_TIMESTAMP()), " {min}") WHEN TIMESTAMPDIFF(HOUR,PK.UpdatedOn,UTC_TIMESTAMP()) BETWEEN 0 AND 23 THEN CONCAT(TIMESTAMPDIFF(HOUR,PK.UpdatedOn,UTC_TIMESTAMP())," {H}") WHEN TIMESTAMPDIFF(DAY,PK.UpdatedOn,UTC_TIMESTAMP()) BETWEEN 0 AND 7 THEN CONCAT(TIMESTAMPDIFF(DAY,PK.UpdatedOn,UTC_TIMESTAMP())," {D}") WHEN TIMESTAMPDIFF(WEEK,PK.UpdatedOn,UTC_TIMESTAMP()) BETWEEN 0 AND 8 THEN CONCAT(TIMESTAMPDIFF(WEEK,PK.UpdatedOn,UTC_TIMESTAMP())," {W}") WHEN TIMESTAMPDIFF(MONTH,PK.UpdatedOn,UTC_TIMESTAMP()) BETWEEN 0 AND 12 THEN CONCAT(TIMESTAMPDIFF(MONTH,PK.UpdatedOn,UTC_TIMESTAMP())," {M}") WHEN TIMESTAMPDIFF(YEAR,PK.UpdatedOn,UTC_TIMESTAMP()) BETWEEN 0 AND 4 THEN CONCAT(TIMESTAMPDIFF(YEAR,PK.UpdatedOn,UTC_TIMESTAMP())," {Y}") ELSE DATE_FORMAT(PK.CreatedOn,"%Y-%m-%d %H:%i:%S") END AS UpdatedOnFormat, DATE_FORMAT(PK.CreatedOn,"%H:%i:%S %Y-%m-%d") AS CreatedOnRTL, DATE_FORMAT(PK.UpdatedOn,"%H:%i:%S %Y-%m-%d") AS UpdatedOnRTL , PK.* FROM VActionsPK AS PK'; | |
$sqlCmd = str_replace("{S}", $timeIntervalSecond, $sqlCmdTemplate); | |
$sqlCmd = str_replace("{min}", $timeIntervalMinute, $sqlCmd); | |
$sqlCmd = str_replace("{H}", $timeIntervalHour, $sqlCmd); | |
$sqlCmd = str_replace("{D}", $timeIntervalDay, $sqlCmd); | |
$sqlCmd = str_replace("{W}", $timeIntervalWeek, $sqlCmd); | |
$sqlCmd = str_replace("{M}", $timeIntervalMonth, $sqlCmd); | |
$sqlCmd = str_replace("{Y}", $timeIntervalYear, $sqlCmd); | |
$floatClass = "align-self-start"; | |
$db_conf = array( | |
"type" => PHPGRID_DBTYPE, | |
"server" => PHPGRID_DBHOST, | |
"user" => PHPGRID_DBUSER, | |
"password" => PHPGRID_DBPASS, | |
"database" => PHPGRID_DBNAME | |
); | |
if (!empty($lang) && $lang == 'ar') { | |
$confirmDlgIconStyle = "float:right;margin:5px;"; | |
$logoIconStyle = "float:right;margin:5px;"; | |
$userNameLogoutStyle = "float:left;margin:5px;"; | |
$htmlDirection = sprintf("dir=\"rtl\" lang=\"%s\"", $lang); | |
$floatClass = "align-self-start"; | |
$masterStyle = '<link type="text/css" rel="stylesheet" href="../themes/default/css/rtl/Master.css">'; | |
$alameenLogoImgPath = Path::MapNeutralImageLocal('alameensoft-ar.svg'); | |
} else { | |
$confirmDlgIconStyle = "float:left;margin:5px;"; | |
$logoIconStyle = "float:left;margin:5px;"; | |
$userNameLogoutStyle = "float:right;margin:5px;"; | |
$htmlDirection = sprintf("dir=\"ltr\" lang=\"%s\"", $lang); | |
$floatClass = "align-self-end"; | |
$masterStyle = '<link type="text/css" rel="stylesheet" href="../themes/default/css/ltr/Master.css">'; | |
$alameenLogoImgPath = Path::MapNeutralImageLocal('alameensoft-en.svg'); | |
} | |
if ($g_Principal && !$g_Principal->IsGuest && $g_Principal->UserId && $g_Principal->UserId > 0) { | |
$langQuery = ''; | |
if (!empty($lang)) | |
$langQuery = '?lang=' . $lang; | |
$userNameHtml = sprintf( | |
'<span>%s</span><span class="Separator"></span> | |
<img src="%s" alt="" /> | |
<span><a href="/SyriansoftWebSiteV2/LogOff.php%s">%s</a></span>', | |
ToUserName($g_Principal->UserId), | |
Path::MapThemeNeutralImageLocal('logoff16.png'), | |
$langQuery, | |
LoadIEString('LOG_OFF') | |
); | |
} | |
$g = new jqgrid($db_conf); | |
$newProtectionKeyDialogTitle = LoadString('PKACTIONS,Protection Keys Actions'); | |
$actionKeyTitleLabel = LoadIEString('TITLE'); | |
$actionKeyTitleValue = ""; | |
$actionKeyTitleReqMsg = LoadString('VMSG_R_ATITLE,Action Title is required'); | |
$relationTypeLabel = "Action Key"; | |
$relationTypeValue = "Protection Key"; | |
$externalNoLabel = LoadIEString('kEY_EXTERNAL_NO,Key Number'); | |
$externalNoValue = ""; | |
$externalNoReqMsg = LoadString('VMSG_R_KEYNUM,Key Number is required'); | |
$internalNoLabel = LoadIEString('kEY_INTERNAL_NO'); | |
$internalNoValue = "0"; | |
$internalNoReqMsg = ""; | |
$actionTypeLabel = LoadIEString('ACT_TYPE,Action Type'); | |
$actionTypeLookupValue = $g->get_dropdown_values('SELECT Name as k, Name as v FROM ActionsTemplate WHERE ActiveFlag=1'); | |
$actionTypeReqMsg = ""; | |
$sentTimesNumberLabel = LoadIEString('TIMES_SENT,Number of times sent'); | |
$sentTimesNumberValue = "0"; | |
$actionTemplateAddLabel = "Add Actions to your template"; | |
$descriptionLabel = LoadString('DESCRIPTION'); | |
$descriptionValue = ""; | |
$grid["caption"] = LoadString('PKACTIONS,Protection Keys Actions'); | |
//$grid["loadComplete"] = "function(){ addButton(); }"; | |
// export PDF file params | |
$grid["export"] = array("filename" => "ProtectionKey", "heading" => "Protection Key List", "orientation" => "landscape", "paper" => "a4"); | |
// for excel, sheet header | |
$grid["export"]["sheetname"] = "ProtectionKey"; | |
// export filtered data or all data | |
$grid["export"]["range"] = "all"; // "filtered"; // or "all" | |
$g->set_options($grid); | |
//$g->table = "actionspk"; | |
$g->select_command = $sqlCmd; | |
//'SELECT PK.*,date_format(PK.CreatedOn,"%H:%i:%S %Y-%m-%d") AS CreatedOnRTL,date_format(PK.UpdatedOn,"%H:%i:%S %Y-%m-%d") AS UpdatedOnRTL FROM VActionsPK AS PK'; | |
$col = array(); | |
$col["title"] = LoadString('ID'); // caption of column, can use HTML tags too | |
$col["name"] = "Id"; // grid column name, same as db field or alias from sql | |
$col["formatter"] = "function(cellval,options,rowdata){ return '<a class=\"phpgrid\" href=\"javascript: loadExistingProtectionKey('+rowdata['Id']+')\">'+cellval+'</a>'; }"; | |
//$col["width"] = "50"; // width on grid | |
$col["editable"] = false; | |
$cols[] = $col; | |
$col = array(); | |
$col["title"] = LoadString('TYPE'); // caption of column, can use HTML tags too | |
$col["name"] = "Type"; // grid column name, same as db field or alias from sql | |
$col["stype"] = "select"; | |
// blank row, then all db values - ; is record separator, : is key-value separator | |
$col["searchoptions"] = array( | |
"value" => '1:Protection Key;2:Product Version;3:Computer Id;4:API' | |
); | |
//$col["width"] = "120"; // width on grid | |
//$col["formatter"] = "image"; | |
//$col["formatoptions"] = array("src"=>'../images/keys16.png'); | |
$col["formatter"] = "function(cellval,options,rowdata){ | |
if(rowdata['Type'] == 1) | |
{ | |
return '<img src=\"../themes/default/images/keys16.png\" alt=\"Protection Key\" /><span> Protection Key</span>'; | |
} | |
else if(rowdata['Type'] == 2) | |
{ | |
return '<img src=\"../themes/default/images/product16.png\" alt=\"Product Version\" /><span> Product Version</span>'; | |
}else if(rowdata['Type'] == 3) | |
{ | |
return '<img src=\"../themes/default/images/security16.png\" alt=\"Computer Id\" /><span> Computer Id</span>'; | |
} | |
else return '<img src=\"../themes/default/images/category16.png\" alt=\"API\"/>'; }"; | |
$col["editable"] = false; | |
$col["align"] = "center"; | |
$cols[] = $col; | |
$col = array(); | |
$col["title"] = LoadString('kEY_EXTERNAL_NO'); // caption of column, can use HTML tags too | |
$col["name"] = "Key"; // grid column name, same as db field or alias from sql | |
//$col["width"] = "110"; // width on grid | |
$col["editable"] = false; | |
$col["align"] = "right"; | |
$cols[] = $col; | |
$col = array(); | |
$col["title"] = LoadString('kEY_INTERNAL_NO'); // caption of column, can use HTML tags too | |
$col["name"] = "Key2"; // grid column name, same as db field or alias from sql | |
//$col["width"] = "110"; // width on grid | |
$col["editable"] = false; | |
$col["align"] = "right"; | |
$cols[] = $col; | |
$col = array(); | |
$col["formatter"] = "function(cellval,options,rowdata){ return '<a class=\"phpgrid\" href=\"javascript: loadExistingProtectionKey('+rowdata['Id']+')\">'+cellval+'</a>'; }"; | |
//$col["formatter"]="";//<a href="javascript: onEditClick(34327);">لم تتفرغ 2004</a> | |
$col["title"] = LoadString('TITLE'); // caption of column, can use HTML tags too | |
$col["name"] = "Title"; // grid column name, same as db field or alias from sql | |
$col["width"] = "300"; // width on grid | |
$col["editable"] = false; | |
$cols[] = $col; | |
$col = array(); | |
$col["stype"] = "select"; | |
$col["searchoptions"] = array( | |
"value" => 'Message:Message;WriteKey:WriteKey;BlockKey:BlockKey;IllegalCopy:IllegalCopy;DrvPackage1:DrvPackage1;UpdateAction:UpdateAction' | |
); | |
$col["title"] = LoadString('ACTION_NAME,Action Name'); // caption of column, can use HTML tags too | |
$col["name"] = "ActionName"; // grid column name, same as db field or alias from sql | |
//$col["width"] = "100"; // width on grid | |
$col["editable"] = false; | |
$cols[] = $col; | |
$col = array(); | |
$col["title"] = LoadString('SENT_TIMES,Number of times sent'); // caption of column, can use HTML tags too | |
$col["name"] = "Sent"; // grid column name, same as db field or alias from sql | |
//$col["width"] = "130"; // width on grid | |
$col["editable"] = false; | |
$col["formatter"] = "number"; | |
$col["formatoptions"] = array( | |
"thousandsSeparator" => ",", | |
"decimalSeparator" => ".", | |
"decimalPlaces" => 0 | |
); | |
$col["align"] = "right"; | |
$cols[] = $col; | |
$col = array(); | |
$col["formatter"] = "function(cellval,options,rowdata) | |
{ | |
if(rowdata['Active'] == 2) | |
return '<img src=\"../themes/default/images/enabled16.png\" />'; | |
else return '<img src=\"../themes/default/images/disabled16.png\" />' | |
}"; | |
$col["stype"] = "select"; | |
$col["searchoptions"] = array( | |
"value" => '1:Not Active;2:Active' | |
); | |
$col["search"] = true; | |
$col["title"] = LoadString('Active'); // caption of column, can use HTML tags too | |
$col["name"] = "Active"; // grid column name, same as db field or alias from sql | |
$col["width"] = "50"; // width on grid | |
$col["editable"] = false; | |
$col["align"] = "center"; | |
$cols[] = $col; | |
$col = array(); | |
//$col["formatter"] = "function(cellval,options,rowdata){ return '<a href=\"javascript: onEditClick('+rowdata['Id']+')\">'+cellval+'</a>'; }"; | |
//$col["formatter"]="";//<a href="javascript: onEditClick(34327);">لم تتفرغ 2004</a> | |
$col["title"] = $descriptionLabel; // caption of column, can use HTML tags too | |
$col["name"] = "Description"; // grid column name, same as db field or alias from sql | |
//$col["width"] = "300"; // width on grid | |
$col["editable"] = false; | |
$cols[] = $col; | |
$col = array(); | |
$col["title"] = LoadString('CREATEDON'); // caption of column, can use HTML tags too | |
//$col["name"] = "CreatedOnRTL"; // grid column name, same as db field or alias from sql | |
//$col["width"] = "50"; // width on grid | |
$col["editable"] = false; | |
$col["name"] = "CreatedOn"; // grid column name, same as db field or alias from sql | |
//$col["width"] = "50"; // width on grid | |
$col["editable"] = false; | |
if (!empty($lang) && $lang == 'ar') | |
$col["formatter"] = "function(cellvalue, options, rowObject){ return '<div title=\"'+rowObject.CreatedOnRTL+'\">'+rowObject.CreateOnFormat+'</div>'; }"; | |
else | |
$col["formatter"] = "function(cellvalue, options, rowObject){ return '<div title=\"'+rowObject.CreatedOn+'\">'+rowObject.CreateOnFormat+'</div>'; }"; | |
$cols[] = $col; | |
# fetch data from database, with alias k for key, v for value | |
$createdby_lookup = $g->get_dropdown_values("SELECT concat(CU.FirstName, ' ', CU.LastName) as k,concat(CU.FirstName, ' ', CU.LastName) as v FROM VActionsPK as pk LEFT JOIN Users AS CU ON (pk.CreatedById = CU.Id) group by pk.CreatedById"); | |
$col = array(); | |
$col["stype"] = "select"; | |
// blank row, then all db values - ; is record separator, : is key-value separator | |
$col["searchoptions"] = array("value" => $createdby_lookup); | |
$col["title"] = LoadString('CREATEDBY'); // caption of column, can use HTML tags too | |
$col["name"] = "CreatedBy"; // grid column name, same as db field or alias from sql | |
//$col["width"] = "50"; // width on grid | |
$col["editable"] = false; | |
$cols[] = $col; | |
$updatedby_lookup = $g->get_dropdown_values("SELECT concat(UU.FirstName, ' ', UU.LastName) as k,concat(UU.FirstName, ' ', UU.LastName) as v FROM VActionsPK as pk LEFT JOIN Users AS UU ON (pk.UpdatedById = UU.Id) group by pk.UpdatedById"); | |
$col = array(); | |
$col["title"] = LoadString('UPDATEDON'); // caption of column, can use HTML tags too | |
$col["name"] = "UpdatedOn"; // grid column name, same as db field or alias from sql | |
//$col["width"] = "50"; // width on grid | |
$col["editable"] = false; | |
if (!empty($lang) && $lang == 'ar') | |
$col["formatter"] = "function(cellvalue, options, rowObject){ return '<div title=\"'+rowObject.UpdatedOnRTL+'\">'+rowObject.UpdatedOnFormat+'</div>'; }"; | |
else | |
$col["formatter"] = "function(cellvalue, options, rowObject){ return '<div title=\"'+rowObject.UpdatedOn+'\">'+rowObject.UpdatedOnFormat+'</div>'; }"; | |
$col["editable"] = false; | |
$cols[] = $col; | |
$col = array(); | |
$col["stype"] = "select"; | |
// blank row, then all db values - ; is record separator, : is key-value separator | |
$col["searchoptions"] = array("value" => $updatedby_lookup); | |
$col["title"] = LoadString('UPDATEDBY'); // caption of column, can use HTML tags too | |
$col["name"] = "UpdatedBy"; // grid column name, same as db field or alias from sql | |
//$col["width"] = "50"; // width on grid | |
$col["editable"] = false; | |
$cols[] = $col; | |
$g->set_columns($cols); | |
$opt["rowNum"] = 20; //Number of records to show on page | |
$opt["rowList"] = array( | |
10, | |
20, | |
30, | |
40, | |
50, | |
75, | |
100 | |
); | |
// you can also set 'All' for all records | |
//$opt["rowList"] = array(10,20,30,40,50,75,100,'All'); | |
$opt["rownumbers"] = false; | |
$opt["rownumWidth"] = 30; | |
$opt["pgbuttons"] = true; //To show/remove Paging navigation buttons | |
$opt["page"] = 1; | |
$opt["viewrecords"] = true; //Enable or Disable total records text on grid | |
$opt["width"] = "100%"; | |
//$opt["autowidth"] = true; //Expand grid to screen width | |
$opt["resizable"] = false; //Show corner (lower-right) resizable option on grid | |
$opt["autoresize"] = false; // defaults to false Auto resize grid with browser resize | |
$opt["hiddengrid"] = false; //Initially Hidden Grid | |
$opt["hidegrid"] = true; //Show Hide Grid button | |
$opt["height"] = "100%"; | |
$opt["loadtext"] = "Loading..."; //The text which appear when requesting and sorting data. | |
$opt["toolbar"] = "both"; //Toolbar Position "top" or "bottom" or "both" | |
$opt["multiselect"] = true; //Allow you to multi-select through checkboxes | |
$opt["multiboxonly"] = true; | |
$opt["multiselectWidth"] = 30; | |
$opt["multikey"] = true; | |
$opt["altRows"] = true; | |
// Date will be sorted desc, and ID asc. | |
$opt["sortname"] = "CreatedOn DESC,Id"; | |
$opt["sortorder"] = "ASC"; | |
//$opt["caption"] = "";//In order to remove caption bar, set it to blank. | |
//$opt["scroll"] = true; | |
//$opt["direction"] = "rtl";//Makes grid right to left, for rtl languages e.g. arabic. Default is ltr | |
if (!empty($lang) && $lang == 'ar') | |
$opt["direction"] = "rtl"; | |
else | |
$opt["direction"] = "ltr"; | |
if (!empty($lang) && $lang == 'ar') | |
$gridLocale = "grid.locale-ar.js"; | |
else if (!empty($lang) && $lang == 'fr') | |
$gridLocale = "grid.locale-fr.js"; | |
else | |
$gridLocale = "grid.locale-en.js"; | |
$opt["tooltip"] = true; | |
$opt["hotkeys"] = true; //Enable or disable hotkeys for add, edit or delete operations: true/false It only work for first grid on page. | |
$opt["cellEdit"] = false; //Inline cell editing, like spreadsheet | |
$opt["reloadedit"] = true; //To reload whole grid after editing | |
$opt["toppager"] = false; //Display Top Pager bar | |
//$opt["url"] = "http://domain/page.php?test=1";//URL for grid page (for ajax calls), defaults to REQUEST_URI. It works with http & https. Used when passing extra querystring data, e.g. | |
$opt["form"]["position"] = ""; | |
$opt["add_options"]["jqModal"] = true; | |
$opt["add_options"] = array( | |
'width' => '420', | |
"closeAfterAdd" => true, // close dialog after add/edit | |
"clearAfterAdd" => true, // clear fields after add/edit - default true | |
"top" => "200", // absolute top position of dialog | |
"left" => "200" // absolute left position of dialog | |
); | |
$opt["edit_options"] = array( | |
'width' => '420', | |
"closeAfterEdit" => true, // close dialog after add/edit | |
"top" => "200", // absolute top position of dialog | |
"left" => "200" // absolute left position of dialog | |
); | |
$opt["view_options"]["rowButton"] = false; //On small screen devices when any column is hidden due to responsive behavior, by default a column with "..." text is added which opens view dialog showing all columns. To disable it you can set: | |
$opt["add_options"]["success_msg"] = "Post added"; | |
$opt["edit_options"]["success_msg"] = "Post updated"; | |
$opt["delete_options"]["success_msg"] = "Post deleted"; | |
// for bulk editing | |
$opt["edit_options"]["success_msg_bulk"] = "Post(s) updated"; | |
//To remove these success messages, you can set: | |
$opt["add_options"]["afterSubmit"] = 'function(response) { return [true,""]; }'; | |
$opt["edit_options"]["afterSubmit"] = 'function(response) { return [true,""]; }'; | |
$opt["delete_options"]["afterSubmit"] = 'function(response) { return [true,""]; }'; | |
$opt["edit_options"]["checkOnSubmit"] = true; //This option work only in editing mode. If Set to true this option will work only when a submit button is clicked and if any data is changed in the form. If the data is changed a dilog message appear where the user is asked to confirm the changes or cancel it. | |
//$opt["form"]["position"] = "center"; | |
$opt["form"]["nav"] = true; //Enable form Prev | Next record navigation | |
$opt["actionicon"] = true; //Row Action Icons or Text | |
$g->set_actions(array( | |
"add" => false, | |
"edit" => false, | |
"clone" => false, | |
"bulkedit" => false, | |
"delete" => false, | |
"view" => true, | |
"rowactions" => false, | |
"export_excel" => false, // export excel button | |
"export_pdf" => false, // export pdf button | |
"export_csv" => false, // export csv button | |
"import" => false, | |
"autofilter" => true, | |
"search" => "simple", | |
"inlineadd" => false, | |
"showhidecolumns" => true | |
)); | |
$g->set_options($opt); | |
$out = $g->render("list1"); | |
?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html> | |
<head> | |
<html <?php echo $htmlDirection ?>> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> | |
<link rel="stylesheet" type="text/css" media="screen" href="../lib/js/themes/redmond/jquery-ui.custom.css" /> | |
<link rel="stylesheet" type="text/css" media="screen" href="../lib/js/jqgrid/css/ui.jqgrid.css" /> | |
<script src="../lib/js/jquery.min.js" type="text/javascript"></script> | |
<script src="../lib/js/jqgrid/js/i18n/<?php echo $gridLocale ?>" type="text/javascript"></script> | |
<script src="../lib/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script> | |
<script src="../lib/js/themes/jquery-ui.custom.min.js" type="text/javascript"></script> | |
<script src="../lib/dist/jquery.validate.js" type="text/javascript"></script> | |
<script src="//cdn.jsdelivr.net/jstorage/0.1/jstorage.min.js" type="text/javascript"></script> | |
<script src="//cdn.jsdelivr.net/json2/0.1/json2.min.js" type="text/javascript"></script> | |
<!-- <script src="//cdn.jsdelivr.net/gh/gridphp/jqGridState@master/jqGrid.state.js" type="text/javascript"></script> --> | |
<script src="//cdn.rawgit.com/gridphp/jqGridState/e06788e68cd9f97db9da4bb4ba1c4a82890aed9e/jqGrid.state.js" type="text/javascript"> | |
</script> | |
<link rel="stylesheet" type="text/css" media="screen" href="../themes/default/css/default.css" /> | |
<script language="javascript" type="text/javascript" src="../js/sjcl/Core.js"></script> | |
<script type="text/javascript" language="javascript" src="../js/sjcl/Windows.js"></script> | |
<script type="text/javascript" language="javascript"> | |
function changeLanguage(lang) { | |
var url = window.location.href; | |
if (url.indexOf('?') > -1) { | |
if (url.indexOf('lang') > -1) { | |
var urlModel = new URL(url); | |
var search_params = urlModel.searchParams; | |
search_params.set('lang', lang); | |
url = urlModel.toString(); | |
} else | |
url += '&lang=' + lang; | |
} else { | |
url += '?lang=' + lang; | |
} | |
window.location.href = url; | |
} | |
function LoadTrackinfo() { | |
var unexported, newKeys, ipConf, trackConf; | |
jQuery('#e1').html('<img src="<?= Path::MapNeutralImageLocal('arrow_spinner.gif') ?>" />'); | |
jQuery('#e2').html('<img src="<?= Path::MapNeutralImageLocal('arrow_spinner.gif') ?>" />'); | |
jQuery('#e3').html('<img src="<?= Path::MapNeutralImageLocal('arrow_spinner.gif') ?>" />'); | |
jQuery('#e4').html('<img src="<?= Path::MapNeutralImageLocal('arrow_spinner.gif') ?>" />'); | |
var wr = new sjcl.net.WebRequest( | |
'../lib/ajax/TrackFiles.php?action=3', | |
function() { | |
res = wr.getJson(); | |
unexported = res[1]; | |
newKeys = res[2]; | |
ipConf = res[3]; | |
trackConf = res[4]; | |
jQuery('#e1').html(Number(unexported).toLocaleString()); | |
jQuery('#e2').html(Number(newKeys).toLocaleString()); | |
jQuery('#e3').html(Number(ipConf).toLocaleString()); | |
jQuery('#e4').html(Number(trackConf).toLocaleString()); | |
}, | |
null, | |
"POST", | |
null | |
); | |
} | |
function onDeleteClick(ids) { | |
//var baseurl = "<?php echo '../lib/system/GeneralHandler.php?ds=PKActions&sid=' . SID_PKACTIONS; ?>"; | |
//var deleteUrl = baseurl + (baseurl.indexOf("?") != -1 ? "&" : "?") + "Action=6"; | |
var deleteUrl = '../lib/ajax/PKActions.php?switch=10' | |
var wr = new sjcl.net.WebRequest( | |
deleteUrl, | |
function() { | |
reloadGrid(); | |
}, | |
null, | |
"POST", | |
"ids=" + ids | |
); | |
} | |
function loadExistingProtectionKey(id) { | |
var getUrl = "../lib/ajax/PKActions.php?switch=9&id=" + id; | |
var wr = new sjcl.net.WebRequest( | |
getUrl, | |
function() { | |
res = wr.getText(); | |
const actionKeyObject = JSON.parse(res); | |
jQuery('#XXX_Title').val(actionKeyObject.Title); | |
jQuery('#XXX_Key').val(actionKeyObject.Key); | |
jQuery('#XXX_Key2').val(actionKeyObject.Key2); | |
jQuery('#XXX_ActionName').val(actionKeyObject.ActionName); | |
jQuery('#XXX_SENTNO').val(actionKeyObject.Sent); | |
jQuery('#XXX_Description').val(actionKeyObject.Description); | |
showEditProtectionDialog(actionKeyObject.Id); | |
}, | |
null, | |
"POST", | |
null | |
); | |
} | |
function saveNewProtectionKey(id, postedData) { | |
var saveUrl = "../lib/ajax/PKActions.php?switch=3"; | |
if (id && id > 0) | |
saveUrl = saveUrl + "&id=" + id; | |
//var wd = showWaitDialog(); | |
var wr = new sjcl.net.WebRequest( | |
saveUrl, | |
function() { | |
//wd.close(); | |
reloadGrid(); | |
}, | |
null, | |
"POST", | |
postedData | |
); | |
} | |
function activate(id, status) { | |
//var wd = showWaitDialog(); | |
var wr = new sjcl.net.WebRequest( | |
"../lib/ajax/PKActions.php?switch=4&id=" + id + "&status=" + (status ? 1 : 0), | |
function() { | |
//wd.close(); | |
reloadGrid(); | |
}, | |
null, | |
"POST", | |
null | |
); | |
} | |
</script> | |
</head> | |
<body class="m-1"> | |
<div class="container-fluid"> | |
<div class="row pageHeader"> | |
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-12 col-xs-12"> | |
<img id="aSyrianSoft" src="<?php echo $alameenLogoImgPath ?>" style="<?php echo $logoIconStyle; ?>" alt="" class="Logo" /> | |
</div> | |
<div class="col-xl-2 col-lg-2 col-md-2 col-sm-12 col-xs-12 marginTop5"> | |
<div class="row"> | |
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12"> | |
<a href="#" onclick="changeLanguage('en')" alt="en">English</a> | <a href="#" onclick="changeLanguage('ar')" alt="ar">عربي</a> | |
</div> | |
</div> | |
<div class="row"> | |
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12"><?php echo $userNameHtml ?></div> | |
</div> | |
</div> | |
</div> | |
<div class="row mx-auto"> | |
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12"> | |
<table> | |
<tbody> | |
<tr> | |
<td><img id="aSyrianSoft" src="<?php echo $pageTitleLogo ?>" style="<?php echo $logoIconStyle; ?>" alt="" /></td> | |
<td class="align-middle"> | |
<h1 class="contentHeaderTitle"><?php echo $pageTitle ?></h1> | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
</div> | |
</div> | |
<div class="row"> | |
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-xs-12"> | |
<table class="table table-bordered text-center"> | |
<tbody> | |
<tr> | |
<th rowspan="2" class="align-middle"><img src="<?php echo $refreshDataIcon ?>" onclick="LoadTrackinfo();" class="Hand"></th> | |
<th scope="col"><?php echo $unexportedKeyLabel; ?></th> | |
<th scope="col"><?php echo $newKeyLabel; ?></th> | |
<th scope="col"><?php echo $ipKeyConflict; ?></th> | |
<th scope="col"><?php echo $ipkeyTrackConflictByCountry; ?></th> | |
</tr> | |
<tr> | |
<th id="e1"> | |
</th> | |
<th id="e2"> | |
</th> | |
<th id="e3"> | |
</th> | |
<th id="e4"> | |
</th> | |
</tr> | |
</tbody> | |
</table> | |
</div> | |
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-xs-12"></div> | |
</div> | |
<div class="row mb-1"> | |
<div class="col-xl-2 col-lg-2 col-md-2 col-sm-12 col-xs-12"> | |
<button type=" button" class="btn btn-outline-secondary" onclick="navigateToExportTrackPage()" style="<?php echo $logoIconStyle; ?>"><i class="fa fa-download"></i> <?php echo $exportKeyLabel; ?></button> | |
</div> | |
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-12 col-xs-12"></div> | |
</div> | |
<div class="row"> | |
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12"> | |
<script> | |
// user php session id to retain grid state for current session only | |
var opts_list1 = { | |
"stateOptions": { | |
storageKey: "gridState-gridsimple", | |
columns: true, // remember column chooser settings | |
selection: true, // row selection | |
expansion: true, // subgrid expansion | |
filters: true, // filters | |
pager: true, // page number | |
order: true // field ordering | |
} | |
}; | |
</script> | |
<?php | |
echo $out; | |
?> | |
</div> | |
</div> | |
<div id="activate-confirm" style="display:none; width:500px; height: 500px;" title="<?php echo $activateBtnLabel; ?>"> | |
<p><span class="ui-icon ui-icon-check" style="<?php echo $confirmDlgIconStyle; ?>"></span> | |
"<?php echo $activateConfirmMsg; ?>" | |
</p> | |
</div> | |
<div id="deactivate-confirm" style="display:none; width:500px; height: 500px;" title="<?php echo $deactivateBtnLabel; ?>"> | |
<p><span class="ui-icon ui-icon-alert" style="<?php echo $confirmDlgIconStyle; ?>"></span> | |
"<?php echo $deactivateConfirmMsg; ?>" | |
</p> | |
</div> | |
<div id="delete-confirm" style="display:none; width:500px; height: 500px;" title="<?php echo $deleteBtnLabel; ?>"> | |
<p><span class="ui-icon ui-icon-alert" style="<?php echo $confirmDlgIconStyle; ?>"></span> | |
"<?php echo $deleteConfirmMsg; ?>" | |
</p> | |
</div> | |
<div id="dialog-confirm" style="display:none; " class="Caption" title="<?php echo $newProtectionKeyDialogTitle; ?>"> | |
<form id="basic-form" action="" method="post"> | |
<div class="container"> | |
<div class="row"> | |
<div class="col"> | |
<div class="form-group row"> | |
<label for="XXX_Title" class="col-sm-3 col-form-label"><?php echo $actionKeyTitleLabel; ?><span class="Required">*</span>:</label> | |
<div class="col-sm-9"> | |
<input type="text" class="form-control" id="XXX_Title" name="XXX_Title" value="" Required="1" RequiredMsg="<?php echo $actionKeyTitleReqMsg; ?>"> | |
</div> | |
</div> | |
<div class="form-group row"> | |
<label for="XXX_Key" class="col-sm-3 col-form-label"><?php echo $externalNoLabel; ?><span class="Required">*</span>:</label> | |
<div class="col-sm-9"> | |
<textarea class="form-control" id="XXX_Key" name="XXX_Key" Required="1" RequiredMsg="<?php echo $externalNoReqMsg; ?>"></textarea> | |
</div> | |
</div> | |
<div class="form-group row"> | |
<label for="XXX_Key2" class="col-sm-3 col-form-label"><?php echo $internalNoLabel; ?><span class="Required">*</span>:</label> | |
<div class="col-sm-9"> | |
<input type="text" class="form-control" id="XXX_Key2" name="XXX_Key2" value="0" Required="1" RequiredMsg="<?php echo $internalNoReqMsg; ?>"> | |
</div> | |
</div> | |
<div class="form-group row"> | |
<label for="XXX_ActionName" class="col-sm-3 col-form-label"><?php echo $actionTypeLabel; ?><span class="Required">*</span>:</label> | |
<div class="col-sm-9"> | |
<select id="XXX_ActionName" name="XXX_ActionName" class="form-control" dir="ltr"> | |
<?php | |
$products = array("BlockKey", "IllegalCopy"); | |
// Iterating through the product array | |
foreach ($products as $item) { | |
echo "<option value='$item'>$item</option>"; | |
} | |
?> | |
</select> | |
</div> | |
</div> | |
<div class="form-group row"> | |
<label for="XXX_SENTNO" class="col-sm-3 col-form-label"><?php echo $sentTimesNumberLabel; ?>:</label> | |
<div class="col-sm-9"> | |
<input type="text" class="form-control" id="XXX_SENTNO" name="XXX_SENTNO" value="0" Required="1" disabled> | |
</div> | |
</div> | |
<div class="form-group row"> | |
<label for="XXX_Description" class="col-sm-3 col-form-label"><?php echo $descriptionLabel; ?>:</label> | |
<div class="col-sm-9"> | |
<textarea id="XXX_Description" name="XXX_Description" class="form-control" dir="ltr"></textarea> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<script type="text/javascript" language="javascript"> | |
// Add toolbar buttons with 100ms delay to complete grid setup properly | |
jQuery("document").ready(function() { | |
//jQuery("#phpgridtabledest").html(jQuery("#phpgridtablesource").html()); | |
//jQuery("#phpgridtablesource").remove(); | |
LoadTrackinfo(); | |
setTimeout(() => { // | |
jQuery('#list1').jqGrid('navButtonAdd', '#list1_pager', { | |
'caption': '', | |
'buttonicon': 'ui-icon-check', | |
'onClickButton': function() { | |
// for non multi select | |
var selr_one = jQuery('#list1').jqGrid('getGridParam', 'selrow'); // array of id's of the selected rows when multiselect options is true. Empty array if not selection | |
// for multi select | |
var selr = []; | |
selr = jQuery('#list1').jqGrid('getGridParam', 'selarrrow'); // array of id's of the selected rows when multiselect options is true. Empty array if not selection | |
if (selr && selr.length < 2 && selr_one) | |
selr[0] = selr_one; | |
if (selr && selr.length == 0) { | |
jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap, '<div class=\"ui-state-error\">\"<?php echo $activateNoRowErrorMsg; ?>\"</div>', | |
jQuery.jgrid.edit.bClose, { | |
buttonalign: 'right' | |
}); | |
return; | |
} | |
const myArray = String(selr).split(','); | |
if (myArray.length > 1) { | |
jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap, '<div class=\"ui-state-error\">\"<?php echo $activateSingleRowErrorMsg; ?>\"</div>', | |
jQuery.jgrid.edit.bClose, { | |
buttonalign: 'right' | |
}); | |
return; | |
} | |
showActivateKeyDialog(); | |
}, | |
'position': 'first', | |
'title': "<?php echo $activateBtnLabel; ?>" | |
}); | |
jQuery('#list1').jqGrid('navButtonAdd', '#list1_pager', { | |
'caption': '', | |
'buttonicon': 'ui-icon-minusthick', | |
'onClickButton': function() { | |
// for non multi select | |
var selr_one = jQuery('#list1').jqGrid('getGridParam', 'selrow'); // array of id's of the selected rows when multiselect options is true. Empty array if not selection | |
// for multi select | |
var selr = []; | |
selr = jQuery('#list1').jqGrid('getGridParam', 'selarrrow'); // array of id's of the selected rows when multiselect options is true. Empty array if not selection | |
if (selr && selr.length < 2 && selr_one) | |
selr[0] = selr_one; | |
if (selr && selr.length == 0) { | |
jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap, '<div class=\"ui-state-error\">\"<?php echo $deactivateNoRowErrorMsg; ?>\"</div>', | |
jQuery.jgrid.edit.bClose, { | |
buttonalign: 'right' | |
}); | |
return; | |
} | |
const myArray = String(selr).split(','); | |
if (myArray.length > 1) { | |
jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap, '<div class=\"ui-state-error\">\"<?php echo $deactivateSingleRowErrorMsg; ?>\"</div>', | |
jQuery.jgrid.edit.bClose, { | |
buttonalign: 'right' | |
}); | |
return; | |
} | |
showDeactivateKeyDialog(); | |
}, | |
'position': 'first', | |
'title': "<?php echo $deactivateBtnLabel; ?>" | |
}); | |
jQuery('#list1').jqGrid('navButtonAdd', '#list1_pager', { | |
'caption': '', | |
'buttonicon': 'ui-icon-trash', | |
'onClickButton': function() { | |
// for non multi select | |
var selr_one = jQuery('#list1').jqGrid('getGridParam', 'selrow'); // array of id's of the selected rows when multiselect options is true. Empty array if not selection | |
// for multi select | |
var selr = []; | |
selr = jQuery('#list1').jqGrid('getGridParam', 'selarrrow'); // array of id's of the selected rows when multiselect options is true. Empty array if not selection | |
if (selr && selr.length < 2 && selr_one) | |
selr[0] = selr_one; | |
if (selr && selr.length == 0) { | |
jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap, '<div class=\"ui-state-error\">\"<?php echo $deleteNoRowErrorMsg; ?>\"</div>', | |
jQuery.jgrid.edit.bClose, { | |
buttonalign: 'right' | |
}); | |
return; | |
} | |
showDeleteDialog(); | |
}, | |
'position': 'first', | |
'title': "<?php echo $deleteBtnLabel; ?>" | |
}); | |
jQuery('#list1').jqGrid('navButtonAdd', '#list1_pager', { | |
'caption': '', | |
'buttonicon': 'ui-icon-pencil', | |
'onClickButton': function() { | |
// for non multi select | |
var selr_one = jQuery('#list1').jqGrid('getGridParam', 'selrow'); // array of id's of the selected rows when multiselect options is true. Empty array if not selection | |
// for multi select | |
var selr = []; | |
selr = jQuery('#list1').jqGrid('getGridParam', 'selarrrow'); // array of id's of the selected rows when multiselect options is true. Empty array if not selection | |
if (selr.length < 2 && selr_one) | |
selr[0] = selr_one; | |
if (selr.length == 0) { | |
jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap, '<div class=\"ui-state-error\">\"<?php echo $editNoRowErrorMsg; ?>\"</div>', | |
jQuery.jgrid.edit.bClose, { | |
buttonalign: 'right' | |
}); | |
return; | |
} | |
const myArray = String(selr).split(','); | |
if (myArray.length > 1) { | |
jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap, '<div class=\"ui-state-error\">\"<?php echo $editSingleRowErrorMsg; ?>\"</div>', | |
jQuery.jgrid.edit.bClose, { | |
buttonalign: 'right' | |
}); | |
return; | |
} | |
jQuery('label.error').css('display', 'none'); | |
loadExistingProtectionKey(myArray[0]); | |
//onEditClick(myArray[0]); | |
}, | |
'position': 'first', | |
'title': "<?php echo $editBtnLabel; ?>" | |
}); | |
jQuery('#list1').jqGrid('navButtonAdd', '#list1_pager', { | |
'caption': '', | |
'buttonicon': 'ui-icon-plus', | |
'onClickButton': function() { | |
jQuery('#XXX_Title').val(''); | |
jQuery('#XXX_Key').val(''); | |
jQuery('#XXX_Key2').val('0'); | |
jQuery('#XXX_ActionName').val('BlockKey'); | |
jQuery('#XXX_SENTNO').val('0'); | |
jQuery('#XXX_Description').val(''); | |
jQuery('label.error').css('display', 'none'); | |
showNewProtectionDialog(); | |
}, | |
'position': 'first', | |
'title': "<?php echo $newBtnLabel; ?>" | |
}); | |
}, 20); | |
}); | |
function getCurrentLanguage() { | |
var currentLang = ''; | |
var url = window.location.href; | |
if (url.indexOf('lang') > -1) { | |
var urlModel = new URL(url); | |
var search_params = urlModel.searchParams; | |
currentLang = search_params.get('lang') | |
} | |
return currentLang; | |
} | |
function navigateToExportTrackPage() { | |
var currentLang = getCurrentLanguage(); | |
var redirectUrl = "./pktrackexport.php"; | |
if (currentLang && currentLang.length > 0) { | |
redirectUrl = redirectUrl + '?lang=' + currentLang; | |
} | |
window.location.href = redirectUrl; | |
} | |
function reloadGrid() { | |
jQuery("#list1").trigger("reloadGrid", [{ | |
current: true | |
}]); | |
} | |
function showEditProtectionDialog(id) { | |
jQuery("#dialog-confirm").data('recordId', id).dialog({ | |
resizable: false, | |
dialogClass: "no-close", | |
width: 600, | |
modal: true, | |
create: function(event, ui) { | |
jQuery(event.target).parent().css('z-index', 10000); | |
}, | |
buttons: { | |
"<?php echo $okBtnLabel; ?>": function() { | |
if (jQuery('#basic-form').valid()) { | |
var postedData = (jQuery('#basic-form').serialize()); | |
postedData = postedData.replace(/XXX_/g, ''); | |
var actionTemplate = '<?php echo sprintf('<Actions><Action type="%s"></Action></Actions>', 'IllegalCopy') ?>' | |
var recordIdVal = jQuery(this).data('recordId'); | |
saveNewProtectionKey(recordIdVal, postedData); | |
jQuery(this).dialog("close"); | |
} | |
}, | |
"<?php echo $cancelBtnLabel; ?>": function() { | |
jQuery(this).dialog("close"); | |
} | |
} | |
}); | |
jQuery('#basic-form').validate({ | |
errorClass: "error fail-alert", | |
//validClass: "valid success-alert", | |
rules: { | |
XXX_Title: { | |
required: true, | |
minlength: 3 | |
}, | |
XXX_Key: { | |
required: true, | |
} | |
}, | |
messages: { | |
XXX_Title: { | |
required: '<?php echo $actionKeyTitleReqMsg; ?>' | |
}, | |
XXX_Key: { | |
required: '<?php echo $externalNoReqMsg; ?>' | |
} | |
} | |
}); | |
} | |
function showDeleteDialog() { | |
jQuery("#delete-confirm").dialog({ | |
resizable: false, | |
width: 500, | |
modal: true, | |
create: function(event, ui) { | |
jQuery(event.target).parent().css('z-index', 10000); | |
}, | |
buttons: { | |
"<?php echo $deleteBtnLabel; ?>": function() { | |
var selr_one = jQuery('#list1').jqGrid('getGridParam', 'selrow'); // array of id's of the selected rows when multiselect options is true. Empty array if not selection | |
// for multi select | |
var selr = []; | |
selr = jQuery('#list1').jqGrid('getGridParam', 'selarrrow'); // array of id's of the selected rows when multiselect options is true. Empty array if not selection | |
if (selr && selr.length < 2 && selr_one) | |
selr[0] = selr_one; | |
if (selr && selr.length == 0) { | |
jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap, '<div class=\"ui-state-error\">\"<?php echo $deleteNoRowErrorMsg; ?>\"</div>', | |
jQuery.jgrid.edit.bClose, { | |
buttonalign: 'right' | |
}); | |
return; | |
} | |
onDeleteClick(selr); | |
jQuery(this).dialog("close"); | |
}, | |
"<?php echo $cancelBtnLabel; ?>": function() { | |
jQuery(this).dialog("close"); | |
} | |
} | |
}); | |
} | |
function showActivateKeyDialog() { | |
jQuery("#activate-confirm").dialog({ | |
resizable: false, | |
width: 500, | |
modal: true, | |
create: function(event, ui) { | |
jQuery(event.target).parent().css('z-index', 10000); | |
}, | |
buttons: { | |
"<?php echo $activateBtnLabel; ?>": function() { | |
var selr_one = jQuery('#list1').jqGrid('getGridParam', 'selrow'); // array of id's of the selected rows when multiselect options is true. Empty array if not selection | |
// for multi select | |
var selr = []; | |
selr = jQuery('#list1').jqGrid('getGridParam', 'selarrrow'); // array of id's of the selected rows when multiselect options is true. Empty array if not selection | |
if (selr && selr.length < 2 && selr_one) | |
selr[0] = selr_one; | |
if (selr && selr.length == 0) { | |
jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap, '<div class=\"ui-state-error\">\"<?php echo $activateNoRowErrorMsg; ?>\"</div>', | |
jQuery.jgrid.edit.bClose, { | |
buttonalign: 'right' | |
}); | |
return; | |
} | |
const myArray = String(selr).split(','); | |
if (myArray.length > 1) { | |
jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap, '<div class=\"ui-state-error\">\"<?php echo $activateSingleRowErrorMsg; ?>\"</div>', | |
jQuery.jgrid.edit.bClose, { | |
buttonalign: 'right' | |
}); | |
return; | |
} | |
jQuery(this).dialog("close"); | |
activate(myArray[0], true); | |
}, | |
"<?php echo $cancelBtnLabel; ?>": function() { | |
jQuery(this).dialog("close"); | |
} | |
} | |
}); | |
} | |
function showDeactivateKeyDialog() { | |
jQuery("#deactivate-confirm").dialog({ | |
resizable: false, | |
width: 500, | |
modal: true, | |
create: function(event, ui) { | |
jQuery(event.target).parent().css('z-index', 10000); | |
}, | |
buttons: { | |
"<?php echo $deactivateBtnLabel; ?>": function() { | |
// for non multi select | |
var selr_one = jQuery('#list1').jqGrid('getGridParam', 'selrow'); // array of id's of the selected rows when multiselect options is true. Empty array if not selection | |
// for multi select | |
var selr = []; | |
selr = jQuery('#list1').jqGrid('getGridParam', 'selarrrow'); // array of id's of the selected rows when multiselect options is true. Empty array if not selection | |
if (selr && selr.length < 2 && selr_one) | |
selr[0] = selr_one; | |
if (selr && selr.length == 0) { | |
jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap, '<div class=\"ui-state-error\">\"<?php echo $deactivateNoRowErrorMsg; ?>\"</div>', | |
jQuery.jgrid.edit.bClose, { | |
buttonalign: 'right' | |
}); | |
return; | |
} | |
const myArray = String(selr).split(','); | |
if (myArray.length > 1) { | |
jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap, '<div class=\"ui-state-error\">\"<?php echo $deactivateSingleRowErrorMsg; ?>\"</div>', | |
jQuery.jgrid.edit.bClose, { | |
buttonalign: 'right' | |
}); | |
return; | |
} | |
jQuery(this).dialog("close"); | |
activate(myArray[0], false); | |
}, | |
"<?php echo $cancelBtnLabel; ?>": function() { | |
jQuery(this).dialog("close"); | |
} | |
} | |
}); | |
} | |
function showNewProtectionDialog() { | |
jQuery("#dialog-confirm").dialog({ | |
resizable: false, | |
dialogClass: "no-close", | |
width: 600, | |
modal: true, | |
create: function(event, ui) { | |
jQuery(event.target).parent().css('z-index', 10000); | |
}, | |
buttons: { | |
"<?php echo $okBtnLabel; ?>": function() { | |
if (jQuery('#basic-form').valid()) { | |
var postedData = (jQuery('#basic-form').serialize()); | |
postedData = postedData.replace(/XXX_/g, ''); | |
var actionTemplate = '<?php echo sprintf('<Actions><Action type="%s"></Action></Actions>', 'IllegalCopy') ?>' | |
postedData = postedData + "&Type=1&Action=" + actionTemplate; | |
saveNewProtectionKey(0, postedData); | |
jQuery(this).dialog("close"); | |
} | |
}, | |
"<?php echo $cancelBtnLabel; ?>": function() { | |
jQuery(this).dialog("close"); | |
} | |
} | |
}); | |
jQuery('#basic-form').validate({ | |
//errorClass: "error fail-alert", | |
//validClass: "valid success-alert", | |
rules: { | |
XXX_Title: { | |
required: true, | |
minlength: 3 | |
}, | |
XXX_Key: { | |
required: true, | |
} | |
}, | |
messages: { | |
XXX_Title: { | |
required: '<?php echo $actionKeyTitleReqMsg; ?>' | |
}, | |
XXX_Key: { | |
required: '<?php echo $externalNoReqMsg; ?>' | |
} | |
} | |
}); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment