|
|
@@ -1334,12 +1334,12 @@
|
|
|
<div locale="listmenu/catergory/all" class="item groupType selected" group="All">All</div>
|
|
|
<div locale="listmenu/catergory/media" class="item groupType" group="Media">Media</div>
|
|
|
<div locale="listmenu/catergory/office" class="item groupType" group="Office">Office</div>
|
|
|
- <div locale="listmenu/catergory/download" class="item groupType" group="Download">Download</div>
|
|
|
- <div locale="listmenu/catergory/files" class="item groupType" group="Files">Files</div>
|
|
|
- <div locale="listmenu/catergory/internet" class="item groupType" group="Internet">Internet</div>
|
|
|
- <div locale="listmenu/catergory/settings" class="item groupType" group="System Settings">System Settings</div>
|
|
|
- <div locale="listmenu/catergory/tools" class="item groupType" group="System Tools">System Tools</div>
|
|
|
+ <div locale="listmenu/catergory/network" class="item groupType" group="Network">Network</div>
|
|
|
+ <div locale="listmenu/catergory/engineering" class="item groupType" group="Engineering">Engineering</div>
|
|
|
+ <div locale="listmenu/catergory/development" class="item groupType" group="Development">Development</div>
|
|
|
+ <div locale="listmenu/catergory/system" class="item groupType" group="System">System</div>
|
|
|
<div locale="listmenu/catergory/utils" class="item groupType" group="Utilities">Utilities</div>
|
|
|
+ <div locale="listmenu/catergory/containerApps" id="containerAppsGroup" class="item groupType" group="Container Apps" style="display:none;">Container Apps</div>
|
|
|
<div locale="listmenu/catergory/other" class="item groupType" group="Other">Other</div>
|
|
|
<div class="poweroption">
|
|
|
<img id="powerIcon" style="width:18px; vertical-align: top; margin-right:4px;" src="img/system/power.svg"></img> <span locale="listmenu/catergory/exit">Exit</span>
|
|
|
@@ -1562,6 +1562,18 @@
|
|
|
//ListMenu Related Paramters
|
|
|
var moduleInstalled = [];
|
|
|
var listMenuShown = false;
|
|
|
+ //Module groups listed under each list menu category. Groups of retired
|
|
|
+ //categories (Download, Files) and Internet still land somewhere sensible
|
|
|
+ //for third party modules; any other group goes to Other.
|
|
|
+ var listMenuCategories = {
|
|
|
+ "Media": ["Media"],
|
|
|
+ "Office": ["Office"],
|
|
|
+ "Network": ["Network", "Internet", "Download"],
|
|
|
+ "Engineering": ["Engineering"],
|
|
|
+ "Development": ["Development"],
|
|
|
+ "System": ["System Tools", "System Settings"],
|
|
|
+ "Utilities": ["Utilities", "Files"]
|
|
|
+ };
|
|
|
|
|
|
//Context Menu variables
|
|
|
var menuStartLocation = [0, 0];
|
|
|
@@ -2119,6 +2131,17 @@
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ //Container Apps only exist as a category on hosts that can run containers
|
|
|
+ $.get("system/appproxy/apps", function(data) {
|
|
|
+ if (data && data.error === undefined && data.Containers === true) {
|
|
|
+ $("#containerAppsGroup").show();
|
|
|
+ } else {
|
|
|
+ $("#containerAppsGroup").hide();
|
|
|
+ }
|
|
|
+ }).fail(function() {
|
|
|
+ $("#containerAppsGroup").hide();
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
function hookLaunchMenuEvents(){
|
|
|
@@ -2145,8 +2168,67 @@
|
|
|
return moduleInfo["StartDir"] != "" && moduleInfo["Group"] != "Interface Module";
|
|
|
}
|
|
|
|
|
|
+ //Return the list menu category a module group is listed under
|
|
|
+ function listMenuCategoryOf(group) {
|
|
|
+ var g = (group || "").trim().toLowerCase();
|
|
|
+ for (var category in listMenuCategories) {
|
|
|
+ var groups = listMenuCategories[category];
|
|
|
+ for (var i = 0; i < groups.length; i++) {
|
|
|
+ if (groups[i].toLowerCase() == g) {
|
|
|
+ return category;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return "Other";
|
|
|
+ }
|
|
|
+
|
|
|
+ //List the published container apps the user may open. Fetched on every
|
|
|
+ //open so apps an administrator just published show up at once
|
|
|
+ function listContainerApps() {
|
|
|
+ $("#listMenuItem").html("");
|
|
|
+ $.get("system/appproxy/apps", function(data) {
|
|
|
+ if ($(".groupType.selected").attr("group") != "Container Apps") {
|
|
|
+ //The user moved on to another category meanwhile
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $("#listMenuItem").html("");
|
|
|
+ var apps = (data && data.error === undefined && data.Apps) ? data.Apps : [];
|
|
|
+ apps.forEach(function(app) {
|
|
|
+ generateContainerAppListMenuItem(app);
|
|
|
+ });
|
|
|
+ if (apps.length == 0) {
|
|
|
+ $("#listMenuItem").html(`<div class="item module"><span><img src="img/system/not found.png">No container app found</span></div>`);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function generateContainerAppListMenuItem(app) {
|
|
|
+ var item = $(`<div class="item module" draggable="true"
|
|
|
+ ondragstart="listMenuContainerAppDragStart(event,this);"
|
|
|
+ onclick="openContainerAppFromMenu(this);" ontouchstart="openContainerAppFromMenu(this);">
|
|
|
+ <span><img></img><span class="containerAppName"></span></span>
|
|
|
+ </div>`);
|
|
|
+ //Names and icons are set as data so an app name is never parsed as HTML
|
|
|
+ item.attr("appslug", app.Slug).attr("appname", app.Name);
|
|
|
+ item.find("img").attr("src", app.Icon || "ContainerApps/img/app.svg");
|
|
|
+ item.find(".containerAppName").text(app.Name);
|
|
|
+ $("#listMenuItem").append(item);
|
|
|
+ }
|
|
|
+
|
|
|
+ function openContainerAppFromMenu(object) {
|
|
|
+ openContainerAppShortcut({
|
|
|
+ ShortcutName: $(object).attr("appname"),
|
|
|
+ ShortcutPath: $(object).attr("appslug"),
|
|
|
+ ShortcutImage: $(object).find("img").first().attr("src")
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
function listModulesType(groupType) {
|
|
|
var listingItems = [];
|
|
|
+ if (groupType == "Container Apps") {
|
|
|
+ listContainerApps();
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (groupType == "All") {
|
|
|
//List all of the items
|
|
|
for (var i = 0; i < moduleInstalled.length; i++) {
|
|
|
@@ -2154,18 +2236,11 @@
|
|
|
listingItems.push(moduleInstalled[i]);
|
|
|
}
|
|
|
}
|
|
|
- } else if (groupType == "Other") {
|
|
|
- var excludeList = ["Media", "Office", "Download", "Files", "Internet", "System Settings", "System Tools", "Utilities"];
|
|
|
- //List the Other groups
|
|
|
- for (var i = 0; i < moduleInstalled.length; i++) {
|
|
|
- if (excludeList.includes(moduleInstalled[i]["Group"]) == false && isLaunchableModule(moduleInstalled[i])) {
|
|
|
- listingItems.push(moduleInstalled[i]);
|
|
|
- }
|
|
|
- }
|
|
|
} else {
|
|
|
- //List the given group
|
|
|
+ //List the modules whose group falls under the given category (Other
|
|
|
+ //collects every group no category claims)
|
|
|
for (var i = 0; i < moduleInstalled.length; i++) {
|
|
|
- if (moduleInstalled[i]["Group"] == groupType && isLaunchableModule(moduleInstalled[i])) {
|
|
|
+ if (listMenuCategoryOf(moduleInstalled[i]["Group"]) == groupType && isLaunchableModule(moduleInstalled[i])) {
|
|
|
listingItems.push(moduleInstalled[i]);
|
|
|
}
|
|
|
}
|
|
|
@@ -4568,15 +4643,18 @@
|
|
|
var sourceFilepath = ev.dataTransfer.getData("filepath");
|
|
|
|
|
|
// ── List-menu app drag → create shortcut at drop location ──────────────
|
|
|
- if (ev.dataTransfer.getData("moduledragtype") === "module" && target.attr("id") === "bgwrapper") {
|
|
|
+ var _dragType = ev.dataTransfer.getData("moduledragtype");
|
|
|
+ if ((_dragType === "module" || _dragType === "app") && target.attr("id") === "bgwrapper") {
|
|
|
var _mName = ev.dataTransfer.getData("modulename");
|
|
|
var _mIcon = ev.dataTransfer.getData("moduleicon");
|
|
|
+ //Container apps are opened by slug, modules by name
|
|
|
+ var _mPath = _dragType === "app" ? ev.dataTransfer.getData("moduleslug") : _mName;
|
|
|
var _locs = gridPositionAllocate(ev.clientX, ev.clientY, 1);
|
|
|
var _gx = _locs[0][0], _gy = _locs[0][1];
|
|
|
$.ajax({
|
|
|
url: "system/desktop/createShortcut",
|
|
|
method: "POST",
|
|
|
- data: { stype: "module", stext: _mName, spath: _mName, sicon: _mIcon },
|
|
|
+ data: { stype: _dragType, stext: _mName, spath: _mPath, sicon: _mIcon },
|
|
|
success: function(data) {
|
|
|
if (data.error) { console.log(data.error); return; }
|
|
|
// Set position then refresh; filename is <name>.shortcut
|
|
|
@@ -5121,6 +5199,19 @@
|
|
|
ev.dataTransfer.setData("filedata", "");
|
|
|
}
|
|
|
|
|
|
+ //Dragging a container app out of the list menu pins it as an "app" shortcut
|
|
|
+ function listMenuContainerAppDragStart(ev, el) {
|
|
|
+ ev.stopPropagation();
|
|
|
+ ev.dataTransfer.effectAllowed = "copy";
|
|
|
+ ev.dataTransfer.setData("moduledragtype", "app");
|
|
|
+ ev.dataTransfer.setData("modulename", $(el).attr("appname"));
|
|
|
+ ev.dataTransfer.setData("moduleslug", $(el).attr("appslug"));
|
|
|
+ ev.dataTransfer.setData("moduleicon", $(el).find("img").first().attr("src"));
|
|
|
+ ev.dataTransfer.setData("filepath", "");
|
|
|
+ ev.dataTransfer.setData("filename", "");
|
|
|
+ ev.dataTransfer.setData("filedata", "");
|
|
|
+ }
|
|
|
+
|
|
|
//Pass in the object fullpath and return the icon object onscreen
|
|
|
function getObjectFromPath(path) {
|
|
|
var object;
|