├── AUTHORS ├── COPYING ├── README.md ├── addToDotGitignore ├── admin ├── Dockerfile ├── ORM │ ├── __init__.py │ ├── readFlaskModel.py │ └── readFlaskView.py ├── ReadCursorSample.ipynb ├── SampleIIIFManifest.ipynb ├── SampleREADdbUsing_psycopg2.ipynb ├── app.py ├── config │ ├── __init__.py │ ├── config.py │ ├── gunicorn.py │ ├── instance │ │ └── __init__.py │ └── settings.py ├── data_stats │ ├── __init__.py │ ├── glyph_counts_by_category.ipynb │ └── output │ │ └── .gitignore ├── data_tools │ ├── __init__.py │ ├── output │ │ └── .gitignore │ └── text_edition_cleanup.ipynb ├── extensions.py ├── module │ ├── __init__.py │ ├── iiifManifest.py │ ├── readQueryCursor.py │ └── readStatistics.py ├── requirements.txt └── wsgi.py ├── common ├── css │ ├── exGlossary.css │ ├── jqx.kanishka.css │ └── kanishka.css ├── fonts │ ├── gusym.ttf │ └── gusym.vfb ├── images │ ├── Guest.png │ ├── logo_EFEO.jpg │ ├── logo_LMU.png │ ├── logo_Prakas.png │ ├── logo_UNIL.png │ ├── logo_USyd.png │ └── logo_UW.png └── php │ ├── DBManager.php │ ├── cropImage.php │ ├── cropImagePoly.php │ ├── getEntityInfo.php │ ├── sessionStartUp.php │ ├── userAccess.php │ └── utils.php ├── config-sample.php ├── dev ├── calcLemmaCache.php ├── calcTextEditionCache.php ├── calcTextViewerCache.php ├── calcViewerCache.php ├── calcWordLocations.php ├── changeEntityOwner-Vis.php ├── createImageThumbnails.php ├── gc.php ├── manageDBUsingSQL.php ├── manageDBUsingSQLWin10.php ├── profiles │ ├── .gitignore │ └── transProfiles.sh ├── seqViewTree.php ├── startup.sql ├── synchBaseXEpiDoc.php ├── testCatalogLinks.php ├── testCode.php ├── testEditionLinks.php ├── traces │ ├── .gitignore │ └── transTraces.sh └── validateLine.php ├── doc └── git_log_2013-2017.txt ├── docker ├── READdockerME.md ├── docker-compose.yml ├── pg │ ├── Dockerfile │ └── install-hstore.sh └── php-apache │ └── Dockerfile ├── editors ├── css │ ├── annoVE.css │ ├── editionVE.css │ ├── exGlossary.css │ ├── imageViewer.css │ ├── lemmaVE.css │ ├── paleoVE.css │ ├── propertyVE.css │ ├── searchVE.css │ ├── sequenceVE.css │ ├── syntaxVE.css │ └── wordlistVE.css ├── imageEditor.html ├── imageSegmentor.html ├── images │ ├── 100x100-check.gif │ ├── downButton.png │ ├── leftButton.png │ ├── rightButton.png │ ├── setting.png │ └── upButton.png ├── js │ ├── annoVE.js │ ├── attrVE.js │ ├── dataManager.js │ ├── debug.js │ ├── editionVE.js │ ├── entPropVE.js │ ├── frameV.js │ ├── imageVE.js │ ├── imgVE.js │ ├── layoutManager.js │ ├── lemmaVE.js │ ├── paleoVE.js │ ├── propertyEditor.js │ ├── propertyManager.js │ ├── searchVE.js │ ├── sequenceVE.js │ ├── syllableEditor.js │ ├── syntaxVE.js │ ├── tabbedPropVE.js │ ├── tagVE.js │ ├── tcmEditor.js │ ├── threeDVE.js │ ├── translationV.js │ ├── userEditor.js │ ├── utility.js │ └── wordlistVE.js └── utilityUI │ └── entityEditor.php ├── index.php ├── install.md ├── model ├── authTokenTable.sql ├── buildDBforImport9.3.sh ├── disableAllTriggers.sql ├── enableAllTriggers.sql ├── entities │ ├── Annotation.php │ ├── Annotations.php │ ├── Attribution.php │ ├── AttributionGroup.php │ ├── AttributionGroups.php │ ├── Attributions.php │ ├── Baseline.php │ ├── Baselines.php │ ├── Bibliographies.php │ ├── Bibliography.php │ ├── Catalog.php │ ├── Catalogs.php │ ├── Collection.php │ ├── CollectionObjs.php │ ├── Collections.php │ ├── Compound.php │ ├── Compounds.php │ ├── Date.php │ ├── Edition.php │ ├── Editions.php │ ├── Entity.php │ ├── EntityFactory.php │ ├── EntityIterator.php │ ├── Era.php │ ├── Fragment.php │ ├── Fragments.php │ ├── Grapheme.php │ ├── Graphemes.php │ ├── Image.php │ ├── Images.php │ ├── Inflection.php │ ├── Inflections.php │ ├── Item.php │ ├── Items.php │ ├── JsonCache.php │ ├── Lemma.php │ ├── Lemmas.php │ ├── Line.php │ ├── Lines.php │ ├── Link.php │ ├── MaterialContext.php │ ├── MaterialContexts.php │ ├── OrderedSet.php │ ├── Part.php │ ├── Parts.php │ ├── ProperNoun.php │ ├── ProperNouns.php │ ├── Run.php │ ├── Runs.php │ ├── Segment.php │ ├── Segments.php │ ├── Sequence.php │ ├── Sequences.php │ ├── Span.php │ ├── Spans.php │ ├── Surface.php │ ├── Surfaces.php │ ├── SyllableCluster.php │ ├── SyllableClusters.php │ ├── Term.php │ ├── Terms.php │ ├── Text.php │ ├── TextMetadata.php │ ├── TextMetadatas.php │ ├── Texts.php │ ├── Token.php │ ├── Tokens.php │ ├── UserGroup.php │ ├── UserGroups.php │ └── entityTemplate.php ├── import │ ├── jsonImportItem.php │ ├── jsonImportText.php │ ├── jsonItemTemplate.php │ ├── jsonMetadataTemplate.php │ ├── jsonTextTemplate.php │ ├── jsonUpdateMetadata.php │ ├── jsonUpdateTextEntitiesSample.php │ ├── jsonUpdateTextEntitiesUtil.php │ └── sample.php ├── importNewTermsToMaint.sh ├── kanishkaSchema.sql ├── kanishkaSchemaConstraints.sql ├── kanishkaTerm.sql ├── maintTermViewQuery.sql ├── migration │ └── exportXML │ │ ├── export_db_to_xml.sh │ │ ├── getNode.xq │ │ ├── kanishkatest_schema.xsd │ │ ├── removeDuplicateNodes.php │ │ └── updateEpiDocFromDir.xq ├── rebuildTermsTable.sh ├── runUpdateSQL.sh ├── schemaPrnUpdate.sql ├── schemaUpdate.sql ├── term.sql ├── typeTermUsageMappedToMaintQuery.sql ├── typeTermUsageQuery.sql └── utility │ ├── graphemeCharacterMap.php │ ├── parser.php │ └── textCriticalMarks.php ├── sample.env ├── services ├── changePwd.php ├── clientDataUtils.php ├── cloneEdition.php ├── combineTokens.php ├── commitFreeTextLine.php ├── createCompound.php ├── createEdition.php ├── createPlainTextEdition.php ├── createWordSearchLookup.php ├── deleteBaseline.php ├── deleteCatalog.php ├── deleteEdition.php ├── deleteEntity.php ├── deleteLemma.php ├── deleteLine.php ├── deleteSyllable.php ├── deleteText.php ├── downloadImage.php ├── downloadTextfile.php ├── exportEditionToEpiDoc.php ├── exportEpiDoc.php ├── exportHTMLGlossary.php ├── exportPaleography.php ├── exportRTFEdition.php ├── exportRTFGlossary.php ├── exportRTFStructural.php ├── exportRTFTranslation.php ├── fullCorpusSearchByWords.php ├── getAnnotations.php ├── getEditionStatus.php ├── getEditionSyntaxData.php ├── getEntityData.php ├── getFragmentSurfacesList.php ├── getItemPartsList.php ├── getItemTextsList.php ├── getItemsList.php ├── getPartFragmentsList.php ├── getSchemaRML.php ├── getTagInfo.php ├── getTermUpdateReport.php ├── getTextRML.php ├── getUserPreferences.php ├── insertFreeTextLine.php ├── insertNewLine.php ├── insertNewSyllable.php ├── invalidateSeqCache.php ├── linkOrderedSegments.php ├── load3DViewerData.php ├── loadAttributions.php ├── loadCatalogEntities.php ├── loadTextBaseline.php ├── loadTextBaselines.php ├── loadTextEdition.php ├── loadTextEntities.php ├── loadTextResources.php ├── loadTextSearchEntities.php ├── logChanges.php ├── login.php ├── logout.php ├── mergeLine.php ├── orderSegment.php ├── reOrderSegments.php ├── recalcCatalogLocationMap.php ├── reclipSegmentImageToCache.php ├── refreshEditionWordLocations.php ├── refreshSortCodes.php ├── refreshSortCodesKanishkaTest.php ├── refreshSortCodesKanishkaTestNC.php ├── saveAnno.php ├── saveAttrs.php ├── saveBaseline.php ├── saveCatalog.php ├── saveCompoundAnalysis.php ├── saveEdition.php ├── saveEntityData.php ├── saveEntityLog.php ├── saveFragment.php ├── saveImage.php ├── saveItem.php ├── saveLemma.php ├── saveLink.php ├── savePart.php ├── saveSandhi.php ├── saveSegment.php ├── saveSegment3DAnnotation.php ├── saveSequence.php ├── saveSurface.php ├── saveSyllable.php ├── saveSyntaxChanges.php ├── saveTags.php ├── saveText.php ├── saveText3DModelUID.php ├── saveUserPreferences.php ├── searchAttributions.php ├── splitLine.php ├── splitToken.php ├── switchEntity.php ├── updateGraphemeTCM.php ├── updateLemmaEntryCache.php ├── updateSegments.php ├── updateWordLocationLabelMap.php ├── uploadImage.php ├── utilRML.php ├── validateFreeTextLine.php ├── validateNewEditionString.php ├── xmlNodeHelper.php └── xsl │ └── rml2EpiDoc.xsl └── viewer ├── css └── readviewer.css ├── exportTextViewer.php ├── getTextViewer.php ├── images └── download.png ├── js └── imageViewer.js └── php └── viewutils.php /AUTHORS: -------------------------------------------------------------------------------- 1 | This file is part of the Research Environment for Ancient Documents (READ). 2 | 3 | Contributors to the READ codebase (2013–2017) are: 4 | 5 | Stephen White 6 | Andrew Glass 7 | Yang Li 8 | 9 | READ functionality has been designed (2013–2017) by the READ development team: 10 | 11 | Stefan Baums 12 | Andrew Glass 13 | Ian McCrabb 14 | Stephen White 15 | 16 | and the following individual contributors: 17 | 18 | Arlo Griffiths 19 | Andrea Schlosser 20 | 21 | Copyright in parts of the READ codebase is held by: 22 | 23 | Stephen White 24 | Andrew Glass 25 | Ludwig‐Maximilians‐Universität München 26 | Prakaś Foundation 27 | University of Washington 28 | University of Sydney 29 | 30 | For details please refer to the file in this distribution, as well as to the Git commit log at . 31 | 32 | READ is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 33 | 34 | READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 35 | 36 | You should have received a copy of the GNU General Public License along with READ. If not, see . 37 | -------------------------------------------------------------------------------- /addToDotGitignore: -------------------------------------------------------------------------------- 1 | # below are listed the directories and files to 2 | # ignore in git 3 | # these are configuration files and output directories 4 | # used by READ where content should be ignores. 5 | package.json 6 | .eslintrc.json 7 | .vscode/launch.json 8 | .vscode/settings.json 9 | .env 10 | model/migration 11 | model/migration/.gitignore 12 | model/migration/*.php 13 | model/migration/*.txt 14 | model/migration/*.sh 15 | model/allLastTermInfo.txt 16 | model/allTermInfo.txt 17 | model/allTermInfoForDB.txt 18 | model/maintTermTypeUsage.txt 19 | plugins 20 | viewer/*.html 21 | images 22 | readfilestore 23 | config.php 24 | .idea 25 | dev/traces 26 | dev/profiles 27 | admin/__pycache__ 28 | admin/ORM/__pycache__ 29 | admin/config/__pycache__ 30 | admin/data_stats/__pycache__ 31 | admin/data_tools/__pycache__ 32 | admin/module/__pycache__ 33 | -------------------------------------------------------------------------------- /admin/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.7-slim-buster 2 | # MAINTAINER Stephen White 3 | 4 | ENV INSTALL_PATH /readadmin 5 | RUN mkdir -p $INSTALL_PATH 6 | 7 | WORKDIR $INSTALL_PATH 8 | 9 | COPY requirements.txt requirements.txt 10 | RUN pip install -r requirements.txt 11 | 12 | COPY . . 13 | # requires setup.py for setup of tools ignore for now 14 | # RUN pip install --editable . 15 | 16 | CMD gunicorn -b 0.0.0.0:8001 --access-logfile - "wsgi:application" -------------------------------------------------------------------------------- /admin/ORM/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/admin/ORM/__init__.py -------------------------------------------------------------------------------- /admin/SampleIIIFManifest.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "#pip install psycopg2\n", 10 | "%load_ext autoreload\n", 11 | "%autoreload 2" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "metadata": {}, 17 | "source": [ 18 | "## Working with IIIF manifest\n", 19 | "\n", 20 | "### loading the manifest from url" 21 | ] 22 | }, 23 | { 24 | "cell_type": "code", 25 | "execution_count": null, 26 | "metadata": {}, 27 | "outputs": [], 28 | "source": [ 29 | "import requests\n", 30 | "import json\n", 31 | "url = \"https://somecorp.org/iiif/item1/manifests\"\n", 32 | "r = requests.get(url)\n", 33 | "itemDict = r.json()" 34 | ] 35 | }, 36 | { 37 | "cell_type": "code", 38 | "execution_count": null, 39 | "metadata": {}, 40 | "outputs": [], 41 | "source": [ 42 | "iiif_manifest_metadata = json.dumps(itemDict['metadata'])\n", 43 | "print(f\"manifest metadata: {iiif_manifest_metadata}\")\n", 44 | "iiif_item_description = itemDict['description'][0]['@value']\n", 45 | "print(f\"found item {iiif_item_description}\")\n", 46 | "iiif_images_license = itemDict['license']\n", 47 | "iiif_images_license\n", 48 | "iiif_images_attr = itemDict['attribution']\n", 49 | "iiif_images_attr\n", 50 | "image_count = len(itemDict['sequences'][0]['canvases'])\n", 51 | "print(f\"number of images is {image_count}\")" 52 | ] 53 | }, 54 | { 55 | "cell_type": "markdown", 56 | "metadata": {}, 57 | "source": [ 58 | "### Using iiifManifest library" 59 | ] 60 | }, 61 | { 62 | "cell_type": "code", 63 | "execution_count": null, 64 | "metadata": {}, 65 | "outputs": [], 66 | "source": [ 67 | "import module.iiifManifest as i3fm\n", 68 | "import json\n", 69 | "url = 'https://somecorp.org/iiif/item1/manifests'\n", 70 | "someItemManifest = i3fm.someItemManifest(url)\n", 71 | "someItemManifest.getItemImages()" 72 | ] 73 | } 74 | ], 75 | "metadata": { 76 | "interpreter": { 77 | "hash": "97ae724bfa85b9b34df7982b8bb8c7216f435b92902d749e4263f71162bea840" 78 | }, 79 | "kernelspec": { 80 | "display_name": "Python 3.8.3 64-bit ('base')", 81 | "language": "python", 82 | "name": "python3" 83 | }, 84 | "language_info": { 85 | "codemirror_mode": { 86 | "name": "ipython", 87 | "version": 3 88 | }, 89 | "file_extension": ".py", 90 | "mimetype": "text/x-python", 91 | "name": "python", 92 | "nbconvert_exporter": "python", 93 | "pygments_lexer": "ipython3", 94 | "version": "3.8.3" 95 | } 96 | }, 97 | "nbformat": 4, 98 | "nbformat_minor": 2 99 | } 100 | -------------------------------------------------------------------------------- /admin/app.py: -------------------------------------------------------------------------------- 1 | ''' 2 | @author Stephen White 3 | @copyright Stephen White 4 | @link https://github.com/readsoftware 5 | @version 1.0 6 | @license 7 | @package READ.Admin 8 | 9 | Flask Admin Main Application 10 | ''' 11 | from flask import Flask, redirect 12 | from flask_admin import Admin, AdminIndexView 13 | import ORM.readFlaskModel as rfm 14 | import ORM.readFlaskView as rfv 15 | from extensions import ( 16 | csrf, 17 | # login_manager, 18 | ) 19 | from ORM.readFlaskModel import db 20 | import os 21 | 22 | dbAdminUsername = os.getenv('POSTGRES_USER') 23 | dbAdminPassword = os.getenv('POSTGRES_PASSWORD') 24 | 25 | 26 | def default_app(): 27 | app = Flask(__name__) 28 | 29 | @app.route("/") 30 | def index(): 31 | return "

READ Central Admin coming soon.


Try going direct to admin your database using localhost:8001/yourdbname" 32 | 33 | @app.route("/readadmin/") 34 | def unknown(name): 35 | return f"Failed connecting to dbname: {name}" 36 | 37 | print('returning default app') 38 | return app 39 | 40 | 41 | def checkDBName(dbname): 42 | # todo check is valid db and user has access 43 | return dbname 44 | 45 | 46 | def get_dbname_for_path(path): 47 | checkedDBName = checkDBName(path) 48 | print("got dbname",checkedDBName,"for path", path) 49 | return checkedDBName 50 | 51 | 52 | def create_dbAdmin(dbname=None): 53 | ''' 54 | Create app using app factory pattern 55 | 56 | :param dbname: name of database to admin 57 | :return :Flask app 58 | ''' 59 | print("create dbAdmin for",dbname) 60 | # create Flask app obj 61 | app = Flask(__name__, instance_relative_config=True) 62 | 63 | app.config.from_object('config.settings') #load config/settings.py 64 | app.config.from_pyfile('settings.py', silent=True) #load instance/settings.py if exist 65 | if dbname is None or dbname == '': 66 | return None # not using Admin for db, signal default startup 67 | app.config['SQLALCHEMY_DATABASE_URI'] = \ 68 | f'postgresql+psycopg2://{dbAdminUsername}:{dbAdminPassword}@db/{str(dbname)}' 69 | print(app.config['SQLALCHEMY_DATABASE_URI']) 70 | print("key",app.config['SECRET_KEY']) 71 | try: 72 | db.init_app(app) 73 | app.dbname = dbname 74 | admin = Admin(app, 75 | template_mode='bootstrap4', 76 | index_view=AdminIndexView(name=dbname, 77 | url='/'+dbname,)) 78 | with app.app_context(): 79 | rfv.addAllViews(admin, rfm, db) 80 | db.create_all() 81 | except Exception as err: 82 | print(err) 83 | return None 84 | 85 | @app.route('/favicon.ico') # handle browser request for icon 86 | def favicon(): 87 | return app.send_static_file('vreadlogo.ico') # requires static folder to contain file 88 | 89 | return app 90 | 91 | 92 | def extensions(app): 93 | """ 94 | Register 0 or more extensions (mutates the app passed in). 95 | 96 | :param app: Flask application instance 97 | :return: None 98 | """ 99 | csrf.init_app(app) 100 | db.init_app(app) 101 | # login_manager.init_app(app) 102 | 103 | return None 104 | 105 | 106 | if __name__ == "__main__": 107 | app.run() 108 | -------------------------------------------------------------------------------- /admin/config/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/admin/config/__init__.py -------------------------------------------------------------------------------- /admin/config/config.py: -------------------------------------------------------------------------------- 1 | # file used to set app configuration 2 | # NOTE the database is connected to FLASK using 3 | # SQLALCHEMY_DATABASE_URI 4 | # which needs to be configured before db.init_app 5 | # this can be done uding this file as follows: 6 | # (env) 7 | # set/export APP_CONFIGURATION_SETUP=\ 8 | # "pathfromapptothisconfigfile.configclassname" 9 | # set/export READ_DBNAME="postgresREADdatabasename" 10 | # 11 | # (app.py) 12 | # 13 | # from flask import Flask 14 | # import os 15 | # 16 | # app = Flask(__name__) 17 | # app_config_obj = os.environ['APP_CONFIGURATION_SETUP'] 18 | # dbname = os.getenv('READ_DBNAME') 19 | # app.config.from_object(app_config_obj) 20 | # app.config['SQLALCHEMY_DATABASE_URI'] = app.config['DATABASE_BASEURI']\ 21 | # + str(dbname) 22 | # 23 | 24 | class Config(object): 25 | DEBUG = False 26 | TESTING = False 27 | DATABASE_BASEURI = 'postgresql+psycopg2://postgres:gandhari@db/' 28 | SQLALCHEMY_TRACK_MODIFICATIONS = False 29 | 30 | 31 | class ProdConfig(Config): 32 | ENV = "production" 33 | SECRET_KEY = "98d0tie372SD90AS)(dd78(*&ASWWHD08A" 34 | SQLALCHEMY_ECHO = False 35 | 36 | 37 | class DevConfig(Config): 38 | DEBUG = True 39 | ENV = "development" 40 | SECRET_KEY = "9anvbf*O*^(das0ˆSDer73u5ba67900SA(D*66" 41 | SQLALCHEMY_ECHO = True 42 | 43 | 44 | class TestConfig(Config): 45 | ENV = "testing" 46 | TESTING = True 47 | SQLALCHEMY_ECHO = True 48 | -------------------------------------------------------------------------------- /admin/config/gunicorn.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | bind = '0.0.0.0:8000' 4 | accesslog = '-' 5 | access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" in %(D)sµs' 6 | -------------------------------------------------------------------------------- /admin/config/instance/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/admin/config/instance/__init__.py -------------------------------------------------------------------------------- /admin/config/settings.py: -------------------------------------------------------------------------------- 1 | DEBUG = True 2 | TESTING = False 3 | ENV = 'development' 4 | SQLALCHEMY_ECHO = True 5 | SQLALCHEMY_TRACK_MODIFICATIONS = False 6 | SECRET_KEY = "98d0tie372SD90AS)(dd78(*&ASWWHD08A" 7 | -------------------------------------------------------------------------------- /admin/data_stats/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/admin/data_stats/__init__.py -------------------------------------------------------------------------------- /admin/data_stats/output/.gitignore: -------------------------------------------------------------------------------- 1 | * -------------------------------------------------------------------------------- /admin/data_tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/admin/data_tools/__init__.py -------------------------------------------------------------------------------- /admin/data_tools/output/.gitignore: -------------------------------------------------------------------------------- 1 | * -------------------------------------------------------------------------------- /admin/extensions.py: -------------------------------------------------------------------------------- 1 | from flask_wtf import CSRFProtect 2 | from flask_admin import Admin 3 | # from flask_login import LoginManager 4 | 5 | csrf = CSRFProtect() 6 | # login_manager = LoginManager() 7 | admin = Admin() 8 | -------------------------------------------------------------------------------- /admin/module/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/admin/module/__init__.py -------------------------------------------------------------------------------- /admin/requirements.txt: -------------------------------------------------------------------------------- 1 | autopep8==1.5.4 2 | backcall==0.2.0 3 | click==7.1.2 4 | colorama==0.4.4 5 | decorator==4.4.2 6 | flake8==3.8.4 7 | flask>=2.2.5 8 | Flask-Admin==1.5.7 9 | Flask-SQLAlchemy==2.4.4 10 | Flask-WTF 11 | GeoAlchemy2==0.8.4 12 | gunicorn==22.0.0 13 | ipykernel==5.4.2 14 | ipython>=8.10.0 15 | ipython-genutils==0.2.0 16 | itsdangerous==1.1.0 17 | jedi==0.17.2 18 | jinja2>=2.11.3 19 | jupyter-client==6.1.7 20 | jupyter-core==4.11.2 21 | MarkupSafe==1.1.1 22 | matplotlib 23 | mccabe==0.6.1 24 | numpy 25 | pandas 26 | parso==0.7.1 27 | pickleshare==0.7.5 28 | prompt-toolkit==3.0.8 29 | python-dotenv 30 | psycopg2-binary 31 | pycodestyle==2.6.0 32 | pyflakes==2.2.0 33 | Pygments>=2.15.0 34 | python-dateutil==2.8.1 35 | pyzmq==20.0.0 36 | Shapely==1.7.1 37 | six==1.15.0 38 | SQLAlchemy==1.3.22 39 | SQLAlchemy-Utils==0.36.8 40 | toml==0.10.2 41 | tornado>=6.4.1 42 | traitlets==4.3.3 43 | wcwidth==0.2.5 44 | Werkzeug>=3.0.6 45 | WTForms==2.3.3 46 | pandas 47 | requests 48 | pillow 49 | python-dotenv 50 | livereload -------------------------------------------------------------------------------- /admin/wsgi.py: -------------------------------------------------------------------------------- 1 | ''' 2 | @author Stephen White 3 | @copyright Stephen White 4 | @link https://github.com/readsoftware 5 | @version 1.0 6 | @license 7 | @package READ.Admin 8 | 9 | Flask Admin Application Generator WSGI 10 | ''' 11 | from threading import Lock 12 | from werkzeug.wsgi import pop_path_info, peek_path_info 13 | from app import create_dbAdmin, default_app, get_dbname_for_path 14 | 15 | 16 | class PathDispatcher(object): 17 | 18 | def __init__(self, default_app, create_app): 19 | self.default_app = default_app 20 | self.create_app = create_app 21 | self.lock = Lock() 22 | self.instances = {} 23 | 24 | def get_application(self, path): 25 | print("path in disp get_app =", path) 26 | with self.lock: 27 | app = self.instances.get(path) 28 | if app is None: 29 | app = self.create_app(path) 30 | if app is not None: 31 | self.instances[path] = app 32 | return app 33 | 34 | def __call__(self, environ, start_response): 35 | app = self.get_application(peek_path_info(environ)) 36 | if app is not None: 37 | # print('env',environ) 38 | # pop_path_info(environ) 39 | # print('env',environ) 40 | print('startresp', start_response) 41 | else: 42 | app = self.default_app() 43 | return app(environ, start_response) 44 | 45 | 46 | def make_app(path): 47 | dbname = get_dbname_for_path(path) 48 | if dbname is not None: 49 | return create_dbAdmin(dbname) 50 | 51 | 52 | application = PathDispatcher(default_app, make_app) 53 | 54 | if __name__ == "__main__": 55 | application() 56 | -------------------------------------------------------------------------------- /common/css/exGlossary.css: -------------------------------------------------------------------------------- 1 | 2 | .entry { 3 | padding-bottom: 15px; 4 | } 5 | 6 | .lemmadef{ 7 | font-size: 12pt; 8 | text-indent: -30px; 9 | margin-left: 30px; 10 | padding-bottom: 3px; 11 | } 12 | 13 | .lemma{ 14 | font-size: 12pt; 15 | font-weight: bold; 16 | font-style: italic; 17 | padding-right: 5px; 18 | } 19 | 20 | .etym { 21 | font-size: 12pt; 22 | } 23 | .pos { 24 | font-size: 12pt; 25 | } 26 | 27 | .lemmaCommentary{ 28 | padding-left: 5px; 29 | } 30 | .lemmaLinks { 31 | margin-left: 30px; 32 | } 33 | .attestedforms { 34 | margin-left: 30px; 35 | } 36 | .seeLink, .cfLink { 37 | margin-left: 2px; 38 | font-weight: bold; 39 | font-style: italic; 40 | } 41 | .seeLink a, .cfLink a{ 42 | margin-left: 2px; 43 | color: rgb(96,96,96); 44 | text-decoration: none; 45 | } 46 | .lemmaLinksHeader { 47 | color: black; 48 | } 49 | span.etym:before{ 50 | content: ", "; 51 | } 52 | span.gloss:before{ 53 | content: ", \“"; 54 | } 55 | span.gloss:after{ 56 | content: ".\”"; 57 | } 58 | .inflectdescript{ 59 | padding-right: 5px; 60 | } 61 | .inflectsep{ 62 | padding-right: 5px; 63 | } 64 | .attestedformloc{ 65 | padding-left: 5px; 66 | } 67 | .attestedform { 68 | padding-left: 5px; 69 | font-size: 12pt; 70 | font-style: italic; 71 | } 72 | -------------------------------------------------------------------------------- /common/css/jqx.kanishka.css: -------------------------------------------------------------------------------- 1 | .jqx-button-kanishka{ 2 | outline: none; 3 | border: 1px solid transparent; 4 | padding: 3px; 5 | text-align: center; 6 | vertical-align: middle; 7 | margin: 0 0 0 0; 8 | cursor: default; 9 | } 10 | button.jqx-button-kanishka, 11 | input[type=button].jqx-button-kanishka, 12 | input[type=submit].jqx-button-kanishka { 13 | box-sizing: border-box !important; 14 | -moz-box-sizing: border-box !important; 15 | } 16 | 17 | .toolbuttondiv .jqx-fill-state-normal{ 18 | -moz-box-sizing: content-box; 19 | box-sizing: content-box; 20 | -ms-touch-action: none; 21 | font-family: Verdana,Arial,sans-serif; 22 | font-style: normal; 23 | font-size: 13px; 24 | border-color:#aaa; 25 | background: #efefef; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /common/fonts/gusym.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/common/fonts/gusym.ttf -------------------------------------------------------------------------------- /common/fonts/gusym.vfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/common/fonts/gusym.vfb -------------------------------------------------------------------------------- /common/images/Guest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/common/images/Guest.png -------------------------------------------------------------------------------- /common/images/logo_EFEO.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/common/images/logo_EFEO.jpg -------------------------------------------------------------------------------- /common/images/logo_LMU.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/common/images/logo_LMU.png -------------------------------------------------------------------------------- /common/images/logo_Prakas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/common/images/logo_Prakas.png -------------------------------------------------------------------------------- /common/images/logo_UNIL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/common/images/logo_UNIL.png -------------------------------------------------------------------------------- /common/images/logo_USyd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/common/images/logo_USyd.png -------------------------------------------------------------------------------- /common/images/logo_UW.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/common/images/logo_UW.png -------------------------------------------------------------------------------- /common/php/cropImage.php: -------------------------------------------------------------------------------- 1 | 105 | -------------------------------------------------------------------------------- /common/php/cropImagePoly.php: -------------------------------------------------------------------------------- 1 | 100) $transparency = 100; 10 | $colourNum = intval( 255 * (100-$transparency)/100); 11 | $image = null; 12 | 13 | if (!$url) { 14 | ob_clean(); 15 | header('Location: /images/100x100-check.gif'); 16 | return; 17 | }else { //get image for any URL 18 | $image = loadURLContent($url); 19 | } 20 | 21 | if (!$image) { 22 | ob_clean(); 23 | header('Location: /images/100x100-check.gif'); 24 | return; 25 | } 26 | 27 | if ($polygons) { 28 | $bounds = array(); 29 | foreach ($polygons as $polygon) { 30 | $bounds = array_merge($bounds,getBoundingRect($polygon)); 31 | } 32 | $bounds = getBoundingRect($bounds); 33 | $w = $bounds[4] - $bounds[0]+1;// add 1 to include end points 34 | $h = $bounds[5] - $bounds[1]+1; 35 | $originX = $bounds[0]; 36 | $originY = $bounds[1]; 37 | 38 | // crop the image to bounding box to reduce work - todo test image size against bbox size if < 90% then die 39 | $img_resized = imagecreatetruecolor($w, $h) or die; 40 | imagealphablending($img_resized, false);//preserve alpha 41 | imagesavealpha($img_resized, true); 42 | imagecopyresampled($img_resized, $image, 0, 0, $originX, $originY, $w, $h, $w, $h) or die; 43 | imagedestroy($image); 44 | $image = $img_resized; 45 | 46 | // create mask of areas we need to keep 47 | $mask = imagecreatetruecolor($w, $h); 48 | imagefill($mask, 0, 0, imagecolorallocate($mask, $colourNum, $colourNum, $colourNum)); 49 | 50 | $opaque = imagecolorallocate($mask, 255, 255, 255);//allocate white for opaque 51 | foreach ($polygons as $polygon) {// draw all polygons to keep, tranlating points to new origin 52 | $transPoly = getTranslatedPoly($polygon,-$originX,-$originY, true); 53 | imagefilledpolygon($mask, $transPoly,count($transPoly)/2, $opaque); 54 | } 55 | 56 | $workImage = imagecreatetruecolor( $w, $h ); 57 | imagesavealpha( $workImage, true ); 58 | imagefill( $workImage, 0, 0, imagecolorallocatealpha( $workImage, 0, 0, 0, 127 ) ); 59 | 60 | for( $x = 0; $x < $w; $x++ ) { 61 | for( $y = 0; $y < $h; $y++ ) { 62 | $alpha = imagecolorsforindex( $mask, imagecolorat( $mask, $x, $y ) ); 63 | $alpha = 127 - floor( $alpha[ 'red' ] / 2 ); 64 | $color = imagecolorsforindex( $image, imagecolorat( $image, $x, $y ) ); 65 | if ($color['alpha'] > $alpha) 66 | $alpha = $color['alpha']; 67 | if ($alpha == 127) { 68 | continue; 69 | $color['red'] = 0; 70 | $color['blue'] = 0; 71 | $color['green'] = 0; 72 | } 73 | imagesetpixel( $workImage, $x, $y, imagecolorallocatealpha( $workImage, $color[ 'red' ], $color[ 'green' ], $color[ 'blue' ], $alpha ) ); 74 | } 75 | } 76 | 77 | imagedestroy($image); 78 | imagedestroy($mask); 79 | $image = $workImage; 80 | } 81 | if (array_key_exists('rotate', $_REQUEST)) { 82 | $rotate = $_REQUEST['rotate']; 83 | $image = imagerotate($image,$rotate,0); 84 | } 85 | 86 | ob_clean(); //hack to remove injected space from buffer 87 | header('Content-type: image/png'); 88 | imagepng($image); 89 | imagedestroy($image); 90 | 91 | ?> 92 | -------------------------------------------------------------------------------- /dev/profiles/.gitignore: -------------------------------------------------------------------------------- 1 | * -------------------------------------------------------------------------------- /dev/profiles/transProfiles.sh: -------------------------------------------------------------------------------- 1 | docker exec -t docker_read_1 bash -c "mv /usr/local/etc/php/profiles/*.pro /var/www/html/readV1RC/dev/profiles/" 2 | -------------------------------------------------------------------------------- /dev/traces/.gitignore: -------------------------------------------------------------------------------- 1 | * -------------------------------------------------------------------------------- /dev/traces/transTraces.sh: -------------------------------------------------------------------------------- 1 | docker exec -t docker_read_1 bash -c "mv /usr/local/etc/php/traces/*.xt /var/www/html/readV1RC/dev/traces/" 2 | -------------------------------------------------------------------------------- /docker/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.1' 2 | 3 | services: 4 | db: 5 | build: ./pg 6 | restart: always 7 | environment: 8 | PGDATA: /var/lib/postgresql/data 9 | env_file: 10 | - ../.env 11 | volumes: 12 | - sharebin:/usr/lib/postgresql/10/bin #make postgres tools available to other services 13 | - db-data:/var/lib/postgresql/data #create named volume and add to volumes to persist container data 14 | - ../../../readfilestore:/var/readfilestore # using relative path to bind host dir to /var/readfilestore 15 | ports: 16 | - "5432:5432" 17 | pgadmin: 18 | image: dpage/pgadmin4 19 | restart: unless-stopped 20 | environment: 21 | PGADMIN_LISTEN_PORT: 80 22 | env_file: 23 | - ../.env 24 | ports: 25 | - "81:80" # "host_port:container_port". pgadmin can be found from host browser as localhost:81 26 | volumes: 27 | - sharebin:/usr/local/pgsql-10 # share postgres tools with php server to help maintain databases 28 | - ../../../readfilestore/pgadmin:/var/lib/pgadmin # using relative path to bind host dir to /pgadmin_queries 29 | - ../../../readfilestore/pgadminstorage:/var/lib/pgadmin/storage 30 | links: 31 | - "db:pgsql-server" 32 | depends_on: 33 | - db 34 | read: 35 | build: ./php-apache 36 | ports: 37 | - "80:80" # map container port 80 to host port 80. This will allow the use of localhost directly 38 | extra_hosts: 39 | - "host.docker.internal:host-gateway" 40 | environment: 41 | XDEBUG_MODE: develop,debug 42 | XDEBUG_CONFIG: client_host=host.docker.internal start_with_request=yes 43 | # - SHARE_PATH:/usr/lib/postgresql/bin 44 | env_file: 45 | - ../.env 46 | volumes: 47 | - sharebin:/usr/lib/postgresql/bin # share postgres tools with php server to help maintain databases 48 | - ../..:/var/www/html/ # path_to_workspaceroot:absolute path in apache container for document root 49 | - ../../../readfilestore:/var/www/readfilestore # path_to_database_sql's:absolute path to apache container of readfilestore 50 | depends_on: 51 | - db 52 | 53 | # redis: 54 | # image: 'redis:3.0-alpine' 55 | # command: redis-server --requirepass devpassword 56 | # volumes: 57 | # - 'redis:/var/lib/redis/data' 58 | # ports: 59 | # - '6379:6379' 60 | 61 | readmin: 62 | build: ../admin 63 | command: > 64 | gunicorn -b 0.0.0.0:8000 65 | --access-logfile - 66 | --reload 67 | --workers=2 68 | "wsgi:application" 69 | environment: 70 | PYTHONUNBUFFERED: 'true' 71 | env_file: 72 | - ../.env 73 | volumes: 74 | - '../admin:/readadmin' 75 | - sharebin:/usr/lib/postgresql/bin # share postgres tools with php server to help maintain databases 76 | - ../../../readfilestore:/var/www/readfilestore # path_to_database_sql's:absolute path to apache container of readfilestore 77 | ports: 78 | - '8001:8000' 79 | 80 | volumes: #these volumes will be saved in docker storage until deleted 81 | sharebin: 82 | db-data: 83 | # db-pgadmin: 84 | # redis: 85 | -------------------------------------------------------------------------------- /docker/pg/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM postgres:10 2 | 3 | 4 | EXPOSE 5432 5 | 6 | # copy shell script to install postgres extensions 7 | COPY install-hstore.sh /docker-entrypoint-initdb.d/ 8 | 9 | # One can copy any .sql to initialize startup data 10 | # COPY testdb.sql /docker-entrypoint-initdb.d/ -------------------------------------------------------------------------------- /docker/pg/install-hstore.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL 5 | create extension hstore; 6 | create extension dblink; 7 | EOSQL -------------------------------------------------------------------------------- /editors/css/exGlossary.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: GandhariUnicodeSymbol; 3 | src: url("/kanishka/common/fonts/gusym.ttf"); 4 | } 5 | 6 | .resFontIconBtn { 7 | display: inline-block; 8 | height: 17px; 9 | width: 18px; 10 | font-family: GandhariUnicodeSymbol,"Segoe UI Symbol"; 11 | font-size: 15px; 12 | padding: 0px; 13 | line-height: 0.3; 14 | margin: 0px; 15 | border: none; 16 | color: black; 17 | background-color: inherit; 18 | } 19 | 20 | .entry { 21 | padding-bottom: 15px; 22 | } 23 | span.homograph1:before { 24 | content: "¹"; 25 | } 26 | 27 | span.homograph2:before { 28 | content: "²"; 29 | } 30 | 31 | span.homograph3:before { 32 | content: "³"; 33 | } 34 | 35 | .lemmadef{ 36 | font-size: 12pt; 37 | text-indent: -10px; 38 | margin-left: 10px; 39 | padding-bottom: 3px; 40 | } 41 | 42 | .lemma{ 43 | font-size: 12pt; 44 | font-weight: bold; 45 | font-style: italic; 46 | } 47 | 48 | .etym { 49 | font-size: 12pt; 50 | font-style: italic; 51 | } 52 | .pos { 53 | font-size: 12pt; 54 | } 55 | 56 | span.link:before{ 57 | content: "see "; 58 | color: green; 59 | } 60 | span.gloss:before{ 61 | content: "\""; 62 | } 63 | span.gloss:after{ 64 | content: ".\""; 65 | } 66 | span.inflection:after{ 67 | content: ","; 68 | color: red; 69 | } 70 | span.lineref:after{ 71 | content: "."; 72 | color: red; 73 | } 74 | .attestation { 75 | padding-left: 30px; 76 | } 77 | .attestedform { 78 | font-size: 12pt; 79 | font-style: italic; 80 | } 81 | .link{ 82 | font-weight: bold; 83 | font-style: italic; 84 | } -------------------------------------------------------------------------------- /editors/css/imageViewer.css: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the Research Environment for Ancient Documents (READ). For information on the authors 3 | * and copyright holders of READ, please refer to the file AUTHORS in this distribution or 4 | * at . 5 | * 6 | * READ is free software: you can redistribute it and/or modify it under the terms of the 7 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 11 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * See the GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along with READ. 15 | * If not, see . 16 | */ 17 | /** 18 | * @author Stephen White 19 | * @copyright @see AUTHORS in repository root 20 | * @link https://github.com/readsoftware 21 | * @version 1.0 22 | * @license @see COPYING in repository root or 23 | * @package READ Research Environment for Ancient Documents 24 | */ 25 | .imgCanvas { 26 | cursor: crosshair; 27 | } 28 | 29 | .imgNameDiv { 30 | padding-left: 5px; 31 | } 32 | 33 | .navDiv { 34 | position: absolute; 35 | left: 20px; 36 | top: 20px; 37 | -webkit-box-shadow: rgba(60, 60, 70, 0.7) 5px 5px 7px; 38 | -moz-box-shadow: rgba(60, 60, 70, 0.7) 5px 5px 7px; 39 | box-shadow: rgba(60, 60, 70, 0.7) 5px 5px 7px; 40 | cursor: pointer; 41 | overflow: hidden auto; 42 | } 43 | .zoomUI { 44 | left: 0; 45 | bottom:0; 46 | height: 16px; 47 | width: 100%; 48 | margin-top: -3px; 49 | } 50 | .zoomButton { 51 | width: 50%; 52 | height: 100%; 53 | font-size: large; 54 | font-weight: bold; 55 | text-align: center; 56 | display: inline-block; 57 | line-height: 0.8; 58 | } 59 | -------------------------------------------------------------------------------- /editors/css/propertyVE.css: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the Research Environment for Ancient Documents (READ). For information on the authors 3 | * and copyright holders of READ, please refer to the file AUTHORS in this distribution or 4 | * at . 5 | * 6 | * READ is free software: you can redistribute it and/or modify it under the terms of the 7 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 11 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * See the GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along with READ. 15 | * If not, see . 16 | */ 17 | /** 18 | * @author Stephen White 19 | * @copyright @see AUTHORS in repository root 20 | * @link https://github.com/readsoftware 21 | * @version 1.0 22 | * @license @see COPYING in repository root or 23 | * @package READ Research Environment for Ancient Documents 24 | */ 25 | .propEditContainer .savebtn{ 26 | display: none; 27 | } 28 | 29 | .entityEditDiv{ 30 | overflow: hidden; 31 | } 32 | 33 | .propEditContainer.dirty .savebtn{ 34 | display: inline-block; 35 | } 36 | 37 | tr:not(.editable) { 38 | background-color: lightgrey; 39 | } 40 | 41 | tr.editing>.propertylabel { 42 | background-color: lightblue; 43 | color: blue !important; 44 | } 45 | 46 | tr.editing>.propertyvalue>.editor { 47 | display: inline-block; 48 | } 49 | 50 | tr.editing>.propertyvalue>.viewer { 51 | display: none; 52 | } 53 | 54 | .propertyvalue>.editor { 55 | display: none; 56 | } 57 | 58 | .propertyvalue>.viewer { 59 | display: inline-block; 60 | } 61 | 62 | tr.dirty>.propertyvalue>.viewer { 63 | color: orange; 64 | } 65 | 66 | .propertiesEntityTab{ 67 | margin-left: 30px; 68 | } 69 | 70 | .showPropertyTabs .propertyVEContainer{ 71 | display: none; 72 | } 73 | 74 | .showPropertyTabs .propertyContainer{ 75 | display: block; 76 | } 77 | 78 | .propertyContainer{ 79 | float:left; 80 | } -------------------------------------------------------------------------------- /editors/css/sequenceVE.css: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the Research Environment for Ancient Documents (READ). For information on the authors 3 | * and copyright holders of READ, please refer to the file AUTHORS in this distribution or 4 | * at . 5 | * 6 | * READ is free software: you can redistribute it and/or modify it under the terms of the 7 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 11 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * See the GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along with READ. 15 | * If not, see . 16 | */ 17 | /** 18 | * @author Yang Li 19 | * @copyright @see AUTHORS in repository root 20 | * @link https://github.com/readsoftware 21 | * @version 1.0 22 | * @license @see COPYING in repository root or 23 | * @package READ Research Environment for Ancient Documents 24 | */ 25 | 26 | /* Overwrite jqxTree styles */ 27 | .jqx-tree-dropdown { 28 | padding: 0 20px; 29 | } 30 | 31 | .structTree div.section { 32 | padding: inherit; 33 | } 34 | 35 | .jqx-listbox-feedback.jqx-listbox-feedback-energyblue { 36 | height: 7px; 37 | border: 2px dashed #5e8cb3; 38 | } 39 | -------------------------------------------------------------------------------- /editors/css/syntaxVE.css: -------------------------------------------------------------------------------- 1 | text.linktype { 2 | font-size: 12px; 3 | stroke-width: 0.2pt 4 | } 5 | .linkpoint { 6 | fill: lightgrey; 7 | } 8 | path.pred { stroke: blue ;} 9 | path.sbj { stroke:darkgreen;} 10 | path.obj { stroke: darkcyan;} 11 | path.atr { stroke: dodgerblue;} 12 | path.adv { stroke: darkviolet;} 13 | path.atv-atvv { stroke: darkorange;} 14 | path.pnom { stroke: chartreuse;} 15 | path.ocomp { stroke: cyan;} 16 | path.coord { stroke: darkolivegreen;} 17 | path.apos { stroke: brown;} 18 | path.auxp { stroke: darkkhaki;} 19 | path.auxc { stroke: darkgoldenrod;} 20 | path.auxr { stroke: forestgreen;} 21 | path.auxv { stroke: indigo;} 22 | path.new { stroke: red;} 23 | path.unk { stroke: darkred;} 24 | 25 | 26 | 27 | 28 | textPath.pred { fill: blue ;} 29 | textPath.sbj { fill:darkgreen;} 30 | textPath.obj { fill: darkcyan;} 31 | textPath.atr { fill: dodgerblue;} 32 | textPath.adv { fill: darkviolet;} 33 | textPath.atv-atvv { fill: darkorange;} 34 | textPath.pnom { fill: chartreuse;} 35 | textPath.ocomp { fill: cyan;} 36 | textPath.coord { fill: darkolivegreen;} 37 | textPath.apos { fill: brown;} 38 | textPath.auxp { fill: darkkhaki;} 39 | textPath.auxc { fill: darkgoldenrod;} 40 | textPath.auxr { fill: forestgreen;} 41 | textPath.auxv { fill: indigo;} 42 | textPath.new { fill: red;} 43 | textPath.unk { fill: darkred;} 44 | 45 | 46 | tspan.marker { 47 | font-family: Verdana, Helvetica, Arial, sans-serif; 48 | font-weight:normal; 49 | font-size: 14px; 50 | fill: grey; 51 | } 52 | tspan.marker::before{ 53 | content: "["; 54 | font-family: Verdana, Helvetica, Arial, sans-serif; 55 | font-weight:normal; 56 | font-size: 14px; 57 | fill: grey; 58 | } 59 | tspan.word { 60 | font-family: Verdana, Helvetica, Arial, sans-serif; 61 | font-weight:normal; 62 | font-size: 14px; 63 | fill: black; 64 | } 65 | tspan.pos { 66 | font-family: Verdana, Helvetica, Arial, sans-serif; 67 | font-weight:normal; 68 | font-size: 12px; 69 | fill: blue; 70 | } 71 | tspan.morph { 72 | font-family: Verdana, Helvetica, Arial, sans-serif; 73 | font-weight:bold; 74 | font-size: 8px; 75 | fill: green; 76 | } 77 | #synfuncselector { 78 | width: 50px; 79 | font-size: 10px; 80 | position: absolute; 81 | display: none; 82 | } 83 | #texttitle { 84 | display: inline-block; 85 | } 86 | #textrefresh { 87 | display: inline-block; 88 | margin-left: 30px; 89 | } 90 | #syntaxSave { 91 | display: inline-block; 92 | margin-left: 15px; 93 | 94 | } 95 | -------------------------------------------------------------------------------- /editors/css/wordlistVE.css: -------------------------------------------------------------------------------- 1 | 27 | #textEditPage .word.selected::selection{ background: lightgrey; color:black} 28 | #textEditPage .word.selected::-moz-selection{ background: lightgrey; color:black} 29 | 30 | #textEditPage .linkedword.selected::selection{ background: lightgrey; color:black} 31 | #textEditPage .linkedword.selected::-moz-selection{ background: lightgrey; color:black} 32 | 33 | #textEditPage .lemma.selected::selection{ background: lightgrey; color:blue} 34 | #textEditPage .lemma.selected::-moz-selection{ background: lightgrey; color:blue} 35 | 36 | .wordlistentry { 37 | margin-left: 50px; 38 | padding-left: 1em; 39 | text-indent: -1em; 40 | } 41 | .wordlistentry span.lemma { 42 | color: #2F5597!important; 43 | font-weight: bold; 44 | } 45 | .wordlistentry span.lemma.readonly { 46 | color: black!important; 47 | font-weight: bold; 48 | } 49 | .wordlistentry.sfiltered, 50 | .wordlistentry.wsfiltered, 51 | .wordlistentry span.sfiltered, 52 | .wordlistentry span.wsfiltered, 53 | .wordlistentry span.efiltered { 54 | display:none!important; 55 | } 56 | .wordlistentry span.lemma.selected { 57 | background: lightgrey !important; 58 | color: blue; 59 | } 60 | .wordlistentry span.lemma.readonly.selected { 61 | background: lightgrey !important; 62 | color: black; 63 | } 64 | .wordlistentry span.morphology, .wordlistentry span.POS { 65 | font-style: italic; 66 | } 67 | 68 | .wordlistContentDiv{ 69 | overflow:auto; 70 | font-family: "Segoe UI", "Noto Sans", "DejaVu Sans", sans-serif, "Gandhari Unicode"!important; 71 | } 72 | 73 | .edndraghandle:hover { 74 | cursor: grab!important; 75 | } 76 | 77 | .edndraghandle { 78 | height: 20px; 79 | width: 15px; 80 | background-color: #648cc8; 81 | } 82 | -------------------------------------------------------------------------------- /editors/images/100x100-check.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/editors/images/100x100-check.gif -------------------------------------------------------------------------------- /editors/images/downButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/editors/images/downButton.png -------------------------------------------------------------------------------- /editors/images/leftButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/editors/images/leftButton.png -------------------------------------------------------------------------------- /editors/images/rightButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/editors/images/rightButton.png -------------------------------------------------------------------------------- /editors/images/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/editors/images/setting.png -------------------------------------------------------------------------------- /editors/images/upButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/editors/images/upButton.png -------------------------------------------------------------------------------- /model/authTokenTable.sql: -------------------------------------------------------------------------------- 1 | -- ************* AUTHTOKEN TABLE 2 | 3 | -- Remove old definitions first then recreate new 4 | DROP INDEX IF EXISTS "fki_autSelector"; 5 | -- DROP TRIGGER IF EXISTS update_authtoken_modtime ON authtoken; 6 | DROP TABLE IF EXISTS authtoken CASCADE; 7 | 8 | 9 | CREATE TABLE authtoken 10 | ( 11 | "aut_id" serial NOT NULL PRIMARY KEY, 12 | "aut_selector" varchar(32) NOT NULL UNIQUE, 13 | "aut_hashed_validator" varchar(64) NULL, 14 | "aut_expire" int default now()::abstime::int, 15 | "modified" timestamp default CURRENT_TIMESTAMP, 16 | "aut_user_id" int NOT NULL 17 | ) 18 | WITH ( 19 | OIDS=FALSE 20 | ); 21 | 22 | 23 | CREATE TRIGGER update_authtoken_modtime BEFORE UPDATE ON authtoken FOR EACH ROW EXECUTE PROCEDURE update_modified(); 24 | 25 | ALTER TABLE authtoken OWNER TO postgres; 26 | COMMENT ON TABLE authtoken IS 'Contains a record for each authtoken.'; 27 | COMMENT ON COLUMN authtoken."aut_id" IS 'Uniquely identifies a authtoken object.'; 28 | COMMENT ON COLUMN authtoken."aut_selector" IS 'ISO Language code : label pairs for this authtoken.'; 29 | COMMENT ON COLUMN authtoken."aut_hashed_validator" IS 'hash of validator from cookie used to verify this authtoken.'; 30 | COMMENT ON COLUMN authtoken."aut_expire" IS 'expiration of token'; 31 | COMMENT ON COLUMN authtoken."aut_user_id" IS 'Link to user usergroup.'; 32 | 33 | 34 | -- Indexes: 35 | 36 | CREATE INDEX "fki_autSelector" ON authtoken ("aut_selector"); 37 | 38 | 39 | -------------------------------------------------------------------------------- /model/buildDBforImport9.3.sh: -------------------------------------------------------------------------------- 1 | export PGCLIENTENCODING=UTF8 2 | export LANGUAGE="en_US.UTF-8" 3 | export LANG="en_US.UTF-8" 4 | export LC_ALL="en_US.UTF-8" 5 | 6 | usage () 7 | { 8 | echo 'Usage : buildDBforImport9.3.sh dbname' 9 | exit 10 | } 11 | 12 | if [ "$1" == "" ] 13 | then 14 | usage 15 | fi 16 | 17 | /C/xampp/PostgreSQL/9.3/bin/psql -U postgres -c "DROP DATABASE IF EXISTS $1;" 18 | 19 | /C/xampp/PostgreSQL/9.3/bin/psql -U postgres -c "CREATE DATABASE $1 WITH OWNER = postgres ENCODING = 'UTF8' TABLESPACE = pg_default LC_COLLATE = 'C' LC_CTYPE = 'C' CONNECTION LIMIT = -1 TEMPLATE template0;" 20 | 21 | /C/xampp/PostgreSQL/9.3/bin/psql -U postgres -d $1 -f /C/xampp/htdocs/kanishka/model/kanishkaSchema.sql 22 | 23 | /C/xampp/PostgreSQL/9.3/bin/psql -U postgres -d $1 -f /C/xampp/htdocs/kanishka/model/term.sql 24 | 25 | /C/xampp/PostgreSQL/9.3/bin/psql -U postgres -d $1 -f /C/xampp/htdocs/kanishka/model/propernoun.sql 26 | 27 | /C/xampp/PostgreSQL/9.3/bin/psql -U postgres -d $1 -f /C/xampp/htdocs/kanishka/model/kanishkaTestData_Era.sql 28 | 29 | /C/xampp/PostgreSQL/9.3/bin/psql -U postgres -d $1 -f /C/xampp/htdocs/kanishka/model/kanishkaTestData_Users.sql 30 | 31 | /C/xampp/PostgreSQL/9.3/bin/psql -U postgres -d $1 -f /C/xampp/htdocs/kanishka/model/kanishkaTestData_Collections.sql 32 | 33 | /C/xampp/PostgreSQL/9.3/bin/psql -U postgres -d $1 -f /C/xampp/htdocs/kanishka/model/kanishkaTestData_AttribGrp.sql 34 | 35 | /C/xampp/PostgreSQL/9.3/bin/psql -U postgres -d $1 -f /C/xampp/htdocs/kanishka/model/kanishkaSchemaConstraints.sql 36 | 37 | /C/xampp/php/php.exe ./migration/AzesBibliographyMigration.php -db $1 38 | 39 | -------------------------------------------------------------------------------- /model/disableAllTriggers.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE fragment DISABLE TRIGGER ALL; 2 | ALTER TABLE grapheme DISABLE TRIGGER ALL; 3 | ALTER TABLE inflection DISABLE TRIGGER ALL; 4 | ALTER TABLE line DISABLE TRIGGER ALL; 5 | ALTER TABLE jsoncache DISABLE TRIGGER ALL; 6 | ALTER TABLE lemma DISABLE TRIGGER ALL; 7 | ALTER TABLE materialcontext DISABLE TRIGGER ALL; 8 | ALTER TABLE item DISABLE TRIGGER ALL; 9 | ALTER TABLE edition DISABLE TRIGGER ALL; 10 | ALTER TABLE era DISABLE TRIGGER ALL; 11 | ALTER TABLE sequence DISABLE TRIGGER ALL; 12 | ALTER TABLE token DISABLE TRIGGER ALL; 13 | ALTER TABLE span DISABLE TRIGGER ALL; 14 | ALTER TABLE propernoun DISABLE TRIGGER ALL; 15 | ALTER TABLE segment DISABLE TRIGGER ALL; 16 | ALTER TABLE part DISABLE TRIGGER ALL; 17 | ALTER TABLE surface DISABLE TRIGGER ALL; 18 | ALTER TABLE text DISABLE TRIGGER ALL; 19 | ALTER TABLE textmetadata DISABLE TRIGGER ALL; 20 | ALTER TABLE syllablecluster DISABLE TRIGGER ALL; 21 | ALTER TABLE bibliography DISABLE TRIGGER ALL; 22 | ALTER TABLE annotation DISABLE TRIGGER ALL; 23 | ALTER TABLE baseline DISABLE TRIGGER ALL; 24 | ALTER TABLE image DISABLE TRIGGER ALL; 25 | ALTER TABLE attribution DISABLE TRIGGER ALL; 26 | ALTER TABLE attributiongroup DISABLE TRIGGER ALL; 27 | ALTER TABLE term DISABLE TRIGGER ALL; 28 | ALTER TABLE run DISABLE TRIGGER ALL; 29 | ALTER TABLE catalog DISABLE TRIGGER ALL; 30 | ALTER TABLE usergroup DISABLE TRIGGER ALL; 31 | -------------------------------------------------------------------------------- /model/enableAllTriggers.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE fragment ENABLE TRIGGER ALL; 2 | ALTER TABLE grapheme ENABLE TRIGGER ALL; 3 | ALTER TABLE inflection ENABLE TRIGGER ALL; 4 | ALTER TABLE line ENABLE TRIGGER ALL; 5 | ALTER TABLE jsoncache ENABLE TRIGGER ALL; 6 | ALTER TABLE lemma ENABLE TRIGGER ALL; 7 | ALTER TABLE materialcontext ENABLE TRIGGER ALL; 8 | ALTER TABLE item ENABLE TRIGGER ALL; 9 | ALTER TABLE edition ENABLE TRIGGER ALL; 10 | ALTER TABLE era ENABLE TRIGGER ALL; 11 | ALTER TABLE sequence ENABLE TRIGGER ALL; 12 | ALTER TABLE token ENABLE TRIGGER ALL; 13 | ALTER TABLE span ENABLE TRIGGER ALL; 14 | ALTER TABLE propernoun ENABLE TRIGGER ALL; 15 | ALTER TABLE segment ENABLE TRIGGER ALL; 16 | ALTER TABLE part ENABLE TRIGGER ALL; 17 | ALTER TABLE surface ENABLE TRIGGER ALL; 18 | ALTER TABLE text ENABLE TRIGGER ALL; 19 | ALTER TABLE textmetadata ENABLE TRIGGER ALL; 20 | ALTER TABLE syllablecluster ENABLE TRIGGER ALL; 21 | ALTER TABLE bibliography ENABLE TRIGGER ALL; 22 | ALTER TABLE annotation ENABLE TRIGGER ALL; 23 | ALTER TABLE baseline ENABLE TRIGGER ALL; 24 | ALTER TABLE image ENABLE TRIGGER ALL; 25 | ALTER TABLE attribution ENABLE TRIGGER ALL; 26 | ALTER TABLE attributiongroup ENABLE TRIGGER ALL; 27 | ALTER TABLE term ENABLE TRIGGER ALL; 28 | ALTER TABLE run ENABLE TRIGGER ALL; 29 | ALTER TABLE catalog ENABLE TRIGGER ALL; 30 | ALTER TABLE usergroup ENABLE TRIGGER ALL; 31 | -------------------------------------------------------------------------------- /model/entities/Annotations.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with Annotation entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/Annotation.php'); 31 | 32 | //******************************************************************* 33 | //********************* ANNOTATIONS CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * Annotations class which is an iterating container of annotations 37 | * 38 | * 39 | * require_once 'Annotations.php'; 40 | * 41 | * $annotations = new Annotations(); 42 | * $annotation = $annotations->current(); 43 | * $key = $annotations->key(); 44 | * echo " annotation $key has text - ".$annotation->getText(); 45 | * 46 | * 47 | * @author Stephen White 48 | */ 49 | 50 | class Annotations extends EntityIterator { 51 | 52 | //*******************************PRIVATE MEMBERS************************************ 53 | 54 | //****************************CONSTRUCTOR FUNCTION*************************************** 55 | 56 | /** 57 | * Create an Annotations iterator, optionally setting the offset and pagesize 58 | * @param int $pageSize sets the max size for query results (default 20) 59 | * @param int $offset sets the start point for query results (default 0) 60 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 61 | */ 62 | public function __construct( $condition = "", $sort = "ano_id", $offset = 0, $pageSize = 20, $autoAdvance = true) { 63 | parent::__construct("annotation","ano_id",$autoAdvance); 64 | $this->_autoAdvancePage = $autoAdvance; 65 | $this->_pageSize = $pageSize; 66 | $this->_offset = $offset; 67 | if ($condition) $this->_condition = $condition; 68 | // $this->_security = isSysAdmin()?null:" (".getUserID()."= ano_owner_id or ".getUserID()." = ANY (\"ano_visibility_ids\"))"; 69 | $this->_security = parent::getEntityAccessCondition("ano"); 70 | $this->_sort = $sort; 71 | $this->loadEntities(); 72 | } 73 | 74 | //*******************************PUBLIC FUNCTIONS************************************ 75 | 76 | /** 77 | * Annotations - array of annotations from the current query 78 | * 79 | * @return array returns an Annotation array for the current page size (default is 20) 80 | */ 81 | public function getAnnotations() { 82 | return $this->_entities; 83 | } 84 | 85 | public function createObject($arg){ 86 | return new Annotation($arg); 87 | } 88 | } 89 | ?> 90 | -------------------------------------------------------------------------------- /model/entities/Attributions.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with Attribution entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/Attribution.php'); 31 | 32 | //******************************************************************* 33 | //********************* ATTRIBUTIONS CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * Attributions class which is an iterating container of attributions 37 | * 38 | * 39 | * require_once 'Attributions.php'; 40 | * 41 | * $attributions = new Attributions(); 42 | * $attribution = $attributions->current(); 43 | * $key = $attributions->key(); 44 | * echo " attribution $key is ".$attribution->getTitle(); 45 | * 46 | * 47 | * @author Stephen White 48 | * @todo add member for advance to next page. 49 | */ 50 | 51 | class Attributions extends EntityIterator { 52 | 53 | //*******************************PRIVATE MEMBERS************************************ 54 | 55 | //****************************CONSTRUCTOR FUNCTION*************************************** 56 | 57 | /** 58 | * Create an Attributions iterator, optionally setting the offset and pagesize 59 | * @param int $pageSize sets the max size for query results (default 20) 60 | * @param int $offset sets the start point for query results (default 0) 61 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 62 | */ 63 | public function __construct( $condition = "", $sort = "atb_id", $offset = 0, $pageSize = 20, $autoAdvance = true) { 64 | parent::__construct("attribution","atb_id",$autoAdvance); 65 | $this->_pageSize = $pageSize; 66 | $this->_offset = $offset; 67 | if ($condition) $this->_condition = $condition; 68 | // $this->_security = isSysAdmin()?null:" (".getUserID()."= atb_owner_id or ".getUserID()." = ANY (\"atb_visibility_ids\"))"; 69 | $this->_security = parent::getEntityAccessCondition("atb"); 70 | $this->_sort = $sort; 71 | $this->loadEntities(); 72 | } 73 | 74 | //*******************************PUBLIC FUNCTIONS************************************ 75 | 76 | /** 77 | * Attributions - array of attributions from the current query 78 | * 79 | * @return array returns an Attribution array for the current page size (default is 20) 80 | */ 81 | public function getAttributions() { 82 | return $this->_entities; 83 | } 84 | 85 | public function createObject($arg){ 86 | return new Attribution($arg); 87 | } 88 | } 89 | ?> 90 | -------------------------------------------------------------------------------- /model/entities/Baselines.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with Baseline entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/Baseline.php'); 31 | 32 | //******************************************************************* 33 | //********************* BASELINES CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * Baselines class which is an iterating container of baselines 37 | * 38 | * 39 | * require_once 'Baselines.php'; 40 | * 41 | * $baselines = new Baselines(10,5); 42 | * $baseline = $baselines->current(); 43 | * $key = $baselines->key(); 44 | * echo " baseline $key has image - ".$baseline->getImageURL(); 45 | * 46 | * 47 | * @author Stephen White 48 | */ 49 | 50 | class Baselines extends EntityIterator { 51 | 52 | //*******************************PRIVATE MEMBERS************************************ 53 | 54 | //****************************CONSTRUCTOR FUNCTION*************************************** 55 | 56 | /** 57 | * Create an Baselines iterator, optionally setting the offset and pagesize 58 | * @param int $pageSize sets the max size for query results (default 20) 59 | * @param int $offset sets the start point for query results (default 0) 60 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 61 | */ 62 | public function __construct( $condition = "", $sort = "bln_id", $offset = 0, $pageSize = 20) { 63 | parent::__construct("baseline","bln_id"); 64 | $this->_pageSize = $pageSize; 65 | $this->_offset = $offset; 66 | if ($condition) $this->_condition = $condition; 67 | $this->_security = parent::getEntityAccessCondition("bln"); 68 | $this->_sort = $sort; 69 | $this->_dbMgr = new DBManager(); 70 | $this->loadEntities(); 71 | } 72 | 73 | //*******************************PUBLIC FUNCTIONS************************************ 74 | 75 | /** 76 | * Baselines - array of baselines from the current query 77 | * 78 | * @return array returns an Baseline array for the current page size (default is 20) 79 | */ 80 | public function getBaselines() { 81 | return $this->_entities; 82 | } 83 | 84 | public function createObject($arg){ 85 | return new Baseline($arg); 86 | } 87 | 88 | } 89 | ?> 90 | -------------------------------------------------------------------------------- /model/entities/Bibliographies.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with Bibliography entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/Bibliography.php'); 31 | 32 | //******************************************************************* 33 | //********************* BIBLIOGRAPHIES CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * Bibliographys class which is an iterating container of bibliographys 37 | * 38 | * 39 | * require_once 'Bibliographys.php'; 40 | * 41 | * $bibliographys = new Bibliographys(); 42 | * $bibliography = $bibliographys->current(); 43 | * $key = $bibliographys->key(); 44 | * echo " bibliography $key is ".$bibliography->getName(); 45 | * 46 | * 47 | * @author Stephen White 48 | * @todo add member for advance to next page. 49 | */ 50 | 51 | class Bibliographies extends EntityIterator { 52 | 53 | //*******************************PRIVATE MEMBERS************************************ 54 | 55 | //****************************CONSTRUCTOR FUNCTION*************************************** 56 | 57 | /** 58 | * Create an Bibliographys iterator, optionally setting the offset and pagesize 59 | * @param int $pageSize sets the max size for query results (default 20) 60 | * @param int $offset sets the start point for query results (default 0) 61 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 62 | */ 63 | public function __construct( $condition = "", $sort = "bib_id", $offset = 0, $pageSize = 20) { 64 | parent::__construct("bibliography","bib_id"); 65 | $this->_autoAdvancePage = true; 66 | $this->_pageSize = $pageSize; 67 | $this->_offset = $offset; 68 | if ($condition) $this->_condition = $condition; 69 | // $this->_security = isSysAdmin()?null:" (".getUserID()."= bib_owner_id or ".getUserID()." = ANY (\"bib_visibility_ids\"))"; 70 | $this->_security = parent::getEntityAccessCondition("bib"); 71 | $this->_sort = $sort; 72 | $this->_dbMgr = new DBManager(); 73 | $this->loadEntities(); 74 | } 75 | 76 | //*******************************PUBLIC FUNCTIONS************************************ 77 | 78 | /** 79 | * Bibliographys - array of bibliographys from the current query 80 | * 81 | * @return array returns an Bibliography array for the current page size (default is 20) 82 | */ 83 | public function getBibliographys() { 84 | return $this->_entities; 85 | } 86 | 87 | public function createObject($arg){ 88 | return new Bibliography($arg); 89 | } 90 | } 91 | ?> 92 | -------------------------------------------------------------------------------- /model/entities/Collections.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with Collection entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/Collection.php'); 31 | 32 | //******************************************************************* 33 | //********************* COLLECTIONS CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * Collections class which is an iterating container of collections 37 | * 38 | * 39 | * require_once 'Collections.php'; 40 | * 41 | * $collections = new Collections(null,null,10,5); 42 | * $collection = $collections->current(); 43 | * $key = $collections->key(); 44 | * echo " collection $key has objects - ".$collection->getObjectGlobalIDs(true); 45 | * 46 | * 47 | * @author Stephen White 48 | */ 49 | 50 | class Collections extends EntityIterator { 51 | 52 | //*******************************PRIVATE MEMBERS************************************ 53 | 54 | //****************************CONSTRUCTOR FUNCTION*************************************** 55 | 56 | /** 57 | * Create an Collections iterator, optionally setting the offset and pagesize 58 | * @param int $pageSize sets the max size for query results (default 20) 59 | * @param int $offset sets the start point for query results (default 0) 60 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 61 | * @todo add code to load all ??? what about 10k or 100k case (could call to get rownum) 62 | */ 63 | public function __construct( $condition = "", $sort = "col_id", $offset = 0, $pageSize = 20) { 64 | parent::__construct("collection","col_id"); 65 | $this->_pageSize = $pageSize; 66 | $this->_offset = $offset; 67 | if ($condition) $this->_condition = $condition; 68 | // $this->_security = isSysAdmin()?null:" (".getUserID()."= col_owner_id or ".getUserID()." = ANY (\"col_visibility_ids\"))"; 69 | $this->_security = parent::getEntityAccessCondition("col"); 70 | $this->_sort = $sort; 71 | $this->_dbMgr = new DBManager(); 72 | $this->loadEntities(); 73 | } 74 | 75 | //*******************************PUBLIC FUNCTIONS************************************ 76 | 77 | 78 | /** 79 | * Collections - array of collections from the current query 80 | * 81 | * @return array returns a Collection array for the current page size (default is 20) 82 | */ 83 | public function getCollections() { 84 | return $this->_entities; 85 | } 86 | 87 | public function createObject($arg){ 88 | return new Collection($arg); 89 | } 90 | 91 | } 92 | ?> 93 | -------------------------------------------------------------------------------- /model/entities/Editions.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with edition entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/Edition.php'); 31 | 32 | //******************************************************************* 33 | //********************* EDITIONS CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * Editions class which is an iterating container of editions 37 | * 38 | * 39 | * require_once 'Editions.php'; 40 | * 41 | * $editions = new Editions(10,5); 42 | * $edition = $editions->current(); 43 | * $key = $editions->key(); 44 | * echo " edition $key is ".$edition->getDescription(); 45 | * 46 | * 47 | * @author Stephen White 48 | */ 49 | 50 | class Editions extends EntityIterator { 51 | 52 | //*******************************PRIVATE MEMBERS************************************ 53 | 54 | //****************************CONSTRUCTOR FUNCTION*************************************** 55 | 56 | /** 57 | * Create a Editions iterator, optionally setting the offset and pagesize 58 | * @param int $pageSize sets the max size for query results (default 20) 59 | * @param int $offset sets the start point for query results (default 0) 60 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 61 | */ 62 | public function __construct( $condition = "", $sort = "edn_id", $offset = 0, $pageSize = 20) { 63 | parent::__construct("edition","edn_id"); 64 | $this->_autoAdvancePage = true; 65 | $this->_pageSize = $pageSize; 66 | $this->_offset = $offset; 67 | if ($condition) $this->_condition = $condition; 68 | // $this->_security = isSysAdmin()?null:" (".getUserID()."= edn_owner_id or ".getUserID()." = ANY (\"edn_visibility_ids\"))"; 69 | $this->_security = parent::getEntityAccessCondition("edn"); 70 | $this->_sort = $sort; 71 | $this->_dbMgr = new DBManager(); 72 | $this->loadEntities(); 73 | } 74 | 75 | //*******************************PUBLIC FUNCTIONS************************************ 76 | 77 | /** 78 | * editions - array of editions from the current query 79 | * 80 | * @return array returns an edition array for the current page size (default is 20) 81 | */ 82 | public function geteditions() { 83 | return $this->_entities; 84 | } 85 | 86 | public function createObject($arg){ 87 | return new Edition($arg); 88 | } 89 | 90 | } 91 | ?> 92 | -------------------------------------------------------------------------------- /model/entities/Fragments.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with fragment entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/Fragment.php'); 31 | 32 | //******************************************************************* 33 | //********************* FRAGMENTS CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * Fragments class which is an iterating container of fragments 37 | * 38 | * 39 | * require_once 'Fragments.php'; 40 | * 41 | * $fragments = new Fragments(10,5); 42 | * $fragment = $fragments->current(); 43 | * $key = $fragments->key(); 44 | * echo " fragment $key is ".$fragment->getDescription(); 45 | * 46 | * 47 | * @author Stephen White 48 | */ 49 | 50 | class Fragments extends EntityIterator { 51 | 52 | //*******************************PRIVATE MEMBERS************************************ 53 | 54 | //****************************CONSTRUCTOR FUNCTION*************************************** 55 | 56 | /** 57 | * Create a Fragments iterator, optionally setting the offset and pagesize 58 | * @param int $pageSize sets the max size for query results (default 20) 59 | * @param int $offset sets the start point for query results (default 0) 60 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 61 | */ 62 | public function __construct( $condition = "", $sort = "frg_id", $offset = 0, $pageSize = 20) { 63 | parent::__construct("fragment","frg_id"); 64 | $this->_autoAdvancePage = true; 65 | $this->_pageSize = $pageSize; 66 | $this->_offset = $offset; 67 | if ($condition) $this->_condition = $condition; 68 | // $this->_security = isSysAdmin()?null:" (".getUserID()."= frg_owner_id or ".getUserID()." = ANY (\"frg_visibility_ids\"))"; 69 | $this->_security = parent::getEntityAccessCondition("frg"); 70 | $this->_sort = $sort; 71 | $this->_dbMgr = new DBManager(); 72 | $this->loadEntities(); 73 | } 74 | 75 | //*******************************PUBLIC FUNCTIONS************************************ 76 | 77 | /** 78 | * fragments - array of fragments from the current query 79 | * 80 | * @return array returns an fragment array for the current page size (default is 20) 81 | */ 82 | public function getfragments() { 83 | return $this->_entities; 84 | } 85 | 86 | public function createObject($arg){ 87 | return new Fragment($arg); 88 | } 89 | 90 | } 91 | ?> 92 | -------------------------------------------------------------------------------- /model/entities/Images.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with image entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/Image.php'); 31 | 32 | //******************************************************************* 33 | //********************* IMAGES CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * Images class which is an iterating container of images 37 | * 38 | * 39 | * require_once 'Images.php'; 40 | * 41 | * $images = new Images(10,5); 42 | * $image = $images->current(); 43 | * $key = $images->key(); 44 | * echo " image $key has URL ".$image->getURL(); 45 | * 46 | * 47 | * @author Stephen White 48 | */ 49 | 50 | class Images extends EntityIterator { 51 | 52 | //*******************************PRIVATE MEMBERS************************************ 53 | 54 | //****************************CONSTRUCTOR FUNCTION*************************************** 55 | 56 | /** 57 | * Create a Images iterator, optionally setting the offset and pagesize 58 | * @param int $pageSize sets the max size for query results (default 20) 59 | * @param int $offset sets the start point for query results (default 0) 60 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 61 | */ 62 | public function __construct( $condition = "", $sort = "img_id", $offset = 0, $pageSize = 20) { 63 | parent::__construct("image","img_id"); 64 | $this->_autoAdvancePage = true; 65 | $this->_pageSize = $pageSize; 66 | $this->_offset = $offset; 67 | if ($condition) $this->_condition = $condition; 68 | // $this->_security = isSysAdmin()?null:" (".getUserID()."= img_owner_id or ".getUserID()." = ANY (\"img_visibility_ids\"))"; 69 | $this->_security = parent::getEntityAccessCondition("img"); 70 | $this->_sort = $sort; 71 | $this->_dbMgr = new DBManager(); 72 | $this->loadEntities(); 73 | } 74 | 75 | //*******************************PUBLIC FUNCTIONS************************************ 76 | 77 | /** 78 | * getImages - array of images from the current query 79 | * 80 | * @return array returns an image array for the current page size (default is 20) 81 | */ 82 | public function getImages() { 83 | return $this->_entities; 84 | } 85 | 86 | public function createObject($arg){ 87 | return new Image($arg); 88 | } 89 | 90 | } 91 | ?> 92 | -------------------------------------------------------------------------------- /model/entities/Inflections.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with Inflection entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/Inflection.php'); 31 | 32 | //******************************************************************* 33 | //********************* LEMMA CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * Inflections class which is an iterating container of inflections 37 | * 38 | * 39 | * require_once 'Inflections.php'; 40 | * 41 | * $inflections = new Inflections(10,5); 42 | * $inflection = $inflections->current(); 43 | * $key = $inflections->key(); 44 | * echo " inflection $key is ".$inflection->getInflection(); 45 | * 46 | * 47 | * @author Stephen White 48 | */ 49 | 50 | class Inflections extends EntityIterator { 51 | 52 | //*******************************PRIVATE MEMBERS************************************ 53 | 54 | //****************************CONSTRUCTOR FUNCTION*************************************** 55 | 56 | /** 57 | * Create an Inflections iterator, optionally setting the offset and pagesize 58 | * @param int $pageSize sets the max size for query results (default 20) 59 | * @param int $offset sets the start point for query results (default 0) 60 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 61 | * @todo add code to load all ??? what about 10k or 100k case (could call to get rownum) 62 | */ 63 | public function __construct( $condition = "", $sort = "inf_id", $offset = 0, $pageSize = 20) { 64 | parent::__construct("inflection","inf_id"); 65 | $this->_autoAdvancePage = true; 66 | $this->_pageSize = $pageSize; 67 | $this->_offset = $offset; 68 | if ($condition) $this->_condition = $condition; 69 | // $this->_security = isSysAdmin()?null:" (".getUserID()."= lem_owner_id or ".getUserID()." = ANY (\"lem_visibility_ids\"))"; 70 | $this->_security = parent::getEntityAccessCondition("inf"); 71 | $this->_sort = $sort; 72 | $this->_dbMgr = new DBManager(); 73 | $this->loadEntities(); 74 | } 75 | 76 | //*******************************PUBLIC FUNCTIONS************************************ 77 | 78 | 79 | /** 80 | * Inflections - array of inflections from the current query 81 | * 82 | * @return array returns a Inflection array for the current page size (default is 20) 83 | */ 84 | public function getInflections() { 85 | return $this->_entities; 86 | } 87 | 88 | public function createObject($arg){ 89 | return new Inflection($arg); 90 | } 91 | 92 | } 93 | ?> 94 | -------------------------------------------------------------------------------- /model/entities/Items.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with Item entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/Item.php'); 31 | 32 | //******************************************************************* 33 | //********************* ITEMS CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * Items class which is an iterating container of items 37 | * 38 | * 39 | * require_once 'Items.php'; 40 | * 41 | * $items = new Items(); 42 | * $item = $items->current(); 43 | * $key = $items->key(); 44 | * echo " item $key is ".$item->getTitle(); 45 | * 46 | * 47 | * @author Stephen White 48 | * @todo add member for advance to next page. 49 | */ 50 | 51 | class Items extends EntityIterator { 52 | 53 | //*******************************PRIVATE MEMBERS************************************ 54 | 55 | //****************************CONSTRUCTOR FUNCTION*************************************** 56 | 57 | /** 58 | * Create an Items iterator, optionally setting the offset and pagesize 59 | * @param int $pageSize sets the max size for query results (default 20) 60 | * @param int $offset sets the start point for query results (default 0) 61 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 62 | */ 63 | public function __construct( $condition = "", $sort = "itm_id", $offset = 0, $pageSize = 20) { 64 | parent::__construct("item","itm_id"); 65 | $this->_autoAdvancePage = true; 66 | $this->_pageSize = $pageSize; 67 | $this->_offset = $offset; 68 | if ($condition) $this->_condition = $condition; 69 | // $this->_security = isSysAdmin()?null:" (".getUserID()."= itm_owner_id or ".getUserID()." = ANY (\"itm_visibility_ids\"))"; 70 | $this->_security = parent::getEntityAccessCondition("itm"); 71 | $this->_sort = $sort; 72 | $this->_dbMgr = new DBManager(); 73 | $this->loadEntities(); 74 | } 75 | 76 | //*******************************PUBLIC FUNCTIONS************************************ 77 | 78 | /** 79 | * Items - array of items from the current query 80 | * 81 | * @return array returns an Item array for the current page size (default is 20) 82 | */ 83 | public function getItems() { 84 | return $this->_entities; 85 | } 86 | 87 | public function createObject($arg){ 88 | return new Item($arg); 89 | } 90 | } 91 | ?> 92 | -------------------------------------------------------------------------------- /model/entities/Lemmas.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with Lemma entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/Lemma.php'); 31 | 32 | //******************************************************************* 33 | //********************* LEMMA CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * Lemmas class which is an iterating container of lemmas 37 | * 38 | * 39 | * require_once 'Lemmas.php'; 40 | * 41 | * $lemmas = new Lemmas(10,5); 42 | * $lemma = $lemmas->current(); 43 | * $key = $lemmas->key(); 44 | * echo " lemma $key is ".$lemma->getLemma(); 45 | * 46 | * 47 | * @author Stephen White 48 | */ 49 | 50 | class Lemmas extends EntityIterator { 51 | 52 | //*******************************PRIVATE MEMBERS************************************ 53 | 54 | //****************************CONSTRUCTOR FUNCTION*************************************** 55 | 56 | /** 57 | * Create an Lemmas iterator, optionally setting the offset and pagesize 58 | * @param int $pageSize sets the max size for query results (default 20) 59 | * @param int $offset sets the start point for query results (default 0) 60 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 61 | * @todo add code to load all ??? what about 10k or 100k case (could call to get rownum) 62 | */ 63 | public function __construct( $condition = "", $sort = "lem_id", $offset = 0, $pageSize = 20) { 64 | parent::__construct("lemma","lem_id"); 65 | $this->_autoAdvancePage = true; 66 | $this->_pageSize = $pageSize; 67 | $this->_offset = $offset; 68 | if ($condition) $this->_condition = $condition; 69 | // $this->_security = isSysAdmin()?null:" (".getUserID()."= lem_owner_id or ".getUserID()." = ANY (\"lem_visibility_ids\"))"; 70 | $this->_security = parent::getEntityAccessCondition("lem"); 71 | $this->_sort = $sort; 72 | $this->_dbMgr = new DBManager(); 73 | $this->loadEntities(); 74 | } 75 | 76 | //*******************************PUBLIC FUNCTIONS************************************ 77 | 78 | 79 | /** 80 | * Lemmas - array of lemmas from the current query 81 | * 82 | * @return array returns a Lemma array for the current page size (default is 20) 83 | */ 84 | public function getLemmas() { 85 | return $this->_entities; 86 | } 87 | 88 | public function createObject($arg){ 89 | return new Lemma($arg); 90 | } 91 | 92 | } 93 | ?> 94 | -------------------------------------------------------------------------------- /model/entities/Lines.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with line entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/Line.php'); 31 | 32 | //******************************************************************* 33 | //********************* LINES CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * Lines class which is an iterating container of lines 37 | * 38 | * 39 | * require_once 'Lines.php'; 40 | * 41 | * $lines = new Lines(10,5); 42 | * $line = $lines->current(); 43 | * $key = $lines->key(); 44 | * echo " line $key has URL ".$line->getURL(); 45 | * 46 | * 47 | * @author Stephen White 48 | */ 49 | 50 | class Lines extends EntityIterator { 51 | 52 | //*******************************PRIVATE MEMBERS************************************ 53 | 54 | //****************************CONSTRUCTOR FUNCTION*************************************** 55 | 56 | /** 57 | * Create a Lines iterator, optionally setting the offset and pagesize 58 | * @param int $pageSize sets the max size for query results (default 20) 59 | * @param int $offset sets the start point for query results (default 0) 60 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 61 | */ 62 | public function __construct( $condition = "", $sort = "lin_id", $offset = 0, $pageSize = 20) { 63 | parent::__construct("line","lin_id"); 64 | $this->_autoAdvancePage = true; 65 | $this->_pageSize = $pageSize; 66 | $this->_offset = $offset; 67 | if ($condition) $this->_condition = $condition; 68 | // $this->_security = isSysAdmin()?null:" (".getUserID()."= lin_owner_id or ".getUserID()." = ANY (\"lin_visibility_ids\"))"; 69 | $this->_security = parent::getEntityAccessCondition("lin"); 70 | $this->_sort = $sort; 71 | $this->_dbMgr = new DBManager(); 72 | $this->loadEntities(); 73 | } 74 | 75 | //*******************************PUBLIC FUNCTIONS************************************ 76 | 77 | /** 78 | * getLines - array of lines from the current query 79 | * 80 | * @return array returns an line array for the current page size (default is 20) 81 | */ 82 | public function getLines() { 83 | return $this->_entities; 84 | } 85 | 86 | public function createObject($arg){ 87 | return new Line($arg); 88 | } 89 | 90 | } 91 | ?> 92 | -------------------------------------------------------------------------------- /model/entities/MaterialContexts.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with materialcontext entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/MaterialContext.php'); 31 | 32 | //******************************************************************* 33 | //********************* MATERIALCONTEXTS CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * MaterialContexts class which is an iterating container of materialcontexts 37 | * 38 | * 39 | * require_once 'MaterialContexts.php'; 40 | * 41 | * $materialcontexts = new MaterialContexts(10,5); 42 | * $materialcontext = $materialcontexts->current(); 43 | * $key = $materialcontexts->key(); 44 | * echo " materialcontext $key has status ".$materialcontext->getFindStatus(); 45 | * 46 | * 47 | * @author Stephen White 48 | */ 49 | 50 | class MaterialContexts extends EntityIterator { 51 | 52 | //*******************************PRIVATE MEMBERS************************************ 53 | 54 | //****************************CONSTRUCTOR FUNCTION*************************************** 55 | 56 | /** 57 | * Create a MaterialContexts iterator, optionally setting the offset and pagesize 58 | * @param int $pageSize sets the max size for query results (default 20) 59 | * @param int $offset sets the start point for query results (default 0) 60 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 61 | */ 62 | public function __construct( $condition = "", $sort = "mcx_id", $offset = 0, $pageSize = 20) { 63 | parent::__construct("materialcontext","mcx_id"); 64 | $this->_autoAdvancePage = true; 65 | $this->_pageSize = $pageSize; 66 | $this->_offset = $offset; 67 | if ($condition) $this->_condition = $condition; 68 | // $this->_security = isSysAdmin()?null:" (".getUserID()."= mcx_owner_id or ".getUserID()." = ANY (\"mcx_visibility_ids\"))"; 69 | $this->_security = parent::getEntityAccessCondition("mcx"); 70 | $this->_sort = $sort; 71 | $this->_dbMgr = new DBManager(); 72 | $this->loadEntities(); 73 | } 74 | 75 | //*******************************PUBLIC FUNCTIONS************************************ 76 | 77 | /** 78 | * materialcontexts - array of materialcontexts from the current query 79 | * 80 | * @return array returns an materialcontext array for the current page size (default is 20) 81 | */ 82 | public function getmaterialcontexts() { 83 | return $this->_entities; 84 | } 85 | 86 | public function createObject($arg){ 87 | return new MaterialContext($arg); 88 | } 89 | 90 | } 91 | ?> 92 | -------------------------------------------------------------------------------- /model/entities/Parts.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with part entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/Part.php'); 31 | 32 | //******************************************************************* 33 | //********************* PARTS CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * Parts class which is an iterating container of parts 37 | * 38 | * 39 | * require_once 'Parts.php'; 40 | * 41 | * $parts = new Parts(10,5); 42 | * $part = $parts->current(); 43 | * $key = $parts->key(); 44 | * echo " part $key has # ".$part->getNumber(); 45 | * 46 | * 47 | * @author Stephen White 48 | */ 49 | 50 | class Parts extends EntityIterator { 51 | 52 | //*******************************PRIVATE MEMBERS************************************ 53 | 54 | //****************************CONSTRUCTOR FUNCTION*************************************** 55 | 56 | /** 57 | * Create a Parts iterator, optionally setting the offset and pagesize 58 | * @param int $pageSize sets the max size for query results (default 20) 59 | * @param int $offset sets the start point for query results (default 0) 60 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 61 | */ 62 | public function __construct( $condition = "", $sort = "prt_id", $offset = 0, $pageSize = 20) { 63 | parent::__construct("part","prt_id"); 64 | $this->_autoAdvancePage = true; 65 | $this->_pageSize = $pageSize; 66 | $this->_offset = $offset; 67 | if ($condition) $this->_condition = $condition; 68 | // $this->_security = isSysAdmin()?null:" (".getUserID()."= prt_owner_id or ".getUserID()." = ANY (\"prt_visibility_ids\"))"; 69 | $this->_security = parent::getEntityAccessCondition("prt"); 70 | $this->_sort = $sort; 71 | $this->_dbMgr = new DBManager(); 72 | $this->loadEntities(); 73 | } 74 | 75 | //*******************************PUBLIC FUNCTIONS************************************ 76 | 77 | /** 78 | * getParts - array of parts from the current query 79 | * 80 | * @return array returns an part array for the current page size (default is 20) 81 | */ 82 | public function getParts() { 83 | return $this->_entities; 84 | } 85 | 86 | public function createObject($arg){ 87 | return new Part($arg); 88 | } 89 | 90 | } 91 | ?> 92 | -------------------------------------------------------------------------------- /model/entities/Runs.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with run entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/Run.php'); 31 | 32 | //******************************************************************* 33 | //********************* RUNS CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * Runs class which is an iterating container of runs 37 | * 38 | * 39 | * require_once 'Runs.php'; 40 | * 41 | * $runs = new Runs(10,5); 42 | * $run = $runs->current(); 43 | * $key = $runs->key(); 44 | * echo " run $key has URL ".$run->getURL(); 45 | * 46 | * 47 | * @author Stephen White 48 | */ 49 | 50 | class Runs extends EntityIterator { 51 | 52 | //*******************************PRIVATE MEMBERS************************************ 53 | 54 | //****************************CONSTRUCTOR FUNCTION*************************************** 55 | 56 | /** 57 | * Create a Runs iterator, optionally setting the offset and pagesize 58 | * @param int $pageSize sets the max size for query results (default 20) 59 | * @param int $offset sets the start point for query results (default 0) 60 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 61 | */ 62 | public function __construct( $condition = "", $sort = "run_id", $offset = 0, $pageSize = 20) { 63 | parent::__construct("run","run_id"); 64 | $this->_autoAdvancePage = true; 65 | $this->_pageSize = $pageSize; 66 | $this->_offset = $offset; 67 | if ($condition) $this->_condition = $condition; 68 | // $this->_security = isSysAdmin()?null:" (".getUserID()."= run_owner_id or ".getUserID()." = ANY (\"run_visibility_ids\"))"; 69 | $this->_security = parent::getEntityAccessCondition("run"); 70 | $this->_sort = $sort; 71 | $this->_dbMgr = new DBManager(); 72 | $this->loadEntities(); 73 | } 74 | 75 | //*******************************PUBLIC FUNCTIONS************************************ 76 | 77 | /** 78 | * getRuns - array of runs from the current query 79 | * 80 | * @return array returns an run array for the current page size (default is 20) 81 | */ 82 | public function getRuns() { 83 | return $this->_entities; 84 | } 85 | 86 | public function createObject($arg){ 87 | return new Run($arg); 88 | } 89 | 90 | } 91 | ?> 92 | -------------------------------------------------------------------------------- /model/entities/Segments.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with segment entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/Segment.php'); 31 | 32 | //******************************************************************* 33 | //********************* SEGMENTS CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * Segments class which is an iterating container of segments 37 | * 38 | * 39 | * require_once 'Segments.php'; 40 | * 41 | * $segments = new Segments(10,5); 42 | * $segment = $segments->current(); 43 | * $key = $segments->key(); 44 | * echo " segment $key is ".$segment->getDescription(); 45 | * 46 | * 47 | * @author Stephen White 48 | */ 49 | 50 | class Segments extends EntityIterator { 51 | 52 | //*******************************PRIVATE MEMBERS************************************ 53 | 54 | //****************************CONSTRUCTOR FUNCTION*************************************** 55 | 56 | /** 57 | * Create a Segments iterator, optionally setting the offset and pagesize 58 | * @param int $pageSize sets the max size for query results (default 20) 59 | * @param int $offset sets the start point for query results (default 0) 60 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 61 | */ 62 | public function __construct( $condition = "", $sort = "seg_id", $offset = 0, $pageSize = 20) { 63 | parent::__construct("segment","seg_id"); 64 | $this->_autoAdvancePage = true; 65 | $this->_pageSize = $pageSize; 66 | $this->_offset = $offset; 67 | if ($condition) $this->_condition = $condition; 68 | // $this->_security = isSysAdmin()?null:" (".getUserID()."= seg_owner_id or ".getUserID()." = ANY (\"seg_visibility_ids\"))"; 69 | $this->_security = parent::getEntityAccessCondition("seg"); 70 | $this->_sort = $sort; 71 | $this->_dbMgr = new DBManager(); 72 | $this->loadEntities(); 73 | } 74 | 75 | //*******************************PUBLIC FUNCTIONS************************************ 76 | 77 | /** 78 | * getSegments - array of segments from the current query 79 | * 80 | * @return array returns an segment array for the current page size (default is 20) 81 | */ 82 | public function getSegments() { 83 | return $this->_entities; 84 | } 85 | 86 | public function createObject($arg){ 87 | return new Segment($arg); 88 | } 89 | 90 | } 91 | ?> 92 | -------------------------------------------------------------------------------- /model/entities/Sequences.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with Sequence entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/Sequence.php'); 31 | 32 | //******************************************************************* 33 | //********************* SEQUENCES CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * Sequences class which is an iterating container of sequences 37 | * 38 | * 39 | * require_once 'Sequences.php'; 40 | * 41 | * $sequences = new Sequences(10,5); 42 | * $sequence = $sequences->current(); 43 | * $key = $sequences->key(); 44 | * echo " sequence $key has objects - ".$sequence->getEntityIDs(true); 45 | * 46 | * 47 | * @author Stephen White 48 | */ 49 | 50 | class Sequences extends EntityIterator { 51 | 52 | //*******************************PRIVATE MEMBERS************************************ 53 | 54 | //****************************CONSTRUCTOR FUNCTION*************************************** 55 | 56 | /** 57 | * Create an Sequences iterator, optionally setting the offset and pagesize 58 | * @param int $pageSize sets the max size for query results (default 20) 59 | * @param int $offset sets the start point for query results (default 0) 60 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 61 | * @todo add code to load all ??? what about 10k or 100k case (could call to get rownum) 62 | */ 63 | public function __construct( $condition = "", $sort = "seq_id", $offset = 0, $pageSize = 20) { 64 | parent::__construct("sequence","seq_id"); 65 | $this->_pageSize = $pageSize; 66 | $this->_offset = $offset; 67 | if ($condition) $this->_condition = $condition; 68 | // $this->_security = isSysAdmin()?null:" (".getUserID()."= seq_owner_id or ".getUserID()." = ANY (\"seq_visibility_ids\"))"; 69 | $this->_security = parent::getEntityAccessCondition("seq"); 70 | $this->_sort = $sort; 71 | $this->_dbMgr = new DBManager(); 72 | $this->loadEntities(); 73 | } 74 | 75 | //*******************************PUBLIC FUNCTIONS************************************ 76 | 77 | 78 | /** 79 | * Sequences - array of sequences from the current query 80 | * 81 | * @return array returns a Sequence array for the current page size (default is 20) 82 | */ 83 | public function getSequences() { 84 | return $this->_entities; 85 | } 86 | 87 | public function createObject($arg){ 88 | return new Sequence($arg); 89 | } 90 | 91 | } 92 | ?> 93 | -------------------------------------------------------------------------------- /model/entities/Spans.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with span entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/Span.php'); 31 | 32 | //******************************************************************* 33 | //********************* SPANS CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * Spans class which is an iterating container of spans 37 | * 38 | * 39 | * require_once 'Spans.php'; 40 | * 41 | * $spans = new Spans(10,5); 42 | * $span = $spans->current(); 43 | * $key = $spans->key(); 44 | * echo " span $key has URL ".$span->getURL(); 45 | * 46 | * 47 | * @author Stephen White 48 | */ 49 | 50 | class Spans extends EntityIterator { 51 | 52 | //*******************************PRIVATE MEMBERS************************************ 53 | 54 | //****************************CONSTRUCTOR FUNCTION*************************************** 55 | 56 | /** 57 | * Create a Spans iterator, optionally setting the offset and pagesize 58 | * @param int $pageSize sets the max size for query results (default 20) 59 | * @param int $offset sets the start point for query results (default 0) 60 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 61 | */ 62 | public function __construct( $condition = "", $sort = "spn_id", $offset = 0, $pageSize = 20) { 63 | parent::__construct("span","spn_id"); 64 | $this->_autoAdvancePage = true; 65 | $this->_pageSize = $pageSize; 66 | $this->_offset = $offset; 67 | if ($condition) $this->_condition = $condition; 68 | // $this->_security = isSysAdmin()?null:" (".getUserID()."= spn_owner_id or ".getUserID()." = ANY (\"spn_visibility_ids\"))"; 69 | $this->_security = parent::getEntityAccessCondition("spn"); 70 | $this->_sort = $sort; 71 | $this->_dbMgr = new DBManager(); 72 | $this->loadEntities(); 73 | } 74 | 75 | //*******************************PUBLIC FUNCTIONS************************************ 76 | 77 | /** 78 | * getSpans - array of spans from the current query 79 | * 80 | * @return array returns an span array for the current page size (default is 20) 81 | */ 82 | public function getSpans() { 83 | return $this->_entities; 84 | } 85 | 86 | public function createObject($arg){ 87 | return new Span($arg); 88 | } 89 | 90 | } 91 | ?> 92 | -------------------------------------------------------------------------------- /model/entities/Surfaces.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with Surface entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/Surface.php'); 31 | 32 | //******************************************************************* 33 | //********************* TEXTS CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * Surfaces class which is an iterating container of surfaces 37 | * 38 | * 39 | * require_once 'Surfaces.php'; 40 | * 41 | * $surfaces = new Surfaces(10,5); 42 | * $surface = $surfaces->current(); 43 | * $key = $surfaces->key(); 44 | * echo " surface $key is ".$surface->getTitle(); 45 | * 46 | * 47 | * @author Stephen White 48 | */ 49 | 50 | class Surfaces extends EntityIterator { 51 | 52 | //*******************************PRIVATE MEMBERS************************************ 53 | 54 | //****************************CONSTRUCTOR FUNCTION*************************************** 55 | 56 | /** 57 | * Create an Surfaces iterator, optionally setting the offset and pagesize 58 | * @param int $pageSize sets the max size for query results (default 20) 59 | * @param int $offset sets the start point for query results (default 0) 60 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 61 | * @todo add code to load all ??? what about 10k or 100k case (could call to get rownum) 62 | */ 63 | public function __construct( $condition = "", $sort = "srf_id", $offset = 0, $pageSize = 20) { 64 | parent::__construct("surface","srf_id"); 65 | $this->_autoAdvancePage = true; 66 | $this->_pageSize = $pageSize; 67 | $this->_offset = $offset; 68 | if ($condition) $this->_condition = $condition; 69 | $this->_security = isSysAdmin()?null:" ARRAY[".join(",",getUserMembership()).",".getUserID()."] && srf_visibility_ids"; 70 | // $this->_security = parent::getEntityAccessCondition("srf"); 71 | $this->_sort = $sort; 72 | $this->_dbMgr = new DBManager(); 73 | $this->loadEntities(); 74 | } 75 | 76 | //*******************************PUBLIC FUNCTIONS************************************ 77 | 78 | 79 | /** 80 | * Surfaces - array of surfaces from the current query 81 | * 82 | * @return array returns a Surface array for the current page size (default is 20) 83 | */ 84 | public function getSurfaces() { 85 | return $this->_entities; 86 | } 87 | 88 | public function createObject($arg){ 89 | return new Surface($arg); 90 | } 91 | 92 | } 93 | ?> 94 | -------------------------------------------------------------------------------- /model/entities/Terms.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with Term entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/Term.php'); 31 | 32 | //******************************************************************* 33 | //********************* TERMS CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * Terms class which is an iterating container of terms 37 | * 38 | * 39 | * require_once 'Terms.php'; 40 | * 41 | * $terms = new Terms(10,5); 42 | * $term = $terms->current(); 43 | * $key = $terms->key(); 44 | * echo " term $key is ".$term->getTerm(); 45 | * 46 | * 47 | * @author Stephen White 48 | */ 49 | 50 | class Terms extends EntityIterator { 51 | 52 | //*******************************PRIVATE MEMBERS************************************ 53 | 54 | //****************************CONSTRUCTOR FUNCTION*************************************** 55 | 56 | /** 57 | * Create an Terms iterator, optionally setting the offset and pagesize 58 | * @param int $pageSize sets the max size for query results (default 20) 59 | * @param int $offset sets the start point for query results (default 0) 60 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 61 | * @todo add code to load all ??? what about 10k or 100k case (could call to get rownum) 62 | */ 63 | public function __construct( $condition = "", $sort = "trm_id", $offset = 0, $pageSize = 20) { 64 | parent::__construct("term","trm_id"); 65 | $this->_autoAdvancePage = true; 66 | $this->_pageSize = $pageSize; 67 | $this->_offset = $offset; 68 | if ($condition) $this->_condition = $condition; 69 | // $this->_security = isSysAdmin()?null:" (".getUserID()."= trm_owner_id or ".getUserID()." = ANY (\"trm_visibility_ids\"))"; 70 | $this->_security = parent::getEntityAccessCondition("trm"); 71 | $this->_sort = $sort; 72 | $this->_dbMgr = new DBManager(); 73 | $this->loadEntities(); 74 | } 75 | 76 | //*******************************PUBLIC FUNCTIONS************************************ 77 | 78 | 79 | /** 80 | * Terms - array of terms from the current query 81 | * 82 | * @return array returns a Term array for the current page size (default is 20) 83 | */ 84 | public function getTerms() { 85 | return $this->_entities; 86 | } 87 | 88 | public function createObject($arg){ 89 | return new Term($arg); 90 | } 91 | 92 | } 93 | ?> 94 | -------------------------------------------------------------------------------- /model/entities/Tokens.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with Token entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/Token.php'); 31 | 32 | //******************************************************************* 33 | //********************* TEXTS CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * Tokens class which is an iterating container of tokens 37 | * 38 | * 39 | * require_once 'Tokens.php'; 40 | * 41 | * $tokens = new Tokens(10,5); 42 | * $token = $tokens->current(); 43 | * $key = $tokens->key(); 44 | * echo " token $key is ".$token->getToken(); 45 | * 46 | * 47 | * @author Stephen White 48 | */ 49 | 50 | class Tokens extends EntityIterator { 51 | 52 | //*******************************PRIVATE MEMBERS************************************ 53 | 54 | //****************************CONSTRUCTOR FUNCTION*************************************** 55 | 56 | /** 57 | * Create an Tokens iterator, optionally setting the offset and pagesize 58 | * @param int $pageSize sets the max size for query results (default 20) 59 | * @param int $offset sets the start point for query results (default 0) 60 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 61 | * @todo add code to load all ??? what about 10k or 100k case (could call to get rownum) 62 | */ 63 | public function __construct( $condition = "", $sort = "tok_id", $offset = 0, $pageSize = 20) { 64 | parent::__construct("token","tok_id"); 65 | $this->_autoAdvancePage = true; 66 | $this->_pageSize = $pageSize; 67 | $this->_offset = $offset; 68 | if ($condition) $this->_condition = $condition; 69 | // $this->_security = isSysAdmin()?null:" (".getUserID()."= tok_owner_id or ".getUserID()." = ANY (\"tok_visibility_ids\"))"; 70 | $this->_security = parent::getEntityAccessCondition("tok"); 71 | $this->_sort = $sort; 72 | $this->_dbMgr = new DBManager(); 73 | $this->loadEntities(); 74 | } 75 | 76 | //*******************************PUBLIC FUNCTIONS************************************ 77 | 78 | 79 | /** 80 | * Tokens - array of tokens from the current query 81 | * 82 | * @return array returns a Token array for the current page size (default is 20) 83 | */ 84 | public function getTokens() { 85 | return $this->_entities; 86 | } 87 | 88 | public function createObject($arg){ 89 | return new Token($arg); 90 | } 91 | 92 | } 93 | ?> 94 | -------------------------------------------------------------------------------- /model/entities/UserGroups.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Classes to deal with AttributionGroup entities 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | require_once (dirname(__FILE__) . '/EntityIterator.php'); 30 | require_once (dirname(__FILE__) . '/UserGroup.php'); 31 | 32 | //******************************************************************* 33 | //********************* USERGROUPS CLASS ***************************** 34 | //******************************************************************* 35 | /** 36 | * UserGroups class which is an iterating container of UserGroups 37 | * 38 | * 39 | * require_once 'UserGroups.php'; 40 | * 41 | * $userGroups = new UserGroups("",,10,5); 42 | * $userGroup = $userGroups->current(); 43 | * $key = $userGroup->key(); 44 | * echo " userGroup $key is ".$userGroup->getRealName(); 45 | * 46 | * 47 | * @author Stephen White 48 | */ 49 | 50 | class UserGroups extends EntityIterator { 51 | 52 | //*******************************PRIVATE MEMBERS************************************ 53 | //****************************CONSTRUCTOR FUNCTION*************************************** 54 | 55 | /** 56 | * Create an UserGroups iterator, optionally setting the offset and pagesize 57 | * @param int $pageSize sets the max size for query results (default 20) 58 | * @param int $offset sets the start point for query results (default 0) 59 | * @todo write a store procedure to test for intersection of 2 integer arrays for security checking access IDs with VisibilityIDs 60 | */ 61 | public function __construct( $condition = "", $sort = "ugr_id", $offset = 0, $pageSize = 20) { 62 | parent::__construct("usergroup","ugr_id"); 63 | $this->_autoAdvancePage = true; 64 | $this->_pageSize = $pageSize; 65 | $this->_offset = $offset; 66 | if ($condition) $this->_condition = $condition; 67 | $this->_security = isSysAdmin()?null:($condition?" AND ":"")." (".getUserID()." = ANY (\"ugr_member_ids\") or ".getUserID()." = ANY (\"ugr_admin_ids\") or ugr_id in (2,3,6))"; 68 | // $this->_security = parent::getEntityAccessCondition("ugr"); 69 | $this->_sort = $sort; 70 | $this->_dbMgr = new DBManager(); 71 | $this->loadEntities(); 72 | } 73 | 74 | //*******************************PUBLIC FUNCTIONS************************************ 75 | 76 | /** 77 | * UserGroups - array of UserGroups from the current query 78 | * 79 | * @return array returns an UserGroupsarray for the current page size (default is 20) 80 | */ 81 | public function getUserGroups() { 82 | return $this->_entities; 83 | } 84 | 85 | public function createObject($arg){ 86 | return new UserGroup($arg); 87 | } 88 | 89 | } 90 | ?> 91 | -------------------------------------------------------------------------------- /model/entities/entityTemplate.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * brief description of file 20 | * 21 | * @author Stephen White 22 | * @copyright @see AUTHORS in repository root 23 | * @link https://github.com/readsoftware 24 | * @version 1.0 25 | * @license @see COPYING in repository root or 26 | * @package READ Research Environment for Ancient Documents 27 | * @subpackage Entity Classes 28 | */ 29 | 30 | 31 | ?> 32 | -------------------------------------------------------------------------------- /model/import/jsonMetadataTemplate.php: -------------------------------------------------------------------------------- 1 | array(// img1 is a text local nonce that will be used to lookup the image if exist for deduplication 6 | //it can also be a image ID (int) 7 | "type" => "InscriptionRubbing",//"InscriptionPhotograph","InscriptionEyeCopy","InscriptionPhotograph","ReliquaryPhotograph","EyeCopy","ManuscriptReconstruction","ManuscriptConserved","InscriptionPhotographInfraRed","ReconstructedSurface", 8 | "url" => "/images/vp/EIAD???/EIAD_???.JPG", 9 | "attribution" => array( 10 | "title" => "", 11 | "description" => "", 12 | "bibliographyid" => null, 13 | "type" => "reference", 14 | "detail" => "", 15 | "aedid" => null, 16 | "usergroupid" => null 17 | ) 18 | //"polygon" => new Polygon("(55,65),(34,63),(45,95)) //cropping polygon 19 | ) 20 | ); 21 | 22 | $textItem = array( 23 | "title"=>"", 24 | // "type" => "typeOfItemTerm", 25 | // "shape" => "shapeOfItemTerm", 26 | //"measure" => "Unit:cm, Height:,Width:,Depth:", 27 | //"image_ids" => array("img1") 28 | ); 29 | 30 | $textParts = array( 31 | "prt1" => array( 32 | "label"=>"", 33 | // "type" => "typeOfPartTerm", 34 | // "shape" => "shapeOfPartTerm", 35 | //"mediums" => array("marble"), 36 | //"measure" => "Unit:cm, Height:,Width:,Depth:", 37 | //"sequence" => 1, 38 | //"item_id" => "toBeFilledIn", 39 | //"image_ids" => array("img1") 40 | ) 41 | ); 42 | 43 | $materialContexts = array( 44 | "mtx1" => array( 45 | "arch_context" => "", 46 | "find_status" => "" 47 | ) 48 | ); 49 | 50 | $textFragments = array( 51 | "fra1" => array( 52 | "label"=>"", 53 | "description" =>"", 54 | //"measure" => "Unit:cm, Height:,Width:", 55 | //"restore_state" => "original", 56 | "location_refs" => array(""), 57 | "part_id" => "prt1", 58 | "material_context_ids" => array("mtx1"), 59 | "image_ids" => array("img1") 60 | ) 61 | ); 62 | 63 | $textSurfaces = array( 64 | "srf1" => array( 65 | //"text_ids" => array("toBeFilledIn"), 66 | "description" =>"", 67 | //"number" => 1, 68 | //"layer_number" => 1, 69 | "scripts" => array(""), 70 | "fragment_id" => "fra1", 71 | "image_ids" => array("img1") 72 | ) 73 | ); 74 | 75 | $textImageBaselines = array( 76 | "bln1" => array( 77 | "imgID" => "img1", 78 | //"polygon" => new Polygon("(55,65),(34,63),(45,95)) //cropping polygon 79 | "surface_id" => "srf1", 80 | "scriptLanguage" => "" //temporary storage location 81 | ) 82 | ); 83 | 84 | 85 | ?> 86 | -------------------------------------------------------------------------------- /model/import/jsonTextTemplate.php: -------------------------------------------------------------------------------- 1 | "", 7 | "description"=>"" 8 | ); 9 | 10 | $editionNotes = array( 11 | "comment"=>"", 12 | "description"=>"" 13 | ); 14 | 15 | $editionDef = array ( 16 | "Description"=>"EIAD??? VP2SK 2016", 17 | "TranscriptionLines" => array(//transcription markup for text, must be parser compatible 18 | "1"=>"", 19 | ""=>"", 20 | ""=>""), 21 | "physlineComments" => array (//annotations on physical line sequence so keys need to match seq label 22 | ""=>array( 23 | "" 24 | ), 25 | ""=>array( 26 | "" 27 | ), 28 | ""=>array( 29 | "" 30 | ) 31 | ) 32 | ); 33 | 34 | $imageDefs = array( 35 | "img1" => array( 36 | "type" => "InscriptionPhotograph",//"InscriptionRubbing","InscriptionEyeCopy","InscriptionPhotograph","ReliquaryPhotograph","EyeCopy","ManuscriptReconstruction","ManuscriptConserved","InscriptionPhotographInfraRed","ReconstructedSurface", 37 | "url" => "/images/vp/EIAD???/EIAD_???.JPG" 38 | //"polygon" => new Polygon("(55,65),(34,63),(45,95)) //cropping polygon 39 | ) 40 | ); 41 | 42 | $textItem = array( 43 | "title"=>"", 44 | // "type" => "typeOfItemTerm", 45 | // "shape" => "shapeOfItemTerm", 46 | //"measure" => "Unit:cm, Height:,Width:,Depth:", 47 | //"image_ids" => array("img1") 48 | ); 49 | 50 | $textParts = array( 51 | "prt1" => array( 52 | "label"=>"", 53 | // "type" => "typeOfPartTerm", 54 | // "shape" => "shapeOfPartTerm", 55 | "mediums" => array("marble"), 56 | //"measure" => "Unit:cm, Height:,Width:,Depth:", 57 | "sequence" => 1, 58 | //"item_id" => "toBeFilledIn", 59 | //"image_ids" => array("img1") 60 | ) 61 | ); 62 | 63 | $materialContexts = array( 64 | "mtx1" => array( 65 | "arch_context" => "", 66 | "find_status" => "" 67 | ) 68 | ); 69 | 70 | $textFragments = array( 71 | "fra1" => array( 72 | "label"=>"", 73 | "description" =>"", 74 | //"measure" => "Unit:cm, Height:,Width:", 75 | //"restore_state" => "original", 76 | "location_refs" => array(""), 77 | "part_id" => "prt1", 78 | "material_context_ids" => array("mtx1"), 79 | "image_ids" => array("img1") 80 | ) 81 | ); 82 | 83 | $textSurfaces = array( 84 | "srf1" => array( 85 | //"text_ids" => array("toBeFilledIn"), 86 | "description" =>"", 87 | //"number" => 1, 88 | //"layer_number" => 1, 89 | "scripts" => array(""), 90 | "fragment_id" => "fra1", 91 | "image_ids" => array("img1") 92 | ) 93 | ); 94 | 95 | $textImageBaselines = array( 96 | "bln1" => array( 97 | "imgID" => "img1", 98 | // "polygon" => new Polygon("(55,65),(34,63),(45,95)) //cropping polygon 99 | "surface_id" => "srf1", // link to surface this baseline represents 100 | // "scriptLanguage" => "" // code to identify the language on this baseline 101 | ) 102 | ); 103 | 104 | $textBaselineRuns = array( 105 | "run1" => array( 106 | //"text_ids" => array("toBeFilledIn"), 107 | //"scribe" => "nameInPronoun", 108 | "baseline_id" => "bln1", 109 | //"polygon" => new Polygon("(55,65),(34,63),(45,95)) //cropping polygon absence means whole baseline 110 | "scriptLanguage" => "", 111 | //"writing" => "writingTechniqueTerm", 112 | ) 113 | ); 114 | 115 | 116 | ?> 117 | -------------------------------------------------------------------------------- /model/import/jsonUpdateTextEntitiesSample.php: -------------------------------------------------------------------------------- 1 | array(// img1 is a text local nonce that will be used to lookup the image if exist for deduplication 6 | //it can also be a image ID (int) 7 | "title" => "Avalokeśvara Inscription", 8 | "type" => "InscriptionPhotograph",//"InscriptionPhotograph","InscriptionEyeCopy","InscriptionPhotograph","ReliquaryPhotograph","EyeCopy","ManuscriptReconstruction","ManuscriptConserved","InscriptionPhotographInfraRed","ReconstructedSurface", 9 | "url" => "/images/Gandhari/txt222/s_CKI0222.1.jpg", 10 | "attribution" => array( 11 | "title" => "Dani 1958", 12 | "description" => "", 13 | "bibliographyid" => null, 14 | "type" => "reference", 15 | "detail" => "", 16 | "aedid" => null, 17 | "usergroupid" => null 18 | ) 19 | //"polygon" => new Polygon("(55,65),(34,63),(45,95)) //cropping polygon 20 | ), 21 | "img2" => array(// img1 is a text local nonce that will be used to lookup the image if exist for deduplication 22 | //it can also be a image ID (int) 23 | "title" => "Avalokeśvara Relief", 24 | "type" => "InscriptionPhotograph",//"InscriptionPhotograph","InscriptionEyeCopy","InscriptionPhotograph","ReliquaryPhotograph","EyeCopy","ManuscriptReconstruction","ManuscriptConserved","InscriptionPhotographInfraRed","ReconstructedSurface", 25 | "url" => "/images/Gandhari/txt222/s_CKI0222.2.jpg", 26 | "attribution" => array( 27 | "title" => "Dani 1958", 28 | "description" => "", 29 | "bibliographyid" => null, 30 | "type" => "reference", 31 | "detail" => "", 32 | "aedid" => null, 33 | "usergroupid" => null 34 | ) 35 | //"polygon" => new Polygon("(55,65),(34,63),(45,95)) //cropping polygon 36 | ) 37 | ); 38 | 39 | 40 | ?> 41 | -------------------------------------------------------------------------------- /model/import/jsonUpdateTextEntitiesUtil.php: -------------------------------------------------------------------------------- 1 | array( 7 | "img1" => array(// img1 is a text local nonce that will be used to lookup the image if exist for deduplication 8 | //it can also be a image ID (int) 9 | "title" => "Avalokeśvara Inscription", 10 | "type" => "InscriptionPhotograph",//"InscriptionPhotograph","InscriptionEyeCopy","InscriptionPhotograph","ReliquaryPhotograph","EyeCopy","ManuscriptReconstruction","ManuscriptConserved","InscriptionPhotographInfraRed","ReconstructedSurface", 11 | "url" => "/images/Gandhari/txt222/s_CKI0222.1.jpg", 12 | "attribution" => array( 13 | "title" => "Dani 1958", 14 | "description" => "", 15 | "bibliographyid" => null, 16 | "type" => "reference", 17 | "detail" => "", 18 | "aedid" => null, 19 | "usergroupid" => null 20 | ) 21 | //"polygon" => new Polygon("(55,65),(34,63),(45,95)) //cropping polygon 22 | ), 23 | "img2" => array(// img1 is a text local nonce that will be used to lookup the image if exist for deduplication 24 | //it can also be a image ID (int) 25 | "title" => "Avalokeśvara Relief", 26 | "type" => "InscriptionPhotograph",//"InscriptionPhotograph","InscriptionEyeCopy","InscriptionPhotograph","ReliquaryPhotograph","EyeCopy","ManuscriptReconstruction","ManuscriptConserved","InscriptionPhotographInfraRed","ReconstructedSurface", 27 | "url" => "/images/Gandhari/txt222/s_CKI0222.2.jpg", 28 | "attribution" => array( 29 | "title" => "Dani 1958", 30 | "description" => "", 31 | "bibliographyid" => null, 32 | "type" => "reference", 33 | "detail" => "", 34 | "aedid" => null, 35 | "usergroupid" => null 36 | ) 37 | //"polygon" => new Polygon("(55,65),(34,63),(45,95)) //cropping polygon 38 | ) 39 | ) 40 | ); 41 | 42 | updateTextEntites($textCKN, $entitiesConfig); 43 | 44 | 45 | ?> 46 | -------------------------------------------------------------------------------- /model/importNewTermsToMaint.sh: -------------------------------------------------------------------------------- 1 | export PGCLIENTENCODING=UTF8 2 | export LANGUAGE="en_US.UTF-8" 3 | export LANG="en_US.UTF-8" 4 | export LC_ALL="en_US.UTF-8" 5 | 6 | if ! psql -U postgres -lqt | cut -d \| -f 1 | grep -qw termmaintenance; then 7 | echo "termmaintenance database doesn't exist so creating" 8 | psql -U postgres -c "CREATE DATABASE termmaintenance WITH OWNER = postgres ENCODING = 'UTF8' TABLESPACE = pg_default LC_COLLATE = 'C' LC_CTYPE = 'C' CONNECTION LIMIT = -1 TEMPLATE template0;" 9 | echo "importing term.sql " 10 | psql -U postgres -d termmaintenance -f kanishkaTerm.sql 11 | psql -U postgres -d termmaintenance -f term.sql 12 | else 13 | monthday=$(date '+%m_%d') 14 | echo "archiving terms_last to terms$monthday" 15 | psql -U postgres -d termmaintenance -c "DROP TABLE IF EXISTS terms$monthday" 16 | psql -U postgres -d termmaintenance -c "ALTER TABLE IF EXISTS terms_last RENAME TO terms$monthday" 17 | echo "archiving terms to terms_last" 18 | psql -U postgres -d termmaintenance -c "ALTER TABLE IF EXISTS term RENAME TO terms_last" 19 | echo "importing term.sql " 20 | psql -U postgres -d termmaintenance -f kanishkaTerm.sql 21 | psql -U postgres -d termmaintenance -f term.sql 22 | echo "show changes between terms to terms_last" 23 | psql -U postgres -d termmaintenance -c "SELECT c.trm_id,concat(c.trm_labels::hstore->'en','_',p.trm_labels::hstore->'en') AS label_parentlabel,c.trm_type_id,c.trm_code, c.trm_list_ids FROM term c LEFT JOIN term p ON c.trm_parent_id = p.trm_id ORDER BY c.trm_ID" > allTermInfo.txt 24 | psql -U postgres -d termmaintenance -c "SELECT c.trm_id,concat(c.trm_labels::hstore->'en','_',p.trm_labels::hstore->'en') AS label_parentlabel,c.trm_type_id,c.trm_code, c.trm_list_ids FROM terms_last c LEFT JOIN terms_last p ON c.trm_parent_id = p.trm_id ORDER BY c.trm_ID" > allLastTermInfo.txt 25 | diff -bBwy --suppress-common-lines allLastTermInfo.txt allTermInfo.txt 26 | fi -------------------------------------------------------------------------------- /model/kanishkaTerm.sql: -------------------------------------------------------------------------------- 1 | CREATE EXTENSION IF NOT EXISTS hstore; 2 | 3 | CREATE TABLE term 4 | ( 5 | "trm_id" serial NOT NULL PRIMARY KEY, 6 | "trm_labels" text NOT NULL DEFAULT 'Need Labels', 7 | "trm_parent_id" int NULL DEFAULT 1, 8 | "trm_type_id" int NULL DEFAULT 1, 9 | "trm_list_ids" int[] NULL, 10 | "trm_code" text NULL, 11 | "trm_description" text NULL, 12 | "trm_url" text NULL, 13 | "trm_attribution_ids" int[] NULL, 14 | "modified" TIMESTAMP default CURRENT_TIMESTAMP, 15 | "trm_owner_id" int NULL DEFAULT 2, 16 | "trm_annotation_ids" int[] NULL,-- TODO handle integrity with triggers and/or utilities //note: append syntax update foo set a = a || newInt 17 | "trm_visibility_ids" int[] NULL DEFAULT '{6}',-- TODO handle integrity with triggers and/or utilities //note: append syntax update foo set a = a || newInt 18 | "trm_scratch" text NULL 19 | ) 20 | WITH ( 21 | OIDS=FALSE 22 | ); 23 | -------------------------------------------------------------------------------- /model/maintTermViewQuery.sql: -------------------------------------------------------------------------------- 1 | CREATE EXTENSION IF NOT EXISTS dblink; 2 | DROP VIEW IF EXISTS termmaintenance_term; 3 | CREATE OR REPLACE VIEW termmaintenance_term AS 4 | SELECT * 5 | FROM dblink('dbname=termmaintenance user=postgres password=gandhari', 'select trm_id,trm_labels,trm_type_id,trm_parent_id,trm_code,trm_list_ids from term') 6 | AS t1(trm_id int, trm_labels text, trm_type_id int, trm_parent_id int, trm_code text, trm_list_ids int[]); 7 | -------------------------------------------------------------------------------- /model/migration/exportXML/export_db_to_xml.sh: -------------------------------------------------------------------------------- 1 | export PGCLIENTENCODING=UTF8 2 | export LANGUAGE="en_US.UTF-8" 3 | export LANG="en_US.UTF-8" 4 | export LC_ALL="en_US.UTF-8" 5 | 6 | usage () 7 | { 8 | echo 'Usage : extract_dbtables_to_xml.sh dbname' 9 | exit 10 | } 11 | 12 | if [ "$1" == "" ] 13 | then 14 | usage 15 | fi 16 | 17 | ADMINPSWD="admin" 18 | PSQLPATH="/C/xampp/PostgreSQL/9.3/bin/psql -U postgres " 19 | PHPPATH="/C/xampp/php/php " 20 | TABLENAMES_QUERY="SELECT relname 21 | FROM pg_class C 22 | LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) 23 | WHERE nspname NOT IN ('pg_catalog', 'information_schema') 24 | AND relkind='r' AND nspname = 'public' 25 | ORDER BY relname;" 26 | echo $TABLENAMES_QUERY | $PSQLPATH -t -d $1 > $1_table_names.txt 27 | echo '' > $1_schema.xsd 28 | echo "" >> $1_schema.xsd 29 | 30 | cat $1_table_names.txt | \ 31 | while read tablename; do 32 | tablename=$( echo "${tablename}"| sed -e 's/^ *//' -e 's/ *$//' ); 33 | echo '' > $1_$tablename.xml 34 | echo '' >> $1_$tablename.xml 35 | if [[ -n "$tablename" ]] 36 | then 37 | $PSQLPATH -tAq -d $1 -c "select table_to_xml('$tablename',true,true,'');" >> $1_$tablename.xml 38 | $PSQLPATH -tAq -d $1 -c "select table_to_xmlschema('$tablename',true,true,'');" >> $1_schema.xsd 39 | fi 40 | echo '' >> $1_$tablename.xml 41 | # if [ -e ./$1_$tablename.xml ] 42 | # then /opt/basex/bin/basexclient -Uadmin -P$ADMINPSWD -c "CHECK $1; REPLACE $1_$tablename.xml $PWD/$1_$tablename.xml" 43 | # fi 44 | # if [ -e ./$1_$tablename.xml ] 45 | # then rm ./$1_$tablename.xml 46 | # fi 47 | 48 | done 49 | echo "" >> $1_schema.xsd 50 | if [[ -e ./removeDuplicateNodes.php && -e ./$1_schema.xsd ]]; then 51 | $PHPPATH ./removeDuplicateNodes.php $1_schema.xsd 52 | echo "removed duplicate elements from $1_schema.xsd" 53 | fi 54 | #if [ -e ./$1_schema.xsd ]; then 55 | # /opt/basex/bin/basexclient -Uadmin -P$ADMINPSWD -c "CHECK $1; REPLACE $1_schema.xsd $PWD/$1_schema.xsd" 56 | #fi 57 | -------------------------------------------------------------------------------- /model/migration/exportXML/getNode.xq: -------------------------------------------------------------------------------- 1 | (: XQuery file: getNode.xq :) 2 | (: example call servername:8984/rest?run=readXQ/getNode.xq&db=test&tableName=token&id=25 :) 3 | declare variable $db as xs:string external; 4 | declare variable $tableName as xs:string external; 5 | declare variable $id as xs:integer external; 6 | let $idName := if ($tableName = "token") then "tok_id" 7 | else if ($tableName = "compound") then "cmp_id" 8 | else if ($tableName = "sequence") then "seq_id" 9 | else if ($tableName = "grapheme") then "gra_id" 10 | else if ($tableName = "syllablecluster") then "scl_id" 11 | else "???" 12 | for $nodes in db:open($db)//*[name() eq $nodeName][*[name() eq $idName and xs:integer(data()) eq $id]] 13 | return $nodes 14 | -------------------------------------------------------------------------------- /model/migration/exportXML/removeDuplicateNodes.php: -------------------------------------------------------------------------------- 1 | '."\n"; 11 | if ($fileXML->getName()== "root") { //processing output of DB schema dump 12 | foreach ($fileXML->children("xsd",true) as $topNode) { 13 | if ($topNode->getName()== "schema") { 14 | foreach ($topNode->children("xsd",true) as $level2Node) { 15 | $hash = md5($level2Node->asXML()); 16 | if (!array_key_exists($hash,$seenNodeHashes)) { 17 | $seenNodeHashes[$hash] = 1; 18 | $schemaXML .= $level2Node->asXML()."\n"; 19 | } 20 | } 21 | } 22 | } 23 | } else if ($fileXML->getName()== "schema") { 24 | foreach ($fileXML->children("xsd",true) as $node) { 25 | $hash = md5($node->asXML()); 26 | if (!array_key_exists($hash,$seenNodeHashes)) { 27 | $seenNodeHashes[$hash] = 1; 28 | $schemaXML .= $node->asXML()."\n"; 29 | } 30 | } 31 | } else { 32 | echo "Unknown file format, aborting process"; 33 | exit; 34 | } 35 | $schemaXML .= ""; 36 | $schema = simplexml_load_string($schemaXML,NULL,NULL,"xsd",true); 37 | $schema->asXML($filename); 38 | // echo "Finished processing $filename\n*********** Contents :\n\n"; 39 | // echo file_get_contents($filename); 40 | } else { 41 | exit("Failed to open $filename."); 42 | } 43 | ?> 44 | -------------------------------------------------------------------------------- /model/migration/exportXML/updateEpiDocFromDir.xq: -------------------------------------------------------------------------------- 1 | declare variable $dbxName as xs:string external := "basexDbName"; 2 | declare variable $dbName as xs:string external := "psqlDbName"; 3 | declare variable $dir as xs:string external := "/path/to/local/dir/of/tei"; (: local path where exported documents are :) 4 | 5 | let $schema := "http://www.stoa.org/epidoc/schema/latest/tei-epidoc.rng" 6 | let $path := $dir || "/" || $dbName 7 | for $docname in file:list($path) 8 | let $filepath := $path || "/" || $docname 9 | let $vReport := try { 10 | validate:rng-report($filepath,$schema) 11 | } catch * { 12 | 13 | 14 | 'Error [' || $err:code || ']: ' || $err:description 15 | 16 | 17 | } 18 | let $isValidEpidoc :=(data($vReport/report/status) eq "valid") 19 | let $dbExist := db:exists($dbxName) 20 | let $mod := file:last-modified($filepath) 21 | let $fileurl := "file:/" || $filepath 22 | let $filename := replace($docname,"epidoc_","") 23 | let $dbxFilepath := "epidoc/" || $filename 24 | let $returnInfo := 25 | 26 | {$dbxFilepath} 27 | {$filepath} 28 | {$mod} 29 | {$vReport} 30 | 31 | return db:replace($dbxName,$dbxFilepath,doc($filepath)) -------------------------------------------------------------------------------- /model/rebuildTermsTable.sh: -------------------------------------------------------------------------------- 1 | export PGCLIENTENCODING=UTF8 2 | export LANGUAGE="en_US.UTF-8" 3 | export LANG="en_US.UTF-8" 4 | export LC_ALL="en_US.UTF-8" 5 | 6 | usage () 7 | { 8 | echo 'Usage : rebuildTermsTable.sh dbname' 9 | exit 10 | } 11 | 12 | if [ "$1" == "" ] 13 | then 14 | usage 15 | fi 16 | 17 | echo "preparing to update terms for '$1' database showing differences with termmaintenance term table" 18 | 19 | psql -U postgres -d $1 -c "SELECT c.trm_id,concat(c.trm_labels::hstore->'en','_',p.trm_labels::hstore->'en') AS label_parentlabel,c.trm_type_id,c.trm_code, c.trm_list_ids FROM term c LEFT JOIN term p ON c.trm_parent_id = p.trm_id ORDER BY c.trm_ID" > allTermInfoForDB.txt 20 | 21 | psql -U postgres -d termmaintenance -c "SELECT c.trm_id,concat(c.trm_labels::hstore->'en','_',p.trm_labels::hstore->'en') AS label_parentlabel,c.trm_type_id,c.trm_code, c.trm_list_ids FROM term c LEFT JOIN term p ON c.trm_parent_id = p.trm_id ORDER BY c.trm_ID" > allTermInfo.txt 22 | 23 | diff -bBwy --suppress-common-lines allTermInfoForDB.txt allTermInfo.txt 24 | 25 | echo -n "Please review changes! Press enter to continue. > " 26 | 27 | read response 28 | 29 | echo "creating view for new terms from termmaintenance database" 30 | 31 | psql -U postgres -d $1 -f maintTermViewQuery.sql 32 | 33 | echo "output used type ids for database '$1' before term update to trmTypeUsageBeforeTermTableUpdate.txt" 34 | 35 | psql -U postgres -d $1 -f typeTermUsageQuery.sql > trmTypeUsageBeforeTermTableUpdate.txt 36 | 37 | echo "output used type ids for database termmaintenance before term update to maintTermTypeUsage.txt" 38 | 39 | psql -U postgres -d $1 -f typeTermUsageMappedToMaintQuery.sql > maintTermTypeUsage.txt 40 | 41 | echo "show differences for used terms in '$1' compared to those term ids in the new term.sql, blank means no differences detected" 42 | 43 | diff -bBwy --suppress-common-lines trmTypeUsageBeforeTermTableUpdate.txt maintTermTypeUsage.txt 44 | 45 | psql -U postgres -d $1 -c "DROP VIEW IF EXISTS termmaintenance_term;" 46 | 47 | echo -n "Review used term changes! Would you like to update? (Y/n) > " 48 | 49 | read response 50 | 51 | if [ "$response" != "Y" ]; then 52 | echo "response '$response' not equal 'Y'. Aborting term update!" 53 | exit 1 54 | fi 55 | 56 | echo " updating term table for database '$1' " 57 | 58 | psql -U postgres -d $1 -f disableAllTriggers.sql | grep ERROR 59 | 60 | psql -U postgres -d $1 -c 'DELETE FROM term;' 61 | 62 | psql -U postgres -d $1 -c 'ALTER SEQUENCE term_trm_id_seq RESTART WITH 1;' 63 | 64 | psql -U postgres -d $1 -f term.sql 65 | 66 | psql -U postgres -d $1 -f enableAllTriggers.sql | grep ERROR 67 | 68 | echo 'output used type ids after term update to trmTypeUsageAfterTermTableUpdate.txt' 69 | 70 | psql -U postgres -d $1 -f typeTermUsageQuery.sql > trmTypeUsageAfterTermTableUpdate.txt 71 | 72 | echo 'show differences between before and after, blank means no differences detected' 73 | 74 | diff -bBwy --suppress-common-lines trmTypeUsageBeforeTermTableUpdate.txt trmTypeUsageAfterTermTableUpdate.txt -------------------------------------------------------------------------------- /model/runUpdateSQL.sh: -------------------------------------------------------------------------------- 1 | export PGCLIENTENCODING=UTF8 2 | export LANGUAGE="en_US.UTF-8" 3 | export LANG="en_US.UTF-8" 4 | export LC_ALL="en_US.UTF-8" 5 | 6 | usage () 7 | { 8 | echo 'Usage : runUpdateSQL.sh dbname commands.sql' 9 | exit 10 | } 11 | 12 | if [ "$1" == "" ] 13 | then 14 | usage 15 | fi 16 | 17 | if [ "$2" == "" ] 18 | then 19 | usage 20 | fi 21 | 22 | psql -U postgres -d $1 -f $2 23 | 24 | #/C/xampp/PostgreSQL/9.5/bin/psql -U postgres -d $1 -f /C/xampp/htdocs/kanishka/model/authTokenTable.sql 25 | -------------------------------------------------------------------------------- /model/schemaPrnUpdate.sql: -------------------------------------------------------------------------------- 1 | -- ************* Schema Mods 2 | 3 | ALTER TABLE propernoun ADD COLUMN prn_parent_id int NULL; 4 | COMMENT ON COLUMN propernoun."prn_parent_id" IS 'Link to propernoun that conceptually contains this propernoun.'; 5 | 6 | -------------------------------------------------------------------------------- /model/schemaUpdate.sql: -------------------------------------------------------------------------------- 1 | -- ************* Schema Mods 2 | 3 | ALTER TABLE item ADD COLUMN itm_description text; 4 | ALTER TABLE item ADD COLUMN itm_idno text; 5 | COMMENT ON COLUMN item."itm_description" IS 'Free text description of item.'; 6 | COMMENT ON COLUMN item."itm_idno" IS 'Free text identifier/reference number of item.'; 7 | ALTER TABLE part ADD COLUMN prt_description text; 8 | COMMENT ON COLUMN part."prt_description" IS 'Free text description of this part.'; 9 | ALTER TABLE sequence ADD COLUMN seq_ord int; 10 | COMMENT ON COLUMN sequence."seq_ord" IS 'ordinal number define order is a grouping of sibling sequences.'; 11 | ALTER TABLE surface ADD COLUMN srf_label text; 12 | COMMENT ON COLUMN surface."srf_label" IS 'Free text label identifying this surface.'; 13 | ALTER TABLE syllablecluster ADD COLUMN scl_sort_code2 text; 14 | COMMENT ON COLUMN syllablecluster."scl_sort_code2" IS 'Secondary sort code used to order clusters.'; 15 | 16 | -------------------------------------------------------------------------------- /model/typeTermUsageMappedToMaintQuery.sql: -------------------------------------------------------------------------------- 1 | SELECT c.trm_id,concat(c.trm_labels::hstore->'en','_',p.trm_labels::hstore->'en') AS label_parentlabel, c.trm_type_id, c.trm_code, c.trm_list_ids 2 | FROM termmaintenance_term c LEFT JOIN termmaintenance_term p ON c.trm_parent_id = p.trm_id 3 | WHERE c.trm_id IN (SELECT DISTINCT(ano_type_id) FROM annotation 4 | UNION SELECT DISTINCT(atg_type_id) FROM attributiongroup 5 | UNION SELECT DISTINCT(jsc_type_id) FROM jsoncache 6 | UNION SELECT DISTINCT(img_type_id) FROM image 7 | UNION SELECT DISTINCT(prn_type_id) FROM propernoun 8 | -- UNION SELECT DISTINCT(trm_type_id) FROM term 9 | UNION SELECT DISTINCT(ugr_type_id) FROM usergroup 10 | UNION SELECT DISTINCT(itm_type_id) FROM item 11 | UNION SELECT DISTINCT(prt_type_id) FROM part 12 | UNION SELECT DISTINCT(prt_shape_id) FROM part 13 | UNION SELECT DISTINCT(prt_manufacture_id) FROM part 14 | UNION SELECT DISTINCT(bln_type_id) FROM baseline 15 | UNION SELECT DISTINCT(gra_type_id) FROM grapheme 16 | UNION SELECT DISTINCT(lem_type_id) FROM lemma 17 | UNION SELECT DISTINCT(lem_part_of_speech_id) FROM lemma 18 | UNION SELECT DISTINCT(lem_subpart_of_speech_id) FROM lemma 19 | UNION SELECT DISTINCT(lem_nominal_gender_id) FROM lemma 20 | UNION SELECT DISTINCT(lem_verb_class_id) FROM lemma 21 | UNION SELECT DISTINCT(lem_declension_id) FROM lemma 22 | UNION SELECT DISTINCT(inf_case_id) FROM inflection 23 | UNION SELECT DISTINCT(inf_nominal_gender_id) FROM inflection 24 | UNION SELECT DISTINCT(inf_gram_number_id) FROM inflection 25 | UNION SELECT DISTINCT(inf_verb_person_id) FROM inflection 26 | UNION SELECT DISTINCT(inf_verb_voice_id) FROM inflection 27 | UNION SELECT DISTINCT(inf_verb_tense_id) FROM inflection 28 | UNION SELECT DISTINCT(inf_verb_mood_id) FROM inflection 29 | UNION SELECT DISTINCT(inf_verb_second_conj_id) FROM inflection 30 | UNION SELECT DISTINCT(cat_type_id) FROM catalog 31 | UNION SELECT DISTINCT(cat_lang_id) FROM catalog 32 | UNION SELECT DISTINCT(edn_type_id) FROM edition 33 | UNION SELECT DISTINCT(seq_type_id) FROM sequence) 34 | ORDER BY c.trm_id; 35 | -------------------------------------------------------------------------------- /model/typeTermUsageQuery.sql: -------------------------------------------------------------------------------- 1 | SELECT c.trm_id,concat(c.trm_labels::hstore->'en','_',p.trm_labels::hstore->'en') AS label_parentlabel,c.trm_type_id,c.trm_code, c.trm_list_ids 2 | FROM term c LEFT JOIN term p ON c.trm_parent_id = p.trm_id 3 | WHERE c.trm_id IN (SELECT DISTINCT(ano_type_id) FROM annotation 4 | UNION SELECT DISTINCT(atg_type_id) FROM attributiongroup 5 | UNION SELECT DISTINCT(jsc_type_id) FROM jsoncache 6 | UNION SELECT DISTINCT(img_type_id) FROM image 7 | UNION SELECT DISTINCT(prn_type_id) FROM propernoun 8 | -- UNION SELECT DISTINCT(trm_type_id) FROM term 9 | UNION SELECT DISTINCT(ugr_type_id) FROM usergroup 10 | UNION SELECT DISTINCT(itm_type_id) FROM item 11 | UNION SELECT DISTINCT(prt_type_id) FROM part 12 | UNION SELECT DISTINCT(prt_shape_id) FROM part 13 | UNION SELECT DISTINCT(prt_manufacture_id) FROM part 14 | UNION SELECT DISTINCT(bln_type_id) FROM baseline 15 | UNION SELECT DISTINCT(gra_type_id) FROM grapheme 16 | UNION SELECT DISTINCT(lem_type_id) FROM lemma 17 | UNION SELECT DISTINCT(lem_part_of_speech_id) FROM lemma 18 | UNION SELECT DISTINCT(lem_subpart_of_speech_id) FROM lemma 19 | UNION SELECT DISTINCT(lem_nominal_gender_id) FROM lemma 20 | UNION SELECT DISTINCT(lem_verb_class_id) FROM lemma 21 | UNION SELECT DISTINCT(lem_declension_id) FROM lemma 22 | UNION SELECT DISTINCT(inf_case_id) FROM inflection 23 | UNION SELECT DISTINCT(inf_nominal_gender_id) FROM inflection 24 | UNION SELECT DISTINCT(inf_gram_number_id) FROM inflection 25 | UNION SELECT DISTINCT(inf_verb_person_id) FROM inflection 26 | UNION SELECT DISTINCT(inf_verb_voice_id) FROM inflection 27 | UNION SELECT DISTINCT(inf_verb_tense_id) FROM inflection 28 | UNION SELECT DISTINCT(inf_verb_mood_id) FROM inflection 29 | UNION SELECT DISTINCT(inf_verb_second_conj_id) FROM inflection 30 | UNION SELECT DISTINCT(cat_type_id) FROM catalog 31 | UNION SELECT DISTINCT(cat_lang_id) FROM catalog 32 | UNION SELECT DISTINCT(edn_type_id) FROM edition 33 | UNION SELECT DISTINCT(seq_type_id) FROM sequence) 34 | ORDER BY c.trm_id; 35 | -------------------------------------------------------------------------------- /sample.env: -------------------------------------------------------------------------------- 1 | POSTGRES_DB=postgres 2 | POSTGRES_USER=postgres 3 | POSTGRES_PASSWORD=adminpwd 4 | PGADMIN_DEFAULT_EMAIL=xx@xx.uu.com 5 | PGADMIN_DEFAULT_PASSWORD=defaultuserpwd 6 | -------------------------------------------------------------------------------- /services/changePwd.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | 19 | /** 20 | * changePwd 21 | * 22 | * validates the username/password combination then updates password 23 | * @author Stephen White 24 | * @copyright @see AUTHORS in repository root 25 | * @link https://github.com/readsoftware 26 | * @version 1.0 27 | * @license @see COPYING in repository root or 28 | * @package READ Research Environment for Ancient Documents 29 | * @subpackage Authorization 30 | */ 31 | require_once (dirname(__FILE__) . '/../common/php/userAccess.php');//get user access control 32 | require_once (dirname(__FILE__) . '/../common/php/DBManager.php');//get database interface 33 | 34 | if (defined("WORKBENCH_BASE_URL")) { 35 | header("Access-Control-Allow-Origin: " . WORKBENCH_BASE_URL); 36 | header('Access-Control-Allow-Credentials: true'); 37 | } 38 | if (!isLoggedIn()) { 39 | $retVal = array("error" => "Must be logged for request."); 40 | } else { 41 | $username = getUserName(); 42 | $userpwd = isset($_POST['password1'])?$_POST['password1'] : (isset($_REQUEST['password1'])?$_REQUEST['password1']:null); 43 | $newpassword = isset($_POST['password2'])?$_POST['password2'] : (isset($_REQUEST['password2'])?$_REQUEST['password2']:null); 44 | $hashed = (isset($_REQUEST['hashed']) && $_REQUEST['hashed']) ? TRUE : FALSE; 45 | if (!$hashed) { 46 | $userpwd = md5($userpwd); 47 | } 48 | $hashednewpassword = md5($newpassword); 49 | 50 | // CHECK USERS NAME AND PASSWORD 51 | $dbMgr = new DBManager(); 52 | $dbMgr->query("SELECT * FROM usergroup WHERE ugr_name = '$username' AND ugr_password ='" . $userpwd . "'"); 53 | 54 | if ($dbMgr->getRowCount() == 0) { 55 | //return error invalid login 56 | $retVal = array("error" => "Invalid request."); 57 | } else { 58 | $user = $dbMgr->fetchResultRow(); 59 | $ugrID = $user["ugr_id"]; 60 | $data = array("ugr_password"=>$hashednewpassword); 61 | $dbMgr->update("usergroup",$data,"ugr_id=$ugrID"); 62 | if ($dbMgr->getError()) { 63 | $retVal = array("error" => "Error during processing id $ugrID: ". $dbMgr->getError()); 64 | } else { 65 | $retVal = array("success" => 1); 66 | } 67 | } 68 | } 69 | if (array_key_exists("callback",$_REQUEST)) { 70 | $cb = $_REQUEST['callback']; 71 | if (strpos("YUI",$cb) == 0) { // YUI callback need to wrap 72 | print $cb."(".json_encode($retVal).");"; 73 | } 74 | } else { 75 | print json_encode($retVal); 76 | } 77 | 78 | ?> 79 | -------------------------------------------------------------------------------- /services/getFragmentSurfacesList.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * getFragmentSurfacesList 20 | * 21 | * get list of fragments for a given part 22 | * @author Stephen White 23 | * @copyright @see AUTHORS in repository root 24 | * @link https://github.com/readsoftware 25 | * @version 1.0 26 | * @license @see COPYING in repository root or 27 | * @package READ Research Environment for Ancient Documents 28 | * @subpackage Services 29 | */ 30 | define('ISSERVICE',1); 31 | ini_set("zlib.output_compression_level", 5); 32 | ob_start(); 33 | 34 | header("Content-type: text/javascript"); 35 | header('Cache-Control: no-cache'); 36 | header('Pragma: no-cache'); 37 | 38 | require_once (dirname(__FILE__) . '/../common/php/DBManager.php');//get database interface 39 | require_once (dirname(__FILE__) . '/../common/php/userAccess.php');//get user access control 40 | require_once (dirname(__FILE__) . '/../common/php/utils.php');//get utilies 41 | 42 | 43 | $dbMgr = new DBManager(); 44 | 45 | //check and validate parameters 46 | $data = (array_key_exists('data',$_REQUEST)? json_decode($_REQUEST['data'],true):$_REQUEST); 47 | if (!$data) { 48 | error_log("invalid request - not enough or invalid parameters"); 49 | $retval = ''; 50 | } else { 51 | //get parameters 52 | if (isset($data['frgID']) && is_numeric($data['frgID'])) { 53 | $frgID = intval($data['frgID']); 54 | if (!is_int($frgID)) { 55 | $frgID = null; 56 | } 57 | } 58 | } 59 | 60 | if ($frgID) { 61 | $query = "select srf_id, srf_number,". 62 | "(case when srf_label is null then concat('surf-',srf_id) else srf_label end) as srfdisplay,". 63 | " srf_label, cast(srf_text_ids as int[]) as srftxtids ". 64 | 'from surface '. 65 | "where srf_fragment_id = $frgID ". 66 | 'order by srf_id'; 67 | 68 | $dbMgr->query($query); 69 | if ($dbMgr->getError()) { 70 | error_log($dbMgr->getError()); 71 | } else { 72 | $retVal = $dbMgr->fetchAllResultRows(false); 73 | } 74 | } 75 | if (array_key_exists("callback",$_REQUEST)) { 76 | $cb = $_REQUEST['callback']; 77 | if (strpos("YUI",$cb) == 0) { // YUI callback need to wrap 78 | print $cb."(".json_encode($retVal).");"; 79 | } 80 | } else { 81 | print json_encode($retVal); 82 | } 83 | ?> 84 | -------------------------------------------------------------------------------- /services/getItemPartsList.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * getItemPartsList 20 | * 21 | * get list of parts for a given item 22 | * @author Stephen White 23 | * @copyright @see AUTHORS in repository root 24 | * @link https://github.com/readsoftware 25 | * @version 1.0 26 | * @license @see COPYING in repository root or 27 | * @package READ Research Environment for Ancient Documents 28 | * @subpackage Services 29 | */ 30 | define('ISSERVICE',1); 31 | ini_set("zlib.output_compression_level", 5); 32 | ob_start(); 33 | 34 | header("Content-type: text/javascript"); 35 | header('Cache-Control: no-cache'); 36 | header('Pragma: no-cache'); 37 | 38 | require_once (dirname(__FILE__) . '/../common/php/DBManager.php');//get database interface 39 | require_once (dirname(__FILE__) . '/../common/php/userAccess.php');//get user access control 40 | require_once (dirname(__FILE__) . '/../common/php/utils.php');//get utilies 41 | 42 | 43 | $dbMgr = new DBManager(); 44 | 45 | //check and validate parameters 46 | $data = (array_key_exists('data',$_REQUEST)? json_decode($_REQUEST['data'],true):$_REQUEST); 47 | if (!$data) { 48 | error_log("invalid request - not enough or invalid parameters"); 49 | $retval = ''; 50 | } else { 51 | //get parameters 52 | if (isset($data['itmID']) && is_numeric($data['itmID'])) { 53 | $itmID = intval($data['itmID']); 54 | if (!is_int($itmID)) { 55 | $itmID = null; 56 | } 57 | } 58 | } 59 | 60 | if ($itmID) { 61 | $query = "select prt_id, prt_label, prt_description, prt_sequence,". 62 | "(case when prt_label is null then concat('part-',prt_id) else prt_label end) as prtdisplay ". 63 | 'from part '. 64 | "where prt_owner_id != 1 and prt_item_id = $itmID ". 65 | 'order by prt_sequence;'; 66 | 67 | $dbMgr->query($query); 68 | if ($dbMgr->getError()) { 69 | error_log($dbMgr->getError()); 70 | } else { 71 | $retVal = $dbMgr->fetchAllResultRows(false); 72 | } 73 | } 74 | if (array_key_exists("callback",$_REQUEST)) { 75 | $cb = $_REQUEST['callback']; 76 | if (strpos("YUI",$cb) == 0) { // YUI callback need to wrap 77 | print $cb."(".json_encode($retVal).");"; 78 | } 79 | } else { 80 | print json_encode($retVal); 81 | } 82 | ?> 83 | -------------------------------------------------------------------------------- /services/getItemsList.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * getItemsList 20 | * 21 | * get list of items 22 | * @author Stephen White 23 | * @copyright @see AUTHORS in repository root 24 | * @link https://github.com/readsoftware 25 | * @version 1.0 26 | * @license @see COPYING in repository root or 27 | * @package READ Research Environment for Ancient Documents 28 | * @subpackage Services 29 | */ 30 | define('ISSERVICE',1); 31 | ini_set("zlib.output_compression_level", 5); 32 | ob_start(); 33 | 34 | header("Content-type: text/javascript"); 35 | header('Cache-Control: no-cache'); 36 | header('Pragma: no-cache'); 37 | 38 | require_once (dirname(__FILE__) . '/../common/php/DBManager.php');//get database interface 39 | require_once (dirname(__FILE__) . '/../common/php/userAccess.php');//get user access control 40 | require_once (dirname(__FILE__) . '/../common/php/utils.php');//get utilies 41 | 42 | $dbMgr = new DBManager(); 43 | 44 | /*$query ='select row_to_json(t) '. 45 | 'from (select itm_id as itemid, itm_idno as ckn, itm_title as title '. 46 | 'from item '. 47 | 'where itm_owner_id != 1 '. 48 | 'order by SUBSTRING(itm_idno,3,1) DESC, itm_idno) t;'; 49 | */ 50 | $query ="select itm_id, itm_idno, itm_title, itm_description, ". 51 | "CONCAT(itm_idno,': ',itm_title) as display ". 52 | 'from item '. 53 | 'where itm_owner_id != 1 '. 54 | 'order by SUBSTRING(itm_idno,3,1) DESC, itm_idno;'; 55 | 56 | $dbMgr->query($query); 57 | 58 | $retVal = $dbMgr->fetchAllResultRows(false); 59 | if (array_key_exists("callback",$_REQUEST)) { 60 | $cb = $_REQUEST['callback']; 61 | if (strpos("YUI",$cb) == 0) { // YUI callback need to wrap 62 | print $cb."(".json_encode($retVal).");"; 63 | } 64 | } else { 65 | print json_encode($retVal); 66 | } 67 | ?> 68 | -------------------------------------------------------------------------------- /services/getPartFragmentsList.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * getPartFragmentsList 20 | * 21 | * get list of fragments for a given part 22 | * @author Stephen White 23 | * @copyright @see AUTHORS in repository root 24 | * @link https://github.com/readsoftware 25 | * @version 1.0 26 | * @license @see COPYING in repository root or 27 | * @package READ Research Environment for Ancient Documents 28 | * @subpackage Services 29 | */ 30 | define('ISSERVICE',1); 31 | ini_set("zlib.output_compression_level", 5); 32 | ob_start(); 33 | 34 | header("Content-type: text/javascript"); 35 | header('Cache-Control: no-cache'); 36 | header('Pragma: no-cache'); 37 | 38 | require_once (dirname(__FILE__) . '/../common/php/DBManager.php');//get database interface 39 | require_once (dirname(__FILE__) . '/../common/php/userAccess.php');//get user access control 40 | require_once (dirname(__FILE__) . '/../common/php/utils.php');//get utilies 41 | 42 | 43 | $dbMgr = new DBManager(); 44 | 45 | //check and validate parameters 46 | $data = (array_key_exists('data',$_REQUEST)? json_decode($_REQUEST['data'],true):$_REQUEST); 47 | if (!$data) { 48 | error_log("invalid request - not enough or invalid parameters"); 49 | $retval = ''; 50 | } else { 51 | //get parameters 52 | if (isset($data['prtID']) && is_numeric($data['prtID'])) { 53 | $prtID = intval($data['prtID']); 54 | if (!is_int($prtID)) { 55 | $prtID = null; 56 | } 57 | } 58 | } 59 | 60 | if ($prtID) { 61 | $query = "select frg_id, (case when frg_label is null then concat('frag-',frg_id) else frg_label end) as frgdisplay, ". 62 | 'frg_label, frg_description '. 63 | 'from fragment '. 64 | "where frg_owner_id != 1 and frg_part_id = $prtID ". 65 | 'order by frg_id'; 66 | 67 | $dbMgr->query($query); 68 | if ($dbMgr->getError()) { 69 | error_log($dbMgr->getError()); 70 | } else { 71 | $retVal = $dbMgr->fetchAllResultRows(false); 72 | } 73 | } 74 | if (array_key_exists("callback",$_REQUEST)) { 75 | $cb = $_REQUEST['callback']; 76 | if (strpos("YUI",$cb) == 0) { // YUI callback need to wrap 77 | print $cb."(".json_encode($retVal).");"; 78 | } 79 | } else { 80 | print json_encode($retVal); 81 | } 82 | ?> 83 | -------------------------------------------------------------------------------- /services/getTagInfo.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * @author Stephen White 20 | * @copyright @see AUTHORS in repository root 21 | * @link https://github.com/readsoftware 22 | * @version 1.0 23 | * @license @see COPYING in repository root or 24 | * @package READ Research Environment for Ancient Documents 25 | */ 26 | ini_set("zlib.output_compression_level", 5); 27 | ob_start('ob_gzhandler'); 28 | 29 | require_once (dirname(__FILE__) . '/../common/php/userAccess.php');//get user access control 30 | require_once (dirname(__FILE__) . '/../common/php/utils.php');//get utilies 31 | require_once (dirname(__FILE__) . '/../common/php/DBManager.php');//get database interface 32 | require_once dirname(__FILE__) . '/../model/entities/Term.php'; 33 | require_once dirname(__FILE__) . '/../model/entities/Terms.php'; 34 | 35 | header('Content-type: text/javascript'); 36 | header('Cache-Control: no-transform,private,max-age=300,s-maxage=900'); 37 | 38 | $tagsInfo = getTagsInfo(); 39 | if ($tagsInfo && count($tagsInfo) > 0 ){ 40 | if (array_key_exists('tags',$tagsInfo)) { 41 | print "var tagInfo = ".json_encode($tagsInfo['tags'],true).";\n"; 42 | } 43 | if (array_key_exists('entTagToLabel',$tagsInfo)) { 44 | print "var entTagToLabel = ".json_encode($tagsInfo['entTagToLabel'],true).";\n"; 45 | } 46 | if (array_key_exists('entTagToPath',$tagsInfo)) { 47 | print "var entTagToPath = ".json_encode($tagsInfo['entTagToPath'],true).";\n"; 48 | } 49 | if (array_key_exists('tagIDToAnoID',$tagsInfo)) { 50 | print "var tagIDToAnoID = ".json_encode($tagsInfo['tagIDToAnoID'],true).";\n"; 51 | } 52 | } 53 | 54 | ?> 55 | -------------------------------------------------------------------------------- /services/getUserPreferences.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | 19 | 20 | /** 21 | * getUserPreferences 22 | * 23 | * Load the user's preferences. 24 | * 25 | * Preference include default attributions, viewability, and edit control among others. 26 | * Arguments passed as name=value where name is a valid preference name will change the value 27 | * for that preference before returning an array of all preferences. 28 | * Preferences are initialized using the default array and stored in the $_SESSION['ka_UserPrefs'], 29 | * later they may be maintained on a per DB basis. 30 | 31 | * @author Stephen White 32 | * @copyright @see AUTHORS in repository root 33 | * @link https://github.com/readsoftware 34 | * @version 1.0 35 | * @license @see COPYING in repository root or 36 | * @package READ Research Environment for Ancient Documents 37 | * @subpackage Services 38 | */ 39 | define('ISSERVICE',1); 40 | ini_set("zlib.output_compression_level", 5); 41 | ob_start('ob_gzhandler'); 42 | 43 | header("Content-type: text/javascript"); 44 | header('Cache-Control: no-cache'); 45 | header('Pragma: no-cache'); 46 | 47 | require_once (dirname(__FILE__) . '/../common/php/userAccess.php');//get user access control 48 | require_once (dirname(__FILE__) . '/../common/php/utils.php');//get utilies 49 | require_once (dirname(__FILE__) . '/../common/php/DBManager.php');//get database interface 50 | require_once (dirname(__FILE__) . '/../services/clientDataUtils.php');//get utilies 51 | require_once (dirname(__FILE__) . '/../model/entities/Attribution.php'); 52 | 53 | 54 | $retVal = array('userDefPrefs' => getUserPreferences(DBNAME), 55 | 'userUIList' => getUserUGrpList());//get current UI set 56 | if ($retVal['userDefPrefs'] && 57 | $retVal['userDefPrefs']['defaultAttributionIDs'] && 58 | count($retVal['userDefPrefs']['defaultAttributionIDs']) > 0 ) { 59 | foreach ($retVal['userDefPrefs']['defaultAttributionIDs'] as $atbID){ 60 | if ($atbID){ 61 | addNewEntityReturnData('atb',new Attribution($atbID)); 62 | } 63 | } 64 | } 65 | if (count($entities)) { 66 | $retVal["entities"] = $entities; 67 | } 68 | 69 | //return preferences strucuture 70 | print json_encode($retVal); 71 | 72 | ?> 73 | -------------------------------------------------------------------------------- /services/invalidateSeqCache.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * invalidateSeqCache 20 | * 21 | * invalidates a sequnce cache given an edition ID and sequence ID 22 | * 23 | * @author Stephen White 24 | * @copyright @see AUTHORS in repository root 25 | * @link https://github.com/readsoftware 26 | * @version 1.0 27 | * @license @see COPYING in repository root or 28 | * @package READ Research Environment for Ancient Documents 29 | * @subpackage Services 30 | */ 31 | define('ISSERVICE',1); 32 | ini_set("zlib.output_compression_level", 5); 33 | ob_start('ob_gzhandler'); 34 | 35 | header("Content-type: text/javascript"); 36 | header('Cache-Control: no-cache'); 37 | header('Pragma: no-cache'); 38 | 39 | require_once (dirname(__FILE__) . '/../common/php/DBManager.php');//get database interface 40 | require_once (dirname(__FILE__) . '/../common/php/userAccess.php');//get user access control 41 | require_once (dirname(__FILE__) . '/../common/php/utils.php');//get utilies 42 | require_once (dirname(__FILE__) . '/../model/entities/Edition.php'); 43 | require_once (dirname(__FILE__) . '/../model/entities/JsonCache.php'); 44 | $dbMgr = new DBManager(); 45 | $retVal = array(); 46 | $errors = array(); 47 | $entities = array(); 48 | $warnings = array(); 49 | $ednOwnerID = null; 50 | 51 | $data = (array_key_exists('data',$_REQUEST)? json_decode($_REQUEST['data'],true):$_REQUEST); 52 | 53 | if (!$data) { 54 | array_push($errors,"invalid json data - decode failed"); 55 | } else if ( isset($data['ednID'])) {//get edition 56 | $edition = new Edition($data['ednID']); 57 | if ($edition->hasError()) { 58 | array_push($errors,"creating edition - ".join(",",$edition->getErrors())); 59 | } else { 60 | $ednOwnerID = $edition->getOwnerID(); 61 | invalidateCachedEditionViewerHtml($data['ednID']); 62 | if ( isset($data['lineSeqID'])) {//get line sequence 63 | $physLineSeqID = $data['lineSeqID']; 64 | invalidateCachedSeqEntities($physLineSeqID,$edition->getID()); 65 | } 66 | } 67 | } 68 | 69 | $retVal["success"] = false; 70 | if (count($errors)) { 71 | $retVal["errors"] = $errors; 72 | } else { 73 | $retVal["success"] = true; 74 | } 75 | if (array_key_exists("callback",$_REQUEST)) { 76 | $cb = $_REQUEST['callback']; 77 | if (strpos("YUI",$cb) == 0) { // YUI callback need to wrap 78 | print $cb."(".json_encode($retVal).");"; 79 | } 80 | } else { 81 | print json_encode($retVal); 82 | } 83 | ?> 84 | -------------------------------------------------------------------------------- /services/logout.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | 19 | /** 20 | * logout 21 | * 22 | * destroys session and associated cookies 23 | * @author Stephen White 24 | * @copyright @see AUTHORS in repository root 25 | * @link https://github.com/readsoftware 26 | * @version 1.0 27 | * @license @see COPYING in repository root or 28 | * @package READ Research Environment for Ancient Documents 29 | * @subpackage Authorization 30 | */ 31 | require_once (dirname(__FILE__) . '/../common/php/userAccess.php');//get user access control 32 | require_once (dirname(__FILE__) . '/../common/php/DBManager.php');//get database interface 33 | // Initialize the session. 34 | // If you are using session_name("something"), don't forget it now! 35 | if (!isset($_SESSION)) { 36 | session_start(); 37 | } 38 | if (!isset($dbn)) { 39 | $dbn = DBNAME; 40 | } 41 | //clean up persistant login 42 | if ($_COOKIE && isset($_COOKIE['ka_username_'.$dbn])) { 43 | //separate selector and validator 44 | list($selector,$validator) = explode(':', $_COOKIE['ka_username_'.$dbn]); 45 | $dbMgr = new DBManager(); 46 | //remove authtoken 47 | if ($selector) { 48 | $dbMgr->query("delete from authtoken where aut_selector='$selector'"); 49 | } 50 | //remove cookie 51 | unsetLoginCookie($dbMgr); 52 | } 53 | //cleanup db specific session login info 54 | unsetSessionUserLogin($dbn); 55 | 56 | //last person out shut off the lights 57 | if (!isset($_SESSION["readSessions"]) || (count($_SESSION["readSessions"]) == 0)) { 58 | // If it's desired to kill the session, also delete the session cookie. 59 | // Note: This will destroy the session, and not just the session data! 60 | if (ini_get("session.use_cookies")) { 61 | $params = session_get_cookie_params(); 62 | setcookie(session_name(), '', time() - 60*60*24*100, 63 | $params["path"], $params["domain"], 64 | $params["secure"], $params["httponly"] 65 | ); 66 | } 67 | /* 68 | try { 69 | session_gc(); 70 | session_destroy(); 71 | } 72 | catch (Exception $e) { 73 | error_log(print_r($e,true)); 74 | } 75 | */ 76 | } 77 | 78 | $retVal = array("success" => 1); 79 | 80 | if (array_key_exists("callback",$_REQUEST)) { 81 | $cb = $_REQUEST['callback']; 82 | if (strpos("YUI",$cb) == 0) { // YUI callback need to wrap 83 | print $cb."(".json_encode($retVal).");"; 84 | } 85 | } else { 86 | print json_encode($retVal); 87 | } 88 | ?> 89 | -------------------------------------------------------------------------------- /services/reOrderSegments.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * reorderSegments 20 | * 21 | * take image segments that have been ordered and injects the baseline and polygons into segments link with syllables. 22 | * assumes transcription baselines are linked to all syllables and that ordered image segments count matches syllable count. 23 | * @author Stephen White 24 | * @copyright @see AUTHORS in repository root 25 | * @link https://github.com/readsoftware 26 | * @version 1.0 27 | * @license @see COPYING in repository root or 28 | * @package READ Research Environment for Ancient Documents 29 | * @subpackage Services 30 | */ 31 | define('ISSERVICE',1); 32 | ini_set("zlib.output_compression_level", 5); 33 | ob_start('ob_gzhandler'); 34 | 35 | header("Content-type: text/javascript"); 36 | header('Cache-Control: no-cache'); 37 | header('Pragma: no-cache'); 38 | 39 | require_once (dirname(__FILE__) . '/../common/php/DBManager.php');//get database interface 40 | require_once (dirname(__FILE__) . '/../common/php/userAccess.php');//get user access control 41 | require_once (dirname(__FILE__) . '/../common/php/utils.php');//get utilies 42 | require_once (dirname(__FILE__) . '/../model/entities/Segments.php'); 43 | require_once (dirname(__FILE__) . '/clientDataUtils.php'); 44 | $data = (array_key_exists('data',$_REQUEST)? json_decode($_REQUEST['data'],true):$_REQUEST); 45 | if (!$data) { 46 | array_push($errors,"invalid json data - decode failed"); 47 | } else { 48 | if (isset($data['blnIDs'])) { 49 | $blnIDs = $data['blnIDs']; 50 | } else if (isset($data['blnID'])) { 51 | $blnIDs = array($data['blnID']); 52 | } else { 53 | $blnIDs = null; 54 | } 55 | $retStruct = reorderSegments($blnIDs); 56 | } 57 | 58 | 59 | if (array_key_exists("callback",$_REQUEST)) { 60 | $cb = $_REQUEST['callback']; 61 | if (strpos("YUI",$cb) == 0) { // YUI callback need to wrap 62 | print $cb."(".json_encode($retStruct).");"; 63 | } 64 | } else { 65 | print json_encode($retStruct); 66 | } 67 | ?> 68 | -------------------------------------------------------------------------------- /services/recalcCatalogLocationMap.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * recalcCatalogLocationMap.php 20 | * 21 | * A service that recalculates a text:line location map for each token and caches it. 22 | * 23 | * @author Stephen White 24 | * @copyright @see AUTHORS in repository root 25 | * @link https://github.com/readsoftware 26 | * @version 1.0 27 | * @license @see COPYING in repository root or 28 | * @package READ Research Environment for Ancient Documents 29 | * @subpackage Utility Classes 30 | */ 31 | define('ISSERVICE',1); 32 | ini_set("zlib.output_compression_level", 5); 33 | ob_start('ob_gzhandler'); 34 | 35 | header("Content-type: text/javascript"); 36 | header('Cache-Control: no-cache'); 37 | header('Pragma: no-cache'); 38 | 39 | // if(!defined("DBNAME")) define("DBNAME","kanishkatest"); 40 | require_once (dirname(__FILE__) . '/../common/php/DBManager.php');//get database interface 41 | require_once (dirname(__FILE__) . '/../common/php/utils.php');//get utilies 42 | require_once (dirname(__FILE__) . '/../common/php/userAccess.php');//get user access control 43 | require_once dirname(__FILE__) . '/../model/entities/Tokens.php'; 44 | require_once dirname(__FILE__) . '/../model/entities/Lemmas.php'; 45 | require_once dirname(__FILE__) . '/../model/entities/Inflections.php'; 46 | require_once dirname(__FILE__) . '/../model/entities/Catalogs.php'; 47 | require_once dirname(__FILE__) . '/../model/entities/Compounds.php'; 48 | require_once dirname(__FILE__) . '/../model/entities/Images.php'; 49 | require_once (dirname(__FILE__) . '/../viewer/php/viewutils.php');//get utilities for viewing 50 | // $userID = array_key_exists('userID',$_REQUEST) ? $_REQUEST['userID']:12; 51 | //DEPRECATED 52 | die("this service has been deprecated!"); 53 | $dbMgr = new DBManager(); 54 | $retVal = array(); 55 | $gra2SclMap = array(); 56 | $edn2CatMap = array(); 57 | $segID2sclIDs = array(); 58 | $cknLookup = array(); 59 | $catID = (array_key_exists('catID',$_REQUEST)? $_REQUEST['catID']:(array_key_exists('cat',$_REQUEST)? $_REQUEST['cat']:null)); 60 | $termInfo = getTermInfoForLangCode('en'); 61 | 62 | $anoIDs = array(); 63 | $atbIDs = array(); 64 | $ednIDs = array(); 65 | $errors = array(); 66 | $warnings = array(); 67 | $entityIDs = array(); 68 | //find catalogs 69 | $catalog = new Catalog($catID); 70 | if (!$catalog || $catalog->hasError()) {//no catalog or unavailable so warn 71 | array_push($warnings,"Warning no catalog available for id $catID ."); 72 | } else if (!$catalog->isMarkedDelete()){ 73 | $startt = time() + microtime(); 74 | $retVal['map'] = getWordTagToLocationLabelMap($catalog, true); 75 | $endt = time() + microtime(); 76 | $retVal['duration'] = substr ($endt - $startt, 0, 4); 77 | } 78 | 79 | if (array_key_exists("callback",$_REQUEST)) { 80 | $cb = $_REQUEST['callback']; 81 | if (strpos("YUI",$cb) == 0) { // YUI callback need to wrap 82 | print $cb."(".json_encode($retVal).");"; 83 | } 84 | } else { 85 | print json_encode($retVal); 86 | } 87 | 88 | ?> 89 | -------------------------------------------------------------------------------- /services/reclipSegmentImageToCache.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * reclipSegmentImageToCache 20 | * 21 | * clips an image of each segment and stores in the system configured segment cache 22 | * @author Stephen White 23 | * @copyright @see AUTHORS in repository root 24 | * @link https://github.com/readsoftware 25 | * @version 1.0 26 | * @license @see COPYING in repository root or 27 | * @package READ Research Environment for Ancient Documents 28 | * @subpackage Services 29 | */ 30 | define('ISSERVICE',1); 31 | ini_set("zlib.output_compression_level", 5); 32 | ob_start('ob_gzhandler'); 33 | 34 | header("Content-type: text/javascript"); 35 | header('Cache-Control: no-cache'); 36 | header('Pragma: no-cache'); 37 | 38 | require_once (dirname(__FILE__) . '/../common/php/DBManager.php');//get database interface 39 | require_once (dirname(__FILE__) . '/../common/php/userAccess.php');//get user access control 40 | require_once (dirname(__FILE__) . '/../common/php/utils.php');//get utilies 41 | require_once (dirname(__FILE__) . '/../model/entities/Segments.php'); 42 | require_once (dirname(__FILE__) . '/clientDataUtils.php'); 43 | $data = (array_key_exists('data',$_REQUEST)? json_decode($_REQUEST['data'],true):$_REQUEST); 44 | if (!$data) { 45 | array_push($errors,"invalid json data - decode failed"); 46 | } else { 47 | // print json_encode($_REQUEST); 48 | $blnIDs = null; 49 | if (isset($data['force'])) { 50 | $forceReclip = true; 51 | } else { 52 | $forceReclip = false; 53 | } 54 | if (isset($data['blnIDs'])) { 55 | if (is_array($data['blnIDs'])) { 56 | $blnIDs = $data['blnIDs']; 57 | } else if (is_numeric($data['blnIDs'])) { 58 | $blnIDs = array($data['blnIDs']); 59 | } else if (strpos(',',$data['blnIDs'])!==false) { 60 | $blnIDs = explode(',',$data['blnIDs']); 61 | } 62 | } else if (isset($data['blnID']) && is_numeric($data['blnID'])) { 63 | $blnIDs = array($data['blnID']); 64 | } else { 65 | $blnIDs = null; 66 | } 67 | $retStruct = synchSegmentImageCache($blnIDs,$forceReclip); 68 | } 69 | 70 | if (array_key_exists("callback",$_REQUEST)) { 71 | $cb = $_REQUEST['callback']; 72 | if (strpos("YUI",$cb) == 0) { // YUI callback need to wrap 73 | print $cb."(".json_encode($retStruct).");"; 74 | } 75 | } else { 76 | print json_encode($retStruct); 77 | } 78 | ?> 79 | -------------------------------------------------------------------------------- /services/refreshSortCodesKanishkaTest.php: -------------------------------------------------------------------------------- 1 | 1,13=>1,4=>1)); 5 | include 'refreshSortCodes.php'; 6 | restoreUser(); 7 | ?> 8 | -------------------------------------------------------------------------------- /services/refreshSortCodesKanishkaTestNC.php: -------------------------------------------------------------------------------- 1 | 1,13=>1,4=>1)); 5 | include 'refreshSortCodes.php'; 6 | restoreUser(); 7 | ?> 8 | -------------------------------------------------------------------------------- /services/saveSegment3DAnnotation.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Service to save the 3D model annotation of a segment. 20 | * 21 | * The service only accept POST request. The following keys can be specified in 22 | * the request body. 23 | * 24 | * - segID: (required) The segment ID. 25 | * - coords: (optional) The 3D position of the 3D annotation. 26 | * - cameraPosition: (optional) The camera position of the 3D annotation. 27 | * - cameraTarget: (optional) The camera target of the 3D annotation. 28 | * 29 | * If only the segment ID is passed in, it will delete the current annotation 30 | * of the segment. 31 | * 32 | * @author Yang Li 33 | * @copyright @see AUTHORS in repository root 34 | * @link https://github.com/readsoftware 35 | * @version 1.0 36 | * @license @see COPYING in repository root or 37 | * @package READ Research Environment for Ancient Documents 38 | * @subpackage Utility Classes 39 | */ 40 | 41 | define('ISSERVICE',1); 42 | ini_set("zlib.output_compression_level", 5); 43 | ob_start('ob_gzhandler'); 44 | 45 | header("Content-type: text/javascript"); 46 | header('Cache-Control: no-cache'); 47 | header('Pragma: no-cache'); 48 | 49 | require_once (dirname(__FILE__) . '/../common/php/DBManager.php');//get database interface 50 | require_once (dirname(__FILE__) . '/../common/php/userAccess.php');//get user access control 51 | require_once (dirname(__FILE__) . '/../common/php/utils.php');//get utilies 52 | require_once (dirname(__FILE__) . '/../model/entities/Segment.php'); 53 | require_once (dirname(__FILE__) . '/../model/entities/EntityFactory.php'); 54 | require_once (dirname(__FILE__) . '/clientDataUtils.php'); 55 | 56 | $errors = []; 57 | $response = []; 58 | 59 | $segID = empty($_POST['segID']) ? null : $_POST['segID']; 60 | $coords = empty($_POST['coords']) ? null : $_POST['coords']; 61 | $cameraPosition = empty($_POST['cameraPosition']) ? null : $_POST['cameraPosition']; 62 | $cameraTarget = empty($_POST['cameraTarget']) ? null : $_POST['cameraTarget']; 63 | 64 | if (empty($segID)) { 65 | $errors[] = 'Missing segment ID'; 66 | } else { 67 | $segment = new Segment($segID); 68 | if ($segment->hasError()) { 69 | $errors[] = 'Unable to find the segment'; 70 | } else { 71 | if (isset($coords) || isset($cameraPosition) || isset($cameraTarget)) { 72 | $segment->set3DModelAnnotations([ 73 | [ 74 | 'coords' => $coords, 75 | 'cameraPosition' => $cameraPosition, 76 | 'cameraTarget' => $cameraTarget, 77 | ], 78 | ]); 79 | } else { 80 | $segment->clear3DModelAnnotations(); 81 | } 82 | $segment->save(); 83 | } 84 | } 85 | 86 | if (count($errors) > 0) { 87 | $response['success'] = FALSE; 88 | $response['errors'] = $errors; 89 | } else { 90 | $response['success'] = TRUE; 91 | } 92 | 93 | print json_encode($response); 94 | -------------------------------------------------------------------------------- /services/saveText3DModelUID.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | /** 19 | * Service to save the 3D model UID of a text. 20 | * 21 | * The service only accept POST request. The following keys can be specified in 22 | * the request body. 23 | * 24 | * - txtID: (required) The text ID. 25 | * - uid: (optional) The 3D model UID. If omitted or set to empty, it will delete 26 | * the UID of the text. 27 | * 28 | * @author Yang Li 29 | * @copyright @see AUTHORS in repository root 30 | * @link https://github.com/readsoftware 31 | * @version 1.0 32 | * @license @see COPYING in repository root or 33 | * @package READ Research Environment for Ancient Documents 34 | * @subpackage Utility Classes 35 | */ 36 | 37 | define('ISSERVICE',1); 38 | ini_set("zlib.output_compression_level", 5); 39 | ob_start('ob_gzhandler'); 40 | 41 | header("Content-type: text/javascript"); 42 | header('Cache-Control: no-cache'); 43 | header('Pragma: no-cache'); 44 | 45 | require_once (dirname(__FILE__) . '/../common/php/DBManager.php');//get database interface 46 | require_once (dirname(__FILE__) . '/../common/php/userAccess.php');//get user access control 47 | require_once (dirname(__FILE__) . '/../common/php/utils.php');//get utilies 48 | require_once (dirname(__FILE__) . '/../model/entities/Text.php'); 49 | require_once (dirname(__FILE__) . '/../model/entities/EntityFactory.php'); 50 | require_once (dirname(__FILE__) . '/clientDataUtils.php'); 51 | 52 | $errors = []; 53 | $response = []; 54 | 55 | $txtID = empty($_POST['txtID']) ? null : $_POST['txtID']; 56 | $uid = empty($_POST['uid']) ? null : $_POST['uid']; 57 | 58 | if (empty($txtID)) { 59 | $errors[] = 'Missing text ID'; 60 | } else { 61 | $text = new Text($txtID); 62 | if ($text->hasError()) { 63 | $errors[] = 'Unable to find the text'; 64 | } else { 65 | if (isset($uid)) { 66 | $text->set3DModelUID($uid); 67 | } else { 68 | $text->clear3DModelUID(); 69 | } 70 | $text->save(); 71 | } 72 | } 73 | 74 | if (count($errors) > 0) { 75 | $response['success'] = FALSE; 76 | $response['errors'] = $errors; 77 | } else { 78 | $response['success'] = TRUE; 79 | } 80 | 81 | print json_encode($response); 82 | -------------------------------------------------------------------------------- /services/saveUserPreferences.php: -------------------------------------------------------------------------------- 1 | . 6 | * 7 | * READ is free software: you can redistribute it and/or modify it under the terms of the 8 | * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 9 | * or (at your option) any later version. 10 | * 11 | * READ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with READ. 16 | * If not, see . 17 | */ 18 | 19 | 20 | /** 21 | * saveUserPreferences 22 | * 23 | * Saves the user's preferences. 24 | * 25 | * Preference include default attributions, viewability, and edit control among others. 26 | * Arguments passed as name=value where name is a valid preference name will change the value 27 | * for that preference before returning an array of all preferences. 28 | * Preferences are initialized using the default array and stored in the $_SESSION['ka_UserPrefs'], 29 | * later they may be maintained on a per DB basis. 30 | 31 | * @author Stephen White 32 | * @copyright @see AUTHORS in repository root 33 | * @link https://github.com/readsoftware 34 | * @version 1.0 35 | * @license @see COPYING in repository root or 36 | * @package READ Research Environment for Ancient Documents 37 | * @subpackage Services 38 | */ 39 | define('ISSERVICE',1); 40 | ini_set("zlib.output_compression_level", 5); 41 | ob_start('ob_gzhandler'); 42 | 43 | header("Content-type: text/javascript"); 44 | header('Cache-Control: no-cache'); 45 | header('Pragma: no-cache'); 46 | 47 | require_once (dirname(__FILE__) . '/../common/php/userAccess.php');//get user access control 48 | require_once (dirname(__FILE__) . '/../common/php/DBManager.php');//get database interface 49 | require_once (dirname(__FILE__) . '/../common/php/utils.php');//get utilies 50 | 51 | $data = (array_key_exists('data',$_REQUEST)? json_decode($_REQUEST['data'],true):$_REQUEST); 52 | if (!$data) { 53 | array_push($errors,"invalid json data - decode failed"); 54 | } else { // process user preferences 55 | if (isset($data['editUserID'])) { 56 | setUserDefEditorID($data['editUserID'], DBNAME); 57 | } 58 | 59 | if (isset($data['defVisIDs'])) { 60 | setUserDefVisibilityIDs($data['defVisIDs'], DBNAME); 61 | } 62 | 63 | if (isset($data['defAttrIDs'])) { 64 | setUserDefAttrIDs($data['defAttrIDs'], DBNAME); 65 | } 66 | } 67 | if (isset($data['persist'])) { 68 | $user = new UserGroup(getUserID()); 69 | if (!$user || $user->hasError()) { 70 | return; 71 | } else { 72 | $prefs = getUserPreferences(DBNAME); 73 | //store in user 74 | $user->setPreferences($prefs); 75 | $user->save(); 76 | } 77 | } 78 | 79 | $retVal = array('userDefPrefs' => getUserPreferences(DBNAME), 80 | 'userUIList' => getUserUGrpList());//get current UI set 81 | //return preferences strucuture 82 | print json_encode($retVal); 83 | 84 | ?> 85 | -------------------------------------------------------------------------------- /viewer/images/download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/readsoftware/read/3de22763a7210e5a3f6633d54bd60a726d9f2dab/viewer/images/download.png --------------------------------------------------------------------------------