Gorazd Editor

The application was created within the project GORAZD: The Old Church Slavonic Digital Hub (implemented thanks to the NAKI II programme of the Ministry of Culture of the Czech Republic, DG16P02H024). The web application Gorazd Editor can be used to correct and edit entries saved as Gorazd XML files (XSD schema of Gorazd XML format: http://gorazd.org/sites/default/files/software/gXML.zip) in the managing system Invenio (https://invenio-software.org), including auxiliary MARCXML files used for separate management of data. In the Invenio system, users can be assigned different roles (editor, corrector, administrator etc.). Access to data can be managed based on these roles.

Installation

The application Gorazd Editor requires the installation of Invenio to run and thus it can only be launched on a computer where the system Invenio is installed. Gorazd Editor is distributed in the form of source files that are then uploaded into the system Invenio v. 1.2.

Requirements:

  • PHP 5.x – basic installation, also a library for work with XSL and XML
  • MySQL
  • Invenio v. 1.2

Process:

1) Copying source files into Gorazd Editor into the web space of the server.

The web space of the server means folders where PHP files can be used and that are visible through the server address. Rights have to be checked after copying the content of the editor to the server. All files should be accessible to all at least for reading.

2) Configuration of MySQL.

You can connect to MySQL using any tool allowing access to MySQL, for example PhpMyAdmin, Workbench etc. Create a new database and name it, in our example the name is “gorazd_editor”. Perform import into this newly created database. In the tab import, select one by one both files attached to the editor containing structure of tables needed for the editor. After a successful import, two new tables should appear in the new database, “editor_cache” and “editor_clipboard”.

3) Creating a user in MySQL who has access to the newly created database.

Gorazd Editor does not require higher rights than full editing of the tables “editor_cache” and “editor_clipboard”.

4) Configuration of the editor.

In the file “mysql_config.php”, fill in the items “username” (username of the newly created user), “password” (password of the newly created user), “dbname” (name of the newly created database, in this case “gorazd_editor”).

Adapting the editor:

If names of folders or files are changed, the changes have to be reflected also in the relevant files:

  1. Folder or files of the folder “css” and “js” – reflect in “index.html”
  2. Folder or files of the folder “xsl” and “xsd” – reflect in “/js/vars.js” and “xml_xsl.php”
  3. Folder or files of the folder “fonts”, “img” – reflect in “index.html” and files of the folder “css”
  4. File “xml_xsl.php” – reflect in “/js/var.js”

Entire structure of Gorazd Editor:

| editor.html – the main HTML file containing the whole framework
| gorazd_status_set.php – file allowing Invenio to change the state of backups
| mysql_config.php – file containing configuration of the editor for access to MySQL
| xml_xsl.php – file mediating communication between JavaScript and MySQL and Invenio, it performs transformations
|
+---css – file containing all styles used in the editor
| | blocks.css – styles for inside of records, styles of blocks
| | fonts.css – definition of fonts with paths
| | global.css – global styles of the editor
| | loader.css – styles for loading
| | material_icons.css – styles for icons
| | split_move.css – styles for split scroll bar
| | virtual_keyboard.css – styles for the virtual keyboard
| |
| \---jquery – folder containing appearances for jQuery library
| | jquery-ui.css
| |
| \---images
| ui-bg_flat_0_aaaaaa_40x100.png
| ui-bg_flat_75_ffffff_40x100 (1).png
| ui-bg_flat_75_ffffff_40x100.png
| ui-bg_glass_65_ffffff_1x400.png
| ui-bg_glass_75_dadada_1x400.png
| ui-bg_glass_75_e6e6e6_1x400.png
| ui-icons_222222_256x240 (1).png
| ui-icons_222222_256x240.png
| ui-icons_454545_256x240.png
| ui-icons_888888_256x240.png
|
+---fonts – folder containing all fonts required for right display in the editor
| arial_narrow.ttf
| BukyVede-Bold.ttf
| BukyVede-Italic.ttf
| BukyVede-Regular.ttf
| CB10U.TTF
| FreeSerif.otf
| FreeSerifBold.otf
| FreeSerifBoldItalic.otf
| FreeSerifItalic.otf
| material_icons.woff2
|
+---img – folder containing images for animation of loading
| loader_large.gif – animation of loading (big)
| loader_small.gif – animation of loading (small)
|
+---js – folder containing JavaScript files
| | blocks.js – file containing work with and display of blocks of record
| | dialogs.js – file containing dialogs and functions connected to it
| | divs.js – file containing definitions for marking divs
| | events.js – file containing main events of the editor
| | FileSaver.js
| | history.js – file containing movement and saving history of editing
| | key_binding.js – file containing keyboard shortcuts and functions connected to it
| | loader.js – file containing displaying and hiding of the animation of loading
| | main_func.js – file containing main functions of the editor
| | menu.js – file containing movement of native menu in Invenio
| | reqs.js – file containing all callings of PHP files and functions connected to it
| | selects.js – file containing functionality of all drop-down menus
| | select_vars.js – file containing lists and values for all drop-down menus in the editor
| | split_move.js – file containing functionality of split scroll bar
| | vars.js – file containing paths and definitions for editing
| | virtual_keyboard.js – file containing functionality of the virtual keyboard
| | virtual_keyboard_keys.js – file containing all keys of the virtual keyboard
| | xsl.js – file containing transformations and functions connected to it
| | zoom_menu.js – file containing zooming in and out in the editor
| |
| \---jquery – folder containing JavaScript files of jQuery library
| jquery-1.10.2.js
| jquery-1.11.3.min.js
| jquery-migrate-1.2.1.min.js
| jquery-ui.js
| jquery.hotkeys.js
| jquery.jeditable.mini.js
|
+---xsd – folder containing all XSD files for editing
| gXML.xsd
| gXML_MS.xsd
| gXML_RSI.xsd
| tree.txt
|
\---xsl – folder containing all transformations for editing
dzarog-part1.xsl
dzarog-part2.xsl
dzarog-part2_RSI.xsl
dzarog-part3.xsl
dzarog-part3_MS.xsl
dzarog-part3_RSI.xsl
gorazd.xsl
gorazd_MARC.xsl
gorazd_MARC_RSI.xsl
gorazd_MS.xsl
gorazd_RSI.xsl
gxmlpreview1.xsl
gxmlpreview2.xsl

Main files of the editor:

  • file „key_binding.js“ – takes care of keyboard shortcuts and their operating in the editor
  • file „select_vars.js“ - contains lists and values for all drop-down menus in the editor
  • file „virtual_keyboard_keys.js“ – contains keys for the virtual keyboard of the editor
  • file „editor.html“ – main display file of the editor
  • file „mysql_config.php“ – contains configuration for access of the editor to MySQL

Adjustments of the system Invenio

For the function of the application Gorazd Editor, it is necessary to adjust and extend the system Invenio. Most of the adjustments are straightforward changes in the code of bulk editor of records that is provided together with Invenio. The main goal of the adjustments is to enable using Invenio as version data storage. Each record in Invenio is in the form of metadata that are gained from Gorazd XML by XSL transformation. Gorazd XML is connected to this metadata as full-text in the standard way of Invenio. On the implementation level, this functionality is ensured by saving Gorazd XML from POST request to a subfolder in the folder CFG_UPLOAD_DIR that is by default set for /opt/invenio/var/upload. The file is named by a timestamp. The subfolder then contains information about the user who saved it and about recid record of Invenio where the data are saved. Since Invenio is not primarily constructed for real-time editing of data, it is necessary for each saving of data to generate not only MARX XML file with FFT tags (file with the prefix gorazdSubmit_fft) which is the standard way of uploading full-text files into Invenio, but it is also necessary to generate two other files (prefixes gorazdSubmit_marc and gorazdSubmit_fix) with special tags that ensure consistency of the data in full-text, metadata in the Invenio database and metadata presented by Invenio to the user. The processing of these four files by Invenio is then performed by calling the program bibupload with the relevant parameters. Invenio ensures saving and version control of full-text Gorazd XML into the folder /opt/invenio/var/data/files and consistency of its database and its presentational environment.

For greater sturdiness of the editor, its own cache in the SQL database was added. It is contained partly in the Editor itself and partly in bibtasklet bst_aip_unlock that is launched by Invenio at the moment when all processing of the record by Invenio is finished.

gorazdedit_template.py

  • Here Invenio uploads the Gorazd Editor that is written in HTML and Javascrip.

gorazdedit_webinterface.py

  • Operates rights (under the key rungorazdedit) for launching Gorazd Editor by a user and determines the URL of Gorazd Editor.

webaccount.py

  • Added rights for rungorazdedit for superadmin.

access_control_config.py

  • Added possibility to give rights for launching Gorazd Editor to roles (rungorazdedit).

bibsched_tasklets/bst_aip_unlock.py

  • Bibtasklet (viz. documentation of Invenio) for deleting cache of an edited record when the user cancelled editing. Then the record is unlocked for other users.

gorazdedit_engine.py

  • The main code defining JavaScript files that will be provided to Gorazd Editor and processing of AJAX requests.

The editor communicates with Invenio via AJAX requests and uses, besides standard processes of bulk editor of records, also newly added ones:

saveXML

  • It saves a passed file to CFG_UPLOAD_DIR/email/recid/.xml and returns JSON in the form {"status": "OK", "filename": }. If there is an error, it returns {"status": "Chyba pri ukladani: chybi GORAZD XML/saving error: missing Gorazd XML"}.

submit_gorazdXML

  • It prepares three MARC XML and uploads them into the queue of bibsched by utility bibupload. The first file is FFT that uploads passed Gorazd XML. The second one is MARC that contains new metadata gained from the passed Gorazd XML by corresponding XSL transformation. The third one is FIX that ensures consistency of metadata (viz. documentation of Invenio, FFT with the sub-field FIX-MARC). This last bibupload contains a calling of bintasklet bst_aip_unlock that unlocks cache in the database of the editor. If the passed request contains the variable “type” set for “clone”, a new rec_id is reserved and besides bibuploads of the three MARC XML files also bibindex and webcoll ensuring reindexation of the database and re-generating HTML previews to records are added to the queue.

get_latest_version

  • It returns the path to the last version of gorazdXML attached to a document with given recID in the form of JSON {'latest_version': TODO, 'gorazd_paths': full_path}. If there is an error, it returns {'latest_version': 'ERROR', 'gorazd_path': 'ERROR'}.

getUserInfo

  • It returns JSON containing information about the currently logged-in user {'userInfo': USER_INFO}.

bibsched_restarter.py

  • It can sometimes happen that tasks in Invenio end with an unspecific error with unknown cause. It can usually be solved by re-initiating the task. This launchable script checks whether there are any tasks in a state of error and if so, it re-initiates them and waits 60 seconds for repeated control. If the tasks are still in the state of error, it sends an e-mail with the subject "gorazd.org task reinit report: ERRORS " to the administrator of the server. If the tasks are no longer in the state of error, the subject of the e-mail is "gorazd.org task reinit report". The erroneous tasks are listed in the body of the e-mail.
  • Under the user www-data, launch:
    • watch -n 300 /opt/invenio/bin/bibtask_restarter
    • /opt/invenio/bin/bibsched start

search_engine.py

  • Added library icu (URL) through which the ordering of Old Chuch Slavonic words was implemented. This code is used by search modules of Invenio.

bibsort_engine.py

  • Added ordering of Old Church Slavonic that is implemented in search_engine.py.

supervisors_engine.py

  • Added library via which the function of control of user work for chosen supervisors was implemented.

bfe_aip_status.py

  • Added library for displaying the state of an edited record.

Launch

After installation and configuration of the editor, you can test and launch it. Logging-in to Invenio is necessary for launching the editor. After logging-in, the user can find a record they want to open in the editor. After clicking on the name of the record in the list of search results, a new tab with the editor is opened. The editor is displayed as a window divided into two parts. The preview of the entry (if it exists) is displayed in the left part, the editing of the entry is displayed in the right part. If the editor does not report any warnings or errors, the installation and configuration can be considered successful and you can proceed to editing.

Licence

The application is distributed based on the open licence GNU GPL v3. The application can be used for editing entries of other dictionaries by altering the source code. The authors of this application would be very grateful if you inform them about using the source code of this application or its parts in other projects. You can contact them via e-mail: gorazd@slu.cas.cz.

Installation package:

Gorazd Editor 1.0: http://gorazd.org/sites/default/files/software/gorazd_editor-1.zip

Authors:

  • Mgr. Vít Tuček, Ph.D. (programmer)
  • Mgr. Olga Čiperová (development analyst)
  • Bc. Martin Majer (development manager)
  • PhDr. Štefan Pilát, Ph.D. (expert development consultant)

© 2018, Institute of Slavonic studies of the Czech Academy of Sciences