Mercurial Hosting > nabble
diff src/nabble/view/naml/app.naml @ 0:7ecd1a4ef557
add content
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 21 Mar 2019 19:15:52 -0600 |
parents | |
children | 72765b66e2c3 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/nabble/view/naml/app.naml Thu Mar 21 19:15:52 2019 -0600 @@ -0,0 +1,687 @@ +<macro name="view_app" requires="servlet,nabble,basic"> + <n.switch. value="[n.get_node_from_parameter.type/]"> + <n.case. value="forum"> + <n.call_view_forum/> + </n.case.> + <n.case. value="mixed"> + <n.call_view_mixed/> + </n.case.> + <n.case. value="category"> + <n.view_category/> + </n.case.> + <n.case. value="board"> + <n.view_board/> + </n.case.> + <n.case. value="gallery"> + <n.view_gallery/> + </n.case.> + <n.case. value="blog"> + <n.view_blog/> + </n.case.> + <n.case. value="news"> + <n.view_news/> + </n.case.> + <n.default_case.throw_runtime_exception text="invalid app type: '[n.switch_value/]'" /> + </n.switch.> +</macro> + +<macro name="call_view_forum"> + <n.call_view_standard/> +</macro> + +<namespace name="app_namespace" /> +<namespace name="narrow_app_namespace" /> + +<macro name="apply_app_namespace" dot_parameter="do"> + <n.app_namespace.do/> +</macro> + +// workgroup stuff --- will clean up later [Hugo - Aug 2011] + +<namespace name="workgroup_app_namespace" /> +<namespace name="workgroup_narrow_app_namespace" /> + +<macro name="apply_workgroup_app_namespace" dot_parameter="do"> + <n.workgroup_app_namespace.do /> +</macro> + +<macro name="view_app canonical path" requires="http_request"> + <n.view_app_canonical_path/> +</macro> + +<macro name="view_topics canonical path" requires="http_request"> + <n.view_app_canonical_path/> +</macro> + +add more as needed + +<macro name="view_app_canonical_path" requires="http_request"> + <n.get_node_from_parameter.path + template="[n.get_parameter name='macro'/]" + index_record="[n.get_parameter name='index_record'/]" + date="[n.get_parameter name='date'/]" + /> +</macro> + +<macro name="app_html" parameters="head,body" requires="servlet"> + <n.app_min_html> + <head> + <n.head/> + <n.app_meta/> + <n.increment_view_count/> + </head> + <body> + <n.page_node.app_hardcoded_notices/> + <n.newsflash/> + <n.show_administrator_notice/> + <n.app_body_header/> + <n.body/> + <n.app_body_footer/> + </body> + </n.app_min_html> +</macro> + +<macro name="app_min_html" parameters="head,body" requires="servlet"> + <n.node_page.> + <n.app_caching/> + <n.check_that_is_app/> + <n.html> + <head> + <n.head/> + </head> + <body> + <n.body/> + </body> + </n.html> + </n.node_page.> +</macro> + +<macro name="app_caching" requires="node_page"> + <n.uncache_for.> + <n.descendant_changes.page_node.id/> + <n.bread_crumb_changes.page_node.id/> + </n.uncache_for.> +</macro> + +<macro name="node_parameter_or_root" dot_parameter="do"> + <n.if.has_parameter name="node"> + <then.get_node_from_parameter.do/> + <else.root_node.do/> + </n.if.has_parameter> +</macro> + +<macro name="embedding_redirection_js"> + <n.node_parameter_or_root.> + <n.if.has_embedding_redirection_url> + <then> + <script type="text/javascript"> + var embeddedUrl = '<n.embedding_redirection_url/>'; + var botPattern = "(googlebot\/|Googlebot-Mobile|Googlebot-Image|Google favicon|Mediapartners-Google|bingbot|slurp|java|wget|curl|Commons-HttpClient|Python-urllib|libwww|httpunit|nutch|phpcrawl|msnbot|jyxobot|FAST-WebCrawler|FAST Enterprise Crawler|biglotron|teoma|convera|seekbot|gigablast|exabot|ngbot|ia_archiver|GingerCrawler|webmon |httrack|webcrawler|grub.org|UsineNouvelleCrawler|antibot|netresearchserver|speedy|fluffy|bibnum.bnf|findlink|msrbot|panscient|yacybot|AISearchBot|IOI|ips-agent|tagoobot|MJ12bot|dotbot|woriobot|yanga|buzzbot|mlbot|yandexbot|purebot|Linguee Bot|Voyager|CyberPatrol|voilabot|baiduspider|citeseerxbot|spbot|twengabot|postrank|turnitinbot|scribdbot|page2rss|sitebot|linkdex|Adidxbot|blekkobot|ezooms|dotbot|Mail.RU_Bot|discobot|heritrix|findthatfile|europarchive.org|NerdByNature.Bot|sistrix crawler|ahrefsbot|Aboundex|domaincrawler|wbsearchbot|summify|ccbot|edisterbot|seznambot|ec2linkfinder|gslfbot|aihitbot|intelium_bot|facebookexternalhit|yeti|RetrevoPageAnalyzer|lb-spider|sogou|lssbot|careerbot|wotbox|wocbot|ichiro|DuckDuckBot|lssrocketcrawler|drupact|webcompanycrawler|acoonbot|openindexspider|gnam gnam spider|web-archive-net.com.bot|backlinkcrawler|coccoc|integromedb|content crawler spider|toplistbot|seokicks-robot|it2media-domain-crawler|ip-web-crawler.com|siteexplorer.info|elisabot|proximic|changedetection|blexbot|arabot|WeSEE:Search|niki-bot|CrystalSemanticsBot|rogerbot|360Spider|psbot|InterfaxScanBot|Lipperhey SEO Service|CC Metadata Scaper|g00g1e.net|GrapeshotCrawler|urlappendbot|brainobot|fr-crawler|binlar|SimpleCrawler|Livelapbot|Twitterbot|cXensebot|smtbot|bnf.fr_bot|A6-Indexer|ADmantX|Facebot|Twitterbot|OrangeBot|memorybot|AdvBot|MegaIndex|SemanticScholarBot|ltx71|nerdybot|xovibot|BUbiNG|Qwantify|archive.org_bot|Applebot|TweetmemeBot|crawler4j|findxbot|SemrushBot|yoozBot|lipperhey|y!j-asr|Domain Re-Animator Bot|AddThis)"; + var re = new RegExp(botPattern, 'i'); + if( !Nabble.isEmbedded && !re.test(navigator.userAgent) ) { + var url = top.location.href; + + var posHtml = url.lastIndexOf('.html'); + var c = '-'; + var hash; + if (url.indexOf('?') == -1 && posHtml > 0) { + var posStart = url.lastIndexOf('-'); + hash = (posStart > 0)? url.substring(posStart+1, posHtml):''; + } else { + hash = url.replace(new RegExp('https?://'), ''); + hash = hash.substring(hash.indexOf('/')+1); + hash = hash; + c = '+'; + } + if (Nabble.analytics) Nabble.analytics(); + var _hash = hash.length==1?'':'#nabble' + c + encodeURIComponent(hash); + + if (top.location.hash) { + var realHash = top.location.hash.substring(1); + _hash += '|' + encodeURIComponent(realHash); + } + _hash = _hash.length == 8 ? '' : _hash; + top.location.replace(embeddedUrl + _hash); + } + </script> + </then> + </n.if.has_embedding_redirection_url> + </n.node_parameter_or_root.> +</macro> + +<macro name="check_that_is_app"> + <n.if.not.page_node.is_app> + <then.redirect_to.page_node.url/> + </n.if.not.page_node.is_app> +</macro> + +<macro name="app_meta" requires="node_page,servlet"> + <n.if> + <condition> + <n.both> + <condition1.is_null.app_index_record/> + <condition2.equal value1="[n.app_template/]" value2="[n.app_default_template/]"/> + </n.both> + </condition> + <then> + <n.app_meta_description/> + <n.app_meta_keywords/> + </then> + <else> + <META NAME="robots" CONTENT="noindex,follow"/> + </else> + </n.if> +</macro> + +<macro name="app_meta_description" requires="node_page"> + <META NAME="description" CONTENT="[n.page_node.build_meta_description/]"/> +</macro> + +<macro name="build_meta_description" requires="node"> + <n.if.has_property name="page_meta_description"> + <then.get_property name="page_meta_description"/> + <else.default_meta_description/> + </n.if.has_property> +</macro> + +<macro name="app_meta_keywords" requires="node_page"> + <META NAME="keywords" CONTENT="[n.page_node.build_meta_keywords/]"/> +</macro> + +<macro name="build_meta_keywords" requires="node"> + <n.default_meta_keywords/> +</macro> + +<macro name="app_body_footer"> + <n.comment.>To be overridden</n.comment.> +</macro> + +<macro name="app_title"> + <title><n.compress.> + <n.page_node.app_title_contents/> + <n.page_node.app_title_ending/> + </n.compress.></title> +</macro> + +<macro name="app_title_contents" requires="node"> + <n.if.has_property name="page_title"> + <then.get_property name="page_title"/> + <else.default_app_title_contents/> + </n.if.has_property> +</macro> + +<macro name="default_app_title_contents" requires="node"> + <n.if.not.is_root> + <then><n.root_node.subject/> -</then> + </n.if.not.is_root> + <n.subject/> +</macro> + +<macro name="app_title_ending" requires="node"> + <n.if.is_associated_with_mailing_list_archive> + <then>| <t>Mailing List Archive</t></then> + </n.if.is_associated_with_mailing_list_archive> + <n.if.not.equal value1="[n.app_template/]" value2="[n.app_default_template/]"> + <then>| <n.capitalize.substring text="[n.app_template/]" begin="5" /></then> + </n.if.not.equal> + <n.hide_if_equals. value1="[n.app_page_number/]" value2="1"> + | <t>Page <t.number.app_page_number/></t> + </n.hide_if_equals.> +</macro> + +<macro name="app_body_header" requires="node_page,servlet"> + <n.page_node.> + <div id="forum-header"> + <h1 id="forum-title" class="app-title-[n.id/] adbayes-content"><n.subject/></h1> + <div id="description-box" class="adbayes-content"> + <n.mailing_list_information/> + <n.node_message_as_html/> + </div> + <div id="search-box" class="search-box"> + <n.search_box/> + </div> + </div> + </n.page_node.> +</macro> + + +<macro name="app_topic_pagination" requires="node_page,servlet" parameters="margin"> + <n.paging. + total_rows="[n.app_topic_count/]" + current_row="[n.app_index_record/]" + rows_per_page="[n.app_rows_per_page/]" + > + <n.generic_paging> + <margin> + <n.default. to='.55em .2em'> + <n.margin/> + </n.default.> + </margin> + <url> + <n.app_paged_url/> + </url> + </n.generic_paging> + </n.paging.> +</macro> + +<macro name="app_child_pagination" requires="node_page,servlet" parameters="margin"> + <n.paging. + total_rows="[n.page_node.child_count/]" + current_row="[n.app_index_record/]" + rows_per_page="[n.app_rows_per_page/]" + > + <n.generic_paging> + <margin> + <n.default. to='.55em .2em'> + <n.margin/> + </n.default.> + </margin> + <url> + <n.app_paged_url/> + </url> + </n.generic_paging> + </n.paging.> +</macro> + +<macro name="app_paged_url" requires="paging_page,node_page,servlet"> + <n.page_node.path + template="[n.app_template/]" + date="[n.app_date/]" + index_record="[n.page_row/]" + /> +</macro> + +<macro name="app_topic_count" requires="node_page,servlet"> + <n.page_node.topic_count filter="[n.app_topic_filter/]" /> +</macro> + +<macro name="app_topic_filter" requires="node_page,servlet"> + <n.cache var="app_topic_filter" value="[n.calc_app_topic_filter/]" /> +</macro> + +<macro name="calc_app_topic_filter" requires="node_page,servlet"> + <n.if.not.is_null.app_date> + <then.page_node.date_filter date="[n.app_date/]" /> + <else.null /> + </n.if.not.is_null.app_date> +</macro> + + +<macro name="is_front_page" requires="servlet"> + <n.equal value1="[n.app_template/]" value2="view_app" /> +</macro> + +<macro name="app_index_record" requires="servlet"> + <n.get_parameter name="index_record"/> +</macro> + +<macro name="app_template" requires="servlet"> + <n.get_parameter name="macro"/> +</macro> + +<macro name="app_date" requires="servlet"> + <n.get_parameter name="date"/> +</macro> + + + +<macro name="generic_paging" requires="paging" parameters="margin,url"> + <n.if.has_paging> + <then> + <n.put_in_head.> + <style type="text/css"> + span.current-page { padding: .1em .4em; } + span.page { padding: .1em; } + span.pages a { padding: .1em .4em; } + span.current-page { border-width:1px; border-style:solid; } + span.pages { + float:right; + white-space:nowrap; + font-weight:normal; + } + </style> + </n.put_in_head.> + <n.remove_spaces_between_tags.> + <span class="pages" style="padding:[n.margin/]"> + <n.if.not.is_at_beginning> + <then> + <n.first_page.link url="[n.url/]" /> ... + </then> + </n.if.not.is_at_beginning> + <n.neighboring_pages.show url="[n.url/]" /> + <n.if.not.is_at_end> + <then> + ... <n.last_page.link url="[n.url/]" /> + </then> + </n.if.not.is_at_end> + </span> + </n.remove_spaces_between_tags.> + </then> + </n.if.has_paging> +</macro> + +<macro name="show" requires="paging_page" parameters="url"> + <n.if.is_current_page> + <then> + <span class="current-page medium-border-color"><n.page_number/></span> + </then> + <else> + <n.link url="[n.url/]" /> + </else> + </n.if.is_current_page> +</macro> + +<macro name="link" requires="paging_page" parameters="url"> + <span class="page"> + <a href="[n.url/]" title="[t]Page [t.number.page_number/][/t]"><n.page_number/></a> + </span> +</macro> + + + +<macro name="set_app_rows_per_page" parameters="rows_per_page"> + <n.global_set_var name="app_rows_per_page" value="[n.rows_per_page/]" /> +</macro> + +<macro name="app_rows_per_page" requires="node_page"> + <n.cache var="app_rows_per_page" value="[n.page_node.default_rows_per_page/]" /> +</macro> + +<macro name="app_page_number" requires="node_page,servlet"> + <n.cache. var="app_page_number"> + <n.paging. + total_rows="0" + current_row="[n.app_index_record/]" + rows_per_page="[n.app_rows_per_page/]" + > + <n.current_page_number/> + </n.paging.> + </n.cache.> +</macro> + + + +<macro name="url" parameters="template,index_record,date" requires="node"> + <n.remove_spaces.> + <n.base_url/> + <n.path + template="[n.template/]" + index_record="[n.index_record/]" + date="[n.date/]" + /> + </n.remove_spaces.> +</macro> + +<macro name="path" parameters="template,index_record,date" requires="node"> + <n.if.is_app> + <then> + <n.app_path + template="[n.template/]" + index_record="[n.index_record/]" + date="[n.date/]" + /> + </then> + <else> + <n.post_path /> + </else> + </n.if.is_app> +</macro> + +<macro name="app_path" parameters="template,index_record,date" requires="node"> + <n.encode_url.remove_spaces.> + <n.set_var. name="index_record"> + <n.to_null_if. equals="0"> + <n.index_record/> + </n.to_null_if.> + </n.set_var.> + <n.set_var. name="template"> + <n.to_null_if. equals="[n.app_default_template/]"> + <n.template/> + </n.to_null_if.> + </n.set_var.> + <n.if.not.is_null.var name="template"> + <then> + <n.if.not.starts_with prefix="view_" text="[n.var name='template'/]"> + <then> + <n.throw_runtime_exception.> + template = <n.var name='template'/> + </n.throw_runtime_exception.> + </then> + </n.if.not.starts_with> + <n.set_var. name="template"> + <n.substring text="[n.var name='template'/]" begin="5" /> + </n.set_var.> + </then> + </n.if.not.is_null.var> + / + <n.if> + <condition> + <n.not.all_true.> + <n.is_root/> + <n.is_null.var name='template'/> + <n.is_null.date/> + <n.is_null.var name='index_record'/> + </n.not.all_true.> + </condition> + <then> + <n.url_encoded_subject/> + -f<n.id/> + <n.hide_null.prepend. prefix="i"><n.var name="index_record"/></n.hide_null.prepend.> + <n.hide_null.prepend. prefix="d"><n.date/></n.hide_null.prepend.> + <n.hide_null.prepend. prefix="."><n.var name="template"/></n.hide_null.prepend.> + .html + </then> + </n.if> + </n.encode_url.remove_spaces.> +</macro> + +<macro name="app_path_by_date" parameters="date" requires="node"> + <n.app_path + template="[n.app_template/]" + index_record="[n.app_index_record/]" + date="[n.date/]" + /> +</macro> + +<macro name="app_url" parameters="template,index_record,date" requires="node"> + <n.base_url/><n.app_path + template="[n.template/]" + index_record="[n.index_record/]" + date="[n.date/]" + /> +</macro> + +<macro name="app_default_template"> + view_app +</macro> + + + +<macro name="is_pinned_in_loop" requires="node,node_list"> + <n.both> + <condition1> + <n.is_pinned/> + </condition1> + <condition2> + <n.parent_node.equals.loop_node/> + </condition2> + </n.both> +</macro> + +<macro name="is_in_subapp" requires="node,node_list"> + <n.both> + <condition1> + <n.is_post/> + </condition1> + <condition2> + <n.both> + <condition1> + <n.has_loop_node/> + </condition1> + <condition2> + <n.get_app_node.not.equals.loop_node/> + </condition2> + </n.both> + </condition2> + </n.both> +</macro> + +<macro name="subapp_link" requires="node,node_list"> + <n.if.is_in_subapp> + <then> + <n.get_app_node.node_link/> + </then> + </n.if.is_in_subapp> +</macro> + +<macro name="subapp_link_on_hover" requires="node,node_list"> + <n.if.is_in_subapp> + <then> + <n.link_on_hover + id = "[n.id/]" + href = "[n.get_app_node.path/]" + text = "[n.get_app_node.subject/]" + /> + </then> + </n.if.is_in_subapp> +</macro> + +<macro name="link_on_hover" parameters="id,href,text"> + <n.put_in_head.> + <script type="text/javascript"> +<![CDATA[ + function createMouseTrick(nodeid) { + $(document).ready(function() { + var $text = $('#hover-text'+nodeid); + var $link = $('#hover-link'+nodeid); + var entered = false; + var count = 0; + $text.mouseover(function() { + $(this).hide(); + $link.show(); + checkMouse(); + }); + + $link.mouseover(function() { + entered = true; + }); + + $link.mouseout(function() { + $link.hide(); + $text.show(); + count = 0; + entered = false; + }); + + function checkMouse() { + if (!entered) { + count++; + if (count < 5) { + setTimeout(checkMouse, 100); + } else { + $link.hide(); + $text.show(); + count = 0; + entered = false; + } + } + } + }); + }; +]]> + </script> + </n.put_in_head.> + <span id="hover-text[n.id/]"><n.text/></span> + <script type="text/javascript"> + document.write('<a id="hover-link[n.id/]" href="[n.href/]" style="display:none">'); + document.write('<n.javascript_string_encode.get_app_node.text/>'); + document.write('</a>'); + createMouseTrick(<n.id/>); + </script> +</macro> + + + +just for now: + +<macro name="view_comment" requires="servlet"> + <n.redirect_to.node_page.page_node.url/> +</macro> + +<macro name="view_blog_entry" requires="servlet"> + <n.redirect_to.node_page.page_node.url/> +</macro> + +<macro name="view_gallery_entry" requires="servlet"> + <n.redirect_to.node_page.page_node.url/> +</macro> + +<macro name="view_news_entry" requires="servlet"> + <n.redirect_to.node_page.page_node.url/> +</macro> + + + +<macro name="children_list" parameters="start,length,filter,sort" dot_parameter="do" requires="node"> + <n.children_list_standard start="[n.start/]" length="[n.length/]" filter="[n.filter/]" do="[n.do/]" /> +</macro> + +<macro name="topics_list" parameters="start,length,filter,sort" dot_parameter="do" requires="node"> + <n.topics_list_standard start="[n.start/]" length="[n.length/]" filter="[n.filter/]" sort="[n.sort/]" do="[n.do/]" /> +</macro> + +<macro name="app_hardcoded_notices" requires="node_page,servlet"> + <n.inactive_node_deletion_ui/> + + <script type="text/javascript"> + $(document).ready(function() { + if (Nabble.appnotice) { + $('#creation-ad').slideDown(); + Nabble.setVar('appnotice',null); + } + }); + </script> + + <n.if.should_show_creation_notice> + <then> + <div id="creation-ad" class="app-notice light-border-color info-message" style="display:none"> + <n.congratulations_notice/> + </div> + <script type="text/javascript"> + /* Fix for widget creation (weebly) */ + if (Nabble.getParent().nabbleinfo && !Nabble.getParent().nabbleinfo.what) { + Nabble.getParent().nabbleinfo.what = '<n.page_node.lower_case_view_name/>'; + } + </script> + </then> + </n.if.should_show_creation_notice> +</macro> + +<macro name="congratulations_notice"> + <div class="big-title second-font"><t>Congratulations!</t></div> + <t>Your <t.app.page_node.lower_case_view_name/> has been successfully created.</t><br/> + <t>Please check your inbox now and activate your account in order to have access to all features.</t><br/> + <button class="toolbar action-button" onclick="$('#creation-ad').slideUp();" style="margin:.5em 1em 0"> + <t>Close this message</t> + </button> +</macro> + +<macro name="inactive_node_deletion_ui" requires="node_page"> + <n.if.page_node_is_scheduled_for_deletion> + <then> + <script type="text/javascript"> + function clearDeleteDate() { + $.getScript('/forum/ClearDeleteDate.jtp'); + } + </script> + <div id="inactive-delete" class="app-notice info-message"> + <div class="big-title second-font">This <n.page_node.lower_case_view_name/> will be deleted soon!</div> + Nabble has scheduled this <n.page_node.lower_case_view_name/> to be deleted on + <script type="text/javascript">document.write(Nabble.formatDateLong(new Date(<n.site_delete_date.raw_time/>)))</script> + due to its inactivity.<br/> + Click on the button below if you want to save this <n.page_node.lower_case_view_name/> from deletion.<br/> + <input type="button" value="Don't delete this [n.page_node.lower_case_view_name/]" onclick="clearDeleteDate()" style="margin:.5em 1em 0"></input> + </div> + </then> + </n.if.page_node_is_scheduled_for_deletion> +</macro> \ No newline at end of file