Cleanup, repository popup display default icon if error loading
This commit is contained in:
parent
01d1f2dcdf
commit
9fd607b705
Binary file not shown.
|
@ -556,7 +556,7 @@ function displayRepositories() {
|
|||
# get_content - get the results from templates according to categories, filters, etc #
|
||||
######################################################################################
|
||||
function get_content() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths, $caSettings;
|
||||
|
||||
$filter = getPost("filter",false);
|
||||
$category = getPost("category",false);
|
||||
|
@ -623,7 +623,6 @@ function get_content() {
|
|||
writeJsonFile($caPaths['community-templates-displayed'],$displayApplications);
|
||||
@unlink($caPaths['community-templates-allSearchResults']);
|
||||
@unlink($caPaths['community-templates-catSearchResults']);
|
||||
// $sortOrder['sortBy'] = "noSort";
|
||||
$o['display'] = my_display_apps($displayApplications['community'],"1");
|
||||
$o['script'] = "$('#templateSortButtons,#sortButtons').hide();enableIcon('#sortIcon',false);";
|
||||
postReturn($o);
|
||||
|
@ -753,7 +752,6 @@ function get_content() {
|
|||
$searchResults['favNameHit'] = array();
|
||||
|
||||
$displayApplications['community'] = array_merge($searchResults['favNameHit'],$searchResults['nameHit'],$searchResults['anyHit']);
|
||||
// $sortOrder['sortBy'] = "noSort";
|
||||
} else {
|
||||
usort($display,"mySort");
|
||||
$displayApplications['community'] = $display;
|
||||
|
@ -771,9 +769,7 @@ function get_content() {
|
|||
@unlink($caPaths['community-templates-catSearchResults']);
|
||||
}
|
||||
$o['display'] = display_apps();
|
||||
/* if ( count($displayApplications['community']) < 2 ) {
|
||||
//$o['script'] = "disableSort();";
|
||||
} */
|
||||
|
||||
postReturn($o);
|
||||
}
|
||||
|
||||
|
@ -781,7 +777,7 @@ function get_content() {
|
|||
# force_update -> forces an update of the applications #
|
||||
########################################################
|
||||
function force_update() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths;
|
||||
|
||||
$lastUpdatedOld = readJsonFile($caPaths['lastUpdated-old']);
|
||||
|
||||
|
@ -836,7 +832,7 @@ function force_update() {
|
|||
# display_content - displays the templates according to view mode, sort order, etc #
|
||||
####################################################################################
|
||||
function display_content() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths;
|
||||
|
||||
$pageNumber = getPost("pageNumber","1");
|
||||
$startup = getPost("startup",false);
|
||||
|
@ -860,7 +856,8 @@ function display_content() {
|
|||
# convert_docker - called when system adds a container from dockerHub #
|
||||
#######################################################################
|
||||
function convert_docker() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths;
|
||||
|
||||
$dockerID = getPost("ID","");
|
||||
|
||||
$file = readJsonFile($caPaths['dockerSearchResults']);
|
||||
|
@ -892,7 +889,8 @@ function convert_docker() {
|
|||
# search_dockerhub - returns the results from dockerHub #
|
||||
#########################################################
|
||||
function search_dockerhub() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths;
|
||||
|
||||
$filter = getPost("filter","");
|
||||
$pageNumber = getPost("page","1");
|
||||
|
||||
|
@ -949,12 +947,14 @@ function search_dockerhub() {
|
|||
# dismiss_warning - dismisses the warning from appearing at startup #
|
||||
#####################################################################
|
||||
function dismiss_warning() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths;
|
||||
|
||||
file_put_contents($caPaths['warningAccepted'],"warning dismissed");
|
||||
postReturn(['status'=>"warning dismissed"]);
|
||||
}
|
||||
function dismiss_plugin_warning() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths;
|
||||
|
||||
file_put_contents($caPaths['pluginWarning'],"disclaimer ok");
|
||||
postReturn(['status'=>"disclaimed"]);
|
||||
}
|
||||
|
@ -963,7 +963,8 @@ function dismiss_plugin_warning() {
|
|||
# Displays the list of installed or previously installed apps #
|
||||
###############################################################
|
||||
function previous_apps() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths, $caSettings, $DockerClient;
|
||||
|
||||
$installed = getPost("installed","");
|
||||
$dockerUpdateStatus = readJsonFile($caPaths['dockerUpdateStatus']);
|
||||
$info = $caSettings['dockerRunning'] ? $DockerClient->getDockerContainers() : array();
|
||||
|
@ -1158,7 +1159,6 @@ if ( $caSettings['dockerRunning'] ) {
|
|||
# Removes an app from the previously installed list (ie: deletes the user template #
|
||||
####################################################################################
|
||||
function remove_application() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
$application = getPost("application","");
|
||||
if ( pathinfo($application,PATHINFO_EXTENSION) == "xml" || pathinfo($application,PATHINFO_EXTENSION) == "plg" )
|
||||
@unlink($application);
|
||||
|
@ -1170,7 +1170,8 @@ function remove_application() {
|
|||
# Checks for an update still available (to update display) after update installed #
|
||||
###################################################################################
|
||||
function updatePLGstatus() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths;
|
||||
|
||||
$filename = getPost("filename","");
|
||||
$displayed = readJsonFile($caPaths['community-templates-displayed']);
|
||||
$superCategories = array_keys($displayed);
|
||||
|
@ -1190,7 +1191,7 @@ function updatePLGstatus() {
|
|||
# Uninstalls a docker #
|
||||
#######################
|
||||
function uninstall_docker() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $DockerClient, $dockerRunning;
|
||||
$application = getPost("application","");
|
||||
|
||||
# get the name of the container / image
|
||||
|
@ -1214,7 +1215,8 @@ function uninstall_docker() {
|
|||
# Pins / Unpins an application for later viewing #
|
||||
##################################################
|
||||
function pinApp() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths;
|
||||
|
||||
$repository = getPost("repository","oops");
|
||||
$name = getPost("name","oops");
|
||||
$pinnedApps = readJsonFile($caPaths['pinnedV2']);
|
||||
|
@ -1227,7 +1229,8 @@ function pinApp() {
|
|||
# Gets if any apps are pinned or not #
|
||||
######################################
|
||||
function areAppsPinned() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths;
|
||||
|
||||
postReturn(['status' => in_array(true,readJsonFile($caPaths['pinnedV2']))]);
|
||||
}
|
||||
|
||||
|
@ -1235,7 +1238,7 @@ function areAppsPinned() {
|
|||
# Displays the pinned applications #
|
||||
####################################
|
||||
function pinnedApps() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths, $caSettings;
|
||||
$pinnedApps = readJsonFile($caPaths['pinnedV2']);
|
||||
$file = readJsonFile($caPaths['community-templates-info']);
|
||||
@unlink($caPaths['community-templates-allSearchResults']);
|
||||
|
@ -1276,7 +1279,6 @@ function pinnedApps() {
|
|||
# Displays the possible branch tags for an app #
|
||||
################################################
|
||||
function displayTags() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
$leadTemplate = getPost("leadTemplate","oops");
|
||||
postReturn(['tags'=>formatTags($leadTemplate)]);
|
||||
}
|
||||
|
@ -1285,7 +1287,7 @@ function displayTags() {
|
|||
# Displays The Statistics For The Appfeed #
|
||||
###########################################
|
||||
function statistics() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths, $caSettings;
|
||||
@unlink($caPaths['community-templates-displayed']);
|
||||
@unlink($caPaths['community-templates-allSearchResults']);
|
||||
@unlink($caPaths['community-templates-catSearchResults']);
|
||||
|
@ -1372,7 +1374,8 @@ function statistics() {
|
|||
# Removes a private app from the list #
|
||||
#######################################
|
||||
function removePrivateApp() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths;
|
||||
|
||||
$path = getPost("path",false);
|
||||
|
||||
if ( ! $path || pathinfo($path,PATHINFO_EXTENSION) != "xml") {
|
||||
|
@ -1403,7 +1406,7 @@ function removePrivateApp() {
|
|||
# Creates the entries for autocomplete on searches #
|
||||
####################################################
|
||||
function populateAutoComplete() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths, $caSettings;
|
||||
$templates = readJsonFile($caPaths['community-templates-info']);
|
||||
$autoComplete = array_map(function($x){return str_replace(":","",tr($x['Cat']));},readJsonFile($caPaths['categoryList']));
|
||||
foreach ($templates as $template) {
|
||||
|
@ -1417,10 +1420,7 @@ function populateAutoComplete() {
|
|||
$autoComplete[$template['Repo']] = $template['Repo'];
|
||||
}
|
||||
$name = trim(strtolower($template['SortName']));
|
||||
/* if ( $name !== "pihole template" ) {
|
||||
$name = str_ireplace(strtolower($template['Author'])."-","",$name);
|
||||
$name = str_ireplace(strtolower($template['Author'])." ","",$name);
|
||||
} */
|
||||
|
||||
$autoComplete[$name] = $name;
|
||||
if ( startsWith($autoComplete[$name],"dynamix ") )
|
||||
$autoComplete[$name] = str_replace("dynamix ","",$autoComplete[$name]);
|
||||
|
@ -1451,7 +1451,6 @@ function populateAutoComplete() {
|
|||
# Displays the changelog #
|
||||
##########################
|
||||
function caChangeLog() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
$o = "<div style='margin:auto;width:500px;'>";
|
||||
$o .= "<div class='ca_center'><font size='4rem'>".tr("Community Applications Changelog")."</font></div><br><br>";
|
||||
postReturn(["changelog"=>$o.Markdown(plugin("changes","/var/log/plugins/community.applications.plg"))."<br><br>"]);
|
||||
|
@ -1461,7 +1460,7 @@ function caChangeLog() {
|
|||
# Populates the category list #
|
||||
###############################
|
||||
function get_categories() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths, $sortOrder;
|
||||
$categories = readJsonFile($caPaths['categoryList']);
|
||||
if ( ! is_array($categories) || empty($categories) ) {
|
||||
$cat = "<span class='ca_fa-warning'></span> Category list N/A<br><br>";
|
||||
|
@ -1512,7 +1511,6 @@ function get_categories() {
|
|||
# Get the html for the popup #
|
||||
##############################
|
||||
function getPopupDescription() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
$appNumber = getPost("appPath","");
|
||||
postReturn(getPopupDescriptionSkin($appNumber));
|
||||
}
|
||||
|
@ -1521,7 +1519,6 @@ function getPopupDescription() {
|
|||
# Get the html for a repo popup #
|
||||
#################################
|
||||
function getRepoDescription() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
$repository = html_entity_decode(getPost("repository",""),ENT_QUOTES);
|
||||
postReturn(getRepoDescriptionSkin($repository));
|
||||
}
|
||||
|
@ -1530,7 +1527,8 @@ function getRepoDescription() {
|
|||
# Creates the XML for a container install #
|
||||
###########################################
|
||||
function createXML() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths;
|
||||
|
||||
$xmlFile = getPost("xml","");
|
||||
if ( ! $xmlFile ) {
|
||||
postReturn(["error"=>"CreateXML: XML file was missing"]);
|
||||
|
@ -1624,7 +1622,8 @@ function createXML() {
|
|||
# Switch to a language #
|
||||
########################
|
||||
function switchLanguage() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths;
|
||||
|
||||
$language = getPost("language","");
|
||||
if ( $language == "en_US" )
|
||||
$language = "";
|
||||
|
@ -1643,7 +1642,6 @@ function switchLanguage() {
|
|||
# Delete multiple checked off apps from previous apps #
|
||||
#######################################################
|
||||
function remove_multiApplications() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
$apps = getPostArray("apps");
|
||||
if ( ! count($apps) ) {
|
||||
postReturn(["error"=>"No apps were in post when trying to remove multiple applications"]);
|
||||
|
@ -1666,7 +1664,8 @@ function remove_multiApplications() {
|
|||
# Get's the categories present on a search #
|
||||
############################################
|
||||
function getCategoriesPresent() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths;
|
||||
|
||||
if ( is_file($caPaths['community-templates-allSearchResults']) )
|
||||
$displayed = readJsonFile($caPaths['community-templates-allSearchResults']);
|
||||
else
|
||||
|
@ -1694,9 +1693,9 @@ function getCategoriesPresent() {
|
|||
# Set's the favourite repository #
|
||||
##################################
|
||||
function toggleFavourite() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
$repository = html_entity_decode(getPost("repository",""),ENT_QUOTES);
|
||||
global $caPaths;
|
||||
|
||||
$repository = html_entity_decode(getPost("repository",""),ENT_QUOTES);
|
||||
$caSettings['favourite'] = $repository;
|
||||
write_ini_file($caPaths['pluginSettings'],$caSettings);
|
||||
postReturn(['status'=>"ok"]);
|
||||
|
@ -1706,14 +1705,15 @@ function toggleFavourite() {
|
|||
# Returns the favourite repository #
|
||||
####################################
|
||||
function getFavourite() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caSettings;
|
||||
|
||||
postReturn(["favourite"=>$caSettings['favourite']]);
|
||||
}
|
||||
##########################
|
||||
# Changes the sort order #
|
||||
##########################
|
||||
function changeSortOrder() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths, $sortOrder;
|
||||
|
||||
$sortOrder = getPostArray("sortOrder");
|
||||
writeJsonFile($caPaths['sortOrder'],$sortOrder);
|
||||
|
@ -1745,13 +1745,16 @@ function changeSortOrder() {
|
|||
# Gets the sort order when restoring state #
|
||||
############################################
|
||||
function getSortOrder() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $sortOrder;
|
||||
|
||||
postReturn(["sortBy"=>$sortOrder['sortBy'],"sortDir"=>$sortOrder['sortDir']]);
|
||||
}
|
||||
|
||||
############################################################
|
||||
# Reset the sort order to default when reloading Apps page #
|
||||
############################################################
|
||||
function defaultSortOrder() {
|
||||
global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder;
|
||||
global $caPaths, $sortOrder;
|
||||
|
||||
$sortOrder['sortBy'] = "Name";
|
||||
$sortOrder['sortDir'] = "Up";
|
||||
|
|
|
@ -868,7 +868,7 @@ function getRepoDescriptionSkin($repository) {
|
|||
|
||||
$t .= "<div class='popupTitle'>$repository</div>";
|
||||
$t .= "<div class='ca_hr'></div>";
|
||||
$t .= "<div class='popupIconArea ca_center'><img class='popupIcon' src='{$repo['icon']}'></div>";
|
||||
$t .= "<div class='popupIconArea ca_center'><img class='popupIcon' src='{$repo['icon']}' onerror='this.src="/plugins/dynamix.docker.manager/images/question.png"'></div>";
|
||||
$repo['bio'] = $repo['bio'] ? markdown($repo['bio']) : "<br><center>".tr("No description present");
|
||||
$t .= "<div class='popupDescriptionArea ca_center'><br>".strip_tags($repo['bio'])."</div>";
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user