17 require_once(
"$admLibrary/aGroupSupport.i");
22 "operation" => array(
"filter" => FILTER_SANITIZE_STRING),
23 "payload" => array(
"filter" => FILTER_SANITIZE_URL)
25 HCU_ImportVars($admVars,
"GROUP_HUB", $admOk);
28 $gOperation = isset($admVars[
"GROUP_HUB"][
"operation"]) ? $admVars[
"GROUP_HUB"][
"operation"] :
null;
29 $gPayload = isset($admVars[
"GROUP_HUB"][
"payload"]) ? $admVars[
"GROUP_HUB"][
"payload"] :
null;
33 GroupDecrypt($SYSENV, $Cu, $gPayload) :
37 for($i = 0; $i < count($gGroup[
"group"][
"g_primary"]); $i++)
39 $primary = $gGroup[
"group"][
"g_primary"][$i];
40 $gGroup[
"group"][
"g_primary"][$i][
"p_payload"]= urlencode(encryptUser($Cu, $primary,
false));
43 $gGroup = HCU_JsonEncode($gGroup);
46 $advPerm = checkPerm($Cn,
"userSupportAdv", $Cu)[1] == 1;
48 PrintGroupHub($gPayload, $gGroup, $advPerm);
50 }
catch (Exception $e) {
51 $SYSENV[
'logger']->error($e->getMessage());
57 <?php
function PrintGroupHub($pPayload, $pGroup, $pAdvPerm) {
58 $disabledLabel = $pAdvPerm ?
"false" :
"true";
60 <script type=
"text/x-kendo-template" id=
"contentSearch">
61 <div
class=
'search' data-name=
"#: name #" data-ft=
"#: ft #"><a href=
'\\#'><i
class=
'fa #: icon # fa-3x'></i><br>#: text #</a></div>
64 <script type=
"text/x-kendo-template" id=
"contentResults">
68 for(var i=0; i!= g_primary.length; i++) {
69 primaries.push(
'<a href="main.prg?ft=22&payload=' + g_primary[i].p_payload +
'">' + g_primary[i].p_name +
'<i class="fa fa-user fa-fw"></i></a>');
71 primaries= primaries.join(
","); #
72 <?php printHubLabelBlock(array(
"Group Name" =>
"# if (g_name == null) { # (None) # } else { # #: g_name # # } #",
73 "User Count" =>
"#: g_count #",
74 "Profile Name" =>
"# if (g_profile == null) { # (None) # } else { # #: g_profile # # } #",
76 "Primary Owner# if (g_primary.length > 1) { #(s)# } #" =>
"# if (g_primary.length == 0) { # (None) # } else { # #= primaries # # } #")); ?>
78 #if(g_primary.length > 1) {# 79 <div
class=
"col-xs-12">
80 <p><span
class=
"fa fa-exclamation-triangle" style=
"color: \#ff9800;"></span> This group has multiple primary owners. Please use the
"Group Information" card below to correct the issue.</p>
85 <div
class=
'noUserFound'><div>No Group Found</div></div>
90 <script type=
"text/x-kendo-template" id=
"contentCards">
91 # var disabledLabel = disabled === true ? "vsgDisabled" : (disabled === "norights" ? "vsgDisabled dtooltip" : ""); # 92 <div
class=
"col-md-4 col-xs-6 cardDiv openFt aa #: disabledLabel #" data-name=
"#: name #" data-ft=
"#: ft #">
93 <a href=
"\\#" class=
"goBtn">
94 <div
class=
"features-column center col-md-12">
95 <div
class=
"features-box-header">
96 <i
class=
"fa fa-3x #: icon #"></i>
97 <h6
class=
'textSpan'>#: text #</h6>
100 <div
class=
"feature-box-content center col-md-11">
101 <p
class=
"vsgSecondary hidden-xs hidden-sm">#= desc #</p>
107 <script
id=
"titleTemplate" type=
"text/x-kendo-template">
108 Group Hub #
if (cardTitle !=
null && cardTitle.trim() !=
"") { # / #: cardTitle # # } #
109 # if (g_name != null && g_name.trim() != "") { # / #= g_name # # } # 112 <div
id=
"cardContainerDiv">
113 <div
class=
"well well-sm borderless">
114 <h2
id=
"titleContainerDiv" class=
"hubTitle"></h2>
115 <div
id=
"resultContainerDiv"></div>
118 <div
id=
"cardContent"></div>
137 <script type=
"text/javascript">
138 <?php getShowWaitFunctions(); ?>
139 var groupWindows =
null;
146 ghSearchOptionSelected=
null;
147 ghSearchRowSelected=
null;
149 ghWindowContainer =
null;
153 ghHeaderContent =
null;
154 ghHeaderSearchContent =
null;
155 ghHeaderResultsContent =
null;
156 ghHeaderSearchView =
null;
157 ghHeaderResultsView =
null;
160 ghTitleContent =
null;
167 var EventCardClick =
function(e) {
169 var cardFt = card.data(
"ft");
170 var cardName = card.data(
"name");
172 if (ghCardsData[cardName].display.disabled) {
185 $(ghWindowContainer).empty();
186 $(ghWindowContainer).load(
"main.prg?ft=" + cardFt,
function(response) {
190 ghWindow.Data(ghResults, ghSearchOptionSelected, ghSearchRowSelected);
192 case "GroupSettings":
193 ghWindow =
new GroupSettings();
199 ghWindow =
new GroupRights();
202 ghWindow =
new GroupDelete();
212 ghWindow.Init(groupHub.Call, ghWindowContainer);
213 ghWindow.Open(groupWindows);
217 var InitDataSources =
function() {
222 icon:
"fa-cubes", name:
"GroupRights",
223 text:
"Group Rights", desc:
"Manage the group rights and limitations to banking features", disabled: <?php echo $disabledLabel; ?>}
228 icon:
"fa-tasks", name:
"GroupSettings",
229 text:
"Group Settings", desc:
"Settings specific to this group.", disabled: <?php echo $disabledLabel; ?>}
234 icon:
"fa-user-circle-o", name:
"GroupUsers",
235 text:
"Group Users", desc:
"Show all users in this group.", disabled:
false }
240 icon:
"fa-trash", name:
"GroupDelete",
241 text:
"Delete Group", desc:
" ", disabled:
false }
246 icon:
"fa-search", name:
"GroupSearch",
247 text:
"Search", desc:
"", disabled:
false 253 var InitDataViews =
function() {
254 ghTitle = $(
"#titleContainerDiv");
255 ghTitleContent = kendo.template($(
"#titleTemplate").html());
256 ghTitleView = ghTitleContent({ cardTitle:
null,g_name:
null });
257 ghTitle.append(ghTitleView);
259 ghHeader = $(
"#resultContainerDiv");
260 ghHeaderSearchContent = kendo.template($(
"#contentSearch").html());
261 ghHeaderResultsContent = kendo.template($(
"#contentResults").html());
262 ghHeaderSearchView = ghHeaderSearchContent(ghCardsData[
"GroupSearch"].display);
263 ghHeaderResultsView = ghHeaderResultsContent({ display:
false });
264 ghHeader.append(ghHeaderSearchView);
265 ghHeader.append(ghHeaderResultsView);
267 ghCards = $(
"#cardContainerDiv");
268 ghCardsContent = kendo.template($(
"#contentCards").html());
269 ghCards.find(
".cardDiv").hide();
271 ghWindowContainer = $(
"#cardContent");
273 <?php
if (!$pAdvPerm) { ?>
283 function InitPermTooltips() {
285 var toolTipProps = homecuTooltip.defaults;
286 toolTipProps.filter =
".vsgDisabled.dtooltip";
288 toolTipProps.showOn =
"click mouseenter";
289 toolTipProps.content =
function(e) {
291 if ($(e.target).is(
"[data-name]")) {
293 switch ($(e.target).data(
"name")) {
295 card =
"change group rights";
297 case "GroupSettings":
298 card =
"change group settings";
301 text = card ==
"" ?
"" :
"You do not have permission to " + card +
".";
305 toolTipProps.show =
function(e) {
306 if( this.content.text() !==
"") {
307 $(
'[role="tooltip"]').css(
"visibility",
"visible");
310 toolTipProps.hide =
function() {
311 $(
'[role="tooltip"]').css(
"visibility",
"hidden");
314 $(
"#cardContainerDiv").kendoTooltip(toolTipProps).data(
"kendoTooltip");
317 var InitDataActions =
function() {
318 ghHeader.find(
".search").off();
319 ghHeader.find(
".search").on(
"click", EventCardClick);
320 ghCards.find(
".cardDiv").off();
321 ghCards.find(
".cardDiv").on(
"click", EventCardClick);
324 this.Call =
function(action, data) {
326 if (data && data.group) {
327 var
template= kendo.template($(
"#titleTemplate").html());
328 $(
".hubTitle").html(
template({g_name: data.group.g_name, cardTitle:
null}));
332 case "updateGroupInfo":
336 ghGroup = data.group;
337 ghGroup.g_name = ghGroup.g_name ? ghGroup.g_name.trim() :
"";
338 ghGroup.g_profile = ghGroup.g_profile ? ghGroup.g_profile.trim() :
"";
339 ghGroup.g_primary = ghGroup.g_primary ? ghGroup.g_primary : [];
340 ghGroup.g_user = ghGroup.g_user ? ghGroup.g_user.trim() :
"";
341 ghGroup.g_count = parseInt(ghGroup.g_count);
342 ghGroup.display =
true;
345 ghHeaderSearchView = ghHeaderSearchContent(ghCardsData[
"GroupSearch"].display);
346 ghHeaderResultsView = ghHeaderResultsContent(ghGroup);
347 ghHeader.append(ghHeaderSearchView);
348 ghHeader.append(ghHeaderResultsView);
351 for(var key in ghCardsData) {
352 if ([
"GroupSearch"].indexOf(key) !== -1) {
354 }
else if ([
"GroupSettings",
"GroupRights"].indexOf(key) !== -1) {
355 <?php
if ($pAdvPerm) { ?>
356 if (ghGroup.g_count == 0) {
357 ghCardsData[key].display.disabled =
true;
359 ghCardsData[key].display.disabled =
false;
362 ghCardsData[key].display.disabled =
"norights";
364 }
else if ([
"GroupUsers",
"GroupInfo"].indexOf(key) !== -1) {
365 if (ghGroup.g_count == 0) {
366 ghCardsData[key].display.disabled =
true;
368 ghCardsData[key].display.disabled =
false;
371 ghCardsView += ghCardsContent(ghCardsData[key].display);
373 ghCards.find(
".cardDiv").remove();
374 ghCards.append(ghCardsView);
379 case "updateGroupEncrypt":
385 case "updateGroupResults":
390 case "removeGroupInfo":
407 data.Data(ghPayload, ghGroup);
412 this.Init =
function(payload, group) {
420 if (ghPayload && ghGroup.group) {
421 this.Call(
"updateGroupEncrypt", ghPayload);
422 this.Call(
"updateGroupInfo", ghGroup);
424 ghHeader.find(
".search").trigger(
"click");
429 $(document).ready(
function() {
430 var payload =
"<?php echo $pPayload ?>";
431 var group = <?php echo $pGroup; ?>;
435 groupHub.Init(payload, group);
438 $(document).on(
"click",
".k-overlay",
function() {
439 if (groupWindows.length > 0) {
440 var openWindow = groupWindows[groupWindows.length - 1];