Skip to content

Commit

Permalink
Merge branch 'develop' into ftr/PartsInGoToMenu
Browse files Browse the repository at this point in the history
  • Loading branch information
bwbohl authored Jun 25, 2024
2 parents ede3006 + 757a8e3 commit 99bfb94
Show file tree
Hide file tree
Showing 122 changed files with 5,504 additions and 23,481 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/docker-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
types: [ opened, synchronize, reopened ]
branches: [ develop, main ]

permissions:
contents: read

env:
DOCKER_IMAGE: bwbohl/sencha-cmd

Expand All @@ -18,10 +21,10 @@ jobs:

steps:
- name: Chekout repository
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Get short sha
uses: benjlevesque/short-sha@v2.2
uses: benjlevesque/short-sha@599815c8ee942a9616c92bcfb4f947a3b670ab0b # v3.0
id: short-sha
with:
length: 7
Expand All @@ -31,7 +34,7 @@ jobs:

- name: Upload Artifacts to action run
if: github.repository == 'Edirom/Edirom-Online'
uses: actions/upload-artifact@v3.1.3
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
# The name that the artifact will be made available under
name: EdiromOnline_${{ steps.short-sha.outputs.sha }}.zip
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ Thumbs.db
*.xpr
local.properties
.idea/
.existdb.json
.vscode/settings.json
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[submodule "packages/eoTheme/resources/fonts/euryanthe"]
path = packages/eoTheme/resources/fonts/euryanthe
url = https://github.com/Edirom/EuryantheFont
[submodule "Stylesheets"]
path = add/data/xslt/tei/Stylesheets
url = https://github.com/TEIC/Stylesheets
branch = released
188 changes: 169 additions & 19 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,200 @@
1. Use whitespaces, not tabs to indent code
2. Close file with a newline character

# XQuery Styleguide

# XQuery
For formatting of XQuery files we generally rely on the basic configuration of Synchrosoft’s oXygen XML software family and its “Format & Indent” function.

## xqDoc

We use [xqDoc](https://xqdoc.org) for documenting the XQueries in this repository. Please refer to the section [xqDoc Comments](https://xqdoc.org/xqdoc_comments_doc.html) of the xyDoc-website for details on formatting the documentation comment blocks.
We use [xqDoc](https://xqdoc.org) for documenting the XQueries in this repository. Please refer to the section [xqDoc Comments](https://xqdoc.org/xqdoc_comments_doc.html) of the xqDoc-website for details on formatting the documentation comment blocks.

* XQuery modules must have a library module xqDoc comment preceding the module declaration.
* Function declarations must have a library module xqDoc function comment preceding the function.

## XQuery document structure

### XQuery version
### XQuery version declaration

```xquery
xquery version 3.1;
```

### License Statement
### Beginning comments

For now, the beginning comments should only include the following:

```xquery
(:
For LICENSE-Details please refer to the LICENSE file in the root directory of this repository.
:)
: Copyright: For LICENSE-Details please refer to the LICENSE file in the root directory of this repository.
:)
```
The beginning comments and the structuring comments (see below) of the prolog are separated by a blank line.

### Prolog

1. The parts of the prolog, are introduced by a comment followed by a new line.
2. The below form of the comments and the order of the parts is prescriptive.
3. Each part of the prolog ends with a blank line.

```xquery
(: IMPORTS ================================================================= :)
```

Sort imports by type:
1. All `import module namespace` statements registered with eXist-db
2. All `import module namespace` statements of custom modules that are not registered with eXist-db. Always use relative URIs for unregistered `import module namespace` statements.
3. Separate groups with a blank line.
4. In the groups sort alphabetically by prefix.

```xquery
(: NAMESPACE DECLARATIONS ================================================== :)
```

### File Header
All `declare namespace` statements, sorted alphabetically by prefix.

```xquery
(: OPTION DECLARATIONS ===================================================== :)
1. `declare namespace` statements
* sort alphabetically by prefix
2. `import module namespace` statements of registered modules
* sort alphabetically by prefix
3. `import module namespace` statements of custom modules
* sort alphabetically by prefix
* Always use relative URIs for `import module namespace` statements that import for modules not registered with eXist-db.
### Declare variables
```
All `declare option` statements.

* Use `declare variable` statements for all required external parameters
```xquery
(: VARIABLE DECLARATIONS =================================================== :)
```
1. Use `declare variable` statements for all required external parameters
2. All global variable declarations, i.e. `declare variable` statements.
3. Separate these two groups with a blank line.
4. In the groups, sort alphabetically.

```xquery
(: FUNCTION DECLARATIONS =================================================== :)
```

1. All `declare function` statements.
2. All function declarations have to be preceded by an xqDoc comment.
3. The xqDoc comment and function declaration belonging together are not separated by blank lines – not even one ;-)
4. The comment-function-groups are separated by blank lines.

A prototypical example:

```xquery
(: FUNCTION DECLARATIONS =========================================== :)
(:~
:
:)
declare function eg:addComment($comment as xs:string, $function as function())
as xs:string
{
}
(:~
:)
declare function eg:addComment($comment as xs:string, $function as function())
as xs:string
{
}
```

### Query body

The Query body start after a structuring comment as follows:

```xquery
(: QUERY BODY ============================================================== :)
```

#### Strings

Note: this is derived from the current usage in Edirom-Online code

* escape with U+00027 APOSTROPHE: `'`

### Literal results

TODO: how should literal results be indented, especially when they are long, e.g., as in the case of [getAudioPlayer.xql](add/data/xql/getAudioPlayer.xql).

### let statements

Short variable definitions should be in a single line:

```xquery
let $lang := 'de'
```

Longer assignments, especially when the contain if-else-statements or FLWOR-expressions, should break after `:=` and then indent a further level, before following the rules applicable to the respective statements, e.g.:

```xquery
let $elems :=
for $p in $participants
let $id := substring-after($p, '#')
return doc($doc)/id($id)
```

### Function declarations

* functions have to be preceded by an xqDoc comment
```xquery
(:~
: XQdoc comment
:
:
:)
declare function prefix:function-name( $paramOne as datatype, §paramTwo as datatype )
as datatype
{
};
```

- [ ] at the moment return datatypes and opening curly braces of function declarations are still in the same line as the `declare function` statement
- [ ] break long function argument

### HowTo ToDo:s

- [ ] literal results formatting
- [ ] nested return statements
- [ ] parenthesis placement


### XQuery body
# Javascript

## AJAX calls

The class `EdiromOnline.controller.AJAXController` provides a central method `doAJAXRequest` for performing AJAX requests. The method is provided globally as `window.doAJAXRequest`.

`doAJAXRequest` takes the following arguments:

* `url`: The URL of the requestet site or end point.
* `method`: The HTTP method like `PUT`, `GET`, `POST`.
* `params`: An object containing key-value-pairs of parameters for the request.
* `successFn`: A callback function which is called when the AJAX request was successfull.
* `retryNo`: The number of retries, if the requests fails. Standard is 2 retries.
* `async`: Defines the async parameter for AJAX calls. Default is 'true'.

An example of using the function would be:

```javascript
window.doAJAXRequest('data/xql/getAnnotationMeta.xql',
'GET',
{
uri: uri,
lang: lang
},
Ext.bind(function(response){
view.setMeta(response.responseText);
}, this)
);
```

* Strings: escape with U+00027 APOSTROPHE: `'`
23 changes: 15 additions & 8 deletions add/data/xql/checkTextGridLogin.xql
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
xquery version "3.0";
xquery version "3.1";

declare namespace html="http://www.w3.org/1999/xhtml";
declare namespace h="http://exist-db.org/xquery/httpclient";
(:
: Copyright: For LICENSE-Details please refer to the LICENSE file in the root directory of this repository.
:)

let $sessionId := request:get-parameter('sessionId', '')
(: IMPORTS ================================================================= :)

import module namespace httpclient = "http://exist-db.org/xquery/httpclient";

(: NAMESPACE DECLARATIONS ================================================== :)

let $test := httpclient:head(xs:anyURI('http://textgridlab.org/1.0/tgcrud/rest/textgrid:208dw/data?sessionId=' || $sessionId),
false(), ())
declare namespace html = "http://www.w3.org/1999/xhtml";

(: QUERY BODY ============================================================== :)

let $sessionId := request:get-parameter('sessionId', '')
let $test := httpclient:head(xs:anyURI('http://textgridlab.org/1.0/tgcrud/rest/textgrid:208dw/data?sessionId=' || $sessionId), false(), ())
let $status := $test/root()/httpclient:response/string(@statusCode)
let $status := response:set-status-code(xs:int($status))

return
$status
$status
Loading

0 comments on commit 99bfb94

Please sign in to comment.