i18n the template attachments, fixes bug #11186
Also, rework some of the JS code according to jslint.
This commit is contained in:
parent
ce84be0498
commit
7b810ec227
4 changed files with 52 additions and 13 deletions
|
|
@ -4,6 +4,7 @@
|
||||||
- fixed #11203: Manage groups in group: everyone added on save
|
- fixed #11203: Manage groups in group: everyone added on save
|
||||||
- fixed #11101: 7.6.35-7.7 upgrade leaves packages
|
- fixed #11101: 7.6.35-7.7 upgrade leaves packages
|
||||||
- fixed #11209: Form::HTMLArea uses invalid javascript identifier
|
- fixed #11209: Form::HTMLArea uses invalid javascript identifier
|
||||||
|
- fixed #11186: Template Attachments i18n
|
||||||
|
|
||||||
7.8.4
|
7.8.4
|
||||||
- Fixed a compatibility problem between WRE and new Spectre code.
|
- Fixed a compatibility problem between WRE and new Spectre code.
|
||||||
|
|
|
||||||
|
|
@ -372,9 +372,12 @@ sub getEditForm {
|
||||||
);
|
);
|
||||||
|
|
||||||
my ($style, $url) = $self->session->quick(qw(style url));
|
my ($style, $url) = $self->session->quick(qw(style url));
|
||||||
$style->setScript($url->extras('yui/build/yahoo/yahoo-min.js'), {type => 'text/javascript'});
|
$style->setScript($url->extras('yui/build/yahoo/yahoo-min.js'), {type => 'text/javascript'});
|
||||||
$style->setScript($url->extras('yui/build/json/json-min.js'), {type => 'text/javascript'});
|
$style->setScript($url->extras('yui/build/json/json-min.js'), {type => 'text/javascript'});
|
||||||
$style->setScript($url->extras('yui/build/dom/dom-min.js'), {type => 'text/javascript'});
|
$style->setScript($url->extras('yui/build/dom/dom-min.js'), {type => 'text/javascript'});
|
||||||
|
$style->setScript($url->extras('yui/build/event/event-min.js'), {type => 'text/javascript'});
|
||||||
|
$style->setScript($url->extras('yui/build/connect/connect-min.js'), {type => 'text/javascript'});
|
||||||
|
$style->setScript($url->extras('yui-webgui/build/i18n/i18n.js'), {type => 'text/javascript'});
|
||||||
|
|
||||||
pop(@headers);
|
pop(@headers);
|
||||||
my $scriptUrl = $url->extras('templateAttachments.js');
|
my $scriptUrl = $url->extras('templateAttachments.js');
|
||||||
|
|
|
||||||
|
|
@ -379,6 +379,17 @@ Any scratch variables will be available in the template with this syntax:<br/>
|
||||||
message => q|Template in clipboard|,
|
message => q|Template in clipboard|,
|
||||||
lastUpdated => 0,
|
lastUpdated => 0,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'Already attached!' => {
|
||||||
|
message => q|Already attached!|,
|
||||||
|
lastUpdated => 0,
|
||||||
|
},
|
||||||
|
|
||||||
|
'No url!' => {
|
||||||
|
message => q|No url!|,
|
||||||
|
lastUpdated => 0,
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,27 @@
|
||||||
// Really only used by the Template editor, but it doesn't belong in perl
|
// Really only used by the Template editor, but it doesn't belong in perl
|
||||||
// code. It's too long.
|
// code. It's too long.
|
||||||
|
|
||||||
|
if ( typeof WebGUI == "undefined" ) {
|
||||||
|
WebGUI = {};
|
||||||
|
}
|
||||||
|
if ( typeof WebGUI.TemplateAttachments == "undefined" ) {
|
||||||
|
WebGUI.TemplateAttachments = {};
|
||||||
|
}
|
||||||
|
if ( typeof WebGUI.TemplateAttachments.i18n == "undefined" ) {
|
||||||
|
WebGUI.TemplateAttachments.i18n = new WebGUI.i18n( {
|
||||||
|
namespaces : {
|
||||||
|
'Asset_Template' : [
|
||||||
|
"attachment header remove",
|
||||||
|
"Already attached!",
|
||||||
|
"No url!"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
onpreload : {
|
||||||
|
fn : function(){}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
var addClick = (function() {
|
var addClick = (function() {
|
||||||
var uniqueId = 1;
|
var uniqueId = 1;
|
||||||
var count = 0;
|
var count = 0;
|
||||||
|
|
@ -57,12 +78,15 @@ var addClick = (function() {
|
||||||
function nameFields(u) {
|
function nameFields(u) {
|
||||||
var id = uniqueId++;
|
var id = uniqueId++;
|
||||||
var obj = urls[u];
|
var obj = urls[u];
|
||||||
if (!obj.index.name)
|
if (!obj.index.name) {
|
||||||
obj.index.name = 'attachmentIndex' + id;
|
obj.index.name = 'attachmentIndex' + id;
|
||||||
if (!obj.type.name)
|
}
|
||||||
|
if (!obj.type.name) {
|
||||||
obj.type.name = 'attachmentType' + id;
|
obj.type.name = 'attachmentType' + id;
|
||||||
if (!obj.url.name)
|
}
|
||||||
|
if (!obj.url.name) {
|
||||||
obj.url.name = 'attachmentUrl' + id;
|
obj.url.name = 'attachmentUrl' + id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make a function which will remove an attachment (remove the table row
|
// Make a function which will remove an attachment (remove the table row
|
||||||
|
|
@ -77,7 +101,7 @@ var addClick = (function() {
|
||||||
if (--count == 0) {
|
if (--count == 0) {
|
||||||
displayTable.style.display = 'none';
|
displayTable.style.display = 'none';
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a new attachment (proper table row, etc). Attachments that already
|
// Add a new attachment (proper table row, etc). Attachments that already
|
||||||
|
|
@ -85,7 +109,7 @@ var addClick = (function() {
|
||||||
// to the backend.
|
// to the backend.
|
||||||
function add(d) {
|
function add(d) {
|
||||||
if (urls[d.url]) {
|
if (urls[d.url]) {
|
||||||
alert('Already attached!');
|
alert(WebGUI.TemplateAttachments.i18n.get('Asset_Template','Already attached!'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,7 +144,7 @@ var addClick = (function() {
|
||||||
var oldValue = url.oldValue;
|
var oldValue = url.oldValue;
|
||||||
if (urls[newValue]) {
|
if (urls[newValue]) {
|
||||||
url.value = oldValue;
|
url.value = oldValue;
|
||||||
alert('Already attached!');
|
alert(WebGUI.TemplateAttachments.i18n.get('Asset_Template','Already attached!'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
url.oldValue = newValue;
|
url.oldValue = newValue;
|
||||||
|
|
@ -134,7 +158,7 @@ var addClick = (function() {
|
||||||
|
|
||||||
var btn = document.createElement('input');
|
var btn = document.createElement('input');
|
||||||
btn.type = 'button';
|
btn.type = 'button';
|
||||||
btn.value = 'Remove';
|
btn.value = WebGUI.TemplateAttachments.i18n.get('Asset_Template','attachment header remove');
|
||||||
btn.onclick = remover(d.url);
|
btn.onclick = remover(d.url);
|
||||||
|
|
||||||
var tr = document.createElement('tr');
|
var tr = document.createElement('tr');
|
||||||
|
|
@ -149,7 +173,7 @@ var addClick = (function() {
|
||||||
tr : tr,
|
tr : tr,
|
||||||
index : index,
|
index : index,
|
||||||
type : type,
|
type : type,
|
||||||
url : url,
|
url : url
|
||||||
};
|
};
|
||||||
|
|
||||||
nameFields(d.url);
|
nameFields(d.url);
|
||||||
|
|
@ -165,9 +189,9 @@ var addClick = (function() {
|
||||||
url: nodes.url.value
|
url: nodes.url.value
|
||||||
};
|
};
|
||||||
|
|
||||||
d.url = d.url.replace(/^\s+|\s+$/g, '')
|
d.url = d.url.replace(/^\s+|\s+$/g, '');
|
||||||
if (d.url == '') {
|
if (d.url == '') {
|
||||||
alert('No url!');
|
alert(WebGUI.TemplateAttachments.i18n.get('Asset_Template','No url!'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
add(d);
|
add(d);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue