i18n the Attachments Form control

This commit is contained in:
Colin Kuskie 2009-01-02 21:08:43 +00:00
parent cf07abd052
commit 40b86e3dfd
2 changed files with 19 additions and 4 deletions

View file

@ -219,12 +219,14 @@ sub www_show {
$style->setLink($url->extras("/AttachmentsControl/AttachmentsControl.css"), $style->setLink($url->extras("/AttachmentsControl/AttachmentsControl.css"),
{type=>"text/css", rel=>"stylesheet"}); {type=>"text/css", rel=>"stylesheet"});
my $uploadControl = ''; my $uploadControl = '';
my $i18n = WebGUI::International->new($session, "Control_Attachments"); my $i18n = WebGUI::International->new($session);
my $maxFiles = $form->param('maxAttachments') - scalar(@assetIds) ; my $maxFiles = $form->param('maxAttachments') - scalar(@assetIds) ;
my $attachmentForms = ''; my $attachmentForms = '';
foreach my $assetId (@assetIds) { foreach my $assetId (@assetIds) {
$attachmentForms .= '<input type="hidden" name="attachments" value="'.$assetId.'" />'; $attachmentForms .= '<input type="hidden" name="attachments" value="'.$assetId.'" />';
} }
my $upload = $i18n->get('Upload','Operation_FormHelpers');
my $uploadAttachment = $i18n->get('Upload an attachment','WebGUI');
if ($maxFiles > 0) { if ($maxFiles > 0) {
$uploadControl = '<div id="uploadForm"> $uploadControl = '<div id="uploadForm">
<a href="#" onclick="WebguiAttachmentUploadForm.hide();" id="uploadFormCloser">X</a> <a href="#" onclick="WebguiAttachmentUploadForm.hide();" id="uploadFormCloser">X</a>
@ -237,8 +239,8 @@ sub www_show {
<input type="hidden" name="class" value="Attachments" /> <input type="hidden" name="class" value="Attachments" />
<input type="hidden" name="sub" value="upload" /> '. $attachmentForms <input type="hidden" name="sub" value="upload" /> '. $attachmentForms
.'<input type="file" name="attachment" /> .'<input type="file" name="attachment" />
<input type="submit" value="Upload" /> </form> </div> <input type="submit" value="'.$upload.'" /> </form> </div>
<a id="upload" href="#" onclick="WebguiAttachmentUploadForm.show();">Upload an attachment.</a> <a id="upload" href="#" onclick="WebguiAttachmentUploadForm.show();">'.$uploadAttachment. '</a>
'; ';
} }
my $attachments = ''; my $attachments = '';
@ -265,12 +267,13 @@ sub www_show {
$attachments .= '</div>'; $attachments .= '</div>';
} }
} }
my $instructions = $i18n->get('Upload attachments here. Copy and paste attachments into the editor.','WebGUI');
my $output = '<html><head> '.$style->generateAdditionalHeadTags.' my $output = '<html><head> '.$style->generateAdditionalHeadTags.'
<script type="text/javascript"> <script type="text/javascript">
parent.document.getElementById("'.$form->get("name").'_formId").innerHTML = \''.$attachmentForms.'\'; parent.document.getElementById("'.$form->get("name").'_formId").innerHTML = \''.$attachmentForms.'\';
</script> </script>
</head> <body> </head> <body>
'.$uploadControl.' <div id="instructions">Upload attachments here. Copy and paste attachments into the editor.</div> '.$uploadControl.' <div id="instructions">'.$instructions.'</div>
<div id="attachments">'.$attachments.' </div> </body> </html> '; <div id="attachments">'.$attachments.' </div> </body> </html> ';
return $output; return $output;
} }

View file

@ -4313,6 +4313,18 @@ Users may override this setting in their profile.
context => q|Abbreviation for Really Simple Syndication, and other similar terms.|, context => q|Abbreviation for Really Simple Syndication, and other similar terms.|,
}, },
'Upload an attachment' => {
message => q|Upload an attachment|,
context => q|Label in the Attachments form control.|,
lastUpdated => 1230930518,
},
'Upload attachments here. Copy and paste attachments into the editor.' => {
message => q|Upload attachments here. Copy and paste attachments into the editor.|,
context => q|Label in the Attachments form control.|,
lastUpdated => 1230930518,
},
}; };
1; 1;