Skip to content

Commit

Permalink
make use of variable $config:isDevelopment
Browse files Browse the repository at this point in the history
  • Loading branch information
peterstadler committed Jan 30, 2014
1 parent 477e7ad commit 96baefc
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 20 deletions.
4 changes: 2 additions & 2 deletions webapp/modules/ajax.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ declare function ajax:getListFromEntriesWithKey($docID,$lang,$entry) {
let $doc := core:doc($docID)
let $isDiary := config:is-diary($docID)
(: Temporarily suppressing display of persons, works etc. since those are not reliable :)
let $yearsToSuppress := if(config:get-option('environment') eq 'development') then () else (1813,1814,1815,1816,1821,1822,1823,1826)
let $yearsToSuppress := if($config:isDevelopment) then () else (1813,1814,1815,1816,1821,1822,1823,1826)
let $suppressDisplay := if($isDiary) then if(year-from-date($doc/tei:ab/@n cast as xs:date) = $yearsToSuppress) then true() else false() else false()
let $coll :=
if ($entry eq 'person') then
Expand Down Expand Up @@ -682,7 +682,7 @@ declare function ajax:getNewsFoot($doc as document-node(), $lang as xs:string) a

declare function ajax:diary_printTranscription($docID as xs:string, $lang as xs:string) {
(: Temporarily suppressing internal links to persons, works etc. since those are not reliable :)
let $yearsToSuppress := if(config:get-option('environment') eq 'development') then () else (1813,1814,1815,1816,1821,1822,1823,1826)
let $yearsToSuppress := if($config:isDevelopment) then () else (1813,1814,1815,1816,1821,1822,1823,1826)
let $doc := core:doc($docID)
let $curYear := year-from-date($doc/tei:ab/@n cast as xs:date)
let $xslParams :=
Expand Down
2 changes: 1 addition & 1 deletion webapp/modules/error.xql
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ return
<div id="contentRight">
{xho:printEditionLinks($startID, $lang),
xho:printProjectLinks($lang),
if(config:get-option('environment') eq 'development') then xho:printDevelopmentLinks($lang) else ()}
if($config:isDevelopment) then xho:printDevelopmentLinks($lang) else ()}
</div>
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions webapp/modules/getAjax.xql
Original file line number Diff line number Diff line change
Expand Up @@ -69,29 +69,29 @@ return
let $docID := request:get-parameter('id','A050001')
return ajax:getNewsContext($contextContainer, $docID, $lang)

else if($function eq 'showToolsTab' and config:get-option('environment') eq 'development') then
else if($function eq 'showToolsTab' and $config:isDevelopment) then
let $docType := request:get-parameter('docType','common')
return dev:showToolsTab($docType, $lang)

else if($function eq 'generateID' and config:get-option('environment') eq 'development') then
else if($function eq 'generateID' and $config:isDevelopment) then
let $docType :=
if($lang eq 'en') then request:get-parameter('docType','common')
else doc(config:get-option(concat('dic_', $lang)))//entry[lower-case(.) eq lower-case(request:get-parameter('docType', 'Personen'))]/string(@xml:id)
return dev:createNewID($docType)

else if($function eq 'validateIDs' and config:get-option('environment') eq 'development') then
else if($function eq 'validateIDs' and $config:isDevelopment) then
let $docType :=
if($lang eq 'en') then request:get-parameter('docType','common')
else doc(config:get-option(concat('dic_', $lang)))//entry[lower-case(.) eq lower-case(request:get-parameter('docType', 'Personen'))]/string(@xml:id)
return dev:validateIDs($docType)

else if($function eq 'validatePNDs' and config:get-option('environment') eq 'development') then
else if($function eq 'validatePNDs' and $config:isDevelopment) then
let $docType :=
if($lang eq 'en') then request:get-parameter('docType','common')
else doc(config:get-option(concat('dic_', $lang)))//entry[lower-case(.) eq lower-case(request:get-parameter('docType', 'Personen'))]/string(@xml:id)
return dev:validatePNDs($docType)

else if($function eq 'validatePaths' and config:get-option('environment') eq 'development') then
else if($function eq 'validatePaths' and $config:isDevelopment) then
let $docType :=
if($lang eq 'en') then request:get-parameter('docType','common')
else doc(config:get-option(concat('dic_', $lang)))//entry[lower-case(.) eq lower-case(request:get-parameter('docType', 'Personen'))]/string(@xml:id)
Expand Down
2 changes: 1 addition & 1 deletion webapp/modules/index.xql
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ return
<div id="contentRight">
{xho:printEditionLinks($startID, $lang),
xho:printProjectLinks($lang),
if(config:get-option('environment') eq 'development') then xho:printDevelopmentLinks($lang) else ()}
if($config:isDevelopment) then xho:printDevelopmentLinks($lang) else ()}
<div>
<h1>{wega:getLanguageString('whatHappenedOn', wega:strftime(if($lang eq 'en') then '%B %d' else '%d. %B', $date, $lang), $lang)}</h1>
<div id="todaysEvents">
Expand Down
14 changes: 6 additions & 8 deletions webapp/modules/showEntries.xql
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,21 @@ declare function local:getRootNode($node,$docType) {
};

declare function local:createKWIC($item as item(), $lang as xs:string) as element() {
let $dev := config:get-option('environment') eq 'development'
let $kwic := util:catch('*',
kwic:summarize($item, <config width="40"/>),
if($dev) then string-join(('kwic:summarize', $item/@xml:id, $util:exception, $util:exception-message), ' ;; ')
if($config:isDevelopment) then string-join(('kwic:summarize', $item/@xml:id, $util:exception, $util:exception-message), ' ;; ')
else core:logToFile('error', string-join(('kwic:summarize', $item/@xml:id, $util:exception, $util:exception-message), ' ;; '))
)
let $score := ft:score($item)
return
element div {
attribute class {'kwicResult'},
if($dev) then element p {
if($config:isDevelopment) then element p {
attribute class {'id'},
if($item/@xml:id) then $item/@xml:id cast as xs:string else()
}
else(),
if($dev and exists($item//mei:altId[@type="JV"])) then element p {
if($config:isDevelopment and exists($item//mei:altId[@type="JV"])) then element p {
attribute class {'id'},
concat("(JV ",$item//mei:altId[@type="JV"],")")
}
Expand Down Expand Up @@ -82,12 +81,12 @@ declare function local:createKWIC($item as item(), $lang as xs:string) as elemen
(:Kein Treffer im Textteil gefunden:)
(:let $deletion := session:remove-attribute(concat('kwic-',$item/data(@xml:id))):)
return element p {$kwicNew }
else if($dev and normalize-space(string-join($kwic,'')) eq '' and false()) (: Nur eine Überlegung :)
else if($config:isDevelopment and normalize-space(string-join($kwic,'')) eq '' and false()) (: Nur eine Überlegung :)
then element p {'Für dieses Suchergebnis kann leider kein KWIC (keyword in kontext) ausgegeben werden.'}
else for $i in 1 to 20
return $kwic[$i]
,
if($dev) then element p {
if($config:isDevelopment) then element p {
attribute class {'score'},
attribute style {'visibility:hidden'},
$score
Expand All @@ -97,10 +96,9 @@ declare function local:createKWIC($item as item(), $lang as xs:string) as elemen
};

declare function local:createEntry($entry as item(), $clear as xs:boolean, $isSearchResult as xs:boolean, $lang as xs:string) as element()+ {
let $dev := config:get-option('environment') eq 'development'
let $docMetaData := util:catch('*',
wega:getDocumentMetaData($entry, $lang, 'listView'),
if($dev) then element div {
if($config:isDevelopment) then element div {
attribute class {'item'},
string-join(('wega:getDocumentMetaData', $entry/@xml:id, $util:exception, $util:exception-message), ' ;; ')
}
Expand Down
6 changes: 3 additions & 3 deletions webapp/modules/xho.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ declare function xho:createHeadContainer($lang as xs:string) as element()* {
return (
element xhtml:div {
attribute id {"headContainer"},
if(config:get-option('environment') eq 'development') then attribute class {'dev'}
if($config:isDevelopment) then attribute class {'dev'}
else if(config:get-option('environment') eq 'release') then attribute class {'rel'}
else (),
<xhtml:h1><xhtml:a href="{$index}"><xhtml:span class="hiddenLink">Carl Maria von Weber Gesamtausgabe</xhtml:span></xhtml:a></xhtml:h1>,
Expand Down Expand Up @@ -98,15 +98,15 @@ declare function xho:createFooter($lang as xs:string, $docPath as xs:string) as
then '%B %d, %Y'
else '%d. %B %Y'
let $encryptedBugEmail := wega:encryptString(config:get-option('bugEmail'), ())
let $version := concat(config:get-option('version'), if(config:get-option('environment') eq 'development') then 'dev' else '')
let $version := concat(config:get-option('version'), if($config:isDevelopment) then 'dev' else '')
let $versionDate := wega:strftime($dateFormat, xs:date(config:get-option('versionDate')), $lang)
let $permalink := string-join((config:get-option('baseHref'), $docID), '/')
return
if(exists($author) and exists($date)) then
<xhtml:div id="footer">
<xhtml:p>{wega:getLanguageString('proposedCitation', $lang)}, {$permalink} (<xhtml:a href="{wega:createLinkToDoc(core:doc(config:get-option('versionNews')), $lang)}">{wega:getLanguageString('versionInformation',($version, $versionDate), $lang)}</xhtml:a>) </xhtml:p>
<xhtml:p>{
if(config:get-option('environment') eq 'development') then wega:getLanguageString('lastChangeDateWithAuthor',(wega:strftime($dateFormat, $date, $lang),$author),$lang)
if($config:isDevelopment) then wega:getLanguageString('lastChangeDateWithAuthor',(wega:strftime($dateFormat, $date, $lang),$author),$lang)
else wega:getLanguageString('lastChangeDateWithoutAuthor', wega:strftime($dateFormat, $date, $lang), $lang)
}</xhtml:p>
{if($lang eq 'en') then
Expand Down

0 comments on commit 96baefc

Please sign in to comment.