<commit_before># -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
##
## Indico is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 3 of the
## License, or (at your option) any later version.
##
## Indico is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Indico;if not, see <http://www.gnu.org/licenses/>.

from xml.sax.saxutils import quoteattr, escape
from urllib import quote
from datetime import datetime,timedelta
from MaKaC.webinterface.pages.conferences import WPConferenceBase, WPConferenceModifBase
from MaKaC.webinterface.pages.conferences import WPConferenceDefaultDisplayBase
from MaKaC.webinterface.pages.conferences import WContribParticipantList
from MaKaC.webinterface import urlHandlers
from MaKaC.webinterface import wcomponents
from MaKaC import review
from indico.core.config import Config
from MaKaC.common import filters
from MaKaC.webinterface.common.contribStatusWrapper import ContribStatusList
from MaKaC.i18n import _
from indico.util.i18n import i18nformat
import MaKaC.user as user
from MaKaC.common.fossilize import fossilize
from MaKaC.fossils.conference import ILocalFileAbstractMaterialFossil
from MaKaC.webinterface.pages.abstracts import WAbstractManagmentAccept, WAbstractManagmentReject


class WPTrackBase(WPConferenceBase):

    def __init__( self, rh, track, subTrack=None):
        WPConferenceBase.__init__( self, rh, track.getConference() )
        self._track = track
        self._subTrack = subTrack


class WPTrackDisplayBase( WPTrackBase ):
    pass


class WPTrackDefaultDisplayBase( WPTrackDisplayBase, WPConferenceDefaultDisplayBase ):

    def __init__( self, rh, track ):
        WPTrackDisplayBase.__init__( self, rh, track )

    def _applyDecoration( self, body ):
        return WPConferenceDefaultDisplayBase._applyDecoration( self, body )

    def _display(self,params):
        return WPConferenceDefaultDisplayBase._display(self,params)


class WPTrackDisplay( WPTrackDefaultDisplayBase ):

    def _getBody( self, params ):
        wc = wcomponents.WTrackDisplay( self._getAW(), self._track )
        pars = { \
"trackModifURL": urlHandlers.UHTrackModification.getURL( self._track ), \
"materialURLGen": urlHandlers.UHMaterialDisplay.getURL, \
"contribURLGen": urlHandlers.UHContributionDisplay.getURL }
        return wc.getHTML( pars )


class WPTrackModifBase( WPConferenceModifBase ):

    def __init__( self, rh, track, subTrack=None):
        WPConferenceModifBase.__init__( self, rh, track.getConference() )
        self._track = track
        self._subTrack = subTrack

    def _getNavigationDrawer(self):
        if self._subTrack:
            target = self._subTrack
        else:
            target = self._track
        pars = {"target": target, "isModif": True}
        return wcomponents.WNavigationDrawer( pars, bgColor="white" )

    def _createTabCtrl( self ):
        self._tabCtrl = wcomponents.TabControl()
        self._tabMain = self._tabCtrl.newTab( "main", _("Main"), \
                urlHandlers.UHTrackModification.getURL( self._track ) )
        self._tabSubTrack = None
        self._tabCoordination= self._tabCtrl.newTab( "cc", \
                 _("Coordination control"), \
                urlHandlers.UHTrackModifCoordination.getURL( self._track ) )
        self._tabAbstracts = self._tabCtrl.newTab( "abstracts", _("Abstracts"), \
                urlHandlers.UHTrackModifAbstracts.getURL( self._track ) )
        if  self._conf.getAbstractMgr().isActive() and self._conf.hasEnabledSection("cfa"):
            self._tabAbstracts.enable()
            self._tabCoordination.enable()
        else:
            self._tabAbstracts.disable()
            self._tabCoordination.disable()
        self._tabContribs=self._tabCtrl.newTab( "contribs", _("Contributions"), \
                urlHandlers.UHTrackModContribList.getURL(self._track))
        self._setActiveTab()

    def _setActiveTab( self ):
        pass

    def _setActiveSideMenuItem( self ):
        self._programMenuItem.setActive()

    def _getPageContent( self, params ):
        self._createTabCtrl()
        banner = wcomponents.WTrackBannerModif(self._track, isManager=self._tabMain.isEnabled()).getHTML()
        html = wcomponents.WTabControl( self._tabCtrl, self._getAW() ).getHTML( self._getTabContent( params ) )
        return banner+html

    def _getTabContent( self, params ):
        return  _("nothing")


class WTrackModifMain(wcomponents.WTemplated):

    def __init__(self,track):
        self._track = track

    def getVars(self):
        vars=wcomponents.WTemplated.getVars(self)
        vars["title"]=self.htmlText(self._track.getTitle())
        vars["description"]=self.htmlText(self._track.getDescription())
        vars["code"]=self.htmlText(self._track.getCode())<commit_msg>[FIX] Missing MathJax JS assests for tracks<commit_after># -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
##
## Indico is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 3 of the
## License, or (at your option) any later version.
##
## Indico is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Indico;if not, see <http://www.gnu.org/licenses/>.

from xml.sax.saxutils import quoteattr, escape
from urllib import quote
from datetime import datetime,timedelta
from MaKaC.webinterface.pages.conferences import WPConferenceBase, WPConferenceModifBase
from MaKaC.webinterface.pages.conferences import WPConferenceDefaultDisplayBase
from MaKaC.webinterface.pages.conferences import WContribParticipantList
from MaKaC.webinterface import urlHandlers
from MaKaC.webinterface import wcomponents
from MaKaC import review
from indico.core.config import Config
from MaKaC.common import filters
from MaKaC.webinterface.common.contribStatusWrapper import ContribStatusList
from MaKaC.i18n import _
from indico.util.i18n import i18nformat
import MaKaC.user as user
from MaKaC.common.fossilize import fossilize
from MaKaC.fossils.conference import ILocalFileAbstractMaterialFossil
from MaKaC.webinterface.pages.abstracts import WAbstractManagmentAccept, WAbstractManagmentReject
from MaKaC.common.TemplateExec import render


class WPTrackBase(WPConferenceBase):

    def __init__( self, rh, track, subTrack=None):
        WPConferenceBase.__init__( self, rh, track.getConference() )
        self._track = track
        self._subTrack = subTrack


class WPTrackDisplayBase( WPTrackBase ):
    pass


class WPTrackDefaultDisplayBase( WPTrackDisplayBase, WPConferenceDefaultDisplayBase ):

    def __init__( self, rh, track ):
        WPTrackDisplayBase.__init__( self, rh, track )

    def _applyDecoration( self, body ):
        return WPConferenceDefaultDisplayBase._applyDecoration( self, body )

    def _display(self,params):
        return WPConferenceDefaultDisplayBase._display(self,params)


class WPTrackDisplay( WPTrackDefaultDisplayBase ):

    def _getBody( self, params ):
        wc = wcomponents.WTrackDisplay( self._getAW(), self._track )
        pars = { \
"trackModifURL": urlHandlers.UHTrackModification.getURL( self._track ), \
"materialURLGen": urlHandlers.UHMaterialDisplay.getURL, \
"contribURLGen": urlHandlers.UHContributionDisplay.getURL }
        return wc.getHTML( pars )


class WPTrackModifBase( WPConferenceModifBase ):

    def __init__( self, rh, track, subTrack=None):
        WPConferenceModifBase.__init__( self, rh, track.getConference() )
        self._track = track
        self._subTrack = subTrack

    def _getNavigationDrawer(self):
        if self._subTrack:
            target = self._subTrack
        else:
            target = self._track
        pars = {"target": target, "isModif": True}
        return wcomponents.WNavigationDrawer( pars, bgColor="white" )

    def _createTabCtrl( self ):
        self._tabCtrl = wcomponents.TabControl()
        self._tabMain = self._tabCtrl.newTab( "main", _("Main"), \
                urlHandlers.UHTrackModification.getURL( self._track ) )
        self._tabSubTrack = None
        self._tabCoordination= self._tabCtrl.newTab( "cc", \
                 _("Coordination control"), \
                urlHandlers.UHTrackModifCoordination.getURL( self._track ) )
        self._tabAbstracts = self._tabCtrl.newTab( "abstracts", _("Abstracts"), \
                urlHandlers.UHTrackModifAbstracts.getURL( self._track ) )
        if  self._conf.getAbstractMgr().isActive() and self._conf.hasEnabledSection("cfa"):
            self._tabAbstracts.enable()
            self._tabCoordination.enable()
        else:
            self._tabAbstracts.disable()
            self._tabCoordination.disable()
        self._tabContribs=self._tabCtrl.newTab( "contribs", _("Contributions"), \
                urlHandlers.UHTrackModContribList.getURL(self._track))
        self._setActiveTab()

    def _setActiveTab( self ):
        pass

    def _setActiveSideMenuItem( self ):
        self._programMenuItem.setActive()

    def _getPageContent( self, params ):
        self._createTabCtrl()
        banner = wcomponents.WTrackBannerModif(self._track, isManager=self._tabMain.isEnabled()).getHTML()
        html = wcomponents.WTabControl( self._tabCtrl, self._getAW() ).getHTML( self._getTabContent( params ) )
        return banner+html

    def _getTabContent( self, params ):
        return  _("nothing")

    def _getHeadContent(self):
        return WPConferenceModifBase._getHeadContent(self) + render('js/mathjax.config.js.tpl') + \
            '\n'.join(['<script src="{0}" type="text/javascript"></script>'.format(url)
                       for url in self._asset_env['mathjax_js'].urls()])


class WTrackModifMain(wcomponents.WTemplated):

    def __init__(self,track):
        self._track = track

    def getVars(self):
        vars=wcomponents.WTemplated.getVars(self)
        vars["title"]=self.htmlText(self._track.getTitle())
        vars["description"]=self.htmlText(self._track.getDescription())
        vars["code"]=self.htmlText(self._track.getCode())
{'fraction_non_alphanumeric': 0.09612546125461255, 'fraction_numerical': 0.003044280442804428, 'mean_word_length': 3.591698432867429, 'pattern_counts': {'":': 10, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6707402', 'n_tokens_mistral': 3192, 'n_tokens_neox': 3059, 'n_words': 767}