function get_user_dash($user) { global $baseurl, $baseurl_short, $lang, $dash_tile_shadows; #Build User Dash and recalculate order numbers on display $user_tiles = sql_query("SELECT dash_tile.ref AS 'tile',dash_tile.title,dash_tile.all_users,dash_tile.url,dash_tile.reload_interval_secs,dash_tile.link,user_dash_tile.ref AS 'user_tile',user_dash_tile.order_by FROM user_dash_tile JOIN dash_tile ON user_dash_tile.dash_tile = dash_tile.ref WHERE user_dash_tile.user='******' ORDER BY user_dash_tile.order_by"); $order = 10; foreach ($user_tiles as $tile) { if ($order != $tile["order_by"] || $tile["order_by"] % 10 > 0) { update_user_dash_tile_order($user, $tile["user_tile"], $order); } $order += 10; ?> <a <?php # Check link for external or internal if (mb_strtolower(substr($tile["link"], 0, 4)) == "http") { $link = $tile["link"]; $newtab = true; } else { $link = $baseurl . "/" . htmlspecialchars($tile["link"]); $newtab = false; } ?> href="<?php echo parse_dashtile_link($link); ?> " <?php echo $newtab ? "target='_blank'" : ""; ?> onClick="if(dragging){dragging=false;e.defaultPrevented}<?php echo $newtab ? "" : "return CentralSpaceLoad(this,true);"; ?> " class="HomePanel DashTile DashTileDraggable <?php echo $tile['all_users'] == 1 ? 'allUsers' : ''; ?> " tile="<?php echo $tile['tile']; ?> " id="user_tile<?php echo htmlspecialchars($tile["user_tile"]); ?> " > <div id="contents_user_tile<?php echo htmlspecialchars($tile["user_tile"]); ?> " class="HomePanelIN HomePanelDynamicDash <?php echo $dash_tile_shadows ? "TileContentShadow" : ""; ?> "> <script> jQuery(function(){ var height = jQuery("#contents_user_tile<?php echo htmlspecialchars($tile["user_tile"]); ?> ").height(); var width = jQuery("#contents_user_tile<?php echo htmlspecialchars($tile["user_tile"]); ?> ").width(); jQuery('#contents_user_tile<?php echo htmlspecialchars($tile["user_tile"]); ?> ').load("<?php echo $baseurl . "/" . $tile["url"] . "&tile=" . htmlspecialchars($tile["tile"]); ?> &user_tile=<?php echo htmlspecialchars($tile["user_tile"]); ?> &tlwidth="+width+"&tlheight="+height); }); </script> </div> </a> <?php } # Check Permissions to Display Deleting Dash Tiles if (checkperm("h") && !checkperm("hdta") || checkperm("dta") && !checkperm("h") || !checkperm("dtu")) { ?> <div id="dash_tile_bin"><span class="dash_tile_bin_text"><?php echo $lang["tilebin"]; ?> </span></div> <div id="delete_dialog" style="display:none;"></div> <div id="delete_permanent_dialog" style="display:none;text-align:left;"><?php echo $lang['confirmdeleteconfigtile']; ?> </div> <script> function deleteDashTile(id) { jQuery.post( "<?php echo $baseurl; ?> /pages/ajax/dash_tile.php",{"user_tile":id,"delete":"true"},function(data){ jQuery("#user_tile"+id).remove(); }); } function deleteDefaultDashTile(tileid,usertileid) { jQuery.post( "<?php echo $baseurl; ?> /pages/ajax/dash_tile.php",{"tile":tileid,"delete":"true"},function(data){ jQuery("#user_tile"+usertileid).remove(); }); } <?php } else { echo "<script>"; } ?> function updateDashTileOrder(index,tile) { jQuery.post( "<?php echo $baseurl; ?> /pages/ajax/dash_tile.php",{"user_tile":tile,"new_index":((index*10))}); } var dragging=false; jQuery(function() { if(jQuery(window).width()<600 && jQuery(window).height()<600 && is_touch_device()) { return false; } jQuery("#HomePanelContainer").sortable({ items: ".DashTileDraggable", start: function(event,ui) { jQuery("#dash_tile_bin").show(); dragging=true; }, stop: function(event,ui) { jQuery("#dash_tile_bin").hide(); }, update: function(event, ui) { nonDraggableTiles = jQuery(".HomePanel").length - jQuery(".DashTileDraggable").length; newIndex = (ui.item.index() - nonDraggableTiles) + 1; var id=jQuery(ui.item).attr("id").replace("user_tile",""); updateDashTileOrder(newIndex,id); } }); <?php # Check Permissions to Display Deleting Dash Tiles if (checkperm("h") && !checkperm("hdta") || checkperm("dta") && !checkperm("h") || !checkperm("dtu")) { ?> jQuery("#dash_tile_bin").droppable({ accept: ".DashTileDraggable", activeClass: "ui-state-hover", hoverClass: "ui-state-active", drop: function(event,ui) { var id=jQuery(ui.draggable).attr("id"); id = id.replace("user_tile",""); <?php # If permission to delete all_user tiles if (checkperm("h") && !checkperm("hdta") || checkperm("dta") && !checkperm("h")) { ?> var tileid=jQuery(ui.draggable).attr("tile"); <?php } ?> title = jQuery(ui.draggable).find(".title").html(); jQuery("#dash_tile_bin").hide(); <?php # If permission to delete all_user tiles if (checkperm("h") && !checkperm("hdta") || checkperm("dta") && !checkperm("h")) { ?> if(jQuery(ui.draggable).hasClass("allUsers")) { // This tile is set for all users so provide extra options jQuery("#delete_dialog").dialog({ title:'<?php echo $lang["dashtiledelete"]; ?> ', modal: true, resizable: false, dialogClass: 'delete-dialog no-close', buttons: { "<?php echo $lang['confirmdashtiledelete']; ?> ": function() {deleteDashTile(id); jQuery(this).dialog( "close" );}, "<?php echo $lang['confirmdefaultdashtiledelete']; ?> ": function() {deleteDefaultDashTile(tileid,id); jQuery(this).dialog( "close" );}, "<?php echo $lang['managedefaultdash']; ?> ": function() {window.location = "<?php echo $baseurl; ?> /pages/team/team_dash_tile.php"; return false;}, "<?php echo $lang['cancel']; ?> ": function() { jQuery(this).dialog('close'); } } }); } else { //This tile belongs to this user only jQuery("#delete_dialog").dialog({ title:'<?php echo $lang["dashtiledelete"]; ?> ', modal: true, resizable: false, dialogClass: 'delete-dialog no-close', buttons: { "<?php echo $lang['confirmdashtiledelete']; ?> ": function() {deleteDashTile(id); jQuery(this).dialog( "close" );}, "<?php echo $lang['cancel']; ?> ": function() { jQuery(this).dialog('close'); } } }); } <?php } else { ?> var dialog = jQuery("#delete_dialog").dialog({ title:'<?php echo $lang["dashtiledelete"]; ?> ', modal: true, resizable: false, dialogClass: 'delete-dialog no-close', buttons: { "<?php echo $lang['confirmdashtiledelete']; ?> ": function() {deleteDashTile(id); jQuery(this).dialog( "close" );}, "<?php echo $lang['cancel']; ?> ": function() {jQuery(this).dialog('close'); } } }); <?php } ?> } }); <?php } ?> }); </script> <?php }
$usertile = get_user_tile($user_rawtile, $userref); if (!$usertile) { exit($lang["nodashtilefound"]); } } /* * Reorder Tile */ $index = getvalescaped("new_index", "", TRUE); if (!empty($index) && isset($usertile)) { if ($index > $usertile["order_by"]) { $index += 5; } else { $index -= 5; } update_user_dash_tile_order($userref, $usertile["ref"], $index); reorder_user_dash($userref); exit("Tile " . $usertile["ref"] . " at index: " . $index); } if (!empty($index) && isset($tile) && !isset($usertile)) { if ($index > $tile["default_order_by"]) { $index += 5; } else { $index -= 5; } update_default_dash_tile_order($tile["ref"], $index); reorder_default_dash(); echo "Tile " . $tile["ref"] . " at index: " . $index; exit; } /*