fixed: going to plugin's settings would crash CA when returning back to it.

pull/11/head
Squidly271 2022-06-27 19:03:31 -04:00
parent 6ade33be35
commit 87a103523f
4 changed files with 35 additions and 10 deletions

View File

@ -1112,6 +1112,7 @@ function awesompleteSearch() {
function openNewWindow(newURL,target='_self') {
saveState();
var popUp = window.open(newURL,target);
if ( !popUp || popUp.closed || typeof popUp == "undefined" ) {
addBannerWarning("<?tr("Popup Blocked. CA requires popups to be enabled under certain circumstances. You must white list your server within your browser to allow popups")?>",true,true);
@ -1184,6 +1185,8 @@ function actuallyInstallPlugin(pluginURL,update=false,comment="") {
html: true
}, function (isConfirm) {
if (isConfirm) {
hidePluginPending(pluginURL);
if ( $(".selectedMenu").data("category") == "action_centre" ) {
var postFunction = "actionCentre";
} else {
@ -1204,6 +1207,8 @@ function actuallyInstallPlugin(pluginURL,update=false,comment="") {
}
});
} else {
hidePluginPending(pluginURL);
if ( $(".selectedMenu").data("category") == "action_centre" ) {
var postFunction = "actionCentre";
} else {
@ -1223,6 +1228,22 @@ function actuallyInstallPlugin(pluginURL,update=false,comment="") {
}
function hidePluginPending(pluginURL) {
if ( pluginURL.includes("/") ) {
$(".actionsButton").each(function() {
if ( $(this).data("pluginurl") == pluginURL || $(this).data("pluginurl")+"&deprecated" == pluginURL ) {
$(this).hide();
}
});
} else {
$(".actionsButton").each(function() {
if ( $(this).data("pluginurl").basename() == pluginURL ) {
$(this).hide();
}
});
}
}
function OpenSidebarAndRefreshDisplay() {
post({action:"onStartupScreen"},function(result) {
if (result.status) {
@ -1400,6 +1421,7 @@ function uninstallApp(application,humanName) {
}, function(isConfirm) {
if (isConfirm) {
application = application.basename();
hidePluginPending(application);
<?if ($nchanCom):?>
ca_openPlugin('plugin remove '+application,"<?tr('Uninstall Plugin')?>",'','postUninstallPlugin');
<?else:?>
@ -1901,6 +1923,9 @@ function installMulti() {
$("#sb-nav-close").css("visibility","hidden"); // Because docker install cannot be aborted so why allow window to close
openBox('/plugins/<?=$plugin?>/scripts/installMulti.php?plugin='+plugin+'&docker='+docker,tr('Install '+makePlural("Application",dockerCount)),600,1100,true);
} else {
pluginArray.forEach(function(value) {
hidePluginPending(value[1]);
});
<?if ($nchanCom):?>
ca_openPlugin('multiplugin install '+plugin,tr('Install '+makePlural("Application",pluginCount)),'','refresh');
<?else:?>
@ -2962,12 +2987,7 @@ function getPerPageOpts(value) {
function setupActionCentre() {
// set up action centre - run in background without tying anything up
var acBanner = false;
var bannerTimeout = setTimeout(function(){
acBanner = addBannerWarning("<?tr("Running Background Application Tests")?>",false,true);
},1000);
$.post("/plugins/<?=$plugin?>/include/exec.php",{action:'enableActionCentre'},function(data) {
clearTimeout(bannerTimeout);
removeBannerWarning(acBanner);
var ret = JSON.parse(data);
if ( ret.status == "action" ) {
if ( !$(".actionCentre").is(":visible") ) {

View File

@ -1,4 +1,4 @@
617977f759606771015b3a68b05d5fd3 ./Apps.page
72e80b50ac6810b3dc7919a645d63577 ./Apps.page
4e55f7483b661af21a25b677179baffe ./CA_notices.page
42a1658a916a3a3eed2a9f2af80603c4 ./ca_settings.page
e718d7825dbdc96a17a915079222b098 ./default.cfg
@ -22,4 +22,4 @@ da3b4f9b73c5c3bf65be6c42d68b51f9 ./scripts/showStatistics.php
34554a56611dfe625889c82afd5138de ./scripts/updatePluginSupport.php
25bdaed6f62ac73f9ef7c3ce0c125ef7 ./skins/Narrow/css.php
7eb021a105e2f7a15675ec8a14e6f05e ./skins/Narrow/skin.html
829b14396a99228324be4bf5141dd675 ./skins/Narrow/skin.php
3ef00a2eb4031263ecf7768680c08234 ./skins/Narrow/skin.php

View File

@ -1116,9 +1116,14 @@ function displayCard($template) {
<div class='ca_bottomLine $bottomClass'>
<div class='infoButton_docker dockerPopup' data-dockerHub='$DockerHub'>".tr("Docker Hub")."</div>";
} else {
if ( $PluginURL ) {
$dataPluginURL = "data-pluginurl='$PluginURL'";
} else {
$dataPluginURL = "";
}
$backgroundClickable = "ca_backgroundClickable";
$card .= "
<div class='ca_holder $class $popupType $holderClass' data-apppath='$Path' data-appname='$Name' data-repository='".htmlentities($RepoName,ENT_QUOTES)."'>
<div class='ca_holder $class $popupType $holderClass' data-apppath='$Path' data-appname='$Name' data-repository='".htmlentities($RepoName,ENT_QUOTES)."' $dataPluginURL>
<div class='ca_bottomLine $bottomClass'>
<div class='infoButton $cardClass'>".tr("Info")."</div>
";
@ -1133,10 +1138,10 @@ function displayCard($template) {
if ( $actionsContext ) {
if ( count($actionsContext) == 1) {
$dispText = $actionsContext[0]['alternate'] ?: $actionsContext[0]['text'];
$card .= "<div class='actionsButton' onclick={$actionsContext[0]['action']}>$dispText</div>";
$card .= "<div class='actionsButton' data-pluginURL='$PluginURL' onclick={$actionsContext[0]['action']}>$dispText</div>";
}
else
$card .= "<div class='actionsButton actionsButtonContext' id='actions".preg_replace("/[^a-zA-Z0-9]+/", "",$Name)."$ID' data-context='".json_encode($actionsContext,JSON_HEX_QUOT | JSON_HEX_APOS)."'>".tr("Actions")."</div>";
$card .= "<div class='actionsButton actionsButtonContext' data-pluginURL='$PluginURL' id='actions".preg_replace("/[^a-zA-Z0-9]+/", "",$Name)."$ID' data-context='".json_encode($actionsContext,JSON_HEX_QUOT | JSON_HEX_APOS)."'>".tr("Actions")."</div>";
}
$card .= "<span class='$appType' title='".htmlentities($typeTitle)."'></span>";