Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions ui/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

// Define custom options configurable by admins for UI
cloudStackOptions = {
aboutText: "label.app.name",
aboutTitle: "label.about.app",
docTitle: "label.app.name",
helpURL: "http://docs.cloudstack.apache.org/",
keyboardOptions: {
"us": "label.standard.us.keyboard",
"uk": "label.uk.keyboard",
"fr": "label.french.azerty.keyboard",
"jp": "label.japanese.keyboard",
"sc": "label.simplified.chinese.keyboard"
}
};
8 changes: 4 additions & 4 deletions ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1741,6 +1741,7 @@ <h3><translate key="label.set.up.zone.type"/></h3>
<script src="lib/jquery.cookies.js" type="text/javascript"></script>
<script src="lib/jquery.md5.js" type="text/javascript" ></script>
<script src="lib/require.js" type="text/javascript"></script>
<script type="text/javascript" src="config.js"></script>

<!-- localized messages -->
<script type="text/javascript">
Expand Down Expand Up @@ -1803,10 +1804,9 @@ <h3><translate key="label.set.up.zone.type"/></h3>

// Inject translated keyboard options
var keyboardDropdown = $($.find('#keyboard-options'));
keyboardDropdown.append($('<option>', {value: 'us', text: 'Standard (US) keyboard'}));
keyboardDropdown.append($('<option>', {value: 'uk', text: 'UK keyboard'}));
keyboardDropdown.append($('<option>', {value: 'jp', text: '日本語キーボード'}));
keyboardDropdown.append($('<option>', {value: 'sc', text: '简体中文键盘'}));
for (var key in cloudStackOptions.keyboardOptions) {
keyboardDropdown.append($('<option>', {value: key, text: translate(cloudStackOptions.keyboardOptions[key])}));
}
</script>

<script src="lib/excanvas.js" type="text/javascript"></script>
Expand Down
1 change: 1 addition & 0 deletions ui/l10n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,7 @@ var dictionary = {
"label.format":"Format",
"label.format.lower":"format",
"label.friday":"Friday",
"label.french.azerty.keyboard":"French AZERTY keyboard",
"label.full":"Full",
"label.full.path":"Full path",
"label.gateway":"Gateway",
Expand Down
2 changes: 1 addition & 1 deletion ui/scripts/cloudStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,6 @@

cloudStack.uiCustom.login(loginArgs);

document.title = _l('label.app.name');
document.title = _l(cloudStackOptions.docTitle);
});
})(cloudStack, jQuery);
22 changes: 6 additions & 16 deletions ui/scripts/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,22 +449,12 @@
id: "",
description: ""
});
items.push({
id: "us",
description: "US Keboard"
});
items.push({
id: "uk",
description: "UK Keyboard"
});
items.push({
id: "jp",
description: "Japanese Keyboard"
});
items.push({
id: "sc",
description: "Simplified Chinese"
});
for (var key in cloudStackOptions.keyboardOptions) {
items.push({
id: key,
description: _l(cloudStackOptions.keyboardOptions[key])
});
}
args.response.success({
data: items
});
Expand Down
13 changes: 5 additions & 8 deletions ui/scripts/ui/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,23 +317,20 @@

if (this == 'label.help') {
$link.addClass('help').click(function() {
var helpURL = 'http://cloudstack.apache.org/';

window.open(helpURL, '_blank');

window.open(cloudStackOptions.helpURL, '_blank');
return false;
});
}
if (this == 'label.about') {
$link.addClass('about').click(function() {
var $logo = $('<div>').addClass('logo').text(_l('label.app.name')),
$version = $('<div>').addClass('version').text(g_cloudstackversion),
var $logo = $('<div>').addClass('logo').text(_l(cloudStackOptions.aboutText)),
$version = $('<div>').addClass('version').text(_l(g_cloudstackversion)),
$about = $('<div>').addClass('about').append($logo).append($version);

var $aboutDialog = $about.dialog({
modal: true,
width: 300,
title: _l('label.about.app'),
title: _l(cloudStackOptions.aboutTitle),
closeOnEscape: false,
dialogClass: 'dialog-about',
buttons: {
Expand Down