From 0dce349c203e0721cff542b40edf8514e811d388 Mon Sep 17 00:00:00 2001 From: bwbohl Date: Tue, 6 Feb 2024 15:41:39 +0100 Subject: [PATCH 1/6] fix facsimileView for TEI files closes #339 --- app/controller/window/text/FacsimileView.js | 18 +- app/view/window/text/FacsimileView.js | 243 ++++++++++++++++---- 2 files changed, 203 insertions(+), 58 deletions(-) diff --git a/app/controller/window/text/FacsimileView.js b/app/controller/window/text/FacsimileView.js index 642fc00d3..bf197b538 100644 --- a/app/controller/window/text/FacsimileView.js +++ b/app/controller/window/text/FacsimileView.js @@ -32,7 +32,7 @@ Ext.define('EdiromOnline.controller.window.text.FacsimileView', { } }); }, - + onAfterLayout: function(view) { var me = this; @@ -45,7 +45,7 @@ Ext.define('EdiromOnline.controller.window.text.FacsimileView', { var uri = view.uri; window.doAJAXRequest('data/xql/getPages.xql', - 'GET', + 'GET', { uri: uri }, @@ -57,12 +57,12 @@ Ext.define('EdiromOnline.controller.window.text.FacsimileView', { data: Ext.JSON.decode(data) }); - view.setImageSet(pages); + me.pagesLoaded(pages, view); }, this) ); - + window.doAJAXRequest('data/xql/getChapters.xql', - 'GET', + 'GET', { uri: view.uri, mode: 'pageMode' @@ -79,11 +79,15 @@ Ext.define('EdiromOnline.controller.window.text.FacsimileView', { }, this) ); }, - + + pagesLoaded: function (pages, view) { + view.setImageSet(pages); + }, + chaptersLoaded: function(chapters, view) { view.setChapters(chapters); }, - + onGotoChapter: function(view, pageId) { view.gotoPage(pageId); } diff --git a/app/view/window/text/FacsimileView.js b/app/view/window/text/FacsimileView.js index 7a17c0ef1..94b13c78b 100644 --- a/app/view/window/text/FacsimileView.js +++ b/app/view/window/text/FacsimileView.js @@ -1,8 +1,28 @@ +/** + * Edirom Online + * Copyright (C) 2014 The Edirom Project + * http://www.edirom.de + * + * Edirom Online 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. + * + * Edirom Online 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. + * + * You should have received a copy of the GNU General Public License + * along with Edirom Online. If not, see . + * + */ Ext.define('EdiromOnline.view.window.text.FacsimileView', { extend: 'EdiromOnline.view.window.View', requires: [ 'EdiromOnline.view.window.image.ImageViewer', + 'EdiromOnline.view.window.image.OpenSeaDragonViewer', 'EdiromOnline.view.window.image.LeafletFacsimile' ], @@ -20,46 +40,51 @@ Ext.define('EdiromOnline.view.window.text.FacsimileView', { image_server: null, + cls: 'facsimileView', + initComponent: function () { - this.addEvents(); - - this.image_server = getPreference('image_server'); - - if(this.image_server === 'leaflet'){ - this.imageViewer = Ext.create('EdiromOnline.view.window.image.LeafletFacsimile'); - } - else{ - this.imageViewer = Ext.create('EdiromOnline.view.window.image.ImageViewer'); + var me = this; + + me.addEvents(); + + var image_server = getPreference('image_server'); + + if(image_server === 'leaflet'){ + me.imageViewer = Ext.create('EdiromOnline.view.window.image.LeafletFacsimile', {flex: 1, width: '100%'}); + }else if(image_server === 'openseadragon') { + me.imageViewer = Ext.create('EdiromOnline.view.window.image.OpenSeaDragonViewer'); + }else{ /*TODO: test agains 'digilib'? -> what should be the fallback? */ + me.imageViewer = Ext.create('EdiromOnline.view.window.image.ImageViewer'); } - this.imageViewer.region = 'center'; + me.imageViewer.region = 'center'; - this.bottomBar = new EdiromOnline.view.window.BottomBar({owner:this, region:'south'}); + me.bottomBar = new EdiromOnline.view.window.BottomBar({owner:me, region:'south', enableOverflow: false}); - this.items = [ - this.imageViewer, - this.bottomBar + me.items = [ + me.imageViewer, + me.bottomBar ]; - this.callParent(); + me.callParent(); - this.on('afterrender', this.createMenuEntries, this, {single: true}); - this.on('afterrender', this.createToolbarEntries, this, {single: true}); - this.imageViewer.on('zoomChanged', this.updateZoom, this); + me.on('afterrender', me.createMenuEntries, me, {single: true}); + me.on('afterrender', me.createToolbarEntries, me, {single: true}); + me.imageViewer.on('zoomChanged', me.updateZoom, me); - this.window.on('loadInternalLink', this.loadInternalId, this); + me.window.on('loadInternalLink', me.loadInternalId, me); }, getWeightForInternalLink: function(uri, type, id) { var me = this; - + if(me.uri != uri) return 0; - + if(type == 'graphic' || type == 'surface' || type == 'zone') return 70; - + return 0; }, @@ -73,6 +98,7 @@ Ext.define('EdiromOnline.view.window.text.FacsimileView', { }, setImageSet: function(imageSet) { + var me = this; me.imageSet = imageSet; @@ -84,7 +110,7 @@ Ext.define('EdiromOnline.view.window.text.FacsimileView', { }else if(me.imageSet.getCount() > 0) me.pageSpinner.setPage(me.imageSet.getAt(0)); - + me.fireEvent('afterImagesLoaded', me, imageSet); }, @@ -118,32 +144,85 @@ Ext.define('EdiromOnline.view.window.text.FacsimileView', { return this.activePage; }, - createMenuEntries: function() { - - var me = this; - - me.viewMenu = Ext.create('Ext.button.Button', { - text: getLangString('view.window.source.SourceView_viewMenu'), - indent: false, - cls: 'menuButton', - menu : { - items: [ - { - id: me.id + '_fitFacsimile', - text: getLangString('view.window.source.SourceView_fitView'), - handler: Ext.bind(me.fitFacsimile, me, [], 0) - } - ] + createMenuEntries: function() { + + var me = this; + + var image_server = getPreference('image_server'); + + if(image_server === 'digilib'){ + me.zoomSlider = Ext.create('Ext.slider.Single', { + width: 140, + value: 100, + increment: 5, + minValue: 10, + maxValue: 400, + checkChangeBuffer: 100, + useTips: true, + cls: 'zoomSlider', + tipText: function(thumb){ + return Ext.String.format('{0}%', thumb.value); + }, + listeners: { + change: Ext.bind(me.zoomChanged, me, [], 0) } }); - me.window.getTopbar().addViewSpecificItem(me.viewMenu, me.id); + } + if (image_server === 'openseadragon') { + me.zoomSlider = Ext.create('Ext.slider.Single', { + width: 140, + value: 100, + increment: 5, + minValue: 90, + maxValue: 700, + checkChangeBuffer: 100, + useTips: true, + cls: 'zoomSlider', + tipText: function(thumb) { + return Ext.String.format('{0}%', thumb.value); + }, + listeners: { + change: Ext.bind(me.zoomChanged, me, [], 0) + } + }); + } + + /*TODO + pageSppinner + separator + */ + + if(image_server === 'digilib' || image_server === 'openseadragon'){ + return [me.zoomSlider, me.separator, me.pageSpinner]; + } + else{ + return [me.pageSpinner]; + } + + me.viewMenu = Ext.create('Ext.button.Button', { + text: getLangString('view.window.source.SourceView_viewMenu'), + indent: false, + cls: 'menuButton', + menu : { + items: [ + { + id: me.id + '_fitFacsimile', + text: getLangString('view.window.source.SourceView_fitView'), + handler: Ext.bind(me.fitFacsimile, me, [], 0) + } + ] + } + }); + me.window.getTopbar().addViewSpecificItem(me.viewMenu, me.id); }, createToolbarEntries: function() { var me = this; - if(me.image_server === 'digilib'){ + var image_server = getPreference('image_server'); + + if(image_server === 'digilib'){ me.zoomSlider = Ext.create('Ext.slider.Single', { width: 140, value: 100, @@ -160,15 +239,75 @@ Ext.define('EdiromOnline.view.window.text.FacsimileView', { change: Ext.bind(me.zoomChanged, me, [], 0) } }); - me.bottomBar.add(me.zoomSlider); - } + }; + if (image_server === 'openseadragon') { + me.zoomSlider = Ext.create('Ext.slider.Single', { + width: 140, + value: 100, + increment: 5, + minValue: 90, + maxValue: 700, + checkChangeBuffer: 100, + useTips: true, + cls: 'zoomSlider', + tipText: function(thumb) { + return Ext.String.format('{0}%', thumb.value); + }, + listeners: { + change: Ext.bind(me.zoomChanged, me, [], 0) + } + }); + }; me.pageSpinner = Ext.create('EdiromOnline.view.window.util.PageSpinner', { width: 121, cls: 'pageSpinner', owner: me }); - me.bottomBar.add(me.pageSpinner); + + me.separator = Ext.create('Ext.toolbar.Separator'); + + var entries = []; + + if(image_server === 'digilib' || image_server === 'openseadragon'){ + entries = [me.zoomSlider, me.separator, me.pageSpinner]; + } + else{ + entries = [me.pageSpinner]; + } + + Ext.Array.each(entries, function(entry) { + if(image_server === 'digilib' || image_server === 'openseadragon'){ + me.bottomBar.add(entry); + } + else if(entry.initialCls !== 'zoomSlider' && entry.xtype !== 'tbseparator'){ + me.bottomBar.add(entry); + } + }); + }, + + + hideToolbarEntries: function() { + var me = this; + if(typeof me.zoomSlider !== 'undefined'){ + me.zoomSlider.hide(); + } + me.pageSpinner.hide(); + if(typeof me.separator !== 'undefined'){ + me.separator.hide(); + } + }, + + showToolbarEntries: function() { + var me = this; + if(typeof me.zoomSlider !== 'undefined'){ + me.zoomSlider.show(); + } + me.pageSpinner.show(); + if(typeof me.separator !== 'undefined'){ + me.separator.show(); + } + }, fitFacsimile: function() { @@ -176,15 +315,17 @@ Ext.define('EdiromOnline.view.window.text.FacsimileView', { }, updateZoom: function(zoom) { - this.zoomSlider.suspendEvents(); - this.zoomSlider.setValue(Math.round(zoom * 100)); - this.zoomSlider.resumeEvents(); + if(typeof this.zoomSlider !== 'undefined'){ + this.zoomSlider.suspendEvents(); + this.zoomSlider.setValue(Math.round(zoom * 100)); + this.zoomSlider.resumeEvents(); + } }, zoomChanged: function(slider) { this.imageViewer.setZoomAndCenter(slider.getValue() / 100); }, - + setChapters: function(chapters) { var me = this; @@ -214,13 +355,13 @@ Ext.define('EdiromOnline.view.window.text.FacsimileView', { me.gotoMenu.menu.add(chapterItems); me.gotoMenu.show(); }, - + gotoChapter: function (menuItem, event, pageId) { this.fireEvent('gotoChapter', this, pageId); }, - + gotoPage: function (pageId) { var me = this; me.pageSpinner.setPage(me.imageSet.getById(pageId)); } -}); \ No newline at end of file +}); From 9d8cd115a377a503eba14e601afe22960db06a4b Mon Sep 17 00:00:00 2001 From: bwbohl Date: Tue, 6 Feb 2024 15:45:46 +0100 Subject: [PATCH 2/6] prettify code `prettier --tab-width 4` --- app/controller/window/text/FacsimileView.js | 78 ++-- app/view/window/text/FacsimileView.js | 393 ++++++++++---------- 2 files changed, 247 insertions(+), 224 deletions(-) diff --git a/app/controller/window/text/FacsimileView.js b/app/controller/window/text/FacsimileView.js index bf197b538..930f79d27 100644 --- a/app/controller/window/text/FacsimileView.js +++ b/app/controller/window/text/FacsimileView.js @@ -16,79 +16,85 @@ * You should have received a copy of the GNU General Public License * along with Edirom Online. If not, see . */ -Ext.define('EdiromOnline.controller.window.text.FacsimileView', { +Ext.define("EdiromOnline.controller.window.text.FacsimileView", { + extend: "Ext.app.Controller", - extend: 'Ext.app.Controller', + views: ["window.text.FacsimileView"], - views: [ - 'window.text.FacsimileView' - ], - - init: function() { + init: function () { this.control({ - 'facsimileView': { - afterlayout : this.onAfterLayout, - single: true - } + facsimileView: { + afterlayout: this.onAfterLayout, + single: true, + }, }); }, - onAfterLayout: function(view) { - + onAfterLayout: function (view) { var me = this; - if(view.initialized) return; + if (view.initialized) return; view.initialized = true; - view.on('gotoChapter', me.onGotoChapter, me); + view.on("gotoChapter", me.onGotoChapter, me); var uri = view.uri; - window.doAJAXRequest('data/xql/getPages.xql', - 'GET', + window.doAJAXRequest( + "data/xql/getPages.xql", + "GET", { - uri: uri + uri: uri, }, - Ext.bind(function(response){ + Ext.bind(function (response) { var data = response.responseText; - var pages = Ext.create('Ext.data.Store', { - fields: ['id', 'name', 'path', 'width', 'height', 'measures', 'annotations'], - data: Ext.JSON.decode(data) + var pages = Ext.create("Ext.data.Store", { + fields: [ + "id", + "name", + "path", + "width", + "height", + "measures", + "annotations", + ], + data: Ext.JSON.decode(data), }); me.pagesLoaded(pages, view); - }, this) + }, this), ); - window.doAJAXRequest('data/xql/getChapters.xql', - 'GET', + window.doAJAXRequest( + "data/xql/getChapters.xql", + "GET", { uri: view.uri, - mode: 'pageMode' + mode: "pageMode", }, - Ext.bind(function(response){ + Ext.bind(function (response) { var data = response.responseText; - var chapters = Ext.create('Ext.data.Store', { - fields: ['id', 'name', 'pageId'], - data: Ext.JSON.decode(data) + var chapters = Ext.create("Ext.data.Store", { + fields: ["id", "name", "pageId"], + data: Ext.JSON.decode(data), }); me.chaptersLoaded(chapters, view); - }, this) + }, this), ); }, pagesLoaded: function (pages, view) { - view.setImageSet(pages); - }, + view.setImageSet(pages); + }, - chaptersLoaded: function(chapters, view) { + chaptersLoaded: function (chapters, view) { view.setChapters(chapters); }, - onGotoChapter: function(view, pageId) { + onGotoChapter: function (view, pageId) { view.gotoPage(pageId); - } + }, }); diff --git a/app/view/window/text/FacsimileView.js b/app/view/window/text/FacsimileView.js index 94b13c78b..bbb101d2c 100644 --- a/app/view/window/text/FacsimileView.js +++ b/app/view/window/text/FacsimileView.js @@ -17,18 +17,18 @@ * along with Edirom Online. If not, see . * */ -Ext.define('EdiromOnline.view.window.text.FacsimileView', { - extend: 'EdiromOnline.view.window.View', +Ext.define("EdiromOnline.view.window.text.FacsimileView", { + extend: "EdiromOnline.view.window.View", requires: [ - 'EdiromOnline.view.window.image.ImageViewer', - 'EdiromOnline.view.window.image.OpenSeaDragonViewer', - 'EdiromOnline.view.window.image.LeafletFacsimile' + "EdiromOnline.view.window.image.ImageViewer", + "EdiromOnline.view.window.image.OpenSeaDragonViewer", + "EdiromOnline.view.window.image.LeafletFacsimile", ], - alias : 'widget.facsimileView', + alias: "widget.facsimileView", - layout: 'border', + layout: "border", border: 0, @@ -38,101 +38,110 @@ Ext.define('EdiromOnline.view.window.text.FacsimileView', { measuresVisible: false, annotationsVisible: false, - image_server: null, + image_server: null, - cls: 'facsimileView', + cls: "facsimileView", initComponent: function () { - var me = this; me.addEvents(); - var image_server = getPreference('image_server'); - - if(image_server === 'leaflet'){ - me.imageViewer = Ext.create('EdiromOnline.view.window.image.LeafletFacsimile', {flex: 1, width: '100%'}); - }else if(image_server === 'openseadragon') { - me.imageViewer = Ext.create('EdiromOnline.view.window.image.OpenSeaDragonViewer'); - }else{ /*TODO: test agains 'digilib'? -> what should be the fallback? */ - me.imageViewer = Ext.create('EdiromOnline.view.window.image.ImageViewer'); - } + var image_server = getPreference("image_server"); + + if (image_server === "leaflet") { + me.imageViewer = Ext.create( + "EdiromOnline.view.window.image.LeafletFacsimile", + { flex: 1, width: "100%" }, + ); + } else if (image_server === "openseadragon") { + me.imageViewer = Ext.create( + "EdiromOnline.view.window.image.OpenSeaDragonViewer", + ); + } else { + /*TODO: test agains 'digilib'? -> what should be the fallback? */ + me.imageViewer = Ext.create( + "EdiromOnline.view.window.image.ImageViewer", + ); + } - me.imageViewer.region = 'center'; + me.imageViewer.region = "center"; - me.bottomBar = new EdiromOnline.view.window.BottomBar({owner:me, region:'south', enableOverflow: false}); + me.bottomBar = new EdiromOnline.view.window.BottomBar({ + owner: me, + region: "south", + enableOverflow: false, + }); - me.items = [ - me.imageViewer, - me.bottomBar - ]; + me.items = [me.imageViewer, me.bottomBar]; me.callParent(); - me.on('afterrender', me.createMenuEntries, me, {single: true}); - me.on('afterrender', me.createToolbarEntries, me, {single: true}); - me.imageViewer.on('zoomChanged', me.updateZoom, me); + me.on("afterrender", me.createMenuEntries, me, { single: true }); + me.on("afterrender", me.createToolbarEntries, me, { single: true }); + me.imageViewer.on("zoomChanged", me.updateZoom, me); - me.window.on('loadInternalLink', me.loadInternalId, me); + me.window.on("loadInternalLink", me.loadInternalId, me); }, - getWeightForInternalLink: function(uri, type, id) { + getWeightForInternalLink: function (uri, type, id) { var me = this; - if(me.uri != uri) - return 0; + if (me.uri != uri) return 0; - if(type == 'graphic' || type == 'surface' || type == 'zone') - return 70; + if (type == "graphic" || type == "surface" || type == "zone") return 70; return 0; }, - loadInternalId: function() { + loadInternalId: function () { var me = this; - if(me.window.internalIdType == 'surface' || me.window.internalIdType == 'graphic' ) { + if ( + me.window.internalIdType == "surface" || + me.window.internalIdType == "graphic" + ) { me.window.requestForActiveView(me); me.showPage(me.window.internalId); } }, - setImageSet: function(imageSet) { - + setImageSet: function (imageSet) { var me = this; me.imageSet = imageSet; me.pageSpinner.setStore(me.imageSet); - if(me.imageToShow != null) { + if (me.imageToShow != null) { me.pageSpinner.setPage(me.imageSet.getById(me.imageToShow)); me.imageToShow = null; - - }else if(me.imageSet.getCount() > 0) + } else if (me.imageSet.getCount() > 0) me.pageSpinner.setPage(me.imageSet.getAt(0)); - me.fireEvent('afterImagesLoaded', me, imageSet); + me.fireEvent("afterImagesLoaded", me, imageSet); }, - setPage: function(combo, store) { - + setPage: function (combo, store) { var me = this; // Remove old stuff me.imageViewer.clear(); var id = combo.getValue(); - var imgIndex = me.imageSet.findExact('id', id); + var imgIndex = me.imageSet.findExact("id", id); me.activePage = me.imageSet.getAt(imgIndex); - me.imageViewer.showImage(me.activePage.get('path'), - me.activePage.get('width'), me.activePage.get('height')); + me.imageViewer.showImage( + me.activePage.get("path"), + me.activePage.get("width"), + me.activePage.get("height"), + ); }, - showPage: function(pageId) { + showPage: function (pageId) { var me = this; - if(me.imageSet == null) { + if (me.imageSet == null) { me.imageToShow = pageId; return; } @@ -140,108 +149,107 @@ Ext.define('EdiromOnline.view.window.text.FacsimileView', { me.pageSpinner.setPage(me.imageSet.getById(pageId)); }, - getActivePage: function() { + getActivePage: function () { return this.activePage; }, - createMenuEntries: function() { - - var me = this; + createMenuEntries: function () { + var me = this; - var image_server = getPreference('image_server'); + var image_server = getPreference("image_server"); - if(image_server === 'digilib'){ - me.zoomSlider = Ext.create('Ext.slider.Single', { - width: 140, - value: 100, - increment: 5, - minValue: 10, - maxValue: 400, - checkChangeBuffer: 100, - useTips: true, - cls: 'zoomSlider', - tipText: function(thumb){ - return Ext.String.format('{0}%', thumb.value); - }, - listeners: { - change: Ext.bind(me.zoomChanged, me, [], 0) - } - }); - } - if (image_server === 'openseadragon') { - me.zoomSlider = Ext.create('Ext.slider.Single', { - width: 140, - value: 100, - increment: 5, - minValue: 90, - maxValue: 700, - checkChangeBuffer: 100, - useTips: true, - cls: 'zoomSlider', - tipText: function(thumb) { - return Ext.String.format('{0}%', thumb.value); - }, - listeners: { - change: Ext.bind(me.zoomChanged, me, [], 0) - } - }); - } + if (image_server === "digilib") { + me.zoomSlider = Ext.create("Ext.slider.Single", { + width: 140, + value: 100, + increment: 5, + minValue: 10, + maxValue: 400, + checkChangeBuffer: 100, + useTips: true, + cls: "zoomSlider", + tipText: function (thumb) { + return Ext.String.format("{0}%", thumb.value); + }, + listeners: { + change: Ext.bind(me.zoomChanged, me, [], 0), + }, + }); + } + if (image_server === "openseadragon") { + me.zoomSlider = Ext.create("Ext.slider.Single", { + width: 140, + value: 100, + increment: 5, + minValue: 90, + maxValue: 700, + checkChangeBuffer: 100, + useTips: true, + cls: "zoomSlider", + tipText: function (thumb) { + return Ext.String.format("{0}%", thumb.value); + }, + listeners: { + change: Ext.bind(me.zoomChanged, me, [], 0), + }, + }); + } /*TODO pageSppinner separator */ - if(image_server === 'digilib' || image_server === 'openseadragon'){ - return [me.zoomSlider, me.separator, me.pageSpinner]; - } - else{ - return [me.pageSpinner]; - } - - me.viewMenu = Ext.create('Ext.button.Button', { - text: getLangString('view.window.source.SourceView_viewMenu'), - indent: false, - cls: 'menuButton', - menu : { - items: [ - { - id: me.id + '_fitFacsimile', - text: getLangString('view.window.source.SourceView_fitView'), - handler: Ext.bind(me.fitFacsimile, me, [], 0) - } - ] - } - }); - me.window.getTopbar().addViewSpecificItem(me.viewMenu, me.id); - }, + if (image_server === "digilib" || image_server === "openseadragon") { + return [me.zoomSlider, me.separator, me.pageSpinner]; + } else { + return [me.pageSpinner]; + } - createToolbarEntries: function() { + me.viewMenu = Ext.create("Ext.button.Button", { + text: getLangString("view.window.source.SourceView_viewMenu"), + indent: false, + cls: "menuButton", + menu: { + items: [ + { + id: me.id + "_fitFacsimile", + text: getLangString( + "view.window.source.SourceView_fitView", + ), + handler: Ext.bind(me.fitFacsimile, me, [], 0), + }, + ], + }, + }); + me.window.getTopbar().addViewSpecificItem(me.viewMenu, me.id); + }, + createToolbarEntries: function () { var me = this; - var image_server = getPreference('image_server'); - - if(image_server === 'digilib'){ - me.zoomSlider = Ext.create('Ext.slider.Single', { - width: 140, - value: 100, - increment: 5, - minValue: 10, - maxValue: 400, - checkChangeBuffer: 100, - useTips: true, - cls: 'zoomSlider', - tipText: function(thumb){ - return Ext.String.format('{0}%', thumb.value); - }, - listeners: { - change: Ext.bind(me.zoomChanged, me, [], 0) - } - }); - }; - if (image_server === 'openseadragon') { - me.zoomSlider = Ext.create('Ext.slider.Single', { + var image_server = getPreference("image_server"); + + if (image_server === "digilib") { + me.zoomSlider = Ext.create("Ext.slider.Single", { + width: 140, + value: 100, + increment: 5, + minValue: 10, + maxValue: 400, + checkChangeBuffer: 100, + useTips: true, + cls: "zoomSlider", + tipText: function (thumb) { + return Ext.String.format("{0}%", thumb.value); + }, + listeners: { + change: Ext.bind(me.zoomChanged, me, [], 0), + }, + }); + } + if (image_server === "openseadragon") { + me.zoomSlider = Ext.create("Ext.slider.Single", { width: 140, value: 100, increment: 5, @@ -249,106 +257,115 @@ Ext.define('EdiromOnline.view.window.text.FacsimileView', { maxValue: 700, checkChangeBuffer: 100, useTips: true, - cls: 'zoomSlider', - tipText: function(thumb) { - return Ext.String.format('{0}%', thumb.value); + cls: "zoomSlider", + tipText: function (thumb) { + return Ext.String.format("{0}%", thumb.value); }, listeners: { - change: Ext.bind(me.zoomChanged, me, [], 0) - } + change: Ext.bind(me.zoomChanged, me, [], 0), + }, }); - }; + } - me.pageSpinner = Ext.create('EdiromOnline.view.window.util.PageSpinner', { - width: 121, - cls: 'pageSpinner', - owner: me - }); + me.pageSpinner = Ext.create( + "EdiromOnline.view.window.util.PageSpinner", + { + width: 121, + cls: "pageSpinner", + owner: me, + }, + ); - me.separator = Ext.create('Ext.toolbar.Separator'); + me.separator = Ext.create("Ext.toolbar.Separator"); var entries = []; - if(image_server === 'digilib' || image_server === 'openseadragon'){ - entries = [me.zoomSlider, me.separator, me.pageSpinner]; - } - else{ + if (image_server === "digilib" || image_server === "openseadragon") { + entries = [me.zoomSlider, me.separator, me.pageSpinner]; + } else { entries = [me.pageSpinner]; } - Ext.Array.each(entries, function(entry) { - if(image_server === 'digilib' || image_server === 'openseadragon'){ + Ext.Array.each(entries, function (entry) { + if ( + image_server === "digilib" || + image_server === "openseadragon" + ) { me.bottomBar.add(entry); - } - else if(entry.initialCls !== 'zoomSlider' && entry.xtype !== 'tbseparator'){ + } else if ( + entry.initialCls !== "zoomSlider" && + entry.xtype !== "tbseparator" + ) { me.bottomBar.add(entry); } }); }, - - hideToolbarEntries: function() { + hideToolbarEntries: function () { var me = this; - if(typeof me.zoomSlider !== 'undefined'){ - me.zoomSlider.hide(); + if (typeof me.zoomSlider !== "undefined") { + me.zoomSlider.hide(); } me.pageSpinner.hide(); - if(typeof me.separator !== 'undefined'){ - me.separator.hide(); + if (typeof me.separator !== "undefined") { + me.separator.hide(); } }, - showToolbarEntries: function() { + showToolbarEntries: function () { var me = this; - if(typeof me.zoomSlider !== 'undefined'){ + if (typeof me.zoomSlider !== "undefined") { me.zoomSlider.show(); } me.pageSpinner.show(); - if(typeof me.separator !== 'undefined'){ + if (typeof me.separator !== "undefined") { me.separator.show(); } - }, - fitFacsimile: function() { + fitFacsimile: function () { this.imageViewer.fitInImage(); }, - updateZoom: function(zoom) { - if(typeof this.zoomSlider !== 'undefined'){ + updateZoom: function (zoom) { + if (typeof this.zoomSlider !== "undefined") { this.zoomSlider.suspendEvents(); this.zoomSlider.setValue(Math.round(zoom * 100)); this.zoomSlider.resumeEvents(); } }, - zoomChanged: function(slider) { + zoomChanged: function (slider) { this.imageViewer.setZoomAndCenter(slider.getValue() / 100); }, - setChapters: function(chapters) { + setChapters: function (chapters) { var me = this; - if(chapters.getTotalCount() == 0) return; + if (chapters.getTotalCount() == 0) return; - me.gotoMenu = Ext.create('Ext.button.Button', { - text: getLangString('view.window.text.TextView_gotoMenu'), + me.gotoMenu = Ext.create("Ext.button.Button", { + text: getLangString("view.window.text.TextView_gotoMenu"), indent: false, - cls: 'menuButton', - menu : { - items: [ - ] - } + cls: "menuButton", + menu: { + items: [], + }, }); me.window.getTopbar().addViewSpecificItem(me.gotoMenu, me.id); me.chapters = chapters; var chapterItems = []; - chapters.each(function(chapter) { + chapters.each(function (chapter) { chapterItems.push({ - text: chapter.get('name'), - handler: Ext.bind(me.gotoChapter, me, chapter.get('pageId'), true) + text: chapter.get("name"), + handler: Ext.bind( + me.gotoChapter, + me, + chapter.get("pageId"), + true, + ), }); }); @@ -356,12 +373,12 @@ Ext.define('EdiromOnline.view.window.text.FacsimileView', { me.gotoMenu.show(); }, - gotoChapter: function (menuItem, event, pageId) { - this.fireEvent('gotoChapter', this, pageId); - }, + gotoChapter: function (menuItem, event, pageId) { + this.fireEvent("gotoChapter", this, pageId); + }, gotoPage: function (pageId) { - var me = this; - me.pageSpinner.setPage(me.imageSet.getById(pageId)); - } + var me = this; + me.pageSpinner.setPage(me.imageSet.getById(pageId)); + }, }); From 9687adfd172c446651ba325aa48990762f7f9d28 Mon Sep 17 00:00:00 2001 From: bwbohl Date: Wed, 7 Feb 2024 21:54:33 +0100 Subject: [PATCH 3/6] Update source.xqm --- add/data/xqm/source.xqm | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/add/data/xqm/source.xqm b/add/data/xqm/source.xqm index 001ab77cb..102694db3 100644 --- a/add/data/xqm/source.xqm +++ b/add/data/xqm/source.xqm @@ -34,20 +34,29 @@ declare namespace mei="http://www.music-encoding.org/ns/mei"; import module namespace eutil="http://www.edirom.de/xquery/util" at "../xqm/util.xqm"; (:~ -: Returns whether a document is a source or not +: Returns whether a document is a source or not. Generally this should work for MEI versions +: 2011-05 through 5.0 : : @param $uri The URI of the document -: @return Is work or not +: +: @return xs:boolean indicating whether the document referenced by @param $uri +: is considered a music source or not. :) declare function source:isSource($uri as xs:string) as xs:boolean { let $doc := eutil:getDoc($uri) - let $meiVersionRegex := '(([4-9])|(\d+[0-9]))\.\d+\.\d+(-dev)?' + let $meiVersion4To5Regex := '^[4-5](\.\d)+(-dev)?(\+(anyStart|basic|CMN|Mensural|Neumes))?$' + (: 2010-05 pre camelCase :) + (: 2011-05 2012 :) + (: 2013 +meiversion.num 2.1.1:) + (: 3.0.0 :) + (:mei2 and ?3 :) return (exists($doc//mei:mei) and exists($doc//mei:source)) (:mei2 and ?3 :) or - (matches($doc//mei:mei/@meiversion, $meiVersionRegex) and exists($doc//mei:manifestation[@singleton='true'])) (:mei4+ for manuscripts:) + (: MEI 4.0.1 and 5.0 with all dev and cutomization variants :) + (matches($doc//mei:mei/@meiversion, $meiVersion4To5Regex) and exists($doc//mei:manifestation[@singleton='true'])) (:mei4+ for manuscripts:) or - (matches($doc//mei:mei/@meiversion, $meiVersionRegex) and exists($doc//mei:manifestation//mei:item)) (: mei4+ for prints :) + (matches($doc//mei:mei/@meiversion, $meiVersion4ToRegex) and exists($doc//mei:manifestation//mei:item)) (: mei4+ for prints :) }; (:~ From a8c0994f1f26ff81ea16a655f56f6969a0174809 Mon Sep 17 00:00:00 2001 From: "Benjamin W. Bohl" Date: Thu, 8 Feb 2024 11:45:24 +0100 Subject: [PATCH 4/6] Update add/data/xqm/source.xqm Co-authored-by: Dennis Ried --- add/data/xqm/source.xqm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/add/data/xqm/source.xqm b/add/data/xqm/source.xqm index 102694db3..812eb1920 100644 --- a/add/data/xqm/source.xqm +++ b/add/data/xqm/source.xqm @@ -44,7 +44,7 @@ import module namespace eutil="http://www.edirom.de/xquery/util" at "../xqm/util :) declare function source:isSource($uri as xs:string) as xs:boolean { let $doc := eutil:getDoc($uri) - let $meiVersion4To5Regex := '^[4-5](\.\d)+(-dev)?(\+(anyStart|basic|CMN|Mensural|Neumes))?$' + let $meiVersion4To5Regex := '^[4-5](\.\d){1,2}(-dev)?(\+(anyStart|basic|CMN|Mensural|Neumes))?$' (: 2010-05 pre camelCase :) (: 2011-05 2012 :) (: 2013 +meiversion.num 2.1.1:) From d9df3dfa90bcf63b8e551b478e45da48d33a57c1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 07:31:13 +0000 Subject: [PATCH 5/6] Bump benjlevesque/short-sha from 2.2 to 3.0 Bumps [benjlevesque/short-sha](https://github.com/benjlevesque/short-sha) from 2.2 to 3.0. - [Release notes](https://github.com/benjlevesque/short-sha/releases) - [Commits](https://github.com/benjlevesque/short-sha/compare/v2.2...v3.0) --- updated-dependencies: - dependency-name: benjlevesque/short-sha dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/docker-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-ci.yml b/.github/workflows/docker-ci.yml index a46ad5129..5579f563d 100644 --- a/.github/workflows/docker-ci.yml +++ b/.github/workflows/docker-ci.yml @@ -21,7 +21,7 @@ jobs: uses: actions/checkout@v4 - name: Get short sha - uses: benjlevesque/short-sha@v2.2 + uses: benjlevesque/short-sha@v3.0 id: short-sha with: length: 7 From 3d54cb0a051e3ea62f1cf8952f872a0b899b0c27 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 07:31:17 +0000 Subject: [PATCH 6/6] Bump actions/upload-artifact from 4.3.0 to 4.3.1 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.0 to 4.3.1. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v4.3.0...v4.3.1) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/docker-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-ci.yml b/.github/workflows/docker-ci.yml index a46ad5129..00765e7fa 100644 --- a/.github/workflows/docker-ci.yml +++ b/.github/workflows/docker-ci.yml @@ -31,7 +31,7 @@ jobs: - name: Upload Artifacts to action run if: github.repository == 'Edirom/Edirom-Online' - uses: actions/upload-artifact@v4.3.0 + uses: actions/upload-artifact@v4.3.1 with: # The name that the artifact will be made available under name: EdiromOnline_${{ steps.short-sha.outputs.sha }}.zip