Преглед на файлове

Upgrade: Rework Source Code option to be more flexible.

fusionate преди 1 година
родител
ревизия
fb7d4b1e23
променени са 2 файла, в които са добавени 105 реда и са изтрити 59 реда
  1. 49 20
      core/upgrade/app_languages.php
  2. 56 39
      core/upgrade/index.php

+ 49 - 20
core/upgrade/app_languages.php

@@ -925,26 +925,55 @@ $text['description-upgrade_source']['zh-cn'] = "从存储库更新FusionPBX源
 $text['description-upgrade_source']['ja-jp'] = "FusionPBXソースファイルをリポジトリから更新します。";
 $text['description-upgrade_source']['ko-kr'] = "저장소에서 Fusionpbx 소스 파일을 업데이트합니다.";
 
-$text['description-update_apps']['en-us'] = "Updates optional app source files from the respository.";
-$text['description-update_apps']['en-gb'] = "Updates optional app source files from the respository.";
-$text['description-update_apps']['ar-eg'] = "";
-$text['description-update_apps']['de-at'] = "Aktualisiert den Quellcode aus dem Repository"; //copied from de-de
-$text['description-update_apps']['de-ch'] = "Aktualisiert den Quellcode aus dem Repository"; //copied from de-de
-$text['description-update_apps']['de-de'] = "Aktualisiert den Quellcode aus dem Repository";
-$text['description-update_apps']['es-cl'] = "Archivos de origen Actualizaciones del repositorio.";
-$text['description-update_apps']['es-mx'] = "Archivos de origen Actualizaciones del repositorio."; //copied from es-cl
-$text['description-update_apps']['fr-ca'] = "Mise à jour du code source de depuis le dépôt."; //copied from fr-fr
-$text['description-update_apps']['fr-fr'] = "Mise à jour du code source de depuis le dépôt.";
-$text['description-update_apps']['he-il'] = "";
-$text['description-update_apps']['it-it'] = "Aggiorna il files sorgente di dal repository.";
-$text['description-update_apps']['nl-nl'] = "";
-$text['description-update_apps']['pl-pl'] = "Uaktualnia pliki źródłowe z przechowalni.";
-$text['description-update_apps']['pt-br'] = "Atualiza o a partir dos arquivos de código fonte do repositório.";
-$text['description-update_apps']['pt-pt'] = "Arquivos de origem Atualizações do repositório.";
-$text['description-update_apps']['ro-ro'] = "";
-$text['description-update_apps']['ru-ru'] = "Обновляет исходные файлы из репозитория.";
-$text['description-update_apps']['sv-se'] = "Uppdaterar källfiler från respository.";
-$text['description-update_apps']['uk-ua'] = "Оновлення вихідних файлів  з репозиторію Subversion .";
+// $text['description-update_apps']['en-us'] = "Updates optional app source files from the respository.";
+// $text['description-update_apps']['en-gb'] = "Updates optional app source files from the respository.";
+// $text['description-update_apps']['ar-eg'] = "يقوم بتحديث ملفات مصدر التطبيق الاختيارية من المستودع.";
+// $text['description-update_apps']['de-at'] = "Aktualisiert den Quellcode aus dem Repository"; //copied from de-de
+// $text['description-update_apps']['de-ch'] = "Aktualisiert den Quellcode aus dem Repository"; //copied from de-de
+// $text['description-update_apps']['de-de'] = "Aktualisiert den Quellcode aus dem Repository";
+// $text['description-update_apps']['el-gr'] = "Ενημερώνει τα προαιρετικά αρχεία προέλευσης εφαρμογών από το αποθετήριο.";
+// $text['description-update_apps']['es-cl'] = "Archivos de origen Actualizaciones del repositorio.";
+// $text['description-update_apps']['es-mx'] = "Archivos de origen Actualizaciones del repositorio."; //copied from es-cl
+// $text['description-update_apps']['fr-ca'] = "Mise à jour du code source de depuis le dépôt."; //copied from fr-fr
+// $text['description-update_apps']['fr-fr'] = "Mise à jour du code source de depuis le dépôt.";
+// $text['description-update_apps']['he-il'] = "מעדכן קבצי מקור אפליקציה אופציונליים מהמאגר.";
+// $text['description-update_apps']['it-it'] = "Aggiorna il files sorgente di dal repository.";
+// $text['description-update_apps']['nl-nl'] = "Werkt optionele app-bronbestanden bij vanuit de repository.";
+// $text['description-update_apps']['pl-pl'] = "Uaktualnia pliki źródłowe z przechowalni.";
+// $text['description-update_apps']['pt-br'] = "Atualiza o a partir dos arquivos de código fonte do repositório.";
+// $text['description-update_apps']['pt-pt'] = "Arquivos de origem Atualizações do repositório.";
+// $text['description-update_apps']['ro-ro'] = "Actualizează fișierele sursă opționale ale aplicației din depozit.";
+// $text['description-update_apps']['ru-ru'] = "Обновляет исходные файлы из репозитория.";
+// $text['description-update_apps']['sv-se'] = "Uppdaterar källfiler från respository.";
+// $text['description-update_apps']['uk-ua'] = "Оновлення вихідних файлів  з репозиторію Subversion .";
+// $text['description-update_apps']['zh-cn'] = "从存储库更新可选应用程序源文件。";
+// $text['description-update_apps']['ja-jp'] = "オプションのアプリのソース ファイルをリポジトリから更新します。";
+// $text['description-update_apps']['ko-kr'] = "리포지토리에서 선택적 앱 소스 파일을 업데이트합니다.";
+
+$text['description-all_applications']['en-us'] = "All Applications";
+$text['description-all_applications']['en-gb'] = "All Applications";
+$text['description-all_applications']['ar-eg'] = "جميع التطبيقات";
+$text['description-all_applications']['de-at'] = "Alle Anwendungen";
+$text['description-all_applications']['de-ch'] = "Alle Anwendungen";
+$text['description-all_applications']['de-de'] = "Alle Anwendungen";
+$text['description-all_applications']['el-gr'] = "Όλες οι Εφαρμογές";
+$text['description-all_applications']['es-cl'] = "Todas las aplicaciones";
+$text['description-all_applications']['es-mx'] = "Todas las aplicaciones";
+$text['description-all_applications']['fr-ca'] = "Toutes les candidatures";
+$text['description-all_applications']['fr-fr'] = "Toutes les candidatures";
+$text['description-all_applications']['he-il'] = "כל היישומים";
+$text['description-all_applications']['it-it'] = "Tutte le applicazioni";
+$text['description-all_applications']['nl-nl'] = "Alle toepassingen";
+$text['description-all_applications']['pl-pl'] = "Wszystkie aplikacje";
+$text['description-all_applications']['pt-br'] = "Todos os aplicativos";
+$text['description-all_applications']['pt-pt'] = "Todos os aplicativos";
+$text['description-all_applications']['ro-ro'] = "Toate aplicațiile";
+$text['description-all_applications']['ru-ru'] = "Все приложения";
+$text['description-all_applications']['sv-se'] = "Alla applikationer";
+$text['description-all_applications']['uk-ua'] = "Усі додатки";
+$text['description-all_applications']['zh-cn'] = "所有应用程序";
+$text['description-all_applications']['ja-jp'] = "すべてのアプリケーション";
+$text['description-all_applications']['ko-kr'] = "모든 애플리케이션";
 
 $text['description-upgrade_schema']['en-us'] = "Checks to ensure table and field integrity in the database.";
 $text['description-upgrade_schema']['en-gb'] = "Checks to ensure table and field integrity in the database.";

+ 56 - 39
core/upgrade/index.php

@@ -140,6 +140,21 @@
 
 	}
 
+//find optional apps with repos
+	$updateable_repos = git_find_repos($_SERVER["PROJECT_ROOT"]."/app");
+	if (!empty($updateable_repos) && is_array($updateable_repos) && @sizeof($updateable_repos) != 0) {
+		foreach ($updateable_repos as $app_path => $repo) {
+			$x = 0;
+			include $app_path.'/app_config.php';
+			$updateable_repos[$app_path]['app'] = $repo[0];
+			$updateable_repos[$app_path]['name'] = $apps[$x]['name'];
+			$updateable_repos[$app_path]['uuid'] = $apps[$x]['uuid'];
+			$updateable_repos[$app_path]['version'] = $apps[$x]['version'];
+			$updateable_repos[$app_path]['description'] = $apps[$x]['description'][$_SESSION['domain']['language']['code']];
+			unset($apps, $updateable_repos[$app_path][0]);
+		}
+	}
+
 //adjust color and initialize step counter
 	$step = 1;
 	$step_color = isset($_SESSION['theme']['upgrade_step_color']['text']) ? $_SESSION['theme']['upgrade_step_color']['text'] : color_adjust((!empty($_SESSION['theme']['form_table_label_background_color']['text']) ? $_SESSION['theme']['form_table_label_background_color']['text'] : '#e5e9f0'), -0.1);
@@ -166,13 +181,17 @@
 
 	if (permission_exists("upgrade_source") && !is_dir("/usr/share/examples/fusionpbx") && is_writeable($_SERVER["PROJECT_ROOT"]."/.git")) {
 		echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
-		echo "<tr onclick=\"document.getElementById('do_source').checked = !document.getElementById('do_source').checked; (!document.getElementById('do_source').checked ? $('.do_optional_app').prop('checked', false) : null); $('#tr_optional_apps').slideToggle('fast');\">\n";
+		echo "<tr onclick=\"document.getElementById('do_source').checked = !document.getElementById('do_source').checked;\">\n";
 		echo "	<td width='30%' class='vncellreq' style='vertical-align: middle;'>\n";
 		echo "		<div style='".$step_container_style."'><span style='".$step_number_style."'>".$step."</span></div>";
 		echo "		<div class='mt-1'>".$text['label-upgrade_source']."</div>\n";
 		echo "	</td>\n";
 		echo "	<td width='70%' class='vtable' style='height: 50px; cursor: pointer;'>\n";
-		echo "		<input type='checkbox' name='action[upgrade_source]' id='do_source' value='1' onclick=\"event.stopPropagation(); $('#tr_optional_apps').slideToggle('fast'); (!document.getElementById('do_source').checked ? $('.do_optional_app').prop('checked', false) : null);\"> &nbsp;".$text['description-upgrade_source']."<br />\n";
+		echo "		<div style='float: left; clear: both;'>\n";
+		echo "			<input type='checkbox' name='action[upgrade_source]' id='do_source' value='1' onclick=\"event.stopPropagation();\">\n";
+		echo "		</div>\n";
+		echo "		<div style='overflow: hidden;'>\n";
+		echo "			 &nbsp;&nbsp;".$text['description-upgrade_source']."&nbsp;\n";
 		//show current git version info
 		chdir($_SERVER["PROJECT_ROOT"]);
 		exec("git rev-parse --abbrev-ref HEAD 2>&1", $git_current_branch, $branch_return_value);
@@ -180,52 +199,50 @@
 		exec("git log --pretty=format:'%H' -n 1 2>&1", $git_current_commit, $commit_return_value);
 		$git_current_commit = $git_current_commit[0];
 		if (!is_numeric($git_current_branch)) {
-			echo "	<span style='font-weight: 600;'>".software::version()."</span>&nbsp;\n";
+			echo "		<span style='font-weight: 600;'>".software::version()."</span>&nbsp;\n";
 		}
 		if ($branch_return_value == 0 && $commit_return_value == 0) {
-			echo "	<a href='https://github.com/fusionpbx/fusionpbx/compare/".$git_current_commit."...".$git_current_branch."' target='_blank' title='".$git_current_commit."' onclick=\"event.stopPropagation();\"><i>".$git_current_branch."</i></a>";
+			echo "		<a href='https://github.com/fusionpbx/fusionpbx/compare/".$git_current_commit."...".$git_current_branch."' target='_blank' title='".$git_current_commit."' onclick=\"event.stopPropagation();\"><i>".$git_current_branch."</i></a>";
+		}
+		echo "		</div>\n";
+		if (!empty($updateable_repos)) {
+			echo "<div style='float: left; clear: both;'>\n";
+			echo "	<input type='checkbox' id='view_optional' onclick=\"event.stopPropagation(); if (!$(this).prop('checked')) { $('.do_optional_app').prop('checked', false); } else { $('#tr_optional_apps').slideDown('fast'); $('.do_optional_app').prop('checked', true); }\">\n";
+			echo "</div>\n";
+			echo "<div style='overflow: hidden;'>\n";
+			echo "	<span onclick=\"event.stopPropagation(); $('#tr_optional_apps').slideToggle('fast');\">&nbsp;&nbsp;".$text['description-all_applications']." (".@sizeof($updateable_repos).")</span>\n";
+			echo "</div>\n";
 		}
 		echo "	</td>\n";
 		echo "</tr>\n";
 		echo "</table>\n";
 
-		//find and show optional apps with repos
-		$updateable_repos = git_find_repos($_SERVER["PROJECT_ROOT"]."/app");
-		if (!empty($updateable_repos) && is_array($updateable_repos) && @sizeof($updateable_repos) != 0) {
-			foreach ($updateable_repos as $app_path => $repo) {
-				$x = 0;
-				include $app_path.'/app_config.php';
-				$updateable_repos[$app_path]['app'] = $repo[0];
-				$updateable_repos[$app_path]['name'] = $apps[$x]['name'];
-				$updateable_repos[$app_path]['uuid'] = $apps[$x]['uuid'];
-				$updateable_repos[$app_path]['version'] = $apps[$x]['version'];
-				$updateable_repos[$app_path]['description'] = $apps[$x]['description'][$_SESSION['domain']['language']['code']];
-				unset($apps, $updateable_repos[$app_path][0]);
-			}
-		}
-		echo "<div id='tr_optional_apps' style='display: none;'>\n";
-		foreach ($updateable_repos as $repo => $app) {
-			$repo_info = git_repo_info($repo);
-			$pull_method = substr($repo_info['url'], 0, 4) == 'http' ? 'http' : 'ssh';
-			if (!$repo_info) { continue; }
-			echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
-			echo "<tr onclick=\"if (document.getElementById('do_".$app['app']."')) { document.getElementById('do_".$app['app']."').checked = !document.getElementById('do_".$app['app']."').checked; }\">\n";
-			echo "	<td width='30%' class='vncell' style='vertical-align: middle;'>\n";
-			echo "		".$app['name']."\n";
-			echo "	</td>\n";
-			echo "	<td width='70%' class='vtable' style='height: 50px; cursor: ".($pull_method == 'http' ? "pointer;'" : "help;' title=\"".$text['message-upgrade_manually'].": ".$repo_info['url']."\"").">\n";
-			if ($pull_method == 'http') {
-				echo "	<input type='checkbox' name='action[optional_apps][]' class='do_optional_app' id='do_".$app['app']."' value='".$app['app']."' onclick=\"event.stopPropagation();\"> &nbsp;".$app['description']."<br />\n";
-			}
-			else {
-				echo "	<i class='fas fa-ban mr-3' style='opacity: 0.4;'></i> &nbsp;".$app['description']."<br>\n";
+		//show optional apps with repos
+		if (!empty($updateable_repos)) {
+			echo "<div id='tr_optional_apps' style='display: none;'>\n";
+			foreach ($updateable_repos as $repo => $app) {
+				$repo_info = git_repo_info($repo);
+				$pull_method = substr($repo_info['url'], 0, 4) == 'http' ? 'http' : 'ssh';
+				if (!$repo_info) { continue; }
+				echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
+				echo "<tr onclick=\"if (document.getElementById('do_".$app['app']."')) { document.getElementById('do_".$app['app']."').checked = !document.getElementById('do_".$app['app']."').checked; }\">\n";
+				echo "	<td width='30%' class='vncell' style='vertical-align: middle;'>\n";
+				echo "		".$app['name']."\n";
+				echo "	</td>\n";
+				echo "	<td width='70%' class='vtable' style='height: 50px; cursor: ".($pull_method == 'http' ? "pointer;'" : "help;' title=\"".$text['message-upgrade_manually'].": ".$repo_info['url']."\"").">\n";
+				if ($pull_method == 'http') {
+					echo "	<input type='checkbox' name='action[optional_apps][]' class='do_optional_app' id='do_".$app['app']."' value='".$app['app']."' onclick=\"event.stopPropagation();\"> &nbsp;".$app['description']."<br />\n";
+				}
+				else {
+					echo "	<i class='fas fa-ban mr-3' style='opacity: 0.4;'></i> &nbsp;".$app['description']."<br>\n";
+				}
+				echo "		<span style='font-weight: 600;'>".$app['version']."</span>&nbsp;&nbsp;<i><a href='".str_replace(['git@','.com:'],['https://','.com/'], $repo_info['url'])."/compare/".$repo_info['commit']."...".$repo_info['branch']." 'target='_blank' title='".$repo_info['commit']."'>".$repo_info['branch']."</i></a>\n";
+				echo "	</td>\n";
+				echo "</tr>\n";
+				echo "</table>\n";
 			}
-			echo "		<span style='font-weight: 600;'>".$app['version']."</span>&nbsp;&nbsp;<i><a href='".str_replace(['git@','.com:'],['https://','.com/'], $repo_info['url'])."/compare/".$repo_info['commit']."...".$repo_info['branch']." 'target='_blank' title='".$repo_info['commit']."'>".$repo_info['branch']."</i></a>\n";
-			echo "	</td>\n";
-			echo "</tr>\n";
-			echo "</table>\n";
+			echo "</div>\n";
 		}
-		echo "</div>\n";
 		$step++;
 	}