├── CHANGELOG
├── COPYING
├── INSTALL
├── LICENSE
├── README.md
├── UPDATE.txt
├── aligner.php
├── alignment.php
├── api.php
├── cli
├── .htaccess
├── align
├── export
├── import
├── renumber
└── update
├── config
├── config.php
├── default_permissions.php
├── export_customization.php
└── login_handler.php
├── css
├── cupertino
│ ├── images
│ │ ├── ui-bg_diagonals-thick_90_eeeeee_40x40.png
│ │ ├── ui-bg_flat_15_cd0a0a_40x100.png
│ │ ├── ui-bg_glass_100_e4f1fb_1x400.png
│ │ ├── ui-bg_glass_50_3baae3_1x400.png
│ │ ├── ui-bg_glass_80_d7ebf9_1x400.png
│ │ ├── ui-bg_highlight-hard_100_f2f5f7_1x100.png
│ │ ├── ui-bg_highlight-hard_70_000000_1x100.png
│ │ ├── ui-bg_highlight-soft_100_deedf7_1x100.png
│ │ ├── ui-bg_highlight-soft_25_ffef8f_1x100.png
│ │ ├── ui-icons_2694e8_256x240.png
│ │ ├── ui-icons_2e83ff_256x240.png
│ │ ├── ui-icons_3d80b3_256x240.png
│ │ ├── ui-icons_72a7cf_256x240.png
│ │ └── ui-icons_ffffff_256x240.png
│ └── ui.css
└── intertext.css
├── docker
├── Dockerfile
├── Readme.md
├── config.php
├── docker-compose.yml
├── import
│ ├── test_en.txt
│ ├── test_en.xml
│ ├── test_pl.txt
│ └── test_pl.xml
├── init
│ └── 01.sql
└── mysql_charset.cnf
├── header.php
├── help.php
├── help_cs.php
├── hunalign
├── _none_.dic
└── process.sh
├── icons
├── .DS_Store
├── .directory
├── COPYING.LESSER
├── LICENSE
├── add.png
├── arrow-down-double.png
├── arrow-down.png
├── arrow-up-double.png
├── arrow-up.png
├── arrow.png
├── asc.png
├── automatic.png
├── changelog.png
├── desc.png
├── dialog-ok-apply.png
├── dialog-ok.png
├── document-edit.png
├── document-export.png
├── document-import.png
├── document-new.png
├── document-save.png
├── edit-delete-shred.png
├── edit-delete.png
├── edit-rename.png
├── flag-red.png
├── flag-yellow.png
├── format-list-ordered.png
├── format-list-unordered.png
├── go-down.png
├── go-first.png
├── go-jump.png
├── go-last.png
├── go-next-view.png
├── go-next.png
├── go-prev.png
├── go-previous-view.png
├── go-up.png
├── help-contents.png
├── journal.png
├── layer-visible-off.png
├── layer-visible-on.png
├── legalmoves.png
├── mark.png
├── merge.png
├── nomark.png
├── remove.png
├── search.png
├── status_unknown.png
├── swap.png
└── to-check.png
├── index.php
├── init.php
├── intertext.sql
├── js
├── jeip.js
├── jquery-1.3.2.min.js
├── jxs.js
├── ui.core.js
└── ui.progressbar.js
├── lib_intertext.php
├── progress.php
├── tca2
├── no-cs.cfg
└── no-cs.dic
├── textmanager.php
├── triggers
├── alstat_closed
└── alstat_finished
├── update-1.5.sql
├── update-2.0.php
├── update-2.2.php
├── users.php
└── users.sql
/CHANGELOG:
--------------------------------------------------------------------------------
1 | Release 2.3 (2020-10-07)
2 | ------------------------------
3 |
4 | Improvements:
5 | - use MySQLi for PHP7 compatibility
6 | - settings split into several files in the config/ directory
7 | - permanent login added (does it really work as expected?) - update of configuration necessary!
8 | - ignore changes in changelog if current element is marked as deleted and beyond that point in time (element IDs reused by the database may associate changes with wrong elements!)
9 | - option to export alignments (from CLI) without empty segments
10 | - allow text segments to be larger than 64kB
11 |
12 | Fixes:
13 | - ensure consistency of editing when someone edits several texts at once
14 | - fix listing of "all" alignments of one text only and creating new alignments with no selected base version
15 |
16 | Release 2.2 (2014-11-10)
17 | ------------------------
18 |
19 | Improvements:
20 | - support for transactions for better robustness of more complex actions (read UPDATE.txt if updating!)
21 | - possibility to turn off fulltext search (both transactions and fulltext search are not supported
22 | by MySQL <5.6) at the same time
23 | - display changelog of alignment changes if available (for supervisors)
24 | - updated documentation (help)
25 |
26 | Release 2.1.1 (2014-05-28)
27 | --------------------------
28 |
29 | Fixes:
30 | - textmanager failure on empty database
31 |
32 | Release 2.1 (2014-05-15)
33 | --------------------------
34 |
35 | - annoying complaints from cli/import
36 | - added paging in the alignment list
37 | - added paging in the text manager
38 | - added filter in textmanager
39 | - list all alignments of one text (all versions)
40 | - batch changes in alignment manager
41 | - (api.php) version 2 - support for faster merge inquiry
42 | - (api.php) version 2 - support for faster doc_changelist inquiry
43 |
44 | Release 2.0.1 (2013-09-16)
45 | --------------------------
46 |
47 | - synchronization (api.php): fix failures caused by clients sending time zone info in timestamps
48 | - synchronization (api.php): enforce renumbering in all cases (initially imported documents may have unique IDs but non-standard - we are always importing alignment with standard numbering)
49 |
50 |
51 | Release 2.0 (2013-05-14)
52 | ------------------------
53 |
54 | - new config option $MERGE_UNCONFIRMED_FREELY to ignore unconfirmed alignments when checking for merge conflicts
55 | - new config option $DENY_EMPTY_UPDATES to deny creative users "updating" with empty text (i.e. deleting text completely from elements)
56 | - new modes for supervisors; combination of manual status update with automatic rolling (paging)
57 | - XML validation of imported documents now optional
58 | - proper error reporting on invalid XML import
59 |
60 | Fixes:
61 |
62 | - empty segments not shown when at the end of a page
63 | - export of alignment omits last position if there is is exactly a multiple of 200 positions
64 | - small fix of text upload form's behaviour on import failure
65 |
66 | Release 2.0rc2 (no release)
67 | ---------------------------
68 |
69 | Improvements:
70 |
71 | - added filter (search) in the alignment list
72 | - cli/align script now supports "force" option (-f) which will delete any existing alignment before creating the new one
73 |
74 | Fixes:
75 |
76 | - minor fixes of error messages in api.php
77 | - user editor forgot to switch to the user database (in lib_intertext.php)
78 | - blank page when jumping to unchecked segments and there are none
79 | - PHP now requiring default timezone to be set (should appear in settings.php!)
80 |
81 | Release 2.0rc1 (2012-07-12)
82 | ---------------------------
83 | - Read UPDATE.txt before upgrading your current installation!
84 |
85 | Features:
86 | - synchronization of texts and alignments with "InterText editor" clients
87 | - new state of alignment: "remote editor" - for alignments beeing worked on externally in InterText editor; the alignment is reserved for a particular remote editor (user) using InterText editor desktop application in sychronization with the server
88 | - added simple interface for management of users
89 | - ability to split and merge (parent) container elements - i.e. to insert and remove paragraph breaks
90 | - added new permissions and settings: $UPLOAD_MAXUSERLEVEL_CLIENT (to set the lowest level of users able of uploading new texts and alignments from InterText editor application; by default set to administrators only), $DOWNLOAD_TXTVER_MAXUSERLEVEL (to set the lowest level of users able to download text versions from the server into InterText editor in order to create new alignments; by default set to administrators only), $DOWNLOAD_TXTVER_FILTER (regular expression to match text versions (by name) which can be downloaded into InterText editor in order to create new alignments; by default all versions, i.e. '.*')
91 | - added "index.php" as a symbolic link to "aligner.php"
92 | - updated manual reflecting the new features (help)
93 |
94 | Release 1.7.1
95 | -------------
96 | - changed files: aligner.php
97 |
98 | Fixes:
99 | - search and bookmarks search did only work in "auto roll" modes
100 |
101 | Release 1.7
102 | -----------
103 | - changed files: lib_intertext.php, aligner.php, css/intertext.css, cli/export, settings.php
104 | - (optional changes: help.php, help_cs.php)
105 |
106 | Features:
107 | - added logging of all alignment changes on demand (turned off by default; add into settings.php:
108 | $LOG_ALIGN_CHANGES=true; to activate) (no interface for this changelog; no undo!)
109 | - added new possible option to settings.php: $FORCE_SIMPLE_NUMBERING = true; (turned off by default)
110 | which enforces single level element renumbering and (as another side effect) makes it possible
111 | to keep original ID attributes for all elements from the original document except of the
112 | alignable ones (which *must* yield to renumbering)
113 | - added export with long IDs based on the (original) filename (as used by the ECPC project)
114 | (settings.php & aligner.php)
115 | - now recursively showing history of changes for the deleted (< merged-in) elements as well
116 |
117 | Fixes:
118 | - previously "fixed" problem with importing 0:1 or 1:0 alignments from TCA2 appeared again when
119 | reversing the imported alignment
120 |
121 | Release 1.6.1
122 | -------------
123 | - changed files: lib_intertext.php
124 |
125 | - fixed the newly added check for gaps in imported alignments (it did not really work, but broke
126 | the import) (lib_intertext.php)
127 | - fixed problem with importing 0:1 or 1:0 alignments from TCA2, which links those to the parent
128 | element instead (lib_intertext.php)
129 |
130 | Release 1.6
131 | -----------
132 | - changed files: lib_intertext.php, aligner.php, icons/changelog.png
133 | - (optional changes: help.php, help_cs.php)
134 |
135 | Features:
136 | - imported alignments are checked for completeness; if there is a gap in the alignment, the
137 | import fails
138 | - the changed/edited elements can show their history of changes and their contents can be replaced
139 | with some previous contents (state) (un-splitting or un-merging is still not possible but
140 | manually, though!)
141 | - searching for changed/edited elements
142 | - searching both sides (versions) at the same time
143 |
144 |
145 | Release 1.5
146 | -----------
147 | - database structure modified! (apply 'update-1.5.sql' script)
148 | - changed/added files: lib_intertext.php, aligner.php, cli/import, cli/align, css/intertext.css,
149 | icons/swap.png
150 | - (optional changes: help.php, help_cs.php, settings.php)
151 |
152 | Features:
153 | - English translation of the "user guide" (help.php), the Czech text is in 'help_cs.php'
154 | - imported texts remember their original filenames => imported alignment can identify
155 | the texts by their original filenames and not just the internal 'text name' and 'version name'
156 | - swap sides/versions in alignment (for admin)
157 | - import with 'cli/align' in the reverse direction
158 | - the supervisor (responsible) is now also allowed to edit alignment all the time (settings.php)
159 |
160 | Fixes:
161 | - searching bookmarks searched in all alignments of the given text (lib_intertext)
162 |
163 | Release 1.4
164 | -----------
165 | - initial public release
166 |
--------------------------------------------------------------------------------
/INSTALL:
--------------------------------------------------------------------------------
1 | =========================
2 | INSTALLATION INSTRUCTIONS
3 | =========================
4 |
5 | Overview:
6 |
7 | 1) Check requirements.
8 | 2) Copy all files into a web-server accessible directory.
9 | 3) Set-up MySQL.
10 | 4) Check installation of automatic aligners.
11 | 5) Check config/config.php and adjust to your needs.
12 | 6) Read user documentation (help.php) and run the CLI scripts (in 'cli/'
13 | directory) to get more informatiomn on their usage
14 | 7) [optional] Check and adapt trigger scripts in 'triggers/' directory.
15 |
16 |
17 | Ad 1) REQUIREMENTS
18 | ------------------
19 |
20 | - A web server (tested with Apache 2.2) with PHP >= 5.2 support (older versions
21 | might work well, but were not tested)
22 | - PHP CLI support for CLI tools
23 | - PHP support (modules) for: XMLReader, JSON.
24 | - if you want to import XML files with external DTDs (needed for declaration of
25 | entities, etc.), you need to allow the option "allow_url_fopen" in php.ini for
26 | both Apache web-server and the CLI version of PHP
27 | - MySQL v5.6 or higher for fulltext search support; for older versions you must
28 | turn off fulltext searches explicitly by inserting '$DISABLE_FULLTEXT = true;'
29 | into your config.php
30 |
31 |
32 | Ad 2) Copy files to you web-server directory
33 | --------------------------------------------
34 |
35 | Ensure the symbolic link from index.php to aligner.php is there. 'aligner.php'
36 | is the main script that should be run.
37 |
38 | Ad 3) Set-up MySQL
39 | ------------------
40 |
41 | - it is highly suggested to use the option innodb_file_per_table in your
42 | MySQL configuration (usually in /etc/mysql/my.cnf, see the database
43 | documentation)
44 | - ensure that you have no upper size limit set for the main tablespace
45 | in innodb_data_file_path and that you have enough space available on your disk
46 | - [optional] if you want to use the MySQL fulltext search capability to search
47 | for words shorter than 4 characters in the texts, you have to adjust the
48 | configuration of MySQL before creating the database / indices (or rebuild the
49 | indices) by setting "ft_min_word_len = 3" and innodb_ft_min_token_size if you
50 | want to set it to even less characters - see MySQL documentation for more details
51 | - create basic database from intertext.sql script and create a user with full
52 | access to the database (or uncomment the default GRANT command in the script to
53 | create the default user)
54 | - if you do not have a database of users, create the table of default users from
55 | users.sql (InterText does not include its own management of users! but you can
56 | use any other system using MySQL database) - there are three default users
57 | created by users.sql: 'admin', 'resp' and 'editor', all with the default
58 | password 'test'; they represent the default three levels of users supported by
59 | InterText (see below for details)
60 | - set up the database connection parameters for the database of texts (and the
61 | database of users, if you made it a separate database) in config/config.php
62 |
63 | Explanation of the system of users in the InterText system:
64 |
65 | There are three levels of users in the workflow of the InterCorp project:
66 |
67 | - 'administrators' have all rights; it is the main project coordinator(s) who
68 | prepare texts for further processing, convert them into valid XML files and
69 | import them into the InterText system
70 | - 'supervisors (responsibles)' are people with (almost) full access to single
71 | texts assigned to them by the administrator or another 'responsible' users; in
72 | the InterCorp project, they are coordinators of language sections and supply the
73 | raw texts to the administrators, who prepare them for further processing in
74 | InterText; they can then assign the alignments (which they are responsible for)
75 | to particular editors or to each other and should check the quality of the results
76 | - 'editors' are users-workers (often students), who only can edit alignments
77 | assigned to them by higher level users
78 |
79 | The finer control over access rights can be modified by rewriting appropriate
80 | parts in config/default_permissions.php. See there for comments.
81 |
82 |
83 | Ad 4) Installation of automatic aligners
84 | ----------------------------------------
85 |
86 | There are currently two supported automatic aligners:
87 |
88 | HUNALIGN (http://mokk.bme.hu/resources/hunalign):
89 | - you need to have a working binary 'hunalign' in the hunalign/ directory
90 | - there must be at least one default dictionary for hunalign, by default there
91 | is the empty dictionary _none_.dic
92 | - you can add as many dictionaries as you will, they will appear in InterText as
93 | different profiles for hunalign (the filename will be used without the .dic
94 | extension)
95 | - if you want to add pre-processing to the alignment process (e.g.
96 | lemmatization), you have to supply the processing into the process.sh script
97 | (see comments in the process.sh script for details)
98 |
99 | TCA2 (http://gandalf.aksis.uib.no/tca2/):
100 | - place the jar archive with the command-line version (not the GUI version!) of
101 | TCA2 into the tca2/ directory; it has to be called tca2.jar
102 | - you need a working java 1.6 VM in your system (or whatever you version
103 | requires)
104 | - you need profiles for each pair of languages - each profile consists of a pair
105 | of configuration file (.cfg) and a dictionary file (.dic) with otherwise
106 | identical filenames (see enclosed files for examples)
107 |
108 | You do not need any automatic aligner, but it can save you a lot of manual work
109 | by preparing an alignment that you only check and correct manually. By default,
110 | InterText itself can only 'align' the sentences 'one-to-one' (the method called
111 | 'plain alignment' in the system, its results have also visually lower status
112 | than results from the automatic aligners).
113 |
114 |
115 | Ad 5) configuration
116 | ------------------
117 |
118 | The files in the config/ directory are the first files which get processed
119 | at every request. You can modify the default settings and permissions here.
120 | The config.php file contains the very basic settings and defaults.
121 | Read the file comments for further details.
122 |
123 | You have to set up the database connections for the database of texts and the
124 | database of users in the config/config.php file.
125 |
126 | For the database of users, you can supply your own name of the table of users
127 | and the names of columns with the username, password, user-level, first name and
128 | surname of the users. (The password should be encoded by md5sum.) You can also
129 | define which values of your user-level column correspond to which user level in
130 | the InterText system.
131 |
132 | By modifying the set_alignment_settings function in config/default_permissions.php,
133 | you can change the system of permissions for single texts, alignments and users.
134 |
135 | Ad 7) The triggers
136 | ------------------
137 |
138 | The 'triggers/' directory contains scripts, which are run every time the status
139 | of some alignment is changed. The scripts can be any executable files with the
140 | appropriate names. The names are 'alstat_open', 'alstat_finished',
141 | 'alstat_closed' and 'alstat_blocked' for the 'open', 'finished', 'closed' and
142 | 'blocked' status. The most probable use will be for the "closed" (or "finished")
143 | script, which can e.g. export files from InterText, upload them to your corpus
144 | manager, update your database of completed texts, do accounting of payments to
145 | the editor / coordinator, etc.
146 |
147 | See for comments in the example scripts with details on arguments sent to the
148 | script.
149 |
150 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | ***************************************************************************
2 | Copyright (c) 2010-2017 Pavel Vondřička (Pavel.Vondricka@korpus.cz)
3 | Copyright (c) 2010-2017 Charles University in Prague, Faculty of Arts,
4 | Institute of the Czech National Corpus
5 | ***************************************************************************
6 |
7 | This package contains InterText Server.
8 |
9 | InterText Server is free software: you can redistribute it and/or modify
10 | it under the terms of the GNU General Public License as published by
11 | the Free Software Foundation, either version 3 of the License, or
12 | (at your option) any later version.
13 |
14 | InterText Server is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with InterText Server. If not, see .
21 |
22 | ***************************************************************************
23 |
24 | The subdirectory "icons" contains files from the KDE project Oxygen
25 | (http://www.kde.org/) licensed under LGPL v3. See icons/LICENSE
26 | for details.
27 |
28 | ***************************************************************************
29 |
30 | InterText Server uses additional third-party javascript libraries licensed
31 | under their own licenses as provided in their code:
32 |
33 | jQuery:
34 | - js/jquery-1.3.2.min.js
35 | - js/ui.core.js
36 | - js/ui.progressbar.js
37 | - css/cupertino/ (all contents within this directory and its subdirectories)
38 |
39 | JEIP:
40 | - js/jeip.js
41 |
42 | JXS:
43 | - js/jxs.js
44 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # InterText Server
2 |
3 | InterText is an on-line editor for aligned parallel texts. It was developed for
4 | the project [InterCorp](http://www.korpus.cz/intercorp/?lang=en) to edit and
5 | manage alignments of multiple parallel language versions of texts at the level
6 | of sentences, but it is designed with flexibility in mind and supports custom
7 | XML documents and Unicode character set. The software is written in PHP and uses
8 | MySQL database as back-end.
9 |
10 | _InterText Server_ is the original server based implementation with web-based interface, using PHP a MySQL database. It is designed for management of large, collaborative projects with many users, and - unlike the personal desktop application called _Intertext Editor_ - its installation and deployment requires at least some basic skills of server administrator.
11 |
12 | See the [InterText project homepage](http://wanthalf.saga.cz/intertext) for more details.
13 |
14 | ## Features
15 |
16 | - can manage any number of texts
17 | - can manage any number of text (language) versions for each text
18 | - import and export of any valid XML document (see LIMITATIONS & KNOWN ISSUES!)
19 | - support of unicode (UTF-8) by default
20 | - automatic conversion of custom entities into UTF-8 characters on import
21 | - arbitrary alignments between any pair of (language) versions of the same text
22 | - one level alignment, every text version can define its own XML elements
23 | containing text to be aligned
24 | - integration of the 'hunalign' and 'TCA2' automatic aligners
25 | - import and export of alignments in TEI XML format (stand-off alignment, no
26 | conversion, see below for details)
27 | - opt. export of documents with 'corresp' attributes on aligned elements
28 | - opt. export of documents with text segments enclosed in elements (for
29 | ParaConc compatibility)
30 | - possibility to edit text on-the-fly when editing alignments (can be forbidden
31 | on per-text basis)
32 | - keeps history of all changes to the text for later revision
33 | - possibility to change segmentation of elements (e.g. sentences) by splitting
34 | or merging them in the alignment editor (can be forbidden on per-text basis)
35 | - possibility to split or merge container (parent) elements (e.g. paragraphs)
36 | - separate possibility to prevent the change of segmentation (structure) for
37 | 'pivot' text versions
38 | - automatic (one- or two-level) re-numbering of text elements after change in
39 | segmentation (structure)
40 | - possibility to set bookmarks in the alignment and jump quickly between them
41 | - possibility to search for substrings, fulltext search and regular expression
42 | based search in the texts (as limited by the MySQL-engine capabilities), search
43 | for "suspicious" alignments and edited/changed elements, etc.
44 | - basic workflow management based on three-level user hierarchy (only basic user
45 | management, uses external database of users) and three-(four)-level status of
46 | alignments
47 | - command-line access to the import and export functions for batch-processing
48 | - triggers for external scripts on the change of alignment status
49 | - synchronization of texts and alignments with external InterText editor clients
50 |
51 |
52 | ## Technical details on file formats
53 |
54 | - the system expects use of id-attributes with (at most) two-part numbers (two levels) for all
55 | alignable elements, the separator can be any of : , . - _ characters; their
56 | parent elements can be numbered by simple numbers only; prefixes to the
57 | id-attributes are possible, but they will be stripped on import (and can be
58 | regenerated on export as "long-ids" by the corresponding function in
59 | config/export_customization.php
60 | - the default (re-)numbering scheme is to have simple numbers for containers
61 | (parents) and two-part numbers for alignable elements, separated by a colon
62 | (e.g. "12:3" for the third sentence (element) in the 12th paragraph (container))
63 | - if nested containers are detected in the document, only simple (single level)
64 | numbering of the alignable elements is applied and their parents (containers)
65 | are ignored
66 | - the file format for TEI alignment file is one single "linkGrp" element with
67 | two attributes: "toDoc" and "fromDoc"; their values should point to the
68 | filenames of the separate documents, or at least have the form:
69 | "document_name.version_name.extensions" - extensions are optional, but
70 | "document_name" and "version_name" are used to identify the aligned document
71 | versions of this alignment according to the names as declared in InterText;
72 | the "linkGrp" element then contains the "link" elements, each corresponding
73 | to one position (segment) in the alignment, with the following attributes:
74 | - "xtargets" is a semicolon separated list of element's id-values linked
75 | together (first a space-separated list of element id-s from the "toDoc"
76 | document, and after the semicolon a space-separated list of element id-s
77 | from the "fromDoc" document);
78 | - "status" is an optional attribute with the status of the link - known values
79 | are "man" (for manually confirmed link), "auto" (for automatically aligned
80 | elements), "plain" (for unaligned / unconfirmed / uknown status);
81 | - "mark" is used internally to preserve user bookmarks from the editor, only
82 | values 0 and 1 are known, but for 0 no attribute is generated at all on export
83 | - "type" is only generated on export for convenience, it gives a dash
84 | separated count of elements linked together by the link (e.g. "1-2")
85 |
86 |
87 | ## LIMITATIONS & KNOWN ISSUES
88 |
89 | - the package does not contain the Hunalign nor the TCA2 automatic aligners
90 | - DOCTYPE, entity definitions and the XML declaration element are not imported
91 | (preserved) from the XML file (a problem of the PHP XMLReader module); the only
92 | preserved node types are: elements with their attributes (see below for
93 | exception!), text and CDATA contents, comments, processing instructions and
94 | whitespace formatting (CDATA not tested); you can (as a workaround) add your own
95 | DOCTYPE on export or otherwise modify the exported XML header by modification of
96 | the corresponding function in config/export_customization.php
97 | - the PHP XMLReader module is obscure in many ways and its behaviour changes
98 | in different versions of PHP; it is highly suggested to validate every document
99 | by a separate XML validator before import into InterText - the validation officially
100 | supported by the XMLReader behaves unpredictably and erratically, if it works at all;
101 | in case of further issues, remove any DOCTYPE as well
102 | - the "id" attributes of elements are parsed and only final numbers are
103 | extracted: two-part numbers for alignable elements (e.g. "12:3") and single
104 | numbers for the other elements; the alignable elements and their parents
105 | (containers) get renumbered when the document structure is changed in the
106 | editor; in the two-level numbering mode, any other elements will just lose their
107 | id-attributes (i.e. will be cut down to any final numbers like the containers,
108 | if there were any); long id-attributes (and other id-s) can be (as a workaround)
109 | restored/re-created on export by the corresponding function defined in
110 | config/export_customization.php; by configuring InterText to use single-level
111 | numbering of elements exclusively, the IDs of elements (except of the alignable ones)
112 | can be kept, however!
113 | - some versions of "hunalign" are known to fail (segmentation fault)
114 | with texts larger than ca. 30000 elements (this is not a problem of InterText)
115 |
116 |
117 | ## For more information read...
118 |
119 | - INSTALL - installation instructions, set-up, customization and other
120 | administration-related information
121 | - UPDATE.txt - instructions for update
122 | - help.php - user-manual, including details on the functions and principles of
123 | the system
124 | - CHANGELOG - list of changes (added features and fixed bugs)
125 |
126 | For the very basic principles and problems of parallel text alignment, you may also refer to the manual of the _InterText Editor_, available (a.o.) from the [project homepage](http://wanthalf.saga.cz/intertext).
127 |
128 | ## Acknowledgement:
129 |
130 | This software and documentation was partly supported from the implementation of the Czech National Corpus project (LM2011023) funded by the _Ministry of Education, Youth and Sports_ of the Czech republic within the framework of _Large Research, Development and Innovation Infrastructures_.
131 |
132 | ## License:
133 |
134 | This software is licensed under the GNU General Public License v3. (http://www.gnu.org/licenses/gpl-3.0.html)
135 |
136 | - Copyright (c) 2010-2017 Pavel Vondřička
137 | - Copyright (c) 2010-2017 Charles University in Prague, Faculty of Arts, Institute of the Czech National Corpus
138 |
139 |
--------------------------------------------------------------------------------
/UPDATE.txt:
--------------------------------------------------------------------------------
1 | -> version 2.3
2 | ==============
3 |
4 | - the configuration file settings.php has been replaced and split into the files:
5 | init.php
6 | config/config.php
7 | config/default_permissions.php
8 | config/export_customization.php
9 | config/login_handler.php
10 | (you need to move your configuration settings into the appropriate files; in most
11 | cases this will only concern the settings in the config/config.php file)
12 |
13 | -> version 2.2
14 | ==============
15 |
16 | - you need EITHER to have MySQL version >= 5.6 OR to turn off fulltext searches
17 | explicitly by inserting '$DISABLE_FULLTEXT = true;' into your config.php -
18 | this must be decided/solved FIRST OF ALL!
19 | - it is highly suggested to use the option innodb_file_per_table in your
20 | MySQL configuration (usually in /etc/mysql/my.cnf, see the database
21 | documentation)
22 | - ensure that you have no upper size limit set for the main tablespace
23 | in innodb_data_file_path and that you have enough space available on your disk;
24 | the file may grow by several gigabytes even when using
25 | innodb_file_per_table and if it hits a size limit, you may get into troubles with
26 | the conversion process (below); the database will also grow significantly in
27 | size after conversion
28 | - in order to make the new transaction support effective on existing data,
29 | you need to run the script 'update-2.2.php', which will convert all
30 | existing tables into the InnoDB format (and remove fulltext indexes if
31 | fulltext is disabled in config.php) - this conversion is NOT neccessary for
32 | InterText to run, but until you convert the tables, the transactions will
33 | silently be ineffective for all texts existing before the update
34 | (and even for newly added translations of those texts!) - this conversion should
35 | in theory be safe to do on a running system, but making back-ups before any
36 | change is always highly recommended!
37 |
38 | version 1.7 -> version 2.0
39 | ==========================
40 | - before updating, the database must be updated by running the
41 | 'update-2.0.php' script
42 | - new options need to be added to settings.php
43 |
44 | version 1.4 -> version 1.5
45 | ==========================
46 | - before updating, the database must be updated by running the
47 | 'update-1.5.sql' script in MySQL
48 | - additional changes in settings.php may apply
49 |
--------------------------------------------------------------------------------
/alignment.php:
--------------------------------------------------------------------------------
1 | .
20 | *
21 | */
22 |
23 | set_time_limit(9999);
24 | require 'init.php';
25 | require 'lib_intertext.php';
26 | $system = new InterText;
27 |
28 | print "Process: Creating alignment...\nProgress: 0\n"; flush(); ob_flush();
29 | if ($_SESSION['realign']) {
30 | $res = $aid = $_COOKIE['InterText_aid'];
31 | } else {
32 | #$v1 = $system->txtver_by_id($_COOKIE['InterText_txt'],$_SESSION['al_ver1']);
33 | #$v2 = $system->txtver_by_id($_COOKIE['InterText_txt'],$_SESSION['al_ver2']);
34 | #$aid = $system->insert_alignment($v1['text_id'],$v1['id'],$v2['id'],$_SESSION['al_method'],$_SESSION['al_profile'],$USER['id']);
35 | $aid = $system->insert_alignment($_COOKIE['InterText_txt'],$_SESSION['al_ver1'],$_SESSION['al_ver2'],$_SESSION['al_method'],$_SESSION['al_profile'],$USER['id'],0,$DEFAULT_EDIT_PERMISSION);
36 | $defstat = $_SESSION['al_default_status'];
37 | $res = $aid;
38 | }
39 |
40 | if (!$res) { print "Process: Creating alignment...
ERROR: These versions have already an open alignment!\n\n"; flush(); ob_flush(); }
41 | else {
42 | # Import alignment from file, if any
43 | if ($res AND $_SESSION['al_file']!='')
44 | $res = $system->import_alignment($_SESSION['al_file'],$aid,$defstat,TRUE,FALSE);
45 |
46 | if ($res) {
47 | # Run automatic aligner as requested
48 | switch ($_SESSION['al_method']) {
49 | case "tca2":
50 | $res = $system->autoalign_tca2($aid,$_SESSION['al_profile']);
51 | break;
52 | case "hunalign":
53 | $res = $system->autoalign_hunalign($aid,$_SESSION['al_profile']);
54 | break;
55 | default:
56 | $res = $system->plain_alignment($aid);
57 | }
58 | }
59 |
60 | # Create plain alignment for the rest
61 | #if ($res) $system->plain_alignment($aid);
62 |
63 | # In case of failure...
64 | if (!$res) {
65 | if (!$_SESSION['realign']) $system->delete_alignment($aid);
66 | } else print "Process: Finished.\n";
67 | }
68 |
69 | if ($_SESSION['al_file']!='') unlink($_SESSION['al_file']);
70 | unset($_SESSION['realign']);
71 | unset($_SESSION['al_file']);
72 | unset($_SESSION['al_ver1']);
73 | unset($_SESSION['al_ver2']);
74 | unset($_SESSION['al_method']);
75 | unset($_SESSION['al_profile']);
76 | unset($_SESSION['al_default_status']);
77 |
78 | ?>
79 |
--------------------------------------------------------------------------------
/cli/.htaccess:
--------------------------------------------------------------------------------
1 | Deny from all
2 |
3 |
--------------------------------------------------------------------------------
/cli/align:
--------------------------------------------------------------------------------
1 | #!/usr/bin/php
2 | .
21 | *
22 | */
23 |
24 | $CLI_MODE = true;
25 | $pwd = preg_replace('/[^\/]*$/','',$_SERVER['PATH_TRANSLATED']);
26 | require $pwd.'/../init.php';
27 | require $pwd.'/../lib_intertext.php';
28 |
29 | $edit = $DEFAULT_EDIT_PERMISSION;
30 | $method = $DEFAULT_METHOD;
31 | $profile = $DEFAULT_PROFILE;
32 | $defstat = 1;
33 | $verbose = false;
34 | $resp = 0;
35 | $editor = 0;
36 | $swap = false;
37 | $force = false;
38 |
39 | array_shift($argv);
40 | while ($arg = array_shift($argv)) {
41 | switch ($arg) {
42 | case '-i':
43 | $filename = array_shift($argv);
44 | break;
45 | case '-m':
46 | $method = array_shift($argv);
47 | $profile = '';
48 | list($method,$profile) = explode(':',$method,2);
49 | break;
50 | case '-r':
51 | $resp = array_shift($argv);
52 | break;
53 | case '-d':
54 | $defstat = array_shift($argv);
55 | break;
56 | case '-e':
57 | $editor = array_shift($argv);
58 | break;
59 | case '-c_chstruct':
60 | $c_chstruct = 1;
61 | break;
62 | case '-edit':
63 | $edit = 1;
64 | break;
65 | case '-noedit':
66 | $edit = 0;
67 | break;
68 | case '-swap':
69 | $swap = true;
70 | break;
71 | case '-v':
72 | $verbose = true;
73 | break;
74 | case '-f':
75 | $force = true;
76 | break;
77 | case '-s':
78 | $status = array_shift($argv);
79 | break;
80 | default:
81 | if (substr($arg,0,1)=='-') {
82 | print "Error: Unknow option '$arg'.\n"; exit;
83 | } elseif ($tname=='') $tname = $arg;
84 | elseif ($ver1=='') $ver1 = $arg;
85 | elseif ($ver2=='') $ver2 = $arg;
86 | else $fail=true;
87 | }
88 | }
89 |
90 | $statusdata = "1=manual, 2=automatic, 3=plain";
91 |
92 | if (($filename=='' && ($tname=='' || $ver1=='' || $ver2=='')) || $fail) {
93 | print "InterText CLI alignment utility
94 | ===============================
95 | Tool to import and/or generate alignment between two different versions of one text in the InterText system.
96 |
97 | Usage:
98 |
99 | align [options]
100 | align [options] -i
101 |
102 | Options:
103 |
104 | -i
105 | import initial alignment from file
106 |
107 | -swap
108 | swap sides/versions when importing from file (option -i)
109 |
110 | -d
111 | default status for imported alignment links with unknown status:
112 | $statusdata (default: manual)
113 |
114 | -m [:]
115 | specify method (and profile) for authomatic alignment, currently
116 | available mathods: plain, tca2, hunalign (default: by config/config.php, currently: '$DEFAULT_METHOD:$DEFAULT_PROFILE')
117 |
118 | -r
119 | set user-id of the user responsible for the alignment (default: '0' = nobody)
120 |
121 | -e
122 | set user-id of alignment editor (default: '0' = nobody)
123 |
124 | -c_chstruct
125 | enable permission to change structure of the central text version (default: disabled)
126 |
127 | -edit
128 | enable permission to edit the texts (default: by config/config.php, currently: '$DEFAULT_EDIT_PERMISSION')
129 |
130 | -noedit
131 | disable permission to edit the text (default: by config/config.php, currently: '$DEFAULT_EDIT_PERMISSION')
132 |
133 | -s
134 | set status for the alignment, possible values: open, finished, closed, blocked (default: open)
135 |
136 | -f
137 | force delete if alignment already exists
138 |
139 | -v
140 | verbose output (show progress)
141 | ===============================
142 | ";
143 | exit;
144 | }
145 |
146 | $it = new InterText;
147 | if ($tname!='' && $ver1!='' && $ver2!='') {
148 | if (!($txtid=$it->text_id_by_name($tname))) die("Error: Text '$tname' not found in database.\n");
149 | $v1 = $it->txtver_info($txtid,$ver1);
150 | if (!$v1) die("Error: Version '$ver1' not found in database.\n");
151 | $v2 = $it->txtver_info($txtid,$ver2);
152 | if (!$v2) die("Error: Version '$ver2' not found in database.\n");
153 | $aid = $it->insert_alignment($txtid,$v1['id'],$v2['id'],$method,$profile,$resp,$editor,$edit);
154 | if ($aid)
155 | $res = true;
156 | else {
157 | if ($force) {
158 | $al = $it->get_alignment_by_name($tname,$ver1,$ver2);
159 | //if (!$al) $al = $it->get_alignment_by_name($tname,$ver2,$ver1);
160 | $aid = $al['id'];
161 | $it->delete_alignment($aid);
162 | $aid = $it->insert_alignment($txtid,$v1['id'],$v2['id'],$method,$profile,$resp,$editor,$edit);
163 | $res = true;
164 | } else
165 | die("Error: Such alignment already exists.\n");
166 | }
167 | } else $aid = FALSE;
168 |
169 | if ($filename && $filename!='') {
170 | $res = $it->import_alignment($filename,$aid,$defstat,$verbose,FALSE,$method,$profile,$resp,$editor,$edit,$swap);
171 | if ($res) $aid = $res;
172 | }
173 |
174 | if ($res) {
175 | # Run automatic aligner as requested
176 | switch ($method) {
177 | case "tca2":
178 | $res = $it->autoalign_tca2($aid,$profile,$verbose);
179 | break;
180 | case "hunalign":
181 | $res = $it->autoalign_hunalign($aid,$profile,$verbose);
182 | break;
183 | default:
184 | $res = $system->plain_alignment($aid);
185 | }
186 | }
187 |
188 | # In case of failure...
189 | if (!$res) {
190 | if ($aid) $it->delete_alignment($aid);
191 | if ($_ERROR=='') $_ERROR = 'Error while creating alignment. Turn on verbose mode (-v) for more information.';
192 | print $_ERROR."\n";
193 | return 1;
194 | } else {
195 | if ($c_chstruct) $it->alignment_chcstruct($aid,$c_chstruct);
196 | if ($status!='') {
197 | //if ($status=='closed') $res=$it->alignment_chstat($aid,ALSTAT_FINISHED);
198 | if ($res) {
199 | $stat = array_search($status,$ALSTAT);
200 | if ($stat) $res=$it->alignment_chstat($aid,$stat);
201 | else print "Error setting status: Unknown status '$status'.\n";
202 | }
203 | if (!$res) print "Error setting status: $_ERROR\n";
204 | }
205 | }
206 |
207 | return 0;
208 |
209 | ?>
210 |
--------------------------------------------------------------------------------
/cli/export:
--------------------------------------------------------------------------------
1 | #!/usr/bin/php
2 | .
21 | *
22 | */
23 |
24 | $CLI_MODE = true;
25 | $tname='';
26 | $skipempty = false;
27 |
28 | array_shift($argv);
29 | while ($arg = array_shift($argv)) {
30 | switch ($arg) {
31 | case '-se':
32 | $skipempty = true;
33 | break;
34 | case '-f':
35 | $format = array_shift($argv);
36 | break;
37 | case '-tname':
38 | $tname = array_shift($argv);
39 | break;
40 | case 'aid':
41 | $mode = 'aid';
42 | $aid = array_shift($argv);
43 | if ($format=='') $format='xml';
44 | break;
45 | case 't1aid':
46 | $mode = 't1aid';
47 | $aid = array_shift($argv);
48 | if ($format=='') $format='xml';
49 | break;
50 | case 't2aid':
51 | $mode = 't2aid';
52 | $aid = array_shift($argv);
53 | if ($format=='') $format='xml';
54 | break;
55 | case 'aname':
56 | $mode = 'aname';
57 | $tname = array_shift($argv);
58 | $v1name = array_shift($argv);
59 | $v2name = array_shift($argv);
60 | if ($format=='') $format='xml';
61 | break;
62 | case 'tname':
63 | $mode = 'tname';
64 | $tname = array_shift($argv);
65 | $vname = array_shift($argv);
66 | if ($format=='') $format='xml';
67 | break;
68 | case 'all_closed':
69 | $mode = 'all_closed';
70 | if ($format=='') $format='xml';
71 | break;
72 | }
73 | }
74 |
75 | $pwd = preg_replace('/[^\/]*$/','',$_SERVER['PATH_TRANSLATED']);
76 | require $pwd.'/../init.php';
77 | require $pwd.'/../lib_intertext.php';
78 |
79 | if ($mode=='' || ($mode=='aname' && ($tname=='' || $v1name=='' || $v2name=='')) || ($mode=='tname' && ($tname=='' || $vname=='')) || (substr($mode,-3)=='aid' && $aid=='')) {
80 | print "InterText CLI export utility
81 | ============================
82 | Tool to export alignments and texts from the InterText system.
83 |
84 | Usage:
85 |
86 | export [options] aid
87 | export [options] aname
88 | export [options] t1aid
89 | export [options] t2aid
90 | export [options] tname
91 | export [options] all_closed
92 |
93 | Options:
94 |
95 | -f
96 | format of the output
97 | for alignments:
98 | xml - XML TEI file with links (plain IDs) [default]
99 | xml:ic - XML TEI file with links (long IDs for project InterCorp)
100 | xml:fn - XML TEI file with links (long filename-based IDs for project ECPC)
101 | for texts:
102 | xml - original XML file (plain IDs) [default]
103 | xml:ic - original XML file (long IDs for project InterCorp)
104 | xml:fn - original XML file (long filename-based IDs for project ECPC)
105 | corresp - original XML file with added 'corresp' attributes on text elements,
106 | linking the corresponding element IDs from the other version
107 | (cannot be used in 'tname' mode)
108 | segs - XML file with ments (ParaConc format)
109 |
110 | -se
111 | skip empty segments in alignment export
112 |
113 | for all_closed:
114 | -tname
115 | export only alignments of the given text
116 |
117 | Examples:
118 |
119 | - export alignment id 34
120 |
121 | export aid 34
122 |
123 | - export alignment of text 'Document1', versions 'english' and 'french'
124 |
125 | export aname Document1 english french
126 |
127 | - export second text version of alignment id 34
128 |
129 | export t2aid 34
130 |
131 | - export text version 'english' of 'Document1'
132 |
133 | export tname Document1 english
134 |
135 | - export all closed alignments with the texts into the current directory
136 |
137 | export all_closed
138 |
139 | ============================
140 | ";
141 | exit;
142 | }
143 |
144 | $it = new InterText;
145 | $res = false;
146 |
147 | switch ($mode) {
148 | case 'aid':
149 | $res = $it->export_alignment($aid,$format,$skipempty);
150 | break;
151 | case 'aname':
152 | $al = $it->get_alignment_by_name($tname,$v1name,$v2name);
153 | if (!$al) $al = $it->get_alignment_by_name($tname,$v2name,$v1name);
154 | if ($al) $res = $it->export_alignment($al['id'],$format,$skipempty);
155 | break;
156 | case 't1aid':
157 | $al = $it->alignment_info($aid);
158 | if (!$al) break;
159 | $res = $it->export_document($al['text_id'],$al['ver1_id'],$aid,$format);
160 | break;
161 | case 't2aid':
162 | $al = $it->alignment_info($aid);
163 | if (!$al) break;
164 | $res = $it->export_document($al['text_id'],$al['ver2_id'],$aid,$format);
165 | break;
166 | case 'tname':
167 | $tid = $it->text_id_by_name($tname);
168 | if (!$tid) { $_ERROR = "Error: Text not found."; break; }
169 | $ver = $it->txtver_info($tid,$vname);
170 | if (!$ver) { $_ERROR = "Error: Version not found."; break; }
171 | $res = $it->export_document($tid,$ver['id'],0,$format);
172 | break;
173 | case 'all_closed':
174 | $list = $it->get_alignments_by_status(ALSTAT_CLOSED,$tname);
175 | foreach ($list as $al) {
176 | $alname = $al['text_name'].'.'.$al['v1_name'].'.'.$al['v2_name'].'.alignment.xml';
177 | $v1name = $al['text_name'].'.'.$al['v1_name'].'.xml';
178 | $v2name = $al['text_name'].'.'.$al['v2_name'].'.xml';
179 | print $alname;
180 | if (!file_exists($alname)) {
181 | $res = $it->export_alignment($al['id'],$format,$skipempty);
182 | if (!$res) print ' - export failed: '.$_ERROR."\n";
183 | else {
184 | if (file_put_contents($alname,$res)) print "\n";
185 | else print " - cannot save file!\n";
186 | }
187 | } else print " - file already exists!\n";
188 | print $v1name;
189 | if (!file_exists($v1name)) {
190 | $res = $it->export_document($al['text_id'],$al['v1_id'],$al['id'],$format);
191 | if (!$res) print ' - export failed: '.$_ERROR."\n";
192 | else {
193 | if (file_put_contents($v1name,$res)) print "\n";
194 | else print " - cannot save file!\n";
195 | }
196 | } else print " - file already exists!\n";
197 | print $v2name;
198 | if (!file_exists($v2name)) {
199 | $res = $it->export_document($al['text_id'],$al['v2_id'],$al['id'],$format);
200 | if (!$res) print ' - export failed: '.$_ERROR."\n";
201 | else {
202 | if (file_put_contents($v2name,$res)) print "\n";
203 | else print " - cannot save file!\n";
204 | }
205 | } else print " - file already exists!\n";
206 | }
207 | $res = '';
208 | break;
209 | }
210 |
211 | if (!$res) {
212 | $stderr = fopen('php://stderr', 'w');
213 | fwrite($stderr,$_ERROR."\n");
214 | fclose($stderr);
215 | return 1;
216 | } else {
217 | print $res;
218 | return 0;
219 | }
220 | ?>
221 |
--------------------------------------------------------------------------------
/cli/import:
--------------------------------------------------------------------------------
1 | #!/usr/bin/php
2 | .
21 | *
22 | */
23 |
24 | $CLI_MODE = true;
25 | $filename='';
26 | $validate = false;
27 |
28 | array_shift($argv);
29 | while ($arg = array_shift($argv)) {
30 | switch ($arg) {
31 | case '-e':
32 | $myelements = array_shift($argv);
33 | break;
34 | case '-n':
35 | $mydocname = array_shift($argv);
36 | break;
37 | case '-v':
38 | $myversion = array_shift($argv);
39 | break;
40 | case '--validate':
41 | $validate = true;
42 | break;
43 | case 'align':
44 | $ver2 = array_shift($argv);
45 | $alopts = array();
46 | while ($opt = array_shift($argv)) $alopts[] = $opt;
47 | $aloptions = join(' ',$alopts);
48 | break;
49 | case 'align1':
50 | $ver1 = array_shift($argv);
51 | $alopts = array();
52 | while ($opt = array_shift($argv)) $alopts[] = $opt;
53 | $aloptions = join(' ',$alopts);
54 | break;
55 | default:
56 | if (substr($arg,0,1)=='-') {
57 | print "Error: Unknow option '$arg'.\n"; exit;
58 | } elseif ($filename=='') $filename = $arg;
59 | else $fail=true;
60 | }
61 | }
62 |
63 | $pwd = preg_replace('/[^\/]*$/','',$_SERVER['PATH_TRANSLATED']);
64 | require $pwd.'/../init.php';
65 | require $pwd.'/../lib_intertext.php';
66 |
67 | $p = explode('/',$filename);
68 | $docname = $p[count($p)-1];
69 | list($docname,$version,$ext) = explode('.',$docname,3);
70 | if ($mydocname!='') $docname = $mydocname;
71 | if ($myversion!='') $version = $myversion;
72 | if ($myelements!='') $elements = strtr($myelements,',',' ');
73 | else $elements = $DEFAULT_TEXT_ELEMENTS;
74 |
75 |
76 | if ($filename=='' || $docname=='' || $version=='' || $fail) {
77 | print "InterText CLI import utility
78 | ============================
79 | Tool to import text versions into the InterText system and import or generate alignments between them.
80 |
81 | Usage:
82 |
83 | import [options] [align [alignment_options]]
84 | import [options] [align1 [alignment_options]]
85 |
86 | Filename format:
87 |
88 | ..
89 |
90 | Options:
91 |
92 | -e
93 | comma separated list of names of XML elements containing alignable text (e.g. '-e head,s,verse')
94 |
95 | -n
96 | text name (overrides the text name acquired from the filename)
97 |
98 | -v
99 | text version (overrides the version name acquired from filename)
100 |
101 | --validate
102 | force DTD validation
103 |
104 | Align:
105 | Create alignment with version or after the import. The other version
106 | must already be present in the system. Alignment is created by calling the associated 'align' utility.
107 |
108 | Alignment options:
109 | See the 'align' script for options.
110 |
111 | Examples:
112 |
113 | - to import text 'Document1' version 'english' from file 'Document1.english.xml':
114 |
115 | import Document1.english.xml
116 |
117 | - to import text 'Document1' version 'english' from file 'd1_en.xml':
118 |
119 | import -n Document1 -v english d1_en.xml
120 |
121 | - to import 'Document1' version 'french' from file 'Document1.french.xml' and create
122 | automatic alignment with the version 'english' of the same document:
123 |
124 | import Document1.french.xml align english
125 |
126 | - to import 'Document1' version 'french' from the file 'Document1.french.xml' and create
127 | alignment with version 'english', imported from file 'Document1.en-fr_alignment.xml':
128 |
129 | import Document1.french.xml align english -i Document1.en-fr_alignment.xml
130 | ============================
131 | ";
132 | exit;
133 | }
134 |
135 | $it = new InterText;
136 | $res = $it->import_document($docname,$version,$filename,$elements,true,$filename,$validate);
137 | if (!$res) { print $_ERROR."\n"; return 1; }
138 | elseif ($ver2!='') return system("$pwd/align $docname $version $ver2 $aloptions");
139 | elseif ($ver1!='') return system("$pwd/align $docname $ver1 $version $aloptions");
140 | else return 0;
141 |
142 | ?>
143 |
--------------------------------------------------------------------------------
/cli/renumber:
--------------------------------------------------------------------------------
1 | #!/usr/bin/php
2 | .
21 | *
22 | */
23 |
24 | $CLI_MODE = true;
25 | $pwd = preg_replace('/[^\/]*$/','',$_SERVER['PATH_TRANSLATED']);
26 | require $pwd.'/../init.php';
27 | require $pwd.'/../lib_intertext.php';
28 |
29 | $verbose = false;
30 | $twolevel = true;
31 | $tname = '';
32 | $vname = '';
33 |
34 | array_shift($argv);
35 | while ($arg = array_shift($argv)) {
36 | switch ($arg) {
37 | case '-1':
38 | $twolevel = false;
39 | break;
40 | default:
41 | if (substr($arg,0,1)=='-') {
42 | print "Error: Unknow option '$arg'.\n"; exit;
43 | } elseif ($tname=='') $tname = $arg;
44 | elseif ($vname=='') $vname = $arg;
45 | else $fail=true;
46 | }
47 | }
48 |
49 | if (($tname=='' || $vname=='') || $fail) {
50 | print "InterText CLI renumbering utility
51 | ==================================
52 | Tool to renumber ID of the given text version in the InterText system.
53 |
54 | Usage:
55 |
56 | renumber [options]
57 |
58 | Options:
59 |
60 | -1
61 | single level numbering only
62 |
63 | ===============================
64 | ";
65 | exit;
66 | }
67 |
68 | $it = new InterText;
69 | if (!($txtid=$it->text_id_by_name($tname))) die("Error: Text '$tname' not found in database.\n");
70 | $vid = $it->txtver_info($txtid,$vname);
71 | $vid = $vid['id'];
72 | if (!$vid) die("Error: Version '$vname' not found in database.\n");
73 |
74 |
75 | $res = $it->update_eids($txtid, $vid, $twolevel);
76 |
77 | if ($res==1 && $twolevel) {
78 | print "Warning: Text renumbered, but only single level alignment was possible.\n";
79 | }
80 |
81 | return 0;
82 |
83 | ?>
84 |
--------------------------------------------------------------------------------
/cli/update:
--------------------------------------------------------------------------------
1 | #!/usr/bin/php
2 | .
21 | *
22 | */
23 |
24 | $CLI_MODE = true;
25 | $userid = 0;
26 |
27 | array_shift($argv);
28 | while ($arg = array_shift($argv)) {
29 | switch ($arg) {
30 | case '-u':
31 | $userid = array_shift($argv);
32 | break;
33 | case '-n':
34 | $mydocname = array_shift($argv);
35 | break;
36 | case '-v':
37 | $myversion = array_shift($argv);
38 | break;
39 | default:
40 | if (substr($arg,0,1)=='-') {
41 | print "Error: Unknow option '$arg'.\n"; exit;
42 | } elseif ($filename=='') $filename = $arg;
43 | else $fail=true;
44 | }
45 | }
46 |
47 | $pwd = preg_replace('/[^\/]*$/','',$_SERVER['PATH_TRANSLATED']);
48 | require $pwd.'/../init.php';
49 | require $pwd.'/../lib_intertext.php';
50 |
51 | $p = explode('/',$filename);
52 | $docname = $p[count($p)-1];
53 | list($docname,$version,$ext) = explode('.',$docname,3);
54 | if ($mydocname!='') $docname = $mydocname;
55 | if ($myversion!='') $version = $myversion;
56 |
57 | if ($filename=='' || $docname=='' || $version=='' || $fail) {
58 | print "InterText CLI update utility
59 | ============================
60 | Tool to update text versions already present in the database. The given file
61 | will be compared with the database for each text element and in case of
62 | difference the database elements will be updated with the new text. The
63 | structure (and 'id' attributes) must be identical! If not, the script fails
64 | as soon as some ID is not found in the database. However, changes commited up
65 | to this point will NOT be revoked! (The changes are recorded in the changelog
66 | table, at least.) Backup your texts before updating them!
67 |
68 | The script will output a list of all changes done, including the ID and both
69 | the old and the new text of every changed element.
70 |
71 | Usage:
72 |
73 | update [options]
74 |
75 | Filename format:
76 |
77 | ..
78 |
79 | Options:
80 |
81 | -n
82 | text name (overrides the text name acquired from the filename)
83 |
84 | -v
85 | text version (overrides the version name acquired from filename)
86 |
87 | -u
88 | set user-id as the author of updates (default: '0' = nobody)
89 |
90 | ============================
91 | ";
92 | exit;
93 | }
94 |
95 | $it = new InterText;
96 | $res = $it->update_document($docname,$version,$filename,$userid,true);
97 | if (!$res) { print $_ERROR."\n"; return 1; }
98 | else return 0;
99 |
100 | ?>
101 |
--------------------------------------------------------------------------------
/config/config.php:
--------------------------------------------------------------------------------
1 | .
20 | *
21 | */
22 |
23 | ### General defaults
24 | # set default timezone
25 | date_default_timezone_set('Europe/Prague');
26 | # MySQL access for InterText database:
27 | $DB_SERVER = "localhost";
28 | $DB_USER = "intertext";
29 | $DB_PASSWORD = "intertext";
30 | $DB_DATABASE = "intertext";
31 | # MySQL access for user database
32 | $U_SERVER = $DB_SERVER;
33 | $U_USER = $DB_USER;
34 | $U_PASSWORD = $DB_PASSWORD;
35 | $U_DATABASE = $DB_DATABASE;
36 | $U_TABLE = 'users';
37 | $U_USERNAME = 'username';
38 | $U_USERPASS = 'password';
39 | $U_USERTYPE = 'status';
40 | $U_USERID = 'id';
41 | $U_FIRSTNAME = 'name';
42 | $U_SURNAME = 'surname';
43 | # USER levels <=> values in database, column $U_USERTYPE
44 | $USER_ADMIN = 0; # main administrator
45 | $USER_RESP = 1; # supervisor / section coordinator / responsible
46 | $USER_EDITOR = 2; # editor
47 | # ordering of alignmnets (do not change unless you know what and why!)
48 | $ALORDER = array(
49 | 'ver1asc' => 'v1.version_name ASC',
50 | 'ver1desc' => 'v1.version_name DESC',
51 | 'ver2asc' => 'v2.version_name ASC',
52 | 'ver2desc' => 'v2.version_name DESC',
53 | 'edasc' => 'a.editor ASC',
54 | 'eddesc' => 'a.editor DESC',
55 | 'respasc' => 'a.resp ASC',
56 | 'respdesc' => 'a.resp DESC',
57 | 'statasc' => 'a.status ASC, a.id DESC',
58 | 'statdesc' => 'a.status DESC, a.id DESC'
59 | );
60 | # default order in the list of alignments
61 | $DEFAULT_TORDER = 'asc'; # primary sorting by text name ('asc', 'desc' or '' for no ordering by text name)
62 | $DEFAULT_ALORDER = 'ver1asc';
63 | # names of modes
64 | $MODES=array(
65 | '1'=>"manual status update",
66 | '6'=>'manual & roll (-5)',
67 | '7'=>'manual & roll (-2)',
68 | '8'=>'manual & roll (act.)',
69 | '2'=>'auto update status',
70 | '3'=>'auto & roll (-5)',
71 | '4'=>'auto & roll (-2)',
72 | '5'=>'auto & roll (act.)'
73 | );
74 | # default mode
75 | $DEFAULT_MODE=4;
76 | # available limits of positions per page
77 | $LIMITS = array('10','20','50','100');
78 | # default limit (positions per page)
79 | $DEFAULT_LIMIT=20;
80 | # Highlight non-1:1 alignments by default?
81 | $DEFAULT_HIGHLIGHT = 1; # 1=true, 0=false
82 | # Hide controls by default?
83 | $DEFAULT_HIDE = 0; # 1=true, 0=false
84 | # Default permission to edit texts
85 | $DEFAULT_EDIT_PERMISSION = 1; # 1=true; 0=false
86 | # Default permission to change structure of central/pivot text versions
87 | $DEFAULT_C_CHSTRUCT_PERMISSION = 0; # 1=true; 0=false
88 | # Central/pivot text versions (protected of structure changes by the c_chstruct attribute)
89 | $C_VERSION = 'cs-.*'; # Czech versions for InterCorp
90 | # default alignment method and profile (for automatic alignment)
91 | $DEFAULT_METHOD='hunalign';
92 | $DEFAULT_PROFILE='_none_';
93 | #$DEFAULT_METHOD='tca2';
94 | #$DEFAULT_PROFILE='no-cs';
95 | # Default XML elements containing alignable text
96 | $DEFAULT_TEXT_ELEMENTS = 'head s verse';
97 | # Back links
98 | $TXTMGR_URL = '';
99 | $TXTMGR_TEXT = '';
100 | # Logout URL
101 | $LOGOUT_URL = 'aligner.php';
102 | # Global permissions
103 | # $SET['newalign']: permission to CREATE new alignments
104 | # $SET['delalign']: permission to DELETE alignments
105 | # $SET['realign']: permission to run automatic alignment again from any position
106 | # $SET['chalmethod']: permission to change method for authomatic re-alignment
107 | # $SET['export']: permission to export texts and/or alignment
108 | $SET['newalign'] = false;
109 | $SET['delalign'] = false;
110 | $SET['realign'] = true;
111 | $SET['chalmethod'] = true;
112 | $SET['export'] = true;
113 | # Maximal user level for upload of new alignments from the client InterText editor application
114 | # (the user will also be allowed to download any text version from the database!)
115 | $UPLOAD_MAXUSERLEVEL_CLIENT = $USER_ADMIN;
116 | # Maximal user level for download of isolated text versions
117 | $DOWNLOAD_TXTVER_MAXUSERLEVEL = $USER_ADMIN;
118 | # Filter text versions freely accessible for download (limited to user with the UPLOAD permission above)
119 | $DOWNLOAD_TXTVER_FILTER = '.*'; # all versions / "cs-.*": only Czech versions for InterCorp
120 | # Tags allowed in text:
121 | $TAGS_IN_TEXT="i|b|u|emph";
122 | # Use logging of text editation changes?
123 | $LOG_EDIT_CHANGES = true;
124 | # Log all changes in alignments!
125 | $LOG_ALIGN_CHANGES = false;
126 | # Enforce single level (re)numbering of alignable elements
127 | # (and keep original IDs of all other elements!)
128 | $FORCE_SIMPLE_NUMBERING = false;
129 | # ignore unconfirmed alignments when checking for merge conflicts
130 | $MERGE_UNCONFIRMED_FREELY = false;
131 | # deny users to remove text from elements
132 | $DENY_EMPTY_UPDATES = true;
133 | # disable fulltext search (necessary for MySQL <= 5.5)
134 | $DISABLE_FULLTEXT = false;
135 | ?>
--------------------------------------------------------------------------------
/config/default_permissions.php:
--------------------------------------------------------------------------------
1 | .
20 | *
21 | */
22 |
23 | #### Default settings for ADMIN ####
24 | if ($USER['type']==$USER_ADMIN) {
25 | $SET['newalign'] = true;
26 | $SET['delalign'] = true;
27 | $SET['realign'] = true;
28 | $SET['chalmethod'] = true;
29 | $SET['export'] = true;
30 | $SET['client_upload'] = true;
31 | $TXTMGR_URL = 'textmanager.php';
32 | $TXTMGR_TEXT = 'textmanager';
33 | }
34 | #####################################
35 |
36 | # Settings and permissions for particular alignment / text version / user
37 | function set_alignment_settings($alinfo) {
38 | global $SET,$TXTMGR_URL,$TXTMGR_TEXT,$USER,$C_VERSION,$USER_ADMIN;
39 | ###### INPUT array keys for $alinfo array:
40 | # text_name: name of the text
41 | # ver1_id: ID of text version 1
42 | # ver1_name: name of text version 1
43 | # ver2_id: ID of text version 2
44 | # ver2_name: name of text version 2
45 | ###### OUTPUT array for each version:
46 | # $SET[]['chtext']: permisssion to change text (=edit element contents)
47 | # $SET[]['chstruct']: permisssion to change text structure (=split/merge elements)
48 | # $SET['reaonly']: do not allow any changes to the alignment, read-only access
49 |
50 | # Here, some defaults can be set per user, too
51 | global $DEFAULT_METHOD, $DEFAULT_PROFILE, $DEFAULT_HIGHLIGHT, $DEFAULT_MODE, $DEFAULT_LIMIT;
52 |
53 | if ($USER['type']<=$UPLOAD_MAXUSERLEVEL_CLIENT)
54 | $SET['client_upload'] = true;
55 | else
56 | $SET['client_upload'] = false;
57 |
58 | if ($USER['type']==$USER_ADMIN) {
59 | # admin can edit everything, always!
60 | $SET['readonly'] = FALSE;
61 | $SET[$alinfo['ver1_id']]['chtext'] = true;
62 | $SET[$alinfo['ver1_id']]['chstruct'] = true;
63 | $SET[$alinfo['ver2_id']]['chtext'] = true;
64 | $SET[$alinfo['ver2_id']]['chstruct'] = true;
65 | } else {
66 | # Deny everything by default for others
67 | $SET[$alinfo['ver1_id']]['chtext'] = false;
68 | $SET[$alinfo['ver1_id']]['chstruct'] = false;
69 | $SET[$alinfo['ver2_id']]['chtext'] = false;
70 | $SET[$alinfo['ver2_id']]['chstruct'] = false;
71 | $SET['readonly'] = TRUE;
72 | }
73 |
74 | if ($alinfo['editor']==$USER['id'] || $alinfo['resp']==$USER['id']) {
75 | if ($alinfo['chtext']) {
76 | $SET[$alinfo['ver1_id']]['chtext'] = true;
77 | $SET[$alinfo['ver2_id']]['chtext'] = true;
78 | if ($alinfo['c_chstruct'] || !preg_match("/^$C_VERSION$/",$alinfo['ver1_name']))
79 | $SET[$alinfo['ver1_id']]['chstruct'] = true;
80 | if ($alinfo['c_chstruct'] || !preg_match("/^$C_VERSION$/",$alinfo['ver2_name']))
81 | $SET[$alinfo['ver2_id']]['chstruct'] = true;
82 | }
83 | if ($alinfo['status']==ALSTAT_OPEN) $SET['readonly'] = FALSE;
84 | }
85 |
86 | ### Complete "Access denied" termination
87 | #require 'header.php';
88 | #print "Access denied!
\n<< $TXTMGR_TEXT