X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-team.js;h=01d79b85a2d1a3cb5798d3fc133062b5ff9fb0f1;hb=e562c8bf93ae0cb4e865bac6b75d3e515d94d427;hp=81877bca0a08c574f9eae09e89a797fc60bd49ad;hpb=349e19d948afcea4dd0b35c693a0f15a8d00d757;p=mkws-moved-to-github.git diff --git a/src/mkws-team.js b/src/mkws-team.js index 81877bc..01d79b8 100644 --- a/src/mkws-team.js +++ b/src/mkws-team.js @@ -314,13 +314,6 @@ function team($, teamName) { if (blanket) blanket.css('display', 'block'); if (motd) motd.css('display', 'none'); break; - case 'none': - alert("mkws.switchView(" + m_teamName + ", 'none') shouldn't happen"); - if (targets) targets.css('display', 'none'); - if (results) results.css('display', 'none'); - if (blanket) blanket.css('display', 'none'); - if (motd) motd.css('display', 'none'); - break; default: alert("Unknown view '" + view + "'"); } @@ -348,32 +341,6 @@ function team($, teamName) { }; - /* - * All the HTML stuff to render the search forms and - * result pages. - */ - function mkwsHtmlAll() { - var container = findnode(".mkwsMOTDContainer"); - if (container.length) { - // Move the MOTD from the provided element down into the container - findnode(".mkwsMOTD").appendTo(container); - } - } - - - function mkwsSetLang() { - var lang = mkws.getParameterByName("lang") || m_config.lang; - if (!lang || !mkws.locale_lang[lang]) { - m_config.lang = "" - } else { - m_config.lang = lang; - } - - log("Locale language: " + (m_config.lang ? m_config.lang : "none")); - return m_config.lang; - } - - // Translation function. At present, this is properly a // global-level function (hence the assignment to mkws.M) but we // want to make it per-team so different teams can operate in @@ -447,7 +414,7 @@ function team($, teamName) { source = m_tempateText[name]; } if (!source) { - source = defaultTemplate(name); + source = mkws.defaultTemplate(name); } template = Handlebars.compile(source); @@ -460,94 +427,6 @@ function team($, teamName) { that.loadTemplate = loadTemplate; - function defaultTemplate(name) { - if (name === 'Record') { - return '\ -\ - \ - \ - \ - \ - {{#if md-date}}\ - \ - \ - \ - \ - {{/if}}\ - {{#if md-author}}\ - \ - \ - \ - \ - {{/if}}\ - {{#if md-electronic-url}}\ - \ - \ - \ - \ - {{/if}}\ - {{#if-any location having="md-subject"}}\ - \ - \ - \ - \ - {{/if-any}}\ - \ - \ - \ - \ -
{{translate "Title"}}\ - {{md-title}}\ - {{#if md-title-remainder}}\ - ({{md-title-remainder}})\ - {{/if}}\ - {{#if md-title-responsibility}}\ - {{md-title-responsibility}}\ - {{/if}}\ -
{{translate "Date"}}{{md-date}}
{{translate "Author"}}{{md-author}}
{{translate "Links"}}\ - {{#each md-electronic-url}}\ - Link{{index1}}\ - {{/each}}\ -
{{translate "Subject"}}\ - {{#first location having="md-subject"}}\ - {{#if md-subject}}\ - {{#commaList md-subject}}\ - {{this}}{{/commaList}}\ - {{/if}}\ - {{/first}}\ -
{{translate "Locations"}}\ - {{#commaList location}}\ - {{attr "@name"}}{{/commaList}}\ -
\ -'; - } else if (name === "Summary") { - return '\ -\ - {{md-title}}\ -\ -{{#if md-title-remainder}}\ - {{md-title-remainder}}\ -{{/if}}\ -{{#if md-title-responsibility}}\ - {{md-title-responsibility}}\ -{{/if}}\ -'; - } else if (name === "Image") { - return '\ - \ - {{#first md-thumburl}}\ - {{../md-title}}\ - {{/first}}\ -
\ -
\ -'; - } - - var s = "There is no default '" + name +"' template!"; - alert(s); - return s; - } - that.addWidget = function(w) { if (!m_widgets[w.type]) { m_widgets[w.type] = w; @@ -571,7 +450,20 @@ function team($, teamName) { return m_widgets[type]; } - mkwsHtmlAll() + + function mkwsSetLang() { + var lang = mkws.getParameterByName("lang") || m_config.lang; + if (!lang || !mkws.locale_lang[lang]) { + m_config.lang = "" + } else { + m_config.lang = lang; + } + + log("Locale language: " + (m_config.lang ? m_config.lang : "none")); + return m_config.lang; + } + + mkwsSetLang(); return that;