diff --git a/archive/community.applications-2022.01.02-x86_64-1.txz b/archive/community.applications-2022.01.02-x86_64-1.txz new file mode 100644 index 00000000..96abde84 Binary files /dev/null and b/archive/community.applications-2022.01.02-x86_64-1.txz differ diff --git a/source/community.applications/usr/local/emhttp/plugins/community.applications/Apps.page b/source/community.applications/usr/local/emhttp/plugins/community.applications/Apps.page index 428be1f9..9be25186 100644 --- a/source/community.applications/usr/local/emhttp/plugins/community.applications/Apps.page +++ b/source/community.applications/usr/local/emhttp/plugins/community.applications/Apps.page @@ -1224,26 +1224,78 @@ function pinnedApps() { }); } -function displayTags(leadTemplate,rename=false) { +function displayTags(leadTemplate,rename=false,comment="",ports="") { event.stopPropagation(); closeSidebar(); - post({action:'displayTags',leadTemplate:leadTemplate,noSpinner:true,rename:rename},function(result) { - disableSearch(); + var flag = false; + + if ( ports ) { + ports = JSON.parse(ports); + if ( ports ) { + ports.forEach(function(port){ + portsInUse.forEach(function(used) { + if (port == used) + flag = true; + }); + }); + } + if (flag) { + comment = comment.concat("
"); + } + } + if (comment) { swal({ - title: "", - text: result.tags, - html: true, - type: "warning", + title: "", + text: comment, + allowOutsideClick: true, + showConfirmButton: true, showCancelButton: true, - showConfirmButton: false, + confirmButtonText: "", cancelButtonText: "", - allowOutsideClick: true - }, function(isConfirm) { - if ( ! isConfirm ) { - enableSearch(); + animation: false, + type: "warning", + html: true, + closeOnConfirm: false + },function(isConfirm) { + if (isConfirm) { + post({action:'displayTags',leadTemplate:leadTemplate,noSpinner:true,rename:rename},function(result) { + disableSearch(); + swal({ + title: "", + text: result.tags, + html: true, + type: "warning", + showCancelButton: true, + showConfirmButton: false, + cancelButtonText: "", + allowOutsideClick: true + }, function(isConfirm) { + if ( ! isConfirm ) { + enableSearch(); + } + }); + }); } }); - }); + } else { + post({action:'displayTags',leadTemplate:leadTemplate,noSpinner:true,rename:rename},function(result) { + disableSearch(); + swal({ + title: "", + text: result.tags, + html: true, + type: "warning", + showCancelButton: true, + showConfirmButton: false, + cancelButtonText: "", + allowOutsideClick: true + }, function(isConfirm) { + if ( ! isConfirm ) { + enableSearch(); + } + }); + }); + } } function makePlural(string,count) { diff --git a/source/community.applications/usr/local/emhttp/plugins/community.applications/ca.md5 b/source/community.applications/usr/local/emhttp/plugins/community.applications/ca.md5 index 2fd3cfe1..0c49afbf 100644 --- a/source/community.applications/usr/local/emhttp/plugins/community.applications/ca.md5 +++ b/source/community.applications/usr/local/emhttp/plugins/community.applications/ca.md5 @@ -1,9 +1,9 @@ -93430cdb88eb296df5d5753f6c575ea8 ./Apps.page +8c0556f3cbebc296709cd3ef7622fae3 ./Apps.page 4e55f7483b661af21a25b677179baffe ./CA_notices.page c7c6da0a4a4a7ac33f387ea178319bae ./ca_settings.page ed2883d6c44c19304c431079596a1731 ./default.cfg afe60a2b41646f7904be1db8c836f851 ./include/exec.php -192f3642aba7260d90e723d86a1fe257 ./include/helpers.php +fb3835932cb817d530eb0fde0c788dc5 ./include/helpers.php d827ebdf8c29aa6a9818df043a37721e ./include/paths.php 532fffdf939594c143e679da02bd841e ./javascript/libraries.js b398273cf7daa62ab00d2de2336ca25f ./README.md @@ -21,4 +21,4 @@ a1401a0bed89c182b69f0c7508282c1f ./scripts/pluginInstall.php 34554a56611dfe625889c82afd5138de ./scripts/updatePluginSupport.php dec0ef21fb5bd704cd319e0a059a11ba ./skins/Narrow/css.php 7d827147dc8ede3d518b2cacae1d385b ./skins/Narrow/skin.html -b31866f877bd4cd0a9be91b15ed9d0b8 ./skins/Narrow/skin.php +1a27517d5081d2ef2191775e41303a5a ./skins/Narrow/skin.php diff --git a/source/community.applications/usr/local/emhttp/plugins/community.applications/include/helpers.php b/source/community.applications/usr/local/emhttp/plugins/community.applications/include/helpers.php index cb9ff80f..3c045f08 100644 --- a/source/community.applications/usr/local/emhttp/plugins/community.applications/include/helpers.php +++ b/source/community.applications/usr/local/emhttp/plugins/community.applications/include/helpers.php @@ -662,18 +662,17 @@ function debug($str) { # Gets the default ports in a template # ######################################## function portsUsed($template) { - if ( $template['Network'] !== "bridge" || ! is_array($template['Config']) ) + if ( $template['Network'] !== "bridge") return; - $portsUsed = []; if ( $template['Config']['@attributes'] ) $template['Config'] = ['@attributes'=>$template['Config']]; - - foreach ($template['Config'] as $config) { - if ( $config['@attributes']['Type'] !== "Port" ) continue; - $portsUsed[] = $config['value'] ?: $config['@attributes']['Default']; - } - + if ( is_array($template['Config']) ) { + foreach ($template['Config'] as $config) { + if ( $config['@attributes']['Type'] !== "Port" ) continue; + $portsUsed[] = $config['value'] ?: $config['@attributes']['Default']; + } + } return json_encode($portsUsed); } diff --git a/source/community.applications/usr/local/emhttp/plugins/community.applications/skins/Narrow/skin.php b/source/community.applications/usr/local/emhttp/plugins/community.applications/skins/Narrow/skin.php index e7ec1e08..8043071f 100644 --- a/source/community.applications/usr/local/emhttp/plugins/community.applications/skins/Narrow/skin.php +++ b/source/community.applications/usr/local/emhttp/plugins/community.applications/skins/Narrow/skin.php @@ -95,6 +95,11 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false) } else { $actionsContext = []; $selected = false; + $installComment = $template['CAComment']; + + if ( ! $installComment && $template['Requires'] ) + $installComment = tr("This application has additional requirements")."
".markdown($template['Requires']); + if ( ! $template['Language'] ) { if ( ! $template['NoInstall'] && ! $caSettings['NoInstalls']) { if ( ! $template['Plugin'] ) { @@ -120,9 +125,9 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false) } if ( $caSettings['defaultReinstall'] == "true" ) { if ( $template['BranchID'] ) - $actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install second instance"),"action"=>"displayTags('{$template['ID']}',true);"); + $actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install second instance"),"action"=>"displayTags('{$template['ID']}',true,'".str_replace(" "," ",htmlspecialchars($installComment))."','".portsUsed($template)."');"); else - $actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install second instance"),"action"=>"popupInstallXML('".addslashes($template['Path'])."','second','','".portsUsed($template)."');"); + $actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install second instance"),"action"=>"popupInstallXML('".addslashes($template['Path'])."','second','".str_replace(" "," ",htmlspecialchars($installComment))."','".portsUsed($template)."');"); } $actionsContext[] = array("icon"=>"ca_fa-edit","text"=>tr("Edit"),"action"=>"popupInstallXML('".addslashes($info[$ind]['template'])."','edit');"); $actionsContext[] = array("divider"=>true); @@ -138,9 +143,6 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false) $actionsContext[] = array("divider"=>true); $actionsContext[] = array("icon"=>"ca_fa-delete","text"=>tr("Remove from Previous Apps"),"action"=>"removeApp('{$template['InstallPath']}','{$template['Name']}');"); } else { - $installComment = $template['CAComment']; - if ( ! $installComment && $template['Requires'] ) - $installComment = tr("This application has additional requirements")."
".markdown($template['Requires']); if ( ! $template['BranchID'] ) { if ( is_file("{$caPaths['dockerManTemplates']}/my-{$template['Name']}.xml") ) { $test = readXmlFile("{$caPaths['dockerManTemplates']}/my-{$template['Name']}.xml",true); @@ -152,8 +154,7 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false) } $actionsContext[] = array("icon"=>"ca_fa-install","text"=>"Install","action"=>"popupInstallXML('".addslashes($template['Path'])."','default','".str_replace(" "," ",htmlspecialchars($installComment))."','".portsUsed($template)."');"); } else { - - $actionsContext[] = array("icon"=>"ca_fa-install","text"=>"Install","action"=>"displayTags('{$template['ID']}',false,'".str_replace(" "," ",htmlspecialchars($installComment))."','','".portsUsed($userTemplate)."');"); + $actionsContext[] = array("icon"=>"ca_fa-install","text"=>"Install","action"=>"displayTags('{$template['ID']}',false,'".str_replace(" "," ",htmlspecialchars($installComment))."','".portsUsed($template)."');"); } } } @@ -520,7 +521,7 @@ function getPopupDescriptionSkin($appNumber) { } if ( $caSettings['defaultReinstall'] == "true" ) { if ( $template['BranchID'] ) - $actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install second instance"),"action"=>"displayTags('{$template['ID']}',true);"); + $actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install second instance"),"action"=>"displayTags('{$template['ID']}',true,'','".portsUsed($template)."');"); else $actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install second instance"),"action"=>"popupInstallXML('".addslashes($template['Path'])."','second','','".portsUsed($template)."');"); } @@ -538,9 +539,9 @@ function getPopupDescriptionSkin($appNumber) { if ( ( $template['Compatible'] || $caSettings['hideIncompatible'] !== "true" ) ) { if ( !$template['Deprecated'] || $caSettings['hideDeprecated'] !== "true" ) { if ( ! $template['BranchID'] ) { - $actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install"),"action"=>"popupInstallXML('".addslashes($template['Path'])."','default','','".portsUsed($userTemplate)."');"); + $actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install"),"action"=>"popupInstallXML('".addslashes($template['Path'])."','default','','".portsUsed($template)."');"); } else { - $actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install"),"action"=>"displayTags('{$template['ID']}');"); + $actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install"),"action"=>"displayTags('{$template['ID']}',false,'','".portsUsed($template)."');"); } } }