All new strings should now be localized. There is a new function called localize in the scripts/load-ckeditor.js that translates any given string to the server's language (This function is SYNCHRONOUS). The editor area should make use of more room on bigger screens. The make install command should now behave correctly.

This commit is contained in:
Dario Milicic 2014-09-30 12:55:07 +02:00
parent 5e1898ff11
commit 4d6e68f9b1
7 changed files with 37 additions and 18 deletions

View File

@ -78,7 +78,7 @@ ifeq ($(OSTYPE),Linux)
CC = gcc CC = gcc
endif endif
CFLAGS += -I$(MXMLDIR) CFLAGS += -I$(MXMLDIR)
ifdef USE_SSL ifdef USE_SSL
ifneq ($(USE_SSL),0) ifneq ($(USE_SSL),0)
@ -157,7 +157,7 @@ update: $(EXECS)
install: $(EXECS) install: $(EXECS)
@$(INSTALL) -m 0755 -d $(DESTDIR) $(SDESTDIR) $(MANDIR)/man1/ $(MANDIR)/man8/ @$(INSTALL) -m 0755 -d $(DESTDIR) $(SDESTDIR) $(MANDIR)/man1/ $(MANDIR)/man8/
@$(INSTALL) -m 0755 -d $(ELOGDIR)/scripts/ $(ELOGDIR)/resources/ $(ELOGDIR)/ssl/ $(ELOGDIR)/themes/default/icons @$(INSTALL) -m 0755 -d $(ELOGDIR)/scripts/ $(ELOGDIR)/resources/ $(ELOGDIR)/ssl/ $(ELOGDIR)/themes/default/icons
@$(INSTALL) -m 0755 -d $(ELOGDIR)/logbooks/demo @$(INSTALL) -m 0755 -d $(ELOGDIR)/logbooks/demo
@$(INSTALL) -v -m 0755 ${BINFLAGS} elog elconv $(DESTDIR) @$(INSTALL) -v -m 0755 ${BINFLAGS} elog elconv $(DESTDIR)
@$(INSTALL) -v -m 0755 ${BINFLAGS} elogd $(SDESTDIR) @$(INSTALL) -v -m 0755 ${BINFLAGS} elogd $(SDESTDIR)
@ -165,25 +165,21 @@ install: $(EXECS)
@$(INSTALL) -v -m 0644 man/elogd.8 $(MANDIR)/man8/ @$(INSTALL) -v -m 0644 man/elogd.8 $(MANDIR)/man8/
@$(INSTALL) -v -m 0644 scripts/*.js $(ELOGDIR)/scripts/ @$(INSTALL) -v -m 0644 scripts/*.js $(ELOGDIR)/scripts/
# @echo "Installing CKeditor to $(ELOGDIR)/scripts/ckeditor" @echo "Installing CKeditor to $(ELOGDIR)/scripts/ckeditor"
# @unzip -q -o scripts/fckeditor.zip -d $(ELOGDIR)/scripts/ cp -r scripts/ $(ELOGDIR)/scripts
# @$(INSTALL) -v -m 0644 scripts/fckeditor/fckelog.js $(ELOGDIR)/scripts/fckeditor/fckelog.js
# @mkdir -p -m 0755 $(ELOGDIR)/scripts/fckeditor/editor/plugins/elog
# @$(INSTALL) -v -m 0644 scripts/fckeditor/editor/plugins/elog/fckplugin.js $(ELOGDIR)/scripts/fckeditor/editor/plugins/elog/fckplugin.js
# @$(INSTALL) -v -m 0644 scripts/fckeditor/editor/plugins/elog/inserttime.gif $(ELOGDIR)/scripts/fckeditor/editor/plugins/elog/inserttime.gif
@echo "Installing resources to $(ELOGDIR)/resources" @echo "Installing resources to $(ELOGDIR)/resources"
@$(INSTALL) -m 0644 resources/* $(ELOGDIR)/resources/ @$(INSTALL) -m 0644 resources/* $(ELOGDIR)/resources/
@$(INSTALL) -m 0644 ssl/* $(ELOGDIR)/ssl/ @$(INSTALL) -m 0644 ssl/* $(ELOGDIR)/ssl/
@echo "Installing themes to $(ELOGDIR)/themes" @echo "Installing themes to $(ELOGDIR)/themes"
@$(INSTALL) -m 0644 themes/default/icons/* $(ELOGDIR)/themes/default/icons/ @$(INSTALL) -m 0644 themes/default/icons/* $(ELOGDIR)/themes/default/icons/
@for file in `find themes/default -type f | grep -v .svn` ; \ @for file in `find themes/default -type f | grep -v .svn` ; \
do \ do \
$(INSTALL) -m 0644 $$file $(ELOGDIR)/themes/default/`basename $$file` ;\ $(INSTALL) -m 0644 $$file $(ELOGDIR)/themes/default/`basename $$file` ;\
done done
@echo "Installing example logbook to $(ELOGDIR)/logbooks/demo" @echo "Installing example logbook to $(ELOGDIR)/logbooks/demo"
@if [ ! -f $(ELOGDIR)/logbooks/demo ]; then \ @if [ ! -f $(ELOGDIR)/logbooks/demo ]; then \
$(INSTALL) -v -m 0644 logbooks/demo/* $(ELOGDIR)/logbooks/demo ; \ $(INSTALL) -v -m 0644 logbooks/demo/* $(ELOGDIR)/logbooks/demo ; \
fi fi

View File

@ -3,7 +3,7 @@ port = 8080
[demo] [demo]
Theme = default Theme = default
Comment = General linux tips & tricks Comment = SwissFEL DEMO
Attributes = Author, Type, Category, Subject Attributes = Author, Type, Category, Subject
Options Type = Routine, Software Installation, Problem Fixed, Configuration, Other Options Type = Routine, Software Installation, Problem Fixed, Configuration, Other
Options Category = General, Hardware, Software, Network, Other Options Category = General, Hardware, Software, Network, Other

View File

@ -546,9 +546,11 @@ CKEDITOR.dialog.add( 'image2', function( editor ) {
var dialog = this.getDialog(); var dialog = this.getDialog();
var files = dialog.getContentElement("Upload", "upload").getInputElement().$.files; var files = dialog.getContentElement("Upload", "upload").getInputElement().$.files;
var file_missing_msg = localize("Please select a fileadaw!");
// no files were selected // no files were selected
if(files.length == 0) { if(files.length == 0) {
alert("Please select a file!"); alert(file_missing_msg);
return false; return false;
} }

View File

@ -46,7 +46,8 @@
command.modes = { wysiwyg: !!( editor.element.$.form ) }; command.modes = { wysiwyg: !!( editor.element.$.form ) };
editor.ui.addButton && editor.ui.addButton( 'Save', { editor.ui.addButton && editor.ui.addButton( 'Save', {
label: editor.lang.save.toolbar, label: localize("Submit"),
// label: editor.lang.save.toolbar,
command: pluginName, command: pluginName,
toolbar: 'document,10' toolbar: 'document,10'
} ); } );

View File

@ -1,3 +1,21 @@
// This function takes a string that should be translated
// and asks the server for the translation to the server's locale.
// Translation of the string is returned.
//
// NOTE: This function works SYNCRHONOUSLY
function localize(str) {
var URL = '/' + parent.logbook + "/?cmd=loc&value=" + str;
return $.ajax({
type: "GET",
url: URL,
async: false
}).responseText;
}
console.log(localize("Submit"));
// After the page has loaded, load the Ckeditor and the attachment dropbox
$(document).ready(function() { $(document).ready(function() {
$('textarea').addClass("ckeditor"); $('textarea').addClass("ckeditor");
@ -9,8 +27,10 @@ $(document).ready(function() {
var editor = ev.editor; var editor = ev.editor;
// Make the editor bigger // Make the editor bigger (at least 500px high and 80% of the viewport otherwise)
editor.resize("100%", "500"); var width = Math.max(500, 0.8 * $(window).height() );
console.log(width);
editor.resize("100%", new String(width));
// Create a new command with the desired exec function // Create a new command with the desired exec function
var overridecmd = new CKEDITOR.command(editor, { var overridecmd = new CKEDITOR.command(editor, {

View File

@ -11520,7 +11520,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
rsprintf("<tr>\n"); rsprintf("<tr>\n");
rsprintf("<td style=\"background: white;\" colspan=2>\n"); rsprintf("<td style=\"background: white;\" colspan=2>\n");
rsprintf("<div id=\"holder\" style=\"background: white; border: 10px dashed #ccc; min-height: 200px; margin: 10px\" >"); rsprintf("<div id=\"holder\" style=\"background: white; border: 10px dashed #ccc; min-height: 200px; margin: 10px\" >");
rsprintf("<p class=\"info\" style=\"color: #999; font-size: 2em; text-align: center; margin-top: 40px;\">Drop attachments here...</p></div>"); rsprintf("<p class=\"info\" style=\"color: #999; font-size: 2em; text-align: center; margin-top: 40px;\">%s</p></div>", loc("Drop attachments here..."));
rsprintf("</td></tr>"); rsprintf("</td></tr>");
} }
} }

View File

@ -1 +1 @@
#define GIT_REVISION "Tue Sep 23 17:21:20 2014 +0200 - 6a67f99" #define GIT_REVISION "Tue Sep 23 17:31:26 2014 +0200 - 5e1898f"