<commit_before># This file is part of NIT ( http://www.nitlanguage.org ).
#
# Copyright 2014 <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Configuration of the Web server of xymus.net
module xymus_net

import nitcorn
import privileges

# Use actions defined by contribs
import tnitter
import benitlux_controller
import opportunity_controller

# Header for the whole site
class MasterHeader
	super Template

	# Current page id, is used to set the `active` class on the header tab
	var page: nullable String

	# Make room for a login or logout placeholder (used by tnitter)
	var login_placeholder: Bool

	redef fun rendering
	do
		var actives = new HashMap[String, String]
		var page = page
		if page != null then actives[page] = " class=\"active\""

		add """
<nav class="navbar navbar-default" role="navigation">
  <div class="container-fluid">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
		<span class="icon-bar"></span>
		<span class="icon-bar"></span>
		<span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="http://xymus.net/">Xymus.net</a>
    </div>

    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li{{{actives.get_or_default("ens", "")}}}><a href="http://xymus.net/ens/">Enseignement</a></li>
        <li><a href="http://pep8.xymus.net/">Pep/8 Analysis</a></li>
        <li{{{actives.get_or_default("tnitter", "")}}}><a href="http://tnitter.xymus.net/">Tnitter</a></li>
        <li{{{actives.get_or_default("benitlux", "")}}}><a href="http://benitlux.xymus.net/">Benitlux</a></li>
        <li{{{actives.get_or_default("opportunity", "")}}}><a href="http://xymus.net/opportunity/">Opportunity</a></li>
        <li><a href="http://nitlanguage.org/">Nit</a></li>
      </ul>

      <ul class="nav navbar-nav pull-right">
	  """
		if login_placeholder then add "%header_right%"

		add """
      </ul>
    </div>
  </div>
</nav>"""
	end

	redef fun to_s do return write_to_string
end

class OpportunityMasterHeader
	super OpportunityHeader

	var master_header: MasterHeader

	redef fun rendering
	do
		add """
<!DOCTYPE html>
<html>
<head>
	<title>Opportunity - The meetup planner</title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
	<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
	<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
	<script>
		{{{page_js}}}
	</script>
	<style>
		.answer:hover {
			cursor:pointer;
		}
		.opportunity-action:hover {
			cursor:pointer;
		}
	</style>
</head>
<body>"""
		add master_header
	end
end

redef class Tnitter
	redef var header: String = (new MasterHeader("tnitter", true)).to_s
end

redef class BenitluxDocument
	redef var header = new MasterHeader("benitlux", false)
end

redef class ErrorTemplate
	redef var header = new MasterHeader(null, false)
end

redef class OpportunityPage
	redef var header = new OpportunityMasterHeader(new MasterHeader("opportunity", false))
end

# Avoid executing when running tests
if "NIT_TESTING".environ == "true" then exit 0

# Setup server interfaces
#
# Change these to use this config on your own server!
var default_vh = new VirtualHost("xymus.net:80")
var vps_vh = new VirtualHost("vps.xymus.net:80")<commit_msg>examples/xymus.net: add UQAM/LATECE specific opportunities templates<commit_after># This file is part of NIT ( http://www.nitlanguage.org ).
#
# Copyright 2014-2015 <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Configuration of the Web server of xymus.net
module xymus_net

import nitcorn
import privileges

# Use actions defined by contribs
import tnitter
import benitlux_controller
import opportunity_controller

# Header for the whole site
class MasterHeader
	super Template

	# Current page id, is used to set the `active` class on the header tab
	var page: nullable String

	# Make room for a login or logout placeholder (used by tnitter)
	var login_placeholder: Bool

	redef fun rendering
	do
		var actives = new HashMap[String, String]
		var page = page
		if page != null then actives[page] = " class=\"active\""

		add """
<nav class="navbar navbar-default" role="navigation">
  <div class="container-fluid">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
		<span class="icon-bar"></span>
		<span class="icon-bar"></span>
		<span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="http://xymus.net/">Xymus.net</a>
    </div>

    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li{{{actives.get_or_default("ens", "")}}}><a href="http://xymus.net/ens/">Enseignement</a></li>
        <li><a href="http://pep8.xymus.net/">Pep/8 Analysis</a></li>
        <li{{{actives.get_or_default("tnitter", "")}}}><a href="http://tnitter.xymus.net/">Tnitter</a></li>
        <li{{{actives.get_or_default("benitlux", "")}}}><a href="http://benitlux.xymus.net/">Benitlux</a></li>
        <li{{{actives.get_or_default("opportunity", "")}}}><a href="http://xymus.net/opportunity/">Opportunity</a></li>
        <li><a href="http://nitlanguage.org/">Nit</a></li>
      </ul>

      <ul class="nav navbar-nav pull-right">
	  """
		if login_placeholder then add "%header_right%"

		add """
      </ul>
    </div>
  </div>
</nav>"""
	end

	redef fun to_s do return write_to_string
end

class OpportunityMasterHeader
	super OpportunityHeader

	var master_header: MasterHeader

	redef fun rendering
	do
		add """
<!DOCTYPE html>
<html>
<head>
	<title>Opportunity - The meetup planner</title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
	<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
	<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
	<script>
		{{{page_js}}}
	</script>
	<style>
		.answer:hover {
			cursor:pointer;
		}
		.opportunity-action:hover {
			cursor:pointer;
		}
	</style>
</head>
<body>"""
		add master_header
	end
end

redef class Tnitter
	redef var header: String = (new MasterHeader("tnitter", true)).to_s
end

redef class BenitluxDocument
	redef var header = new MasterHeader("benitlux", false)
end

redef class ErrorTemplate
	redef var header = new MasterHeader(null, false)
end

redef class OpportunityPage
	redef var header = new OpportunityMasterHeader(new MasterHeader("opportunity", false))
end

redef class MeetupCreationPage
	redef var templates do
		var map = super
		map["Pizzas spécial LATECE"] = ["Végétarienne", "Pepperoni", "Viandes", "Poulet BBQ"]
		map["Heures de réunion à l'UQAM"] = ["7h 30", "9h", "10h 30", "12h",
		                                     "13h 30", "15h", "16h 30", "18h"]
		return map
	end
end

# Avoid executing when running tests
if "NIT_TESTING".environ == "true" then exit 0

# Setup server interfaces
#
# Change these to use this config on your own server!
var default_vh = new VirtualHost("xymus.net:80")
var vps_vh = new VirtualHost("vps.xymus.net:80")
{'fraction_non_alphanumeric': 0.14747027279086034, 'fraction_numerical': 0.0097924924224761, 'mean_word_length': 4.112634088200238, 'pattern_counts': {'":': 0, '<': 141, '<?xml version=': 0, '>': 141, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '345589', 'n_tokens_mistral': 3007, 'n_tokens_neox': 2783, 'n_words': 783}