Compare commits
	
		
			7 Commits
		
	
	
		
			11_0_0-43_
			...
			11_0_0-48_
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 642d013437 | |||
| a62968d2d9 | |||
| 0e777fd51a | |||
| eee68afa2b | |||
| c2d677594b | |||
| f6fe2216a0 | |||
| 6d3f8f48c2 | 
| @@ -45,6 +45,7 @@ for my $event ( qw( smeserver-manager-update smanager-refresh bootstrap-console- | ||||
|     event_link('locales2-conf', "$event", '80'); | ||||
| } | ||||
|  | ||||
| event_link('post-upgrade-and-reboot','post-upgrade-and-reboot',80); | ||||
| event_link('systemd-default', "smeserver-manager-update", '88'); | ||||
| event_link('systemd-reload', "smeserver-manager-update", '89'); | ||||
| templates2events("/etc/rsyslog.conf", "smeserver-manager-update"); | ||||
|   | ||||
							
								
								
									
										3
									
								
								root/etc/e-smith/events/actions/post-upgrade-and-reboot
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										3
									
								
								root/etc/e-smith/events/actions/post-upgrade-and-reboot
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| #!/bin/bash | ||||
| /usr/sbin/e-smith/signal-event post-upgrade | ||||
| /usr/sbin/e-smith/signal-event reboot | ||||
| @@ -68,9 +68,18 @@ color: #8ebe43; | ||||
| background-color: #8ebe43; | ||||
|     } | ||||
|        | ||||
| /* flag container no flag */ | ||||
| /* flag container*/ | ||||
| #flag-container span { | ||||
|   font-size: 24px; | ||||
| 	font-size: 24px; | ||||
|     display: flex;                     /* Allows for easy centering */ | ||||
|     justify-content: center;           /* Center horizontally */ | ||||
|     align-items: center;               /* Center vertically */ | ||||
|     width: 100%;                       /* Full width of parent */ | ||||
|     height: 24px;                      /* Set a fixed height */ | ||||
|     border: 1px solid #ccc;            /* Light gray border */ | ||||
|     border-radius: 5px;                /* Rounded corners */ | ||||
|     cursor: default;                   /* Prevent text cursor */ | ||||
|  | ||||
| } | ||||
|  | ||||
| .fallback-box { | ||||
| @@ -84,4 +93,4 @@ background-color: #8ebe43; | ||||
| } | ||||
|  | ||||
| HERE | ||||
| } | ||||
| } | ||||
| @@ -1,7 +1,7 @@ | ||||
| [Unit] | ||||
| Description=Server Manager 2 Mojo | ||||
| Requires=network.target httpd-e-smith.service ldap.service | ||||
| After=network.target  | ||||
| Requires=network-online.target httpd-e-smith.service ldap.service | ||||
| After=network-online.target  | ||||
|  | ||||
| [Service] | ||||
| Type=simple | ||||
|   | ||||
| @@ -224,12 +224,12 @@ sub setup_plugins { | ||||
|     # CSRF protection if production mode | ||||
| #    $self->plugin('Mojolicious::Plugin::CSRFDefender' => { | ||||
| #   Adapted plugin for use with GET method | ||||
|     $self->plugin('SrvMngr::Plugin::CSRFDefender' => { | ||||
| 	onetime => 1, | ||||
| 	error_status => 400, | ||||
| 	error_content => 'Error: CSRF token is invalid or outdated' | ||||
|     #$self->plugin('SrvMngr::Plugin::CSRFDefender' => { | ||||
| 	#onetime => 1, | ||||
| 	#error_status => 400, | ||||
| 	#error_content => 'Error: CSRF token is invalid or outdated' | ||||
|     	#error_template => 'csrf_400' | ||||
| 	}) if ( $self->mode eq 'production' ); | ||||
| 	#}) if ( $self->mode eq 'production' ); | ||||
|  | ||||
|     $self->plugin('SrvMngr::Plugin::I18N' => {namespace => 'SrvMngr::I18N', default => 'en'}); | ||||
|  | ||||
| @@ -866,4 +866,4 @@ sub get_reg_mask { | ||||
| } | ||||
|  | ||||
|  | ||||
| 1; | ||||
| 1; | ||||
| @@ -56,10 +56,11 @@ sub do_action { | ||||
|  | ||||
|             #    esmith::util::backgroundCommand( 1, "/sbin/e-smith/signal-event", "post-upgrade", | ||||
|             #	    "; ", "/sbin/e-smith/signal-event", "reboot" ); | ||||
|             system("/sbin/e-smith/signal-event", "post-upgrade") == 0 | ||||
|                 or die("Error occurred while running post-upgrade.\n"); | ||||
|             system("/sbin/e-smith/signal-event", "reboot") == 0 | ||||
|                 or die("Error occurred while rebooting.\n"); | ||||
|             esmith::util::backgroundCommand( 1, "/sbin/e-smith/signal-event", "post-upgrade-and-reboot"); | ||||
| 		    #system("/sbin/e-smith/signal-event", "post-upgrade") == 0 | ||||
| 		    #or die("Error occurred while running post-upgrade.\n"); | ||||
| 		    #system("/sbin/e-smith/signal-event", "reboot") == 0 | ||||
| 		    #or die("Error occurred while rebooting.\n"); | ||||
|         } ## end unless ($debug) | ||||
|     } ## end elsif ($function eq 'reconfigure') | ||||
|     $c->stash(title => $title, modul => $result); | ||||
|   | ||||
| @@ -17,7 +17,7 @@ use Locale::gettext; | ||||
| use SrvMngr::I18N; | ||||
| use SrvMngr qw(theme_list init_session); | ||||
| use esmith::ConfigDB; | ||||
| use Time::TAI64; | ||||
| #use Time::TAI64; | ||||
| use File::Basename; | ||||
| use HTML::Entities; | ||||
| use esmith::FormMagick qw(gen_locale_date_string); | ||||
| @@ -104,10 +104,11 @@ sub do_action { | ||||
| sub timestamp2local { | ||||
|     $_ = shift; | ||||
|  | ||||
|     if (/^(\@[0-9a-f]{24})(.*)/s) { | ||||
|         return Time::TAI64::tai64nlocal($1) . $2; | ||||
|     } elsif (/^([0-9]{10}\.[0-9]{3})(.*)/s) { | ||||
|         return localtime($1) . $2; | ||||
|     #if (/^(\@[0-9a-f]{24})(.*)/s) { | ||||
|     #    return Time::TAI64::tai64nlocal($1) . $2; | ||||
|     #} els | ||||
| 	if (/^([0-9]{10}\.[0-9]{3})(.*)/s) { | ||||
| 		return localtime($1) . $2; | ||||
|     } | ||||
|     return $_; | ||||
| } ## end sub timestamp2local | ||||
|   | ||||
| @@ -43,8 +43,9 @@ sub init_data { | ||||
| sub reconf_needed { | ||||
|  | ||||
|     my $cdb = esmith::ConfigDB->open_ro() or die("can't open Config DB"); | ||||
|     my $unsafe = ($cdb->get('bootstrap-console') and $cdb->get('bootstrap-console')->prop('Run') eq 'yes') || | ||||
|          ($cdb->get('UnsavedChanges') and $cdb->get('UnsavedChanges')->value eq 'yes') || '0'; | ||||
|     #my $unsafe = ($cdb->get('bootstrap-console') and $cdb->get('bootstrap-console')->prop('Run') eq 'yes') || | ||||
|     #     ($cdb->get('UnsavedChanges') and $cdb->get('UnsavedChanges')->value eq 'yes') || '0'; | ||||
| 	my $unsafe = ($cdb->get('UnsavedChanges') and $cdb->get('UnsavedChanges')->value eq 'yes') || '0';    | ||||
|     return $unsafe; | ||||
| } | ||||
|  | ||||
| @@ -104,5 +105,4 @@ sub check_adminalias { | ||||
| } | ||||
|  | ||||
|  | ||||
| 1; | ||||
|  | ||||
| 1; | ||||
| @@ -1,278 +1,298 @@ | ||||
| document.addEventListener('DOMContentLoaded', () => { | ||||
|   const flagContainer = document.getElementById('flag-container'); | ||||
|  | ||||
|         async function getCountryName(countryCode) { | ||||
|             try { | ||||
|                 const response = await fetch(`https://restcountries.com/v3.1/alpha/${countryCode}`); | ||||
|                 if (!response.ok) throw new Error('Country not found'); | ||||
|                 const data = await response.json(); | ||||
|                 // Return the name in the native language | ||||
|                 return data[0].name.common;  | ||||
|             } catch (error) { | ||||
|                 console.error(error); | ||||
|                 return 'Unknown Country'; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         function getFlagEmoji(locale) { | ||||
|             // Split the locale to get the language and country code | ||||
|             const parts = locale.split('-'); | ||||
|             let countryCode; | ||||
|  | ||||
|             // Handle single subtag (language only) or double subtag (language-country) | ||||
|             if (parts.length === 1) { | ||||
|                 countryCode = getCountryCodeFromLanguage(parts[0]); | ||||
|             } else if (parts.length === 2) { | ||||
|                 countryCode = parts[1].toLowerCase(); // Use the country code | ||||
|             } | ||||
|  | ||||
|             // If country code is not found, set a fallback output | ||||
|             if (!countryCode) { | ||||
|                 const fallback = `? ${locale.toUpperCase()}`; // Just a question mark and the full locale | ||||
|                 return { flag: fallback, isUnknown: true, countryName: 'Unknown Country' }; | ||||
|             } | ||||
|  | ||||
|             // Convert the country code to a flag emoji | ||||
|             return { | ||||
|                 flag: String.fromCodePoint(...[...countryCode.toUpperCase()].map(char => 0x1F1E6 + char.charCodeAt(0) - 'A'.charCodeAt(0))), | ||||
|                 isUnknown: false, | ||||
|                 countryCode: countryCode | ||||
|             }; | ||||
|         } | ||||
|  | ||||
|         function getCountryCodeFromLanguage(language) { | ||||
|             // Map languages to countries (this is an example, extend as needed) | ||||
|             const languageToCountryMap = { | ||||
|                   // Add more mappings as needed | ||||
|     "af": "NA", | ||||
|     "agq": "CM", | ||||
|     "ak": "GH", | ||||
|     "am": "ET", | ||||
|     "ar": "01", | ||||
|     "as": "IN", | ||||
|     "asa": "TZ", | ||||
|     "ast": "ES", | ||||
|     "az": "rl", | ||||
|     "bas": "CM", | ||||
|     "be": "BY", | ||||
|     "bem": "ZM", | ||||
|     "bez": "TZ", | ||||
|     "bg": "BG", | ||||
|     "bm": "ML", | ||||
|     "bn": "BD", | ||||
|     "bo": "CN", | ||||
|     "br": "FR", | ||||
|     "brx": "IN", | ||||
|     "bs": "rl", | ||||
|     "ca": "AD", | ||||
|     "ccp": "BD", | ||||
|     "ce": "RU", | ||||
|     "cgg": "UG", | ||||
|     "chr": "US", | ||||
|     "ckb": "IQ", | ||||
|     "cs": "CZ", | ||||
|     "cy": "GB", | ||||
|     "da": "DK", | ||||
|     "dav": "KE", | ||||
|     "de": "DE", | ||||
|     "dje": "NE", | ||||
|     "dsb": "DE", | ||||
|     "dua": "CM", | ||||
|     "dyo": "SN", | ||||
|     "dz": "BT", | ||||
|     "ebu": "KE", | ||||
|     "ee": "GH", | ||||
|     "el": "CY", | ||||
|     "en": "01", | ||||
|     "es": "ES", | ||||
|     "et": "EE", | ||||
|     "eu": "ES", | ||||
|     "ewo": "CM", | ||||
|     "fa": "AF", | ||||
|     "ff": "CM", | ||||
|     "fi": "FI", | ||||
|     "fil": "PH", | ||||
|     "fo": "FO", | ||||
|     "fr": "FR", | ||||
|     "fur": "IT", | ||||
|     "fy": "NL", | ||||
|     "ga": "IE", | ||||
|     "gd": "GB", | ||||
|     "gl": "ES", | ||||
|     "gsw": "CH", | ||||
|     "gu": "IN", | ||||
|     "guz": "KE", | ||||
|     "gv": "IM", | ||||
|     "ha": "GH", | ||||
|     "haw": "US", | ||||
|     "he": "IL", | ||||
|     "hi": "IN", | ||||
|     "hr": "HR", | ||||
|     "hsb": "DE", | ||||
|     "hu": "HU", | ||||
|     "hy": "AM", | ||||
|     "id": "ID", | ||||
|     "ig": "NG", | ||||
|     "ii": "CN", | ||||
|     "is": "IS", | ||||
|     "it": "IT", | ||||
|     "ja": "JP", | ||||
|     "jgo": "CM", | ||||
|     "jmc": "TZ", | ||||
|     "ka": "GE", | ||||
|     "kab": "DZ", | ||||
|     "kam": "KE", | ||||
|     "kde": "TZ", | ||||
|     "kea": "CV", | ||||
|     "khq": "ML", | ||||
|     "ki": "KE", | ||||
|     "kk": "KZ", | ||||
|     "kkj": "CM", | ||||
|     "kl": "GL", | ||||
|     "kln": "KE", | ||||
|     "km": "KH", | ||||
|     "kn": "IN", | ||||
|     "ko": "KP", | ||||
|     "kok": "IN", | ||||
|     "ks": "IN", | ||||
|     "ksb": "TZ", | ||||
|     "ksf": "CM", | ||||
|     "ksh": "DE", | ||||
|     "kw": "GB", | ||||
|     "ky": "KG", | ||||
|     "lag": "TZ", | ||||
|     "lb": "LU", | ||||
|     "lg": "UG", | ||||
|     "lkt": "US", | ||||
|     "ln": "AO", | ||||
|     "lo": "LA", | ||||
|     "lrc": "IQ", | ||||
|     "lt": "LT", | ||||
|     "lu": "CD", | ||||
|     "luo": "KE", | ||||
|     "Luo": "KE", | ||||
|     "luy": "KE", | ||||
|     "lv": "LV", | ||||
|     "mas": "KE", | ||||
|     "mer": "KE", | ||||
|     "mfe": "MU", | ||||
|     "mg": "MG", | ||||
|     "mgh": "MZ", | ||||
|     "mgo": "CM", | ||||
|     "mk": "MK", | ||||
|     "ml": "IN", | ||||
|     "mn": "MN", | ||||
|     "mr": "IN", | ||||
|     "ms": "BN", | ||||
|     "mt": "MT", | ||||
|     "mua": "CM", | ||||
|     "my": "MM", | ||||
|     "mzn": "IR", | ||||
|     "naq": "NA", | ||||
|     "nb": "NO", | ||||
|     "nd": "ZW", | ||||
|     "nds": "DE", | ||||
|     "ne": "IN", | ||||
|     "nl": "NL", | ||||
|     "nmg": "CM", | ||||
|     "nn": "NO", | ||||
|     "nnh": "CM", | ||||
|     "nus": "SS", | ||||
|     "nyn": "UG", | ||||
|     "om": "ET", | ||||
|     "or": "IN", | ||||
|     "os": "GE", | ||||
|     "pa": "ab", | ||||
|     "pl": "PL", | ||||
|     "ps": "AF", | ||||
|     "pt": "PT", | ||||
|     "qu": "BO", | ||||
|     "rm": "CH", | ||||
|     "rn": "BI", | ||||
|     "ro": "RO", | ||||
|     "rof": "TZ", | ||||
|     "ru": "RU", | ||||
|     "rw": "RW", | ||||
|     "rwk": "TZ", | ||||
|     "sah": "RU", | ||||
|     "saq": "KE", | ||||
|     "sbp": "TZ", | ||||
|     "se": "SE", | ||||
|     "seh": "MZ", | ||||
|     "ses": "ML", | ||||
|     "sg": "CF", | ||||
|     "shi": "tn", | ||||
|     "si": "LK", | ||||
|     "sk": "SK", | ||||
|     "sl": "SI", | ||||
|     "smn": "FI", | ||||
|     "sn": "ZW", | ||||
|     "so": "SO", | ||||
|     "sq": "AL", | ||||
|     "sr": "rl", | ||||
|     "sv": "AX", | ||||
|     "sw": "CD", | ||||
|     "ta": "IN", | ||||
|     "te": "IN", | ||||
|     "teo": "KE", | ||||
|     "tg": "TJ", | ||||
|     "th": "TH", | ||||
|     "ti": "ER", | ||||
|     "to": "TO", | ||||
|     "tr": "TR", | ||||
|     "tt": "RU", | ||||
|     "twq": "NE", | ||||
|     "tzm": "MA", | ||||
|     "ug": "CN", | ||||
|     "uk": "UA", | ||||
|     "ur": "IN", | ||||
|     "uz": "ab", | ||||
|     "vai": "tn", | ||||
|     "Vai": "tn", | ||||
|     "vi": "VN", | ||||
|     "vun": "TZ", | ||||
|     "wae": "CH", | ||||
|     "wo": "SN", | ||||
|     "xog": "UG", | ||||
|     "yav": "CM", | ||||
|     "yi": "01", | ||||
|     "yo": "BJ", | ||||
|     "yue": "ns", | ||||
|     "zgh": "MA", | ||||
|     "zh": "ns", | ||||
|     "zu": "ZA" | ||||
| 	const flagContainer = document.getElementById('flag-container'); | ||||
| 	// Mapping of language codes to country codes and their names | ||||
| 	const languageToCountryMap = { | ||||
| 		"af": { code: "NA", name: "Namibia" }, | ||||
| 		"agq": { code: "CM", name: "Cameroon" }, | ||||
| 		"ak": { code: "GH", name: "Ghana" }, | ||||
| 		"am": { code: "ET", name: "Ethiopia" }, | ||||
| 		"ar": { code: "SA", name: "Saudi Arabia" }, | ||||
| 		"as": { code: "IN", name: "India" }, | ||||
| 		"asa": { code: "TZ", name: "Tanzania" }, | ||||
| 		"ast": { code: "ES", name: "Spain" }, | ||||
| 		"az": { code: "AZ", name: "Azerbaijan" }, | ||||
| 		"bas": { code: "CM", name: "Cameroon" }, | ||||
| 		"be": { code: "BY", name: "Belarus" }, | ||||
| 		"bem": { code: "ZM", name: "Zambia" }, | ||||
| 		"bez": { code: "TZ", name: "Tanzania" }, | ||||
| 		"bg": { code: "BG", name: "Bulgaria" }, | ||||
| 		"bm": { code: "ML", name: "Mali" }, | ||||
| 		"bn": { code: "BD", name: "Bangladesh" }, | ||||
| 		"bo": { code: "CN", name: "China" }, | ||||
| 		"br": { code: "FR", name: "France" }, | ||||
| 		"brx": { code: "IN", name: "India" }, | ||||
| 		"bs": { code: "BA", name: "Bosnia and Herzegovina" }, | ||||
| 		"ca": { code: "AD", name: "Andorra" }, | ||||
| 		"ccp": { code: "BD", name: "Bangladesh" }, | ||||
| 		"ce": { code: "RU", name: "Russia" }, | ||||
| 		"cgg": { code: "UG", name: "Uganda" }, | ||||
| 		"chr": { code: "US", name: "United States" }, | ||||
| 		"ckb": { code: "IQ", name: "Iraq" }, | ||||
| 		"cs": { code: "CZ", name: "Czech Republic" }, | ||||
| 		"cy": { code: "GB", name: "United Kingdom" }, | ||||
| 		"da": { code: "DK", name: "Denmark" }, | ||||
| 		"dav": { code: "KE", name: "Kenya" }, | ||||
| 		"de": { code: "DE", name: "Germany" }, | ||||
| 		"dje": { code: "NE", name: "Niger" }, | ||||
| 		"dsb": { code: "DE", name: "Germany" }, | ||||
| 		"dua": { code: "CM", name: "Cameroon" }, | ||||
| 		"dyo": { code: "SN", name: "Senegal" }, | ||||
| 		"dz": { code: "BT", name: "Bhutan" }, | ||||
| 		"ebu": { code: "KE", name: "Kenya" }, | ||||
| 		"ee": { code: "GH", name: "Ghana" }, | ||||
| 		"el": { code: "CY", name: "Cyprus" }, | ||||
| 		"en": { code: "US", name: "United States" }, // Assume US for English if unspecified | ||||
| 		"es": { code: "ES", name: "Spain" }, | ||||
| 		"et": { code: "EE", name: "Estonia" }, | ||||
| 		"eu": { code: "ES", name: "Spain" }, | ||||
| 		"ewo": { code: "CM", name: "Cameroon" }, | ||||
| 		"fa": { code: "AF", name: "Afghanistan" }, | ||||
| 		"ff": { code: "CM", name: "Cameroon" }, | ||||
| 		"fi": { code: "FI", name: "Finland" }, | ||||
| 		"fil": { code: "PH", name: "Philippines" }, | ||||
| 		"fo": { code: "FO", name: "Faroe Islands" }, | ||||
| 		"fr": { code: "FR", name: "France" }, | ||||
| 		"fur": { code: "IT", name: "Italy" }, | ||||
| 		"fy": { code: "NL", name: "Netherlands" }, | ||||
| 		"ga": { code: "IE", name: "Ireland" }, | ||||
| 		"gd": { code: "GB", name: "United Kingdom" }, | ||||
| 		"gl": { code: "ES", name: "Spain" }, | ||||
| 		"gsw": { code: "CH", name: "Switzerland" }, | ||||
| 		"gu": { code: "IN", name: "India" }, | ||||
| 		"guz": { code: "KE", name: "Kenya" }, | ||||
| 		"gv": { code: "IM", name: "Isle of Man" }, | ||||
| 		"ha": { code: "GH", name: "Ghana" }, | ||||
| 		"haw": { code: "US", name: "United States" }, | ||||
| 		"he": { code: "IL", name: "Israel" }, | ||||
| 		"hi": { code: "IN", name: "India" }, | ||||
| 		"hr": { code: "HR", name: "Croatia" }, | ||||
| 		"hsb": { code: "DE", name: "Germany" }, | ||||
| 		"hu": { code: "HU", name: "Hungary" }, | ||||
| 		"hy": { code: "AM", name: "Armenia" }, | ||||
| 		"id": { code: "ID", name: "Indonesia" }, | ||||
| 		"ig": { code: "NG", name: "Nigeria" }, | ||||
| 		"ii": { code: "CN", name: "China" }, | ||||
| 		"is": { code: "IS", name: "Iceland" }, | ||||
| 		"it": { code: "IT", name: "Italy" }, | ||||
| 		"ja": { code: "JP", name: "Japan" }, | ||||
| 		"jgo": { code: "CM", name: "Cameroon" }, | ||||
| 		"jmc": { code: "TZ", name: "Tanzania" }, | ||||
| 		"ka": { code: "GE", name: "Georgia" }, | ||||
| 		"kab": { code: "DZ", name: "Algeria" }, | ||||
| 		"kam": { code: "KE", name: "Kenya" }, | ||||
| 		"kde": { code: "TZ", name: "Tanzania" }, | ||||
| 		"kea": { code: "CV", name: "Cabo Verde" }, | ||||
| 		"khq": { code: "ML", name: "Mali" }, | ||||
| 		"ki": { code: "KE", name: "Kenya" }, | ||||
| 		"kk": { code: "KZ", name: "Kazakhstan" }, | ||||
| 		"kkj": { code: "CM", name: "Cameroon" }, | ||||
| 		"kl": { code: "GL", name: "Greenland" }, | ||||
| 		"kln": { code: "KE", name: "Kenya" }, | ||||
| 		"km": { code: "KH", name: "Cambodia" }, | ||||
| 		"kn": { code: "IN", name: "India" }, | ||||
| 		"ko": { code: "KP", name: "North Korea" }, | ||||
| 		"kok": { code: "IN", name: "India" }, | ||||
| 		"ks": { code: "IN", name: "India" }, | ||||
| 		"ksb": { code: "TZ", name: "Tanzania" }, | ||||
| 		"ksf": { code: "CM", name: "Cameroon" }, | ||||
| 		"ksh": { code: "DE", name: "Germany" }, | ||||
| 		"kw": { code: "GB", name: "United Kingdom" }, | ||||
| 		"ky": { code: "KG", name: "Kyrgyzstan" }, | ||||
| 		"lag": { code: "TZ", name: "Tanzania" }, | ||||
| 		"lb": { code: "LU", name: "Luxembourg" }, | ||||
| 		"lg": { code: "UG", name: "Uganda" }, | ||||
| 		"lkt": { code: "US", name: "United States" }, | ||||
| 		"ln": { code: "AO", name: "Angola" }, | ||||
| 		"lo": { code: "LA", name: "Laos" }, | ||||
| 		"lrc": { code: "IQ", name: "Iraq" }, | ||||
| 		"lt": { code: "LT", name: "Lithuania" }, | ||||
| 		"lu": { code: "CD", name: "Democratic Republic of the Congo" }, | ||||
| 		"luo": { code: "KE", name: "Kenya" }, | ||||
| 		"Luo": { code: "KE", name: "Kenya" }, | ||||
| 		"luy": { code: "KE", name: "Kenya" }, | ||||
| 		"lv": { code: "LV", name: "Latvia" }, | ||||
| 		"mas": { code: "KE", name: "Kenya" }, | ||||
| 		"mer": { code: "KE", name: "Kenya" }, | ||||
| 		"mfe": { code: "MU", name: "Mauritius" }, | ||||
| 		"mg": { code: "MG", name: "Madagascar" }, | ||||
| 		"mgh": { code: "MZ", name: "Mozambique" }, | ||||
| 		"mgo": { code: "CM", name: "Cameroon" }, | ||||
| 		"mk": { code: "MK", name: "North Macedonia" }, | ||||
| 		"ml": { code: "IN", name: "India" }, | ||||
| 		"mn": { code: "MN", name: "Mongolia" }, | ||||
| 		"mr": { code: "IN", name: "India" }, | ||||
| 		"ms": { code: "BN", name: "Brunei" }, | ||||
| 		"mt": { code: "MT", name: "Malta" }, | ||||
| 		"mua": { code: "CM", name: "Cameroon" }, | ||||
| 		"my": { code: "MM", name: "Myanmar" }, | ||||
| 		"mzn": { code: "IR", name: "Iran" }, | ||||
| 		"naq": { code: "NA", name: "Namibia" }, | ||||
| 		"nb": { code: "NO", name: "Norway" }, | ||||
| 		"nd": { code: "ZW", name: "Zimbabwe" }, | ||||
| 		"nds": { code: "DE", name: "Germany" }, | ||||
| 		"ne": { code: "IN", name: "India" }, | ||||
| 		"nl": { code: "NL", name: "Netherlands" }, | ||||
| 		"nmg": { code: "CM", name: "Cameroon" }, | ||||
| 		"nn": { code: "NO", name: "Norway" }, | ||||
| 		"nnh": { code: "CM", name: "Cameroon" }, | ||||
| 		"nus": { code: "SS", name: "South Sudan" }, | ||||
| 		"nyn": { code: "UG", name: "Uganda" }, | ||||
| 		"om": { code: "ET", name: "Ethiopia" }, | ||||
| 		"or": { code: "IN", name: "India" }, | ||||
| 		"os": { code: "GE", name: "Georgia" }, | ||||
| 		"pa": { code: "PK", name: "Pakistan" }, | ||||
| 		"pl": { code: "PL", name: "Poland" }, | ||||
| 		"ps": { code: "AF", name: "Afghanistan" }, | ||||
| 		"pt": { code: "PT", name: "Portugal" }, | ||||
| 		"qu": { code: "BO", name: "Bolivia" }, | ||||
| 		"rm": { code: "CH", name: "Switzerland" }, | ||||
| 		"rn": { code: "BI", name: "Burundi" }, | ||||
| 		"ro": { code: "RO", name: "Romania" }, | ||||
| 		"rof": { code: "TZ", name: "Tanzania" }, | ||||
| 		"ru": { code: "RU", name: "Russia" }, | ||||
| 		"rw": { code: "RW", name: "Rwanda" }, | ||||
| 		"rwk": { code: "TZ", name: "Tanzania" }, | ||||
| 		"sah": { code: "RU", name: "Russia" }, | ||||
| 		"saq": { code: "KE", name: "Kenya" }, | ||||
| 		"sbp": { code: "TZ", name: "Tanzania" }, | ||||
| 		"se": { code: "SE", name: "Sweden" }, | ||||
| 		"seh": { code: "MZ", name: "Mozambique" }, | ||||
| 		"ses": { code: "ML", name: "Mali" }, | ||||
| 		"sg": { code: "CF", name: "Central African Republic" }, | ||||
| 		"shi": { code: "TN", name: "Tunisia" }, | ||||
| 		"si": { code: "LK", name: "Sri Lanka" }, | ||||
| 		"sk": { code: "SK", name: "Slovakia" }, | ||||
| 		"sl": { code: "SI", name: "Slovenia" }, | ||||
| 		"smn": { code: "FI", name: "Finland" }, | ||||
| 		"sn": { code: "ZW", name: "Zimbabwe" }, | ||||
| 		"so": { code: "SO", name: "Somalia" }, | ||||
| 		"sq": { code: "AL", name: "Albania" }, | ||||
| 		"sr": { code: "RS", name: "Serbia" }, | ||||
| 		"sv": { code: "SE", name: "Sweden" }, | ||||
| 		"sw": { code: "CD", name: "Democratic Republic of the Congo" }, | ||||
| 		"ta": { code: "IN", name: "India" }, | ||||
| 		"te": { code: "IN", name: "India" }, | ||||
| 		"teo": { code: "KE", name: "Kenya" }, | ||||
| 		"tg": { code: "TJ", name: "Tajikistan" }, | ||||
| 		"th": { code: "TH", name: "Thailand" }, | ||||
| 		"ti": { code: "ER", name: "Eritrea" }, | ||||
| 		"to": { code: "TO", name: "Tonga" }, | ||||
| 		"tr": { code: "TR", name: "Turkey" }, | ||||
| 		"tt": { code: "RU", name: "Russia" }, | ||||
| 		"twq": { code: "NE", name: "Niger" }, | ||||
| 		"tzm": { code: "MA", name: "Morocco" }, | ||||
| 		"ug": { code: "CN", name: "China" }, | ||||
| 		"uk": { code: "UA", name: "Ukraine" }, | ||||
| 		"ur": { code: "IN", name: "India" }, | ||||
| 		"uz": { code: "UZ", name: "Uzbekistan" }, | ||||
| 		"vai": { code: "TN", name: "Tunisia" }, | ||||
| 		"Vai": { code: "TN", name: "Tunisia" }, | ||||
| 		"vi": { code: "VN", name: "Vietnam" }, | ||||
| 		"vun": { code: "TZ", name: "Tanzania" }, | ||||
| 		"wae": { code: "CH", name: "Switzerland" }, | ||||
| 		"wo": { code: "SN", name: "Senegal" }, | ||||
| 		"xog": { code: "UG", name: "Uganda" }, | ||||
| 		"yav": { code: "CM", name: "Cameroon" }, | ||||
| 		"yi": { code: "01", name: "Unknown" }, // Placeholder for unspecified region | ||||
| 		"yo": { code: "BJ", name: "Benin" }, | ||||
| 		"yue": { code: "CN", name: "China" }, | ||||
| 		"zgh": { code: "MA", name: "Morocco" }, | ||||
| 		"zh": { code: "CN", name: "China" }, | ||||
| 		"zu": { code: "ZA", name: "South Africa" }, | ||||
| 	}; | ||||
|  | ||||
|  | ||||
|             }; | ||||
| 		//async function getCountryName(countryCode) { | ||||
| 			//try { | ||||
| 				//const response = await fetch(`https://restcountries.com/v3.1/alpha/${countryCode}`); | ||||
| 				//if (!response.ok) throw new Error('Country not found'); | ||||
| 				//const data = await response.json(); | ||||
| 				//// Return the name in the native language | ||||
| 				//return data[0].name.common;  | ||||
| 			//} catch (error) { | ||||
| 				//console.error(error); | ||||
| 				//return 'Unknown Country'; | ||||
| 			//} | ||||
| 		//} | ||||
|  | ||||
|             return languageToCountryMap[language] || null; | ||||
|         } | ||||
| 		function getCountryNameFromLanguage(language) { | ||||
| 			return languageToCountryMap[language] ? languageToCountryMap[language].name : null; | ||||
| 		} | ||||
|  | ||||
|         async function displayLocaleAndFlag() { | ||||
|             // Get the browser locale | ||||
|             const userLocale = navigator.language || navigator.userLanguage; | ||||
|             const { flag, isUnknown, countryCode } = getFlagEmoji(userLocale); | ||||
| 		function getCountryCodeFromLanguage(language) { | ||||
| 			return languageToCountryMap[language] ? languageToCountryMap[language].code : null; | ||||
| 		} | ||||
| 		 | ||||
| 		function getCountryNameFromCountryCode(countryCode) { | ||||
| 			//alert(`Country code: ${countryCode}`); | ||||
| 			for (const language in languageToCountryMap) { | ||||
| 				if (languageToCountryMap.hasOwnProperty(language)) { | ||||
| 					if (languageToCountryMap[language].code === countryCode) { | ||||
| 						return languageToCountryMap[language].name; | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 			return null; // Return null if country code not found | ||||
| 		} | ||||
|  | ||||
|             // Display the locale and the corresponding flag (or fallback) | ||||
|             //document.getElementById('locale').textContent = `Your Locale: ${userLocale}`; | ||||
| 		function getFlagEmoji(locale) { | ||||
| 			// Split the locale to get the language and country code | ||||
| 			const parts = locale.split('-'); | ||||
| 			let countryCode; | ||||
|  | ||||
|             if (isUnknown) { | ||||
|                 const fallbackDiv = document.createElement('div'); | ||||
|                 fallbackDiv.className = 'fallback-box'; | ||||
|                 fallbackDiv.textContent = `? ${userLocale.toUpperCase()}`; // Only show ? and locale code inside the box | ||||
|                 //document.getElementById('flag-container').textContent = "Flag: "; | ||||
|                 document.getElementById('flag-container').appendChild(fallbackDiv); | ||||
|                 // Tooltip for fallback | ||||
|                 fallbackDiv.title = "Unknown Country"; // Tooltip for fallback | ||||
|             } else { | ||||
|                 const countryName = await getCountryName(countryCode); | ||||
|                 const flagSpan = document.createElement('span'); | ||||
|                 flagSpan.textContent = flag; // Use flag emoji | ||||
|                 flagSpan.title = countryName; // Tooltip for the flag in country language | ||||
|                 //document.getElementById('flag-container').textContent = "Flag: "; | ||||
|                 document.getElementById('flag-container').appendChild(flagSpan); | ||||
|             } | ||||
|         } | ||||
| 			// Handle single subtag (language only) or double subtag (language-country) | ||||
| 			if (parts.length === 1) { | ||||
| 				countryCode = getCountryCodeFromLanguage(parts[0]); | ||||
| 			} else if (parts.length === 2) { | ||||
| 				countryCode = parts[1].toLowerCase(); // Use the country code | ||||
| 			} | ||||
|  | ||||
|         displayLocaleAndFlag(); | ||||
| }); | ||||
| 			// If country code is not found, set a fallback output | ||||
| 			if (!countryCode) { | ||||
| 				const fallback = `? ${locale.toUpperCase()}`; // Just a question mark and the full locale | ||||
| 				return { flag: fallback, isUnknown: true, countryName: 'Unknown Country' }; | ||||
| 			} | ||||
|  | ||||
| 			// Convert the country code to a flag emoji | ||||
| 			return { | ||||
| 				flag: String.fromCodePoint(...[...countryCode.toUpperCase()].map(char => 0x1F1E6 + char.charCodeAt(0) - 'A'.charCodeAt(0))), | ||||
| 				isUnknown: false, | ||||
| 				countryCode: countryCode | ||||
| 			}; | ||||
| 		} | ||||
|  | ||||
| function displayLocaleAndFlag() { | ||||
|     // Get the browser locale | ||||
|     const userLocale = navigator.language || navigator.userLanguage; | ||||
|     //alert(`User Locale: ${userLocale}`); // Alert the detected locale | ||||
|  | ||||
|     const { flag, isUnknown, countryCode } = getFlagEmoji(userLocale); | ||||
|      | ||||
|     //alert(`Country Code: ${countryCode}, Is Unknown: ${isUnknown}`); // Debug country code and unknown flag status | ||||
|  | ||||
|     // Display the locale and the corresponding flag (or fallback) | ||||
|     //document.getElementById('locale').textContent = `Your Locale: ${userLocale}`; | ||||
|  | ||||
|     if (isUnknown) { | ||||
|         const fallbackDiv = document.createElement('div'); | ||||
|         fallbackDiv.className = 'fallback-box'; | ||||
|         fallbackDiv.textContent = `? ${userLocale.toUpperCase()}`; // Show ? and locale code inside the box | ||||
|         document.getElementById('flag-container').appendChild(fallbackDiv); | ||||
|          | ||||
|         // Tooltip for fallback | ||||
|         fallbackDiv.title = "Unknown Country"; // Tooltip for fallback | ||||
|         //alert('Fallback triggered: Unknown Country'); // Debug fallback | ||||
|     } else { | ||||
|         const countryName = getCountryNameFromCountryCode(countryCode.toUpperCase()); | ||||
|         //alert(`Country Name from Country Code: ${countryName}`); // Alert the country name | ||||
|  | ||||
|         const flagSpan = document.createElement('span'); | ||||
|         flagSpan.textContent = flag; // Use flag emoji | ||||
|         flagSpan.title = countryName; // Tooltip for the flag in country language | ||||
|         document.getElementById('flag-container').appendChild(flagSpan); | ||||
|          | ||||
|         //alert(`Flag Emoji: ${flag}`); // Debug flag emoji display | ||||
|     } | ||||
| } | ||||
| 		displayLocaleAndFlag(); | ||||
| 	}); | ||||
| @@ -4,9 +4,11 @@ | ||||
| <font class="sme-copyright"> | ||||
| %	if ( $c->is_logged_in ) { | ||||
| 	SME Server <%= session 'releaseVersion' %>-<%= $c->app->VERSION %> Manager II | ||||
| 	(Mojo:<%= Mojolicious->VERSION %>) | ||||
| 	% my $mode; | ||||
| 	% if (config->{mode} eq 'development'){ $mode = '-dev';} else { $mode = '';} | ||||
| 	(Mojo:<%= Mojolicious->VERSION %><%= $mode %>) | ||||
| % } | ||||
| <br>Copyright 1999-2006 Mitel Corporation<br> | ||||
| %= session 'copyRight' | ||||
| <br>Copyright (c) 2013-2024 Koozali Foundation Inc.<br> | ||||
| </font> | ||||
| </font> | ||||
| @@ -20,16 +20,15 @@ | ||||
|  | ||||
| 	<p> | ||||
|     %= $c->render_to_string(inline => $c->l('rbo_DESCRIPTION')) | ||||
|     <br> | ||||
|     <br><br> | ||||
|  | ||||
| 	<span class=label> | ||||
| 	%=l 'rbo_LABEL_REBOOT' | ||||
| 	</span> | ||||
|  | ||||
| 	<span class=data> | ||||
| 	%= select_field 'function' => $c->rebootFunction_list() | ||||
| 	</span> | ||||
| 	</p> | ||||
| 	</p><br> | ||||
|  | ||||
| 	%= submit_button "$btn", class => 'action' | ||||
|  | ||||
| @@ -38,4 +37,4 @@ | ||||
|     %= hidden_field 'debug' => '1' | ||||
|  | ||||
| </div> | ||||
| %end | ||||
| %end | ||||
| @@ -24,7 +24,7 @@ | ||||
| 	<span class=label> | ||||
| 	%=l 'wkg_LABEL_WORKGROUP', class => 'label' | ||||
| 	</span><span class=data> | ||||
| 	%= text_field 'Workgroup' =>  $wkg_datas->{Workgroup}, class => 'input' | ||||
| 	%= text_field 'Workgroup' =>  $wkg_datas->{Workgroup}, class => 'input' , pattern=>".{1,15}", title=>"Limited to 15 characters by the NETBIOS" | ||||
| 	</span> | ||||
| 	</p> | ||||
| 	<p> | ||||
| @@ -63,4 +63,4 @@ | ||||
|     % end     | ||||
|  | ||||
| </div> | ||||
| %end | ||||
| %end | ||||
| @@ -2,7 +2,7 @@ Summary: Sme server  navigation module : manager 2 | ||||
| %define name smeserver-manager | ||||
| Name: %{name} | ||||
| %define version 11.0.0 | ||||
| %define release 43 | ||||
| %define release 48 | ||||
| Version: %{version} | ||||
| Release: %{release}%{?dist} | ||||
| License: GPL | ||||
| @@ -26,19 +26,47 @@ Requires: smeserver-lib >= 1.18.0-26 | ||||
| Requires: smeserver-manager >= 2.4.0-22 | ||||
| Requires: smeserver-apache >= 2.6.0-19 | ||||
| Requires: smeserver-php >= 3.0.0-43 | ||||
| Requires: perl(Mojolicious) >= 7.56 | ||||
| #Requires: smeserver-manager-locale >= 11.0.0 | ||||
| Requires: perl(Mojolicious) >= 8.42 | ||||
| Requires: perl(Mojolicious::Plugin::I18N) >= 1.6 | ||||
| Requires: perl(Mojolicious::Plugin::RenderFile) >= 0.12 | ||||
| Requires: perl(Mojolicious::Plugin::CSRFDefender) >= 0.0.8 | ||||
| Requires: perl(Net::Netmask) >= 1.9 | ||||
| Requires: perl(DBM::Deep) >= 2.0011-1 | ||||
| Requires: perl(Mojo::JWT) >= 0.08-1 | ||||
| #Requires: perl(Time::TAI64) >= 2.11 | ||||
| Requires: mutt >= 1.5.21 | ||||
| Requires: smeserver-manager-jsquery >= 1.0 | ||||
| Requires: smeserver-lib >= 11.0 | ||||
| Requires: smeserver-certificates >= 11.0 | ||||
| #Requires: js-jquery > 2.2.4-3 (optional) | ||||
|  | ||||
| Requires: smeserver-manager-locale-bg | ||||
| Requires: smeserver-manager-locale-da | ||||
| Requires: smeserver-manager-locale-de | ||||
| Requires: smeserver-manager-locale-el | ||||
| Requires: smeserver-manager-locale-es | ||||
| Requires: smeserver-manager-locale-et | ||||
| Requires: smeserver-manager-locale-fr | ||||
| Requires: smeserver-manager-locale-he | ||||
| Requires: smeserver-manager-locale-hu | ||||
| Requires: smeserver-manager-locale-id | ||||
| Requires: smeserver-manager-locale-it | ||||
| Requires: smeserver-manager-locale-ja | ||||
| Requires: smeserver-manager-locale-nb | ||||
| Requires: smeserver-manager-locale-nl | ||||
| Requires: smeserver-manager-locale-pl | ||||
| Requires: smeserver-manager-locale-pt | ||||
| Requires: smeserver-manager-locale-pt_BR | ||||
| Requires: smeserver-manager-locale-ro | ||||
| Requires: smeserver-manager-locale-ru | ||||
| Requires: smeserver-manager-locale-sl | ||||
| Requires: smeserver-manager-locale-sv | ||||
| Requires: smeserver-manager-locale-th | ||||
| Requires: smeserver-manager-locale-tr | ||||
| Requires: smeserver-manager-locale-zh_CN | ||||
| Requires: smeserver-manager-locale-zh_TW | ||||
|  | ||||
| Provides: server-manager | ||||
| AutoReqProv: no | ||||
|  | ||||
| @@ -115,6 +143,27 @@ true | ||||
| %defattr(-,root,root) | ||||
|  | ||||
| %changelog | ||||
| * Wed Jan 29 2025 Brian Read <brianr@koozali.org> 11.0.0-48.sme | ||||
| - Make Country flag display independant of the internet. [SME: 12893] | ||||
|  | ||||
| * Tue Jan 28 2025 Brian Read <brianr@koozali.org> 11.0.0-47.sme | ||||
| - Temp (we hope) remove CSRF protection plugin  [SME: ] | ||||
| - Fix comparison in footer with config->mode  | ||||
|  | ||||
| * Tue Jan 28 2025 Brian Read <brianr@koozali.org> 11.0.0-46.sme | ||||
| - Adjust conditions for showing "Reconfigure required" to only check UnSavedChanges DB entry [SME: 12891] | ||||
| - Add indication of development mode in footer | ||||
|  | ||||
| * Sat Jan 25 2025 Brian Read <brianr@koozali.org> 11.0.0-45.sme | ||||
| - Add some space in the reboot/reconf/shutdown panel [SME: ] | ||||
| - Add check for 15 characters netbios name in workgroup panel [SME: ] | ||||
| - Add action for post-upgrade-and-reboot for reconfigure panel [SME: 12865] | ||||
| - Remove call to TAI64 in viewlogfiles as qmail specific format [SME: 12889] | ||||
| - Add requires to pull in all the locale translation [SME: 12757] | ||||
|  | ||||
| * Fri Jan 24 2025 Brian Read <brianr@koozali.org> 11.0.0-44.sme | ||||
| - Change to network-online for systemd startup to make sure network is up [SME: 12758] | ||||
|  | ||||
| * Thu Jan 23 2025 Brian Read <brianr@koozali.org> 11.0.0-43.sme | ||||
| - fix access to config file though config plugin for mojo 9.39 [SME: 12885] | ||||
| - Fix password setting for useraccounts and also adjust DB opens | ||||
|   | ||||
		Reference in New Issue
	
	Block a user