Changeset - d58e514c0a39
development.ini
Show inline comments
 
################################################################################
 
################################################################################
 
# RhodeCode - Pylons environment configuration                                 #
 
#                                                                              # 
 
# The %(here)s variable will be replaced with the parent directory of this file#
 
################################################################################
 

	
 
[DEFAULT]
 
debug = true
 
pdebug = false
 
################################################################################
 
## Uncomment and replace with the address which should receive                ## 
 
## any error reports after application crash                                  ##
 
## Additionally those settings will be used by RhodeCode mailing system       ##
 
################################################################################
 
#email_to = admin@localhost
 
#error_email_from = paste_error@localhost
 
#app_email_from = rhodecode-noreply@localhost
 
#error_message =
 

	
 
#smtp_server = mail.server.com
 
#smtp_username = 
 
#smtp_password = 
 
#smtp_port = 
 
#smtp_use_tls = false
 
#smtp_use_ssl = true
 
# Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
 
#smtp_auth = 
 

	
 
[server:main]
 
##nr of threads to spawn
 
threadpool_workers = 5
 

	
 
##max request before thread respawn
 
threadpool_max_requests = 6
 

	
 
##option to use threads of process
 
use_threadpool = true
 

	
 
use = egg:Paste#http
 
host = 0.0.0.0
 
port = 5000
 

	
 
[app:main]
 
use = egg:rhodecode
 
full_stack = true
 
static_files = true
 
lang=en
 
cache_dir = %(here)s/data
 
index_dir = %(here)s/data/index
 
app_instance_uuid = develop
 
cut_off_limit = 256000
 
force_https = false
 
commit_parse_limit = 25
 
use_gravatar = true
 

	
 
####################################
 
###        CELERY CONFIG        ####
 
####################################
 
use_celery = false
 
broker.host = localhost
 
broker.vhost = rabbitmqhost
 
broker.port = 5672
 
broker.user = rabbitmq
 
broker.password = qweqwe
 

	
 
celery.imports = rhodecode.lib.celerylib.tasks
 

	
 
celery.result.backend = amqp
 
celery.result.dburi = amqp://
 
celery.result.serialier = json
 

	
 
#celery.send.task.error.emails = true
 
#celery.amqp.task.result.expires = 18000
 

	
 
celeryd.concurrency = 2
 
#celeryd.log.file = celeryd.log
 
celeryd.log.level = debug
 
celeryd.max.tasks.per.child = 1
 

	
 
#tasks will never be sent to the queue, but executed locally instead.
 
celery.always.eager = false
 

	
 
####################################
 
###         BEAKER CACHE        ####
 
####################################
 
beaker.cache.data_dir=%(here)s/data/cache/data
 
beaker.cache.lock_dir=%(here)s/data/cache/lock
 

	
 
beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
 

	
 
beaker.cache.super_short_term.type=memory
 
beaker.cache.super_short_term.expire=10
 
beaker.cache.super_short_term.key_length = 256
 

	
 
beaker.cache.short_term.type=memory
 
beaker.cache.short_term.expire=60
 
beaker.cache.short_term.key_length = 256
 

	
 
beaker.cache.long_term.type=memory
 
beaker.cache.long_term.expire=36000
 
beaker.cache.long_term.key_length = 256
 

	
 
beaker.cache.sql_cache_short.type=memory
 
beaker.cache.sql_cache_short.expire=10
 
beaker.cache.sql_cache_short.key_length = 256
 

	
 
beaker.cache.sql_cache_med.type=memory
 
beaker.cache.sql_cache_med.expire=360
 
beaker.cache.sql_cache_med.key_length = 256
 

	
 
beaker.cache.sql_cache_long.type=file
 
beaker.cache.sql_cache_long.expire=3600
 
beaker.cache.sql_cache_long.key_length = 256
 

	
 
####################################
 
###       BEAKER SESSION        ####
 
####################################
 
## Type of storage used for the session, current types are 
 
## dbm, file, memcached, database, and memory. 
 
## The storage uses the Container API 
 
##that is also used by the cache system.
 
beaker.session.type = file
 

	
 
beaker.session.key = rhodecode
 
beaker.session.secret = g654dcno0-9873jhgfreyu
 
beaker.session.timeout = 36000
 

	
 
##auto save the session to not to use .save()
 
beaker.session.auto = False
 

	
 
##true exire at browser close
 
#beaker.session.cookie_expires = 3600
 

	
 
    
 
################################################################################
 
## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*  ##
 
## Debug mode will enable the interactive debugging tool, allowing ANYONE to  ##
 
## execute malicious code after an exception is raised.                       ##
 
################################################################################
 
#set debug = false
 

	
 
##################################
 
###       LOGVIEW CONFIG       ###
 
##################################
 
logview.sqlalchemy = #faa
 
logview.pylons.templating = #bfb
 
logview.pylons.util = #eee
 

	
 
#########################################################
 
### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG    ###
 
#########################################################
 
#sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
 
sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode
 
sqlalchemy.db1.echo = false
 
sqlalchemy.db1.pool_recycle = 3600
 
sqlalchemy.convert_unicode = true
 

	
 
################################
 
### LOGGING CONFIGURATION   ####
 
################################
 
[loggers]
 
keys = root, routes, rhodecode, sqlalchemy, beaker, templates
 

	
 
[handlers]
 
keys = console, console_sql
 

	
 
[formatters]
 
keys = generic, color_formatter, color_formatter_sql
 

	
 
#############
 
## LOGGERS ##
 
#############
 
[logger_root]
 
level = NOTSET
 
handlers = console
 

	
 
[logger_routes]
 
level = DEBUG
 
handlers = 
 
qualname = routes.middleware
 
# "level = DEBUG" logs the route matched and routing variables.
 
propagate = 1
 

	
 
[logger_beaker]
 
level = DEBUG
 
handlers = 
 
qualname = beaker.container
 
propagate = 1
 

	
 
[logger_templates]
 
level = INFO
 
handlers = 
 
qualname = pylons.templating
 
propagate = 1
 

	
 
[logger_rhodecode]
 
level = DEBUG
 
handlers = 
 
qualname = rhodecode
 
propagate = 1
 

	
 
[logger_sqlalchemy]
 
level = INFO
 
handlers = console_sql
 
qualname = sqlalchemy.engine
 
propagate = 0
 

	
 
##############
 
## HANDLERS ##
 
##############
 

	
 
[handler_console]
 
class = StreamHandler
 
args = (sys.stderr,)
 
level = DEBUG
 
formatter = color_formatter
 

	
 
[handler_console_sql]
 
class = StreamHandler
 
args = (sys.stderr,)
 
level = DEBUG
 
formatter = color_formatter_sql
 

	
 
################
 
## FORMATTERS ##
 
################
 

	
 
[formatter_generic]
 
format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
 
datefmt = %Y-%m-%d %H:%M:%S
 

	
 
[formatter_color_formatter]
 
class=rhodecode.lib.colored_formatter.ColorFormatter
 
format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
 
datefmt = %Y-%m-%d %H:%M:%S
 

	
 
[formatter_color_formatter_sql]
 
class=rhodecode.lib.colored_formatter.ColorFormatterSql
 
format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
 
datefmt = %Y-%m-%d %H:%M:%S
production.ini
Show inline comments
 
################################################################################
 
################################################################################
 
# RhodeCode - Pylons environment configuration                                 #
 
#                                                                              # 
 
# The %(here)s variable will be replaced with the parent directory of this file#
 
################################################################################
 

	
 
[DEFAULT]
 
debug = true
 
pdebug = false
 
################################################################################
 
## Uncomment and replace with the address which should receive                ## 
 
## any error reports after application crash                                  ##
 
## Additionally those settings will be used by RhodeCode mailing system       ##
 
################################################################################
 
#email_to = admin@localhost
 
#error_email_from = paste_error@localhost
 
#app_email_from = rhodecode-noreply@localhost
 
#error_message =
 

	
 
#smtp_server = mail.server.com
 
#smtp_username = 
 
#smtp_password = 
 
#smtp_port = 
 
#smtp_use_tls = false
 
#smtp_use_ssl = true
 
# Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
 
#smtp_auth = 
 

	
 
[server:main]
 
##nr of threads to spawn
 
threadpool_workers = 5
 

	
 
##max request before thread respawn
 
threadpool_max_requests = 10
 

	
 
##option to use threads of process
 
use_threadpool = true
 

	
 
use = egg:Paste#http
 
host = 127.0.0.1
 
port = 8001
 

	
 
[app:main]
 
use = egg:rhodecode
 
full_stack = true
 
static_files = true
 
lang=en
 
cache_dir = %(here)s/data
 
index_dir = %(here)s/data/index
 
app_instance_uuid = prod1234
 
cut_off_limit = 256000
 
force_https = false 
 
commit_parse_limit = 50
 
use_gravatar = true
 

	
 
####################################
 
###        CELERY CONFIG        ####
 
####################################
 
use_celery = false
 
broker.host = localhost
 
broker.vhost = rabbitmqhost
 
broker.port = 5672
 
broker.user = rabbitmq
 
broker.password = qweqwe
 

	
 
celery.imports = rhodecode.lib.celerylib.tasks
 

	
 
celery.result.backend = amqp
 
celery.result.dburi = amqp://
 
celery.result.serialier = json
 

	
 
#celery.send.task.error.emails = true
 
#celery.amqp.task.result.expires = 18000
 

	
 
celeryd.concurrency = 2
 
#celeryd.log.file = celeryd.log
 
celeryd.log.level = debug
 
celeryd.max.tasks.per.child = 1
 

	
 
#tasks will never be sent to the queue, but executed locally instead.
 
celery.always.eager = false
 

	
 
####################################
 
###         BEAKER CACHE        ####
 
####################################
 
beaker.cache.data_dir=%(here)s/data/cache/data
 
beaker.cache.lock_dir=%(here)s/data/cache/lock
 

	
 
beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
 

	
 
beaker.cache.super_short_term.type=memory
 
beaker.cache.super_short_term.expire=10
 
beaker.cache.super_short_term.key_length = 256
 

	
 
beaker.cache.short_term.type=memory
 
beaker.cache.short_term.expire=60
 
beaker.cache.short_term.key_length = 256
 

	
 
beaker.cache.long_term.type=memory
 
beaker.cache.long_term.expire=36000
 
beaker.cache.long_term.key_length = 256
 

	
 
beaker.cache.sql_cache_short.type=memory
 
beaker.cache.sql_cache_short.expire=10
 
beaker.cache.sql_cache_short.key_length = 256
 

	
 
beaker.cache.sql_cache_med.type=memory
 
beaker.cache.sql_cache_med.expire=360
 
beaker.cache.sql_cache_med.key_length = 256
 

	
 
beaker.cache.sql_cache_long.type=file
 
beaker.cache.sql_cache_long.expire=3600
 
beaker.cache.sql_cache_long.key_length = 256
 

	
 
####################################
 
###       BEAKER SESSION        ####
 
####################################
 
## Type of storage used for the session, current types are 
 
## dbm, file, memcached, database, and memory. 
 
## The storage uses the Container API 
 
##that is also used by the cache system.
 
beaker.session.type = file
 

	
 
beaker.session.key = rhodecode
 
beaker.session.secret = g654dcno0-9873jhgfreyu
 
beaker.session.timeout = 36000
 

	
 
##auto save the session to not to use .save()
 
beaker.session.auto = False
 

	
 
##true exire at browser close
 
#beaker.session.cookie_expires = 3600
 

	
 
    
 
################################################################################
 
## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*  ##
 
## Debug mode will enable the interactive debugging tool, allowing ANYONE to  ##
 
## execute malicious code after an exception is raised.                       ##
 
################################################################################
 
set debug = false
 

	
 
##################################
 
###       LOGVIEW CONFIG       ###
 
##################################
 
logview.sqlalchemy = #faa
 
logview.pylons.templating = #bfb
 
logview.pylons.util = #eee
 

	
 
#########################################################
 
### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG    ###
 
#########################################################
 
#sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
 
sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode
 
sqlalchemy.db1.echo = false
 
sqlalchemy.db1.pool_recycle = 3600
 
sqlalchemy.convert_unicode = true
 

	
 
################################
 
### LOGGING CONFIGURATION   ####
 
################################
 
[loggers]
 
keys = root, routes, rhodecode, sqlalchemy, beaker, templates
 

	
 
[handlers]
 
keys = console, console_sql
 

	
 
[formatters]
 
keys = generic, color_formatter, color_formatter_sql
 

	
 
#############
 
## LOGGERS ##
 
#############
 
[logger_root]
 
level = NOTSET
 
handlers = console
 

	
 
[logger_routes]
 
level = DEBUG
 
handlers = 
 
qualname = routes.middleware
 
# "level = DEBUG" logs the route matched and routing variables.
 
propagate = 1
 

	
 
[logger_beaker]
 
level = DEBUG
 
handlers = 
 
qualname = beaker.container
 
propagate = 1
 

	
 
[logger_templates]
 
level = INFO
 
handlers = 
 
qualname = pylons.templating
 
propagate = 1
 

	
 
[logger_rhodecode]
 
level = DEBUG
 
handlers = 
 
qualname = rhodecode
 
propagate = 1
 

	
 
[logger_sqlalchemy]
 
level = INFO
 
handlers = console_sql
 
qualname = sqlalchemy.engine
 
propagate = 0
 

	
 
##############
 
## HANDLERS ##
 
##############
 

	
 
[handler_console]
 
class = StreamHandler
 
args = (sys.stderr,)
 
level = INFO
 
formatter = generic
 

	
 
[handler_console_sql]
 
class = StreamHandler
 
args = (sys.stderr,)
 
level = WARN
 
formatter = generic
 

	
 
################
 
## FORMATTERS ##
 
################
 

	
 
[formatter_generic]
 
format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
 
datefmt = %Y-%m-%d %H:%M:%S
 

	
 
[formatter_color_formatter]
 
class=rhodecode.lib.colored_formatter.ColorFormatter
 
format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
 
datefmt = %Y-%m-%d %H:%M:%S
 

	
 
[formatter_color_formatter_sql]
 
class=rhodecode.lib.colored_formatter.ColorFormatterSql
 
format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
 
datefmt = %Y-%m-%d %H:%M:%S
 
\ No newline at end of file
rhodecode/config/deployment.ini_tmpl
Show inline comments
 
################################################################################
 
################################################################################
 
# RhodeCode - Pylons environment configuration                                 #
 
#                                                                              # 
 
# The %(here)s variable will be replaced with the parent directory of this file#
 
################################################################################
 

	
 
[DEFAULT]
 
debug = true
 
pdebug = false
 
################################################################################
 
## Uncomment and replace with the address which should receive                ## 
 
## any error reports after application crash                                  ##
 
## Additionally those settings will be used by RhodeCode mailing system       ##
 
################################################################################
 
#email_to = admin@localhost
 
#error_email_from = paste_error@localhost
 
#app_email_from = rhodecode-noreply@localhost
 
#error_message =
 

	
 
#smtp_server = mail.server.com
 
#smtp_username = 
 
#smtp_password = 
 
#smtp_port = 
 
#smtp_use_tls = false
 
#smtp_use_ssl = true
 
# Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
 
#smtp_auth = 
 

	
 
[server:main]
 
##nr of threads to spawn
 
threadpool_workers = 5
 

	
 
##max request before thread respawn
 
threadpool_max_requests = 10
 

	
 
##option to use threads of process
 
use_threadpool = true
 

	
 
use = egg:Paste#http
 
host = 127.0.0.1
 
port = 5000
 

	
 
[app:main]
 
use = egg:rhodecode
 
full_stack = true
 
static_files = true
 
lang=en
 
cache_dir = %(here)s/data
 
index_dir = %(here)s/data/index
 
app_instance_uuid = ${app_instance_uuid}
 
cut_off_limit = 256000
 
force_https = false 
 
commit_parse_limit = 50
 
use_gravatar = true
 
container_auth_enabled = false
 
proxypass_auth_enabled = false
 

	
 
####################################
 
###        CELERY CONFIG        ####
 
####################################
 
use_celery = false
 
broker.host = localhost
 
broker.vhost = rabbitmqhost
 
broker.port = 5672
 
broker.user = rabbitmq
 
broker.password = qweqwe
 

	
 
celery.imports = rhodecode.lib.celerylib.tasks
 

	
 
celery.result.backend = amqp
 
celery.result.dburi = amqp://
 
celery.result.serialier = json
 

	
 
#celery.send.task.error.emails = true
 
#celery.amqp.task.result.expires = 18000
 

	
 
celeryd.concurrency = 2
 
#celeryd.log.file = celeryd.log
 
celeryd.log.level = debug
 
celeryd.max.tasks.per.child = 1
 

	
 
#tasks will never be sent to the queue, but executed locally instead.
 
celery.always.eager = false
 

	
 
####################################
 
###         BEAKER CACHE        ####
 
####################################
 
beaker.cache.data_dir=%(here)s/data/cache/data
 
beaker.cache.lock_dir=%(here)s/data/cache/lock
 

	
 
beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
 

	
 
beaker.cache.super_short_term.type=memory
 
beaker.cache.super_short_term.expire=10
 
beaker.cache.super_short_term.key_length = 256
 

	
 
beaker.cache.short_term.type=memory
 
beaker.cache.short_term.expire=60
 
beaker.cache.short_term.key_length = 256
 

	
 
beaker.cache.long_term.type=memory
 
beaker.cache.long_term.expire=36000
 
beaker.cache.long_term.key_length = 256
 

	
 
beaker.cache.sql_cache_short.type=memory
 
beaker.cache.sql_cache_short.expire=10
 
beaker.cache.sql_cache_short.key_length = 256
 

	
 
beaker.cache.sql_cache_med.type=memory
 
beaker.cache.sql_cache_med.expire=360
 
beaker.cache.sql_cache_med.key_length = 256
 

	
 
beaker.cache.sql_cache_long.type=file
 
beaker.cache.sql_cache_long.expire=3600
 
beaker.cache.sql_cache_long.key_length = 256
 

	
 
####################################
 
###       BEAKER SESSION        ####
 
####################################
 
## Type of storage used for the session, current types are 
 
## dbm, file, memcached, database, and memory. 
 
## The storage uses the Container API 
 
##that is also used by the cache system.
 
beaker.session.type = file
 

	
 
beaker.session.key = rhodecode
 
beaker.session.secret = ${app_instance_secret}
 
beaker.session.timeout = 36000
 

	
 
##auto save the session to not to use .save()
 
beaker.session.auto = False
 

	
 
##true exire at browser close
 
#beaker.session.cookie_expires = 3600
 

	
 
    
 
################################################################################
 
## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*  ##
 
## Debug mode will enable the interactive debugging tool, allowing ANYONE to  ##
 
## execute malicious code after an exception is raised.                       ##
 
################################################################################
 
set debug = false
 

	
 
##################################
 
###       LOGVIEW CONFIG       ###
 
##################################
 
logview.sqlalchemy = #faa
 
logview.pylons.templating = #bfb
 
logview.pylons.util = #eee
 

	
 
#########################################################
 
### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG    ###
 
#########################################################
 

	
 
# SQLITE [default]
 
sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
 
 
 
# POSTGRESQL
 
# sqlalchemy.db1.url = postgresql://user:pass@localhost/rhodecode
 

	
 
# MySQL
 
# sqlalchemy.db1.url = mysql://user:pass@localhost/rhodecode
 

	
 
# see sqlalchemy docs for others
 

	
 
sqlalchemy.db1.echo = false
 
sqlalchemy.db1.pool_recycle = 3600
 
sqlalchemy.convert_unicode = true
 

	
 
################################
 
### LOGGING CONFIGURATION   ####
 
################################
 
[loggers]
 
keys = root, routes, rhodecode, sqlalchemy, beaker, templates
 

	
 
[handlers]
 
keys = console, console_sql
 

	
 
[formatters]
 
keys = generic, color_formatter, color_formatter_sql
 

	
 
#############
 
## LOGGERS ##
 
#############
 
[logger_root]
 
level = NOTSET
 
handlers = console
 

	
 
[logger_routes]
 
level = DEBUG
 
handlers = 
 
qualname = routes.middleware
 
# "level = DEBUG" logs the route matched and routing variables.
 
propagate = 1
 

	
 
[logger_beaker]
 
level = DEBUG
 
handlers = 
 
qualname = beaker.container
 
propagate = 1
 

	
 
[logger_templates]
 
level = INFO
 
handlers = 
 
qualname = pylons.templating
 
propagate = 1
 

	
 
[logger_rhodecode]
 
level = DEBUG
 
handlers = 
 
qualname = rhodecode
 
propagate = 1
 

	
 
[logger_sqlalchemy]
 
level = INFO
 
handlers = console_sql
 
qualname = sqlalchemy.engine
 
propagate = 0
 

	
 
##############
 
## HANDLERS ##
 
##############
 

	
 
[handler_console]
 
class = StreamHandler
 
args = (sys.stderr,)
 
level = INFO
 
formatter = color_formatter
 

	
 
[handler_console_sql]
 
class = StreamHandler
 
args = (sys.stderr,)
 
level = WARN
 
formatter = color_formatter_sql
 

	
 
################
 
## FORMATTERS ##
 
################
 

	
 
[formatter_generic]
 
format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
 
datefmt = %Y-%m-%d %H:%M:%S
 

	
 
[formatter_color_formatter]
 
class=rhodecode.lib.colored_formatter.ColorFormatter
 
format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
 
datefmt = %Y-%m-%d %H:%M:%S
 

	
 
[formatter_color_formatter_sql]
 
class=rhodecode.lib.colored_formatter.ColorFormatterSql
 
format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
 
datefmt = %Y-%m-%d %H:%M:%S
 
\ No newline at end of file
rhodecode/config/routing.py
Show inline comments
 
"""
 
Routes configuration
 

	
 
The more specific and detailed routes should be defined first so they
 
may take precedent over the more generic routes. For more information
 
refer to the routes manual at http://routes.groovie.org/docs/
 
"""
 
from __future__ import with_statement
 
from routes import Mapper
 

	
 

	
 
# prefix for non repository related links needs to be prefixed with `/`
 
ADMIN_PREFIX = '/_admin'
 

	
 

	
 
def make_map(config):
 
    """Create, configure and return the routes Mapper"""
 
    rmap = Mapper(directory=config['pylons.paths']['controllers'],
 
                 always_scan=config['debug'])
 
    rmap.minimization = False
 
    rmap.explicit = False
 

	
 
    from rhodecode.lib.utils import is_valid_repo
 
    from rhodecode.lib.utils import is_valid_repos_group
 

	
 
    def check_repo(environ, match_dict):
 
        """
 
        check for valid repository for proper 404 handling
 
        
 
        :param environ:
 
        :param match_dict:
 
        """
 

	
 
        repo_name = match_dict.get('repo_name')
 
        return is_valid_repo(repo_name, config['base_path'])
 

	
 
    def check_group(environ, match_dict):
 
        """
 
        check for valid repositories group for proper 404 handling
 
        
 
        :param environ:
 
        :param match_dict:
 
        """
 
        repos_group_name = match_dict.get('group_name')
 

	
 
        return is_valid_repos_group(repos_group_name, config['base_path'])
 

	
 

	
 
    def check_int(environ, match_dict):
 
        return match_dict.get('id').isdigit()
 

	
 
    # The ErrorController route (handles 404/500 error pages); it should
 
    # likely stay at the top, ensuring it can always be resolved
 
    rmap.connect('/error/{action}', controller='error')
 
    rmap.connect('/error/{action}/{id}', controller='error')
 

	
 
    #==========================================================================
 
    # CUSTOM ROUTES HERE
 
    #==========================================================================
 

	
 
    #MAIN PAGE
 
    rmap.connect('home', '/', controller='home', action='index')
 
    rmap.connect('repo_switcher', '/repos', controller='home',
 
                 action='repo_switcher')
 
    rmap.connect('branch_tag_switcher', '/branches-tags/{repo_name:.*}', 
 
                 controller='home',action='branch_tag_switcher')    
 
    rmap.connect('bugtracker',
 
                 "http://bitbucket.org/marcinkuzminski/rhodecode/issues",
 
                 _static=True)
 
    rmap.connect('rhodecode_official', "http://rhodecode.org", _static=True)
 

	
 
    #ADMIN REPOSITORY REST ROUTES
 
    with rmap.submapper(path_prefix=ADMIN_PREFIX,
 
                        controller='admin/repos') as m:
 
        m.connect("repos", "/repos",
 
             action="create", conditions=dict(method=["POST"]))
 
        m.connect("repos", "/repos",
 
             action="index", conditions=dict(method=["GET"]))
 
        m.connect("formatted_repos", "/repos.{format}",
 
             action="index",
 
            conditions=dict(method=["GET"]))
 
        m.connect("new_repo", "/repos/new",
 
             action="new", conditions=dict(method=["GET"]))
 
        m.connect("formatted_new_repo", "/repos/new.{format}",
 
             action="new", conditions=dict(method=["GET"]))
 
        m.connect("/repos/{repo_name:.*}",
 
             action="update", conditions=dict(method=["PUT"],
 
                                              function=check_repo))
 
        m.connect("/repos/{repo_name:.*}",
 
             action="delete", conditions=dict(method=["DELETE"],
 
                                              function=check_repo))
 
        m.connect("edit_repo", "/repos/{repo_name:.*}/edit",
 
             action="edit", conditions=dict(method=["GET"],
 
                                            function=check_repo))
 
        m.connect("formatted_edit_repo", "/repos/{repo_name:.*}.{format}/edit",
 
             action="edit", conditions=dict(method=["GET"],
 
                                            function=check_repo))
 
        m.connect("repo", "/repos/{repo_name:.*}",
 
             action="show", conditions=dict(method=["GET"],
 
                                            function=check_repo))
 
        m.connect("formatted_repo", "/repos/{repo_name:.*}.{format}",
 
             action="show", conditions=dict(method=["GET"],
 
                                            function=check_repo))
 
        #ajax delete repo perm user
 
        m.connect('delete_repo_user', "/repos_delete_user/{repo_name:.*}",
 
             action="delete_perm_user", conditions=dict(method=["DELETE"],
 
                                                        function=check_repo))
 
        #ajax delete repo perm users_group
 
        m.connect('delete_repo_users_group',
 
                  "/repos_delete_users_group/{repo_name:.*}",
 
                  action="delete_perm_users_group",
 
                  conditions=dict(method=["DELETE"], function=check_repo))
 

	
 
        #settings actions
 
        m.connect('repo_stats', "/repos_stats/{repo_name:.*}",
 
             action="repo_stats", conditions=dict(method=["DELETE"],
 
                                                        function=check_repo))
 
        m.connect('repo_cache', "/repos_cache/{repo_name:.*}",
 
             action="repo_cache", conditions=dict(method=["DELETE"],
 
                                                        function=check_repo))
 
        m.connect('repo_public_journal',
 
                  "/repos_public_journal/{repo_name:.*}",
 
                  action="repo_public_journal", conditions=dict(method=["PUT"],
 
                  function=check_repo))
 
        m.connect('repo_pull', "/repo_pull/{repo_name:.*}",
 
             action="repo_pull", conditions=dict(method=["PUT"],
 
                                                        function=check_repo))
 

	
 
    with rmap.submapper(path_prefix=ADMIN_PREFIX,
 
                        controller='admin/repos_groups') as m:
 
        m.connect("repos_groups", "/repos_groups",
 
                  action="create", conditions=dict(method=["POST"]))
 
        m.connect("repos_groups", "/repos_groups",
 
                  action="index", conditions=dict(method=["GET"]))
 
        m.connect("formatted_repos_groups", "/repos_groups.{format}",
 
                  action="index", conditions=dict(method=["GET"]))
 
        m.connect("new_repos_group", "/repos_groups/new",
 
                  action="new", conditions=dict(method=["GET"]))
 
        m.connect("formatted_new_repos_group", "/repos_groups/new.{format}",
 
                  action="new", conditions=dict(method=["GET"]))
 
        m.connect("update_repos_group", "/repos_groups/{id}",
 
                  action="update", conditions=dict(method=["PUT"],
 
                                                   function=check_int))
 
        m.connect("delete_repos_group", "/repos_groups/{id}",
 
                  action="delete", conditions=dict(method=["DELETE"],
 
                                                   function=check_int))
 
        m.connect("edit_repos_group", "/repos_groups/{id}/edit",
 
                  action="edit", conditions=dict(method=["GET"],
 
                                                 function=check_int))
 
        m.connect("formatted_edit_repos_group",
 
                  "/repos_groups/{id}.{format}/edit",
 
                  action="edit", conditions=dict(method=["GET"],
 
                                                 function=check_int))
 
        m.connect("repos_group", "/repos_groups/{id}",
 
                  action="show", conditions=dict(method=["GET"],
 
                                                 function=check_int))
 
        m.connect("formatted_repos_group", "/repos_groups/{id}.{format}",
 
                  action="show", conditions=dict(method=["GET"],
 
                                                 function=check_int))
 

	
 
    #ADMIN USER REST ROUTES
 
    with rmap.submapper(path_prefix=ADMIN_PREFIX,
 
                        controller='admin/users') as m:
 
        m.connect("users", "/users",
 
                  action="create", conditions=dict(method=["POST"]))
 
        m.connect("users", "/users",
 
                  action="index", conditions=dict(method=["GET"]))
 
        m.connect("formatted_users", "/users.{format}",
 
                  action="index", conditions=dict(method=["GET"]))
 
        m.connect("new_user", "/users/new",
 
                  action="new", conditions=dict(method=["GET"]))
 
        m.connect("formatted_new_user", "/users/new.{format}",
 
                  action="new", conditions=dict(method=["GET"]))
 
        m.connect("update_user", "/users/{id}",
 
                  action="update", conditions=dict(method=["PUT"]))
 
        m.connect("delete_user", "/users/{id}",
 
                  action="delete", conditions=dict(method=["DELETE"]))
 
        m.connect("edit_user", "/users/{id}/edit",
 
                  action="edit", conditions=dict(method=["GET"]))
 
        m.connect("formatted_edit_user",
 
                  "/users/{id}.{format}/edit",
 
                  action="edit", conditions=dict(method=["GET"]))
 
        m.connect("user", "/users/{id}",
 
                  action="show", conditions=dict(method=["GET"]))
 
        m.connect("formatted_user", "/users/{id}.{format}",
 
                  action="show", conditions=dict(method=["GET"]))
 

	
 
        #EXTRAS USER ROUTES
 
        m.connect("user_perm", "/users_perm/{id}",
 
                  action="update_perm", conditions=dict(method=["PUT"]))
 

	
 
    #ADMIN USERS REST ROUTES
 
    with rmap.submapper(path_prefix=ADMIN_PREFIX,
 
                        controller='admin/users_groups') as m:
 
        m.connect("users_groups", "/users_groups",
 
                  action="create", conditions=dict(method=["POST"]))
 
        m.connect("users_groups", "/users_groups",
 
                  action="index", conditions=dict(method=["GET"]))
 
        m.connect("formatted_users_groups", "/users_groups.{format}",
 
                  action="index", conditions=dict(method=["GET"]))
 
        m.connect("new_users_group", "/users_groups/new",
 
                  action="new", conditions=dict(method=["GET"]))
 
        m.connect("formatted_new_users_group", "/users_groups/new.{format}",
 
                  action="new", conditions=dict(method=["GET"]))
 
        m.connect("update_users_group", "/users_groups/{id}",
 
                  action="update", conditions=dict(method=["PUT"]))
 
        m.connect("delete_users_group", "/users_groups/{id}",
 
                  action="delete", conditions=dict(method=["DELETE"]))
 
        m.connect("edit_users_group", "/users_groups/{id}/edit",
 
                  action="edit", conditions=dict(method=["GET"]))
 
        m.connect("formatted_edit_users_group",
 
                  "/users_groups/{id}.{format}/edit",
 
                  action="edit", conditions=dict(method=["GET"]))
 
        m.connect("users_group", "/users_groups/{id}",
 
                  action="show", conditions=dict(method=["GET"]))
 
        m.connect("formatted_users_group", "/users_groups/{id}.{format}",
 
                  action="show", conditions=dict(method=["GET"]))
 

	
 
        #EXTRAS USER ROUTES
 
        m.connect("users_group_perm", "/users_groups_perm/{id}",
 
                  action="update_perm", conditions=dict(method=["PUT"]))
 

	
 
    #ADMIN GROUP REST ROUTES
 
    rmap.resource('group', 'groups',
 
                  controller='admin/groups', path_prefix=ADMIN_PREFIX)
 

	
 
    #ADMIN PERMISSIONS REST ROUTES
 
    rmap.resource('permission', 'permissions',
 
                  controller='admin/permissions', path_prefix=ADMIN_PREFIX)
 

	
 
    ##ADMIN LDAP SETTINGS
 
    rmap.connect('ldap_settings', '%s/ldap' % ADMIN_PREFIX,
 
                 controller='admin/ldap_settings', action='ldap_settings',
 
                 conditions=dict(method=["POST"]))
 

	
 
    rmap.connect('ldap_home', '%s/ldap' % ADMIN_PREFIX,
 
                 controller='admin/ldap_settings')
 

	
 
    #ADMIN SETTINGS REST ROUTES
 
    with rmap.submapper(path_prefix=ADMIN_PREFIX,
 
                        controller='admin/settings') as m:
 
        m.connect("admin_settings", "/settings",
 
                  action="create", conditions=dict(method=["POST"]))
 
        m.connect("admin_settings", "/settings",
 
                  action="index", conditions=dict(method=["GET"]))
 
        m.connect("formatted_admin_settings", "/settings.{format}",
 
                  action="index", conditions=dict(method=["GET"]))
 
        m.connect("admin_new_setting", "/settings/new",
 
                  action="new", conditions=dict(method=["GET"]))
 
        m.connect("formatted_admin_new_setting", "/settings/new.{format}",
 
                  action="new", conditions=dict(method=["GET"]))
 
        m.connect("/settings/{setting_id}",
 
                  action="update", conditions=dict(method=["PUT"]))
 
        m.connect("/settings/{setting_id}",
 
                  action="delete", conditions=dict(method=["DELETE"]))
 
        m.connect("admin_edit_setting", "/settings/{setting_id}/edit",
 
                  action="edit", conditions=dict(method=["GET"]))
 
        m.connect("formatted_admin_edit_setting",
rhodecode/controllers/home.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.controllers.home
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Home controller for Rhodecode
 

	
 
    :created_on: Feb 18, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program 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.
 
#
 
# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
import logging
 
from operator import itemgetter
 

	
 
from pylons import tmpl_context as c, request
 
from paste.httpexceptions import HTTPBadRequest
 

	
 
from rhodecode.lib.auth import LoginRequired
 
from rhodecode.lib.base import BaseController, render
 
from rhodecode.model.db import Group, Repository
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
class HomeController(BaseController):
 

	
 
    @LoginRequired()
 
    def __before__(self):
 
        super(HomeController, self).__before__()
 

	
 
    def index(self):
 

	
 
        c.repos_list = self.scm_model.get_repos()
 

	
 
        c.groups = Group.query().filter(Group.group_parent_id == None).all()
 

	
 
        return render('/index.html')
 

	
 
    def repo_switcher(self):
 
        if request.is_xhr:
 
            all_repos = Repository.query().order_by(Repository.repo_name).all()
 
            c.repos_list = self.scm_model.get_repos(all_repos,
 
                                                    sort_key='name_sort')
 
            return render('/repo_switcher_list.html')
 
        else:
 
            return HTTPBadRequest()
 

	
 
    def branch_tag_switcher(self, repo_name):
 
        if request.is_xhr:
 
            c.rhodecode_db_repo = Repository.get_by_repo_name(c.repo_name)
 
            c.rhodecode_repo = c.rhodecode_db_repo.scm_instance
 
            return render('/switch_to_list.html')
 
        else:
 
            return HTTPBadRequest()
 

	
rhodecode/controllers/summary.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.controllers.summary
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Summary controller for Rhodecode
 

	
 
    :created_on: Apr 18, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program 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.
 
#
 
# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
import traceback
 
import calendar
 
import logging
 
from time import mktime
 
from datetime import datetime, timedelta, date
 
from datetime import timedelta, date
 
from itertools import product
 

	
 
from vcs.exceptions import ChangesetError
 
from vcs.exceptions import ChangesetError, EmptyRepositoryError, \
 
    NodeDoesNotExistError
 

	
 
from pylons import tmpl_context as c, request, url
 
from pylons.i18n.translation import _
 

	
 
from rhodecode.model.db import Statistics, Repository
 
from rhodecode.model.repo import RepoModel
 
from beaker.cache import cache_region, region_invalidate
 

	
 
from rhodecode.model.db import Statistics, CacheInvalidation
 
from rhodecode.lib import ALL_READMES, ALL_EXTS
 
from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
 
from rhodecode.lib.base import BaseRepoController, render
 
from rhodecode.lib.utils import EmptyChangeset
 

	
 
from rhodecode.lib.markup_renderer import MarkupRenderer
 
from rhodecode.lib.celerylib import run_task
 
from rhodecode.lib.celerylib.tasks import get_commits_stats, \
 
    LANGUAGES_EXTENSIONS_MAP
 
from rhodecode.lib.helpers import RepoPage
 
from rhodecode.lib.compat import json, OrderedDict
 

	
 
log = logging.getLogger(__name__)
 

	
 
README_FILES = [''.join([x[0][0], x[1][0]]) for x in
 
                    sorted(list(product(ALL_READMES, ALL_EXTS)),
 
                           key=lambda y:y[0][1] + y[1][1])]
 

	
 
class SummaryController(BaseRepoController):
 

	
 
    @LoginRequired()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    def __before__(self):
 
        super(SummaryController, self).__before__()
 

	
 
    def index(self, repo_name):
 

	
 
        e = request.environ
 
        c.dbrepo = dbrepo = c.rhodecode_db_repo
 

	
 
        c.following = self.scm_model.is_following_repo(repo_name,
 
                                                self.rhodecode_user.user_id)
 

	
 
        def url_generator(**kw):
 
            return url('shortlog_home', repo_name=repo_name, size=10, **kw)
 

	
 
        c.repo_changesets = RepoPage(c.rhodecode_repo, page=1,
 
                                     items_per_page=10, url=url_generator)
 

	
 
        if self.rhodecode_user.username == 'default':
 
            #for default(anonymous) user we don't need to pass credentials
 
            username = ''
 
            password = ''
 
        else:
 
            username = str(self.rhodecode_user.username)
 
            password = '@'
 

	
 
        if e.get('wsgi.url_scheme') == 'https':
 
            split_s = 'https://'
 
        else:
 
            split_s = 'http://'
 

	
 
        qualified_uri = [split_s] + [url.current(qualified=True)\
 
                                     .split(split_s)[-1]]
 
        uri = u'%(proto)s%(user)s%(pass)s%(rest)s' \
 
                % {'user': username,
 
                     'pass': password,
 
                     'proto': qualified_uri[0],
 
                     'rest': qualified_uri[1]}
 
        c.clone_repo_url = uri
 
        c.repo_tags = OrderedDict()
 
        for name, hash in c.rhodecode_repo.tags.items()[:10]:
 
            try:
 
                c.repo_tags[name] = c.rhodecode_repo.get_changeset(hash)
 
            except ChangesetError:
 
                c.repo_tags[name] = EmptyChangeset(hash)
 

	
 
        c.repo_branches = OrderedDict()
 
        for name, hash in c.rhodecode_repo.branches.items()[:10]:
 
            try:
 
                c.repo_branches[name] = c.rhodecode_repo.get_changeset(hash)
 
            except ChangesetError:
 
                c.repo_branches[name] = EmptyChangeset(hash)
 

	
 
        td = date.today() + timedelta(days=1)
 
        td_1m = td - timedelta(days=calendar.mdays[td.month])
 
        td_1y = td - timedelta(days=365)
 

	
 
        ts_min_m = mktime(td_1m.timetuple())
 
        ts_min_y = mktime(td_1y.timetuple())
 
        ts_max_y = mktime(td.timetuple())
 

	
 
        if dbrepo.enable_statistics:
 
            c.no_data_msg = _('No data loaded yet')
 
            run_task(get_commits_stats, c.dbrepo.repo_name, ts_min_y, ts_max_y)
 
        else:
 
            c.no_data_msg = _('Statistics are disabled for this repository')
 
        c.ts_min = ts_min_m
 
        c.ts_max = ts_max_y
 

	
 
        stats = self.sa.query(Statistics)\
 
            .filter(Statistics.repository == dbrepo)\
 
            .scalar()
 

	
 
        c.stats_percentage = 0
 

	
 
        if stats and stats.languages:
 
            c.no_data = False is dbrepo.enable_statistics
 
            lang_stats_d = json.loads(stats.languages)
 
            c.commit_data = stats.commit_activity
 
            c.overview_data = stats.commit_activity_combined
 

	
 
            lang_stats = ((x, {"count": y,
 
                               "desc": LANGUAGES_EXTENSIONS_MAP.get(x)})
 
                          for x, y in lang_stats_d.items())
 

	
 
            c.trending_languages = json.dumps(OrderedDict(
 
                                       sorted(lang_stats, reverse=True,
 
                                            key=lambda k: k[1])[:10]
 
                                        )
 
                                    )
 
            last_rev = stats.stat_on_revision
 
            c.repo_last_rev = c.rhodecode_repo.count() - 1 \
 
                if c.rhodecode_repo.revisions else 0
 
            if last_rev == 0 or c.repo_last_rev == 0:
 
                pass
 
            else:
 
                c.stats_percentage = '%.2f' % ((float((last_rev)) /
 
                                                c.repo_last_rev) * 100)
 
        else:
 
            c.commit_data = json.dumps({})
 
            c.overview_data = json.dumps([[ts_min_y, 0], [ts_max_y, 10]])
 
            c.trending_languages = json.dumps({})
 
            c.no_data = True
 

	
 
        c.enable_downloads = dbrepo.enable_downloads
 
        if c.enable_downloads:
 
            c.download_options = self._get_download_links(c.rhodecode_repo)
 

	
 
        c.readme_data, c.readme_file = self.__get_readme_data(c.rhodecode_repo)
 
        return render('summary/summary.html')
 

	
 
    def __get_readme_data(self, repo):
 

	
 
        @cache_region('long_term')
 
        def _get_readme_from_cache(key):
 
            readme_data = None
 
            readme_file = None
 
            log.debug('Fetching readme file')
 
            try:
 
                cs = repo.get_changeset('tip')
 
                renderer = MarkupRenderer()
 
                for f in README_FILES:
 
                    try:
 
                        readme = cs.get_node(f)
 
                        readme_file = f
 
                        readme_data = renderer.render(readme.content, f)
 
                        log.debug('Found readme %s' % readme_file)
 
                        break
 
                    except NodeDoesNotExistError:
 
                        continue
 
            except ChangesetError:
 
                pass
 
            except EmptyRepositoryError:
 
                pass
 
            except Exception:
 
                log.error(traceback.format_exc())
 

	
 
            return readme_data, readme_file
 

	
 
        key = repo.name + '_README'
 
        inv = CacheInvalidation.invalidate(key)
 
        if inv is not None:
 
            region_invalidate(_get_readme_from_cache, None, key)
 
            CacheInvalidation.set_valid(inv.cache_key)
 
        return _get_readme_from_cache(key)
 

	
 
    def _get_download_links(self, repo):
 

	
 
        download_l = []
 

	
 
        branches_group = ([], _("Branches"))
 
        tags_group = ([], _("Tags"))
 

	
 
        for name, chs in c.rhodecode_repo.branches.items():
 
            #chs = chs.split(':')[-1]
 
            branches_group[0].append((chs, name),)
 
        download_l.append(branches_group)
 

	
 
        for name, chs in c.rhodecode_repo.tags.items():
 
            #chs = chs.split(':')[-1]
 
            tags_group[0].append((chs, name),)
 
        download_l.append(tags_group)
 

	
 
        return download_l
 

	
rhodecode/lib/__init__.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.lib.__init__
 
    ~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    Some simple helper functions
 

	
 
    :created_on: Jan 5, 2011
 
    :author: marcink
 
    :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program 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.
 
#
 
# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
import os
 

	
 
def __get_lem():
 
    from pygments import lexers
 
    from string import lower
 
    from collections import defaultdict
 

	
 
    d = defaultdict(lambda: [])
 

	
 
    def __clean(s):
 
        s = s.lstrip('*')
 
        s = s.lstrip('.')
 

	
 
        if s.find('[') != -1:
 
            exts = []
 
            start, stop = s.find('['), s.find(']')
 

	
 
            for suffix in s[start + 1:stop]:
 
                exts.append(s[:s.find('[')] + suffix)
 
            return map(lower, exts)
 
        else:
 
            return map(lower, [s])
 

	
 
    for lx, t in sorted(lexers.LEXERS.items()):
 
        m = map(__clean, t[-2])
 
        if m:
 
            m = reduce(lambda x, y: x + y, m)
 
            for ext in m:
 
                desc = lx.replace('Lexer', '')
 
                d[ext].append(desc)
 

	
 
    return dict(d)
 

	
 
# language map is also used by whoosh indexer, which for those specified
 
# extensions will index it's content
 
LANGUAGES_EXTENSIONS_MAP = __get_lem()
 

	
 
# Additional mappings that are not present in the pygments lexers
 
# NOTE: that this will overide any mappings in LANGUAGES_EXTENSIONS_MAP
 
ADDITIONAL_MAPPINGS = {'xaml': 'XAML'}
 

	
 
LANGUAGES_EXTENSIONS_MAP.update(ADDITIONAL_MAPPINGS)
 

	
 
# list of readme files to search in file tree and display in summary
 
# attached weights defines the search  order lower is first
 
ALL_READMES = [
 
    ('readme', 0), ('README', 0), ('Readme', 0),
 
    ('doc/readme', 1), ('doc/README', 1), ('doc/Readme', 1),
 
    ('Docs/readme', 2), ('Docs/README', 2), ('Docs/Readme', 2),
 
    ('DOCS/readme', 2), ('DOCS/README', 2), ('DOCS/Readme', 2),
 
    ('docs/readme', 2), ('docs/README', 2), ('docs/Readme', 2),
 
]
 

	
 
# extension together with weights to search lower is first
 
RST_EXTS = [
 
    ('', 0), ('.rst', 1),('.rest', 1),
 
    ('.RST', 2) ,('.REST', 2), 
 
    ('.txt', 3), ('.TXT', 3) 
 
]
 

	
 
MARKDOWN_EXTS = [
 
    ('.md', 1), ('.MD', 1),
 
    ('.mkdn', 2), ('.MKDN', 2),
 
    ('.mdown', 3), ('.MDOWN', 3),
 
    ('.markdown', 4), ('.MARKDOWN', 4)
 
]
 

	
 
PLAIN_EXTS = [('.text', 2),('.TEXT', 2)]
 

	
 
ALL_EXTS = MARKDOWN_EXTS + RST_EXTS + PLAIN_EXTS
 

	
 

	
 
def str2bool(_str):
 
    """
 
    returs True/False value from given string, it tries to translate the
 
    string into boolean
 

	
 
    :param _str: string value to translate into boolean
 
    :rtype: boolean
 
    :returns: boolean from given string
 
    """
 
    if _str is None:
 
        return False
 
    if _str in (True, False):
 
        return _str
 
    _str = str(_str).strip().lower()
 
    return _str in ('t', 'true', 'y', 'yes', 'on', '1')
 

	
 

	
 
def convert_line_endings(line, mode):
 
    """
 
    Converts a given line  "line end" accordingly to given mode
 
    
 
    Available modes are::
 
        0 - Unix
 
        1 - Mac
 
        2 - DOS
 
    
 
    :param line: given line to convert
 
    :param mode: mode to convert to
 
    :rtype: str
 
    :return: converted line according to mode
 
    """
 
    from string import replace
 

	
 
    if mode == 0:
 
            line = replace(line, '\r\n', '\n')
 
            line = replace(line, '\r', '\n')
 
    elif mode == 1:
 
            line = replace(line, '\r\n', '\r')
 
            line = replace(line, '\n', '\r')
 
    elif mode == 2:
 
            import re
 
            line = re.sub("\r(?!\n)|(?<!\r)\n", "\r\n", line)
 
    return line
 

	
 

	
 
def detect_mode(line, default):
 
    """
 
    Detects line break for given line, if line break couldn't be found
 
    given default value is returned
 

	
 
    :param line: str line
 
    :param default: default
 
    :rtype: int
 
    :return: value of line end on of 0 - Unix, 1 - Mac, 2 - DOS
 
    """
 
    if line.endswith('\r\n'):
 
        return 2
 
    elif line.endswith('\n'):
 
        return 0
 
    elif line.endswith('\r'):
 
        return 1
 
    else:
 
        return default
 

	
 

	
 
def generate_api_key(username, salt=None):
 
    """
 
    Generates unique API key for given username, if salt is not given
 
    it'll be generated from some random string
 

	
 
    :param username: username as string
 
    :param salt: salt to hash generate KEY
 
    :rtype: str
 
    :returns: sha1 hash from username+salt
 
    """
 
    from tempfile import _RandomNameSequence
 
    import hashlib
 

	
 
    if salt is None:
 
        salt = _RandomNameSequence().next()
 

	
 
    return hashlib.sha1(username + salt).hexdigest()
 

	
 

	
 
def safe_unicode(str_, from_encoding='utf8'):
 
    """
 
    safe unicode function. Does few trick to turn str_ into unicode
 
     
 
    In case of UnicodeDecode error we try to return it with encoding detected
 
    by chardet library if it fails fallback to unicode with errors replaced
 

	
 
    :param str_: string to decode
 
    :rtype: unicode
 
    :returns: unicode object
 
    """
 
    if isinstance(str_, unicode):
 
        return str_
 

	
 
    try:
 
        return unicode(str_)
 
    except UnicodeDecodeError:
 
        pass
 

	
 
    try:
 
        return unicode(str_, from_encoding)
 
    except UnicodeDecodeError:
 
        pass
 

	
 
    try:
 
        import chardet
 
        encoding = chardet.detect(str_)['encoding']
 
        if encoding is None:
 
            raise Exception()
 
        return str_.decode(encoding)
 
    except (ImportError, UnicodeDecodeError, Exception):
 
        return unicode(str_, from_encoding, 'replace')
 

	
 
def safe_str(unicode_, to_encoding='utf8'):
 
    """
 
    safe str function. Does few trick to turn unicode_ into string
 
     
 
    In case of UnicodeEncodeError we try to return it with encoding detected
 
    by chardet library if it fails fallback to string with errors replaced
 

	
 
    :param unicode_: unicode to encode
 
    :rtype: str
 
    :returns: str object
 
    """
 
    
 
    if not isinstance(unicode_, basestring):
 
        return str(unicode_)
 

	
 
    if isinstance(unicode_, str):
 
        return unicode_
 

	
 
    try:
 
        return unicode_.encode(to_encoding)
 
    except UnicodeEncodeError:
 
        pass
 

	
 
    try:
 
        import chardet
 
        encoding = chardet.detect(unicode_)['encoding']
 
        print encoding
 
        if encoding is None:
 
            raise UnicodeEncodeError()
 

	
 
        return unicode_.encode(encoding)
 
    except (ImportError, UnicodeEncodeError):
 
        return unicode_.encode(to_encoding, 'replace')
 

	
 
    return safe_str
 

	
 

	
 

	
 
def engine_from_config(configuration, prefix='sqlalchemy.', **kwargs):
 
    """
 
    Custom engine_from_config functions that makes sure we use NullPool for
 
    file based sqlite databases. This prevents errors on sqlite. This only 
 
    applies to sqlalchemy versions < 0.7.0
 

	
 
    """
 
    import sqlalchemy
 
    from sqlalchemy import engine_from_config as efc
 
    import logging
 

	
 
    if int(sqlalchemy.__version__.split('.')[1]) < 7:
 

	
 
        # This solution should work for sqlalchemy < 0.7.0, and should use
 
        # proxy=TimerProxy() for execution time profiling
 

	
 
        from sqlalchemy.pool import NullPool
 
        url = configuration[prefix + 'url']
 

	
 
        if url.startswith('sqlite'):
 
            kwargs.update({'poolclass': NullPool})
 
        return efc(configuration, prefix, **kwargs)
 
    else:
 
        import time
 
        from sqlalchemy import event
 
        from sqlalchemy.engine import Engine
 

	
 
        log = logging.getLogger('sqlalchemy.engine')
 
        BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = xrange(30, 38)
 
        engine = efc(configuration, prefix, **kwargs)
 

	
 
        def color_sql(sql):
 
            COLOR_SEQ = "\033[1;%dm"
 
            COLOR_SQL = YELLOW
 
            normal = '\x1b[0m'
 
            return ''.join([COLOR_SEQ % COLOR_SQL, sql, normal])
 

	
 
        if configuration['debug']:
 
            #attach events only for debug configuration
 

	
 
            def before_cursor_execute(conn, cursor, statement,
 
                                    parameters, context, executemany):
 
                context._query_start_time = time.time()
 
                log.info(color_sql(">>>>> STARTING QUERY >>>>>"))
 

	
 

	
 
            def after_cursor_execute(conn, cursor, statement,
 
                                    parameters, context, executemany):
 
                total = time.time() - context._query_start_time
 
                log.info(color_sql("<<<<< TOTAL TIME: %f <<<<<" % total))
 

	
 
            event.listen(engine, "before_cursor_execute",
 
                         before_cursor_execute)
 
            event.listen(engine, "after_cursor_execute",
 
                         after_cursor_execute)
 

	
 
    return engine
 

	
 

	
 
def age(curdate):
 
    """
 
    turns a datetime into an age string.
 
    
 
    :param curdate: datetime object
 
    :rtype: unicode
 
    :returns: unicode words describing age
 
    """
 

	
 
    from datetime import datetime
 
    from webhelpers.date import time_ago_in_words
 

	
 
    _ = lambda s:s
 

	
 
    if not curdate:
 
        return ''
 

	
 
    agescales = [(_(u"year"), 3600 * 24 * 365),
 
                 (_(u"month"), 3600 * 24 * 30),
 
                 (_(u"day"), 3600 * 24),
 
                 (_(u"hour"), 3600),
 
                 (_(u"minute"), 60),
 
                 (_(u"second"), 1), ]
 

	
 
    age = datetime.now() - curdate
 
    age_seconds = (age.days * agescales[2][1]) + age.seconds
 
    pos = 1
 
    for scale in agescales:
 
        if scale[1] <= age_seconds:
 
            if pos == 6:pos = 5
 
            return '%s %s' % (time_ago_in_words(curdate,
 
                                                agescales[pos][0]), _('ago'))
 
        pos += 1
 

	
 
    return _(u'just now')
 

	
 

	
 
def uri_filter(uri):
 
    """
 
    Removes user:password from given url string
 
    
 
    :param uri:
 
    :rtype: unicode
 
    :returns: filtered list of strings  
 
    """
 
    if not uri:
 
        return ''
 

	
 
    proto = ''
 

	
 
    for pat in ('https://', 'http://'):
 
        if uri.startswith(pat):
 
            uri = uri[len(pat):]
 
            proto = pat
 
            break
 

	
 
    # remove passwords and username
 
    uri = uri[uri.find('@') + 1:]
 

	
 
    # get the port
 
    cred_pos = uri.find(':')
 
    if cred_pos == -1:
 
        host, port = uri, None
 
    else:
 
        host, port = uri[:cred_pos], uri[cred_pos + 1:]
 

	
 
    return filter(None, [proto, host, port])
 

	
 

	
 
def credentials_filter(uri):
 
    """
 
    Returns a url with removed credentials
 
    
 
    :param uri:
 
    """
 

	
 
    uri = uri_filter(uri)
 
    #check if we have port
 
    if len(uri) > 2 and uri[2]:
 
        uri[2] = ':' + uri[2]
 

	
 
    return ''.join(uri)
 

	
 
def get_changeset_safe(repo, rev):
 
    """
 
    Safe version of get_changeset if this changeset doesn't exists for a 
 
    repo it returns a Dummy one instead
 
    
 
    :param repo:
 
    :param rev:
 
    """
 
    from vcs.backends.base import BaseRepository
 
    from vcs.exceptions import RepositoryError
 
    if not isinstance(repo, BaseRepository):
 
        raise Exception('You must pass an Repository '
 
                        'object as first argument got %s', type(repo))
 

	
 
    try:
 
        cs = repo.get_changeset(rev)
 
    except RepositoryError:
 
        from rhodecode.lib.utils import EmptyChangeset
 
        cs = EmptyChangeset(requested_revision=rev)
 
    return cs
 

	
 

	
 
def get_current_revision(quiet=False):
 
    """
 
    Returns tuple of (number, id) from repository containing this package
 
    or None if repository could not be found.
rhodecode/lib/base.py
Show inline comments
 
"""The base Controller API
 

	
 
Provides the BaseController class for subclassing.
 
"""
 
import logging
 

	
 
import time
 
from pylons import config, tmpl_context as c, request, session, url
 
from pylons.controllers import WSGIController
 
from pylons.controllers.util import redirect
 
from pylons.templating import render_mako as render
 
from paste.deploy.converters import asbool
 

	
 
from rhodecode import __version__
 
from rhodecode.lib.auth import AuthUser, get_container_username
 
from rhodecode.lib.utils import get_repo_slug
 
from rhodecode.model import meta
 
from rhodecode.model.scm import ScmModel
 
from rhodecode import BACKENDS
 
from rhodecode.model.db import Repository
 

	
 
log = logging.getLogger(__name__)
 

	
 
class BaseController(WSGIController):
 

	
 
    def __before__(self):
 
        c.rhodecode_version = __version__
 
        c.rhodecode_name = config.get('rhodecode_title')
 
        c.ga_code = config.get('rhodecode_ga_code')
 
        c.repo_name = get_repo_slug(request)
 
        c.backends = BACKENDS.keys()
 
        self.cut_off_limit = int(config.get('cut_off_limit'))
 

	
 
        self.sa = meta.Session()
 
        self.scm_model = ScmModel(self.sa)
 

	
 
        #c.unread_journal = scm_model.get_unread_journal()
 

	
 
    def __call__(self, environ, start_response):
 
        """Invoke the Controller"""
 
        # WSGIController.__call__ dispatches to the Controller method
 
        # the request is routed to. This routing information is
 
        # available in environ['pylons.routes_dict']
 
        start = time.time()
 
        try:
 
            # putting this here makes sure that we update permissions each time
 
            api_key = request.GET.get('api_key')
 
            user_id = getattr(session.get('rhodecode_user'), 'user_id', None)
 
            if asbool(config.get('container_auth_enabled', False)):
 
                username = get_container_username(environ)
 
            else:
 
                username = None
 

	
 
            self.rhodecode_user = c.rhodecode_user = AuthUser(user_id, api_key, username)
 
            if not self.rhodecode_user.is_authenticated and \
 
                       self.rhodecode_user.user_id is not None:
 
                self.rhodecode_user.set_authenticated(
 
                                        getattr(session.get('rhodecode_user'),
 
                                       'is_authenticated', False))
 
            session['rhodecode_user'] = self.rhodecode_user
 
            session.save()
 
            return WSGIController.__call__(self, environ, start_response)
 
        finally:
 
            log.debug('Request time: %.3fs' % (time.time()-start))
 
            meta.Session.remove()
 

	
 

	
 
class BaseRepoController(BaseController):
 
    """
 
    Base class for controllers responsible for loading all needed data
 
    for those controllers, loaded items are
 

	
 
    c.rhodecode_repo: instance of scm repository (taken from cache)
 

	
 
    """
 

	
 
    def __before__(self):
 
        super(BaseRepoController, self).__before__()
 
        if c.repo_name:
 

	
 
            c.rhodecode_db_repo = Repository.get_by_repo_name(c.repo_name)
 
            c.rhodecode_repo = c.rhodecode_db_repo.scm_instance
 

	
 
            if c.rhodecode_repo is None:
 
                log.error('%s this repository is present in database but it '
 
                          'cannot be created as an scm instance', c.repo_name)
 

	
 
                redirect(url('home'))
 

	
 
            c.repository_followers = \
 
                self.scm_model.get_followers(c.repo_name)
 
            c.repository_forks = self.scm_model.get_forks(c.repo_name)
 

	
rhodecode/lib/celerylib/__init__.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.lib.celerylib.__init__
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    celery libs for RhodeCode
 

	
 
    :created_on: Nov 27, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program 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.
 
#
 
# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
import os
 
import sys
 
import socket
 
import traceback
 
import logging
 
from os.path import dirname as dn, join as jn
 

	
 
from hashlib import md5
 
from decorator import decorator
 
from pylons import  config
 

	
 
from vcs.utils.lazy import LazyProperty
 

	
 
from rhodecode.lib import str2bool
 
from rhodecode.lib import str2bool, safe_str
 
from rhodecode.lib.pidlock import DaemonLock, LockHeld
 

	
 
from celery.messaging import establish_connection
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 
try:
 
    CELERY_ON = str2bool(config['app_conf'].get('use_celery'))
 
except KeyError:
 
    CELERY_ON = False
 

	
 

	
 
class ResultWrapper(object):
 
    def __init__(self, task):
 
        self.task = task
 

	
 
    @LazyProperty
 
    def result(self):
 
        return self.task
 

	
 

	
 
def run_task(task, *args, **kwargs):
 
    if CELERY_ON:
 
        try:
 
            t = task.apply_async(args=args, kwargs=kwargs)
 
            log.info('running task %s:%s', t.task_id, task)
 
            return t
 

	
 
        except socket.error, e:
 
            if isinstance(e, IOError) and e.errno == 111:
 
                log.debug('Unable to connect to celeryd. Sync execution')
 
            else:
 
                log.error(traceback.format_exc())
 
        except KeyError, e:
 
                log.debug('Unable to connect to celeryd. Sync execution')
 
        except Exception, e:
 
            log.error(traceback.format_exc())
 

	
 
    log.debug('executing task %s in sync mode', task)
 
    return ResultWrapper(task(*args, **kwargs))
 

	
 

	
 
def __get_lockkey(func, *fargs, **fkwargs):
 
    params = list(fargs)
 
    params.extend(['%s-%s' % ar for ar in fkwargs.items()])
 

	
 
    func_name = str(func.__name__) if hasattr(func, '__name__') else str(func)
 

	
 
    lockkey = 'task_%s.lock' % \
 
        md5(func_name + '-' + '-'.join(map(str, params))).hexdigest()
 
        md5(func_name + '-' + '-'.join(map(safe_str, params))).hexdigest()
 
    return lockkey
 

	
 

	
 
def locked_task(func):
 
    def __wrapper(func, *fargs, **fkwargs):
 
        lockkey = __get_lockkey(func, *fargs, **fkwargs)
 
        lockkey_path = config['here']
 

	
 
        log.info('running task with lockkey %s', lockkey)
 
        try:
 
            l = DaemonLock(file_=jn(lockkey_path, lockkey))
 
            ret = func(*fargs, **fkwargs)
 
            l.release()
 
            return ret
 
        except LockHeld:
 
            log.info('LockHeld')
 
            return 'Task with key %s already running' % lockkey
 

	
 
    return decorator(__wrapper, func)
rhodecode/lib/markup_renderer.py
Show inline comments
 
new file 100644
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.lib.markup_renderer
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
    
 
    Renderer for markup languages with ability to parse using rst or markdown
 
    
 
    :created_on: Oct 27, 2011
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program 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.
 
#
 
# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
import re
 
import logging
 

	
 
from rhodecode.lib import safe_unicode
 

	
 
log = logging.getLogger(__name__)
 

	
 
class MarkupRenderer(object):
 
    RESTRUCTUREDTEXT_DISALLOWED_DIRECTIVES = ['include', 'meta', 'raw']
 
    
 
    MARKDOWN_PAT = re.compile(r'md|mkdn?|mdown|markdown',re.IGNORECASE)
 
    RST_PAT = re.compile(r're?st',re.IGNORECASE)
 
    PLAIN_PAT = re.compile(r'readme',re.IGNORECASE)
 
    
 
    def __detect_renderer(self, source, filename=None):
 
        """
 
        runs detection of what renderer should be used for generating html
 
        from a markup language
 
        
 
        filename can be also explicitly a renderer name
 
        
 
        :param source:
 
        :param filename:
 
        """
 

	
 
        if MarkupRenderer.MARKDOWN_PAT.findall(filename):
 
            detected_renderer = 'markdown'
 
        elif MarkupRenderer.RST_PAT.findall(filename):
 
            detected_renderer = 'rst'
 
        elif MarkupRenderer.PLAIN_PAT.findall(filename):
 
            detected_renderer = 'rst'
 
        else:
 
            detected_renderer = 'plain'
 

	
 
        return getattr(MarkupRenderer, detected_renderer)
 

	
 

	
 
    def render(self, source, filename=None):
 
        """
 
        Renders a given filename using detected renderer
 
        it detects renderers based on file extension or mimetype.
 
        At last it will just do a simple html replacing new lines with <br/>
 
        
 
        :param file_name:
 
        :param source:
 
        """
 

	
 
        renderer = self.__detect_renderer(source, filename)
 
        readme_data = renderer(source)
 
        return readme_data
 

	
 
    @classmethod
 
    def plain(cls, source):
 
        source = safe_unicode(source)
 
        def urlify_text(text):
 
            url_pat = re.compile(r'(http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]'
 
                                 '|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)')
 

	
 
            def url_func(match_obj):
 
                url_full = match_obj.groups()[0]
 
                return '<a href="%(url)s">%(url)s</a>' % ({'url':url_full})
 

	
 
            return url_pat.sub(url_func, text)
 

	
 
        source = urlify_text(source)
 
        return '<br />' + source.replace("\n", '<br />')
 

	
 

	
 
    @classmethod
 
    def markdown(cls, source):
 
        source = safe_unicode(source)
 
        try:
 
            import markdown as __markdown
 
            return __markdown.markdown(source)
 
        except ImportError:
 
            log.warning('Install markdown to use this function')
 
            return cls.plain(source)
 

	
 

	
 
    @classmethod
 
    def rst(cls, source):
 
        source = safe_unicode(source)
 
        try:
 
            from docutils.core import publish_parts
 
            from docutils.parsers.rst import directives
 
            docutils_settings = dict([(alias, None) for alias in
 
                                cls.RESTRUCTUREDTEXT_DISALLOWED_DIRECTIVES])
 

	
 
            docutils_settings.update({'input_encoding': 'unicode',
 
                                      'report_level':4})
 

	
 
            for k, v in docutils_settings.iteritems():
 
                directives.register_directive(k, v)
 

	
 
            parts = publish_parts(source=source,
 
                                  writer_name="html4css1",
 
                                  settings_overrides=docutils_settings)
 

	
 
            return parts['html_title'] + parts["fragment"]
 
        except ImportError:
 
            log.warning('Install docutils to use this function')
 
            return cls.plain(source)
 

	
rhodecode/model/db.py
Show inline comments
 
@@ -474,596 +474,625 @@ class UsersGroupMember(Base, BaseModel):
 
        self.user_id = u_id
 

	
 
    @staticmethod
 
    def add_user_to_group(group, user):
 
        ugm = UsersGroupMember()
 
        ugm.users_group = group
 
        ugm.user = user
 
        Session.add(ugm)
 
        Session.commit()
 
        return ugm
 

	
 
class Repository(Base, BaseModel):
 
    __tablename__ = 'repositories'
 
    __table_args__ = (UniqueConstraint('repo_name'), {'extend_existing':True},)
 

	
 
    repo_id = Column("repo_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
    repo_name = Column("repo_name", String(length=255, convert_unicode=False, assert_unicode=None), nullable=False, unique=True, default=None)
 
    clone_uri = Column("clone_uri", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=False, default=None)
 
    repo_type = Column("repo_type", String(length=255, convert_unicode=False, assert_unicode=None), nullable=False, unique=False, default='hg')
 
    user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=False, default=None)
 
    private = Column("private", Boolean(), nullable=True, unique=None, default=None)
 
    enable_statistics = Column("statistics", Boolean(), nullable=True, unique=None, default=True)
 
    enable_downloads = Column("downloads", Boolean(), nullable=True, unique=None, default=True)
 
    description = Column("description", String(length=10000, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    created_on = Column('created_on', DateTime(timezone=False), nullable=True, unique=None, default=datetime.datetime.now)
 

	
 
    fork_id = Column("fork_id", Integer(), ForeignKey('repositories.repo_id'), nullable=True, unique=False, default=None)
 
    group_id = Column("group_id", Integer(), ForeignKey('groups.group_id'), nullable=True, unique=False, default=None)
 

	
 

	
 
    user = relationship('User')
 
    fork = relationship('Repository', remote_side=repo_id)
 
    group = relationship('Group')
 
    repo_to_perm = relationship('RepoToPerm', cascade='all', order_by='RepoToPerm.repo_to_perm_id')
 
    users_group_to_perm = relationship('UsersGroupRepoToPerm', cascade='all')
 
    stats = relationship('Statistics', cascade='all', uselist=False)
 

	
 
    followers = relationship('UserFollowing', primaryjoin='UserFollowing.follows_repo_id==Repository.repo_id', cascade='all')
 

	
 
    logs = relationship('UserLog', cascade='all')
 

	
 
    def __repr__(self):
 
        return "<%s('%s:%s')>" % (self.__class__.__name__,
 
                                  self.repo_id, self.repo_name)
 

	
 
    @classmethod
 
    def url_sep(cls):
 
        return '/'
 

	
 
    @classmethod
 
    def get_by_repo_name(cls, repo_name):
 
        q = Session.query(cls).filter(cls.repo_name == repo_name)
 
        q = q.options(joinedload(Repository.fork))\
 
                .options(joinedload(Repository.user))\
 
                .options(joinedload(Repository.group))
 
        return q.one()
 

	
 
    @classmethod
 
    def get_repo_forks(cls, repo_id):
 
        return cls.query().filter(Repository.fork_id == repo_id)
 

	
 
    @classmethod
 
    def base_path(cls):
 
        """
 
        Returns base path when all repos are stored
 

	
 
        :param cls:
 
        """
 
        q = Session.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key ==
 
                                              cls.url_sep())
 
        q.options(FromCache("sql_cache_short", "repository_repo_path"))
 
        return q.one().ui_value
 

	
 
    @property
 
    def just_name(self):
 
        return self.repo_name.split(Repository.url_sep())[-1]
 

	
 
    @property
 
    def groups_with_parents(self):
 
        groups = []
 
        if self.group is None:
 
            return groups
 

	
 
        cur_gr = self.group
 
        groups.insert(0, cur_gr)
 
        while 1:
 
            gr = getattr(cur_gr, 'parent_group', None)
 
            cur_gr = cur_gr.parent_group
 
            if gr is None:
 
                break
 
            groups.insert(0, gr)
 

	
 
        return groups
 

	
 
    @property
 
    def groups_and_repo(self):
 
        return self.groups_with_parents, self.just_name
 

	
 
    @LazyProperty
 
    def repo_path(self):
 
        """
 
        Returns base full path for that repository means where it actually
 
        exists on a filesystem
 
        """
 
        q = Session.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key ==
 
                                              Repository.url_sep())
 
        q.options(FromCache("sql_cache_short", "repository_repo_path"))
 
        return q.one().ui_value
 

	
 
    @property
 
    def repo_full_path(self):
 
        p = [self.repo_path]
 
        # we need to split the name by / since this is how we store the
 
        # names in the database, but that eventually needs to be converted
 
        # into a valid system path
 
        p += self.repo_name.split(Repository.url_sep())
 
        return os.path.join(*p)
 

	
 
    def get_new_name(self, repo_name):
 
        """
 
        returns new full repository name based on assigned group and new new
 

	
 
        :param group_name:
 
        """
 
        path_prefix = self.group.full_path_splitted if self.group else []
 
        return Repository.url_sep().join(path_prefix + [repo_name])
 

	
 
    @property
 
    def _ui(self):
 
        """
 
        Creates an db based ui object for this repository
 
        """
 
        from mercurial import ui
 
        from mercurial import config
 
        baseui = ui.ui()
 

	
 
        #clean the baseui object
 
        baseui._ocfg = config.config()
 
        baseui._ucfg = config.config()
 
        baseui._tcfg = config.config()
 

	
 

	
 
        ret = RhodeCodeUi.query()\
 
            .options(FromCache("sql_cache_short", "repository_repo_ui")).all()
 

	
 
        hg_ui = ret
 
        for ui_ in hg_ui:
 
            if ui_.ui_active:
 
                log.debug('settings ui from db[%s]%s:%s', ui_.ui_section,
 
                          ui_.ui_key, ui_.ui_value)
 
                baseui.setconfig(ui_.ui_section, ui_.ui_key, ui_.ui_value)
 

	
 
        return baseui
 

	
 
    @classmethod
 
    def is_valid(cls, repo_name):
 
        """
 
        returns True if given repo name is a valid filesystem repository
 

	
 
        @param cls:
 
        @param repo_name:
 
        """
 
        from rhodecode.lib.utils import is_valid_repo
 

	
 
        return is_valid_repo(repo_name, cls.base_path())
 

	
 

	
 
    #==========================================================================
 
    # SCM PROPERTIES
 
    #==========================================================================
 

	
 
    def get_changeset(self, rev):
 
        return get_changeset_safe(self.scm_instance, rev)
 

	
 
    @property
 
    def tip(self):
 
        return self.get_changeset('tip')
 

	
 
    @property
 
    def author(self):
 
        return self.tip.author
 

	
 
    @property
 
    def last_change(self):
 
        return self.scm_instance.last_change
 

	
 
    #==========================================================================
 
    # SCM CACHE INSTANCE
 
    #==========================================================================
 

	
 
    @property
 
    def invalidate(self):
 
        """
 
        Returns Invalidation object if this repo should be invalidated
 
        None otherwise. `cache_active = False` means that this cache
 
        state is not valid and needs to be invalidated
 
        """
 
        return CacheInvalidation.query()\
 
            .filter(CacheInvalidation.cache_key == self.repo_name)\
 
            .filter(CacheInvalidation.cache_active == False)\
 
            .scalar()
 
        return CacheInvalidation.invalidate(self.repo_name)
 

	
 
    def set_invalidate(self):
 
        """
 
        set a cache for invalidation for this instance
 
        """
 
        inv = CacheInvalidation.query()\
 
            .filter(CacheInvalidation.cache_key == self.repo_name)\
 
            .scalar()
 

	
 
        if inv is None:
 
            inv = CacheInvalidation(self.repo_name)
 
        inv.cache_active = True
 
        Session.add(inv)
 
        Session.commit()
 
        CacheInvalidation.set_invalidate(self.repo_name)
 

	
 
    @LazyProperty
 
    def scm_instance(self):
 
        return self.__get_instance()
 

	
 
    @property
 
    def scm_instance_cached(self):
 
        @cache_region('long_term')
 
        def _c(repo_name):
 
            return self.__get_instance()
 

	
 
        # TODO: remove this trick when beaker 1.6 is released
 
        # and have fixed this issue with not supporting unicode keys
 
        rn = safe_str(self.repo_name)
 
        rn = self.repo_name
 

	
 
        inv = self.invalidate
 
        if inv is not None:
 
            region_invalidate(_c, None, rn)
 
            # update our cache
 
            inv.cache_active = True
 
            Session.add(inv)
 
            Session.commit()
 

	
 
            CacheInvalidation.set_valid(inv.cache_key)
 
        return _c(rn)
 

	
 
    def __get_instance(self):
 

	
 
        repo_full_path = self.repo_full_path
 

	
 
        try:
 
            alias = get_scm(repo_full_path)[0]
 
            log.debug('Creating instance of %s repository', alias)
 
            backend = get_backend(alias)
 
        except VCSError:
 
            log.error(traceback.format_exc())
 
            log.error('Perhaps this repository is in db and not in '
 
                      'filesystem run rescan repositories with '
 
                      '"destroy old data " option from admin panel')
 
            return
 

	
 
        if alias == 'hg':
 

	
 
            repo = backend(safe_str(repo_full_path), create=False,
 
                           baseui=self._ui)
 
            #skip hidden web repository
 
            # skip hidden web repository
 
            if repo._get_hidden():
 
                return
 
        else:
 
            repo = backend(repo_full_path, create=False)
 

	
 
        return repo
 

	
 

	
 
class Group(Base, BaseModel):
 
    __tablename__ = 'groups'
 
    __table_args__ = (UniqueConstraint('group_name', 'group_parent_id'),
 
                      CheckConstraint('group_id != group_parent_id'), {'extend_existing':True},)
 
    __mapper_args__ = {'order_by':'group_name'}
 

	
 
    group_id = Column("group_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
    group_name = Column("group_name", String(length=255, convert_unicode=False, assert_unicode=None), nullable=False, unique=True, default=None)
 
    group_parent_id = Column("group_parent_id", Integer(), ForeignKey('groups.group_id'), nullable=True, unique=None, default=None)
 
    group_description = Column("group_description", String(length=10000, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 

	
 
    parent_group = relationship('Group', remote_side=group_id)
 

	
 

	
 
    def __init__(self, group_name='', parent_group=None):
 
        self.group_name = group_name
 
        self.parent_group = parent_group
 

	
 
    def __repr__(self):
 
        return "<%s('%s:%s')>" % (self.__class__.__name__, self.group_id,
 
                                  self.group_name)
 

	
 
    @classmethod
 
    def groups_choices(cls):
 
        from webhelpers.html import literal as _literal
 
        repo_groups = [('', '')]
 
        sep = ' &raquo; '
 
        _name = lambda k: _literal(sep.join(k))
 

	
 
        repo_groups.extend([(x.group_id, _name(x.full_path_splitted))
 
                              for x in cls.query().all()])
 

	
 
        repo_groups = sorted(repo_groups, key=lambda t: t[1].split(sep)[0])
 
        return repo_groups
 

	
 
    @classmethod
 
    def url_sep(cls):
 
        return '/'
 

	
 
    @classmethod
 
    def get_by_group_name(cls, group_name, cache=False, case_insensitive=False):
 
        if case_insensitive:
 
            gr = cls.query()\
 
                .filter(cls.group_name.ilike(group_name))
 
        else:
 
            gr = cls.query()\
 
                .filter(cls.group_name == group_name)
 
        if cache:
 
            gr = gr.options(FromCache("sql_cache_short",
 
                                          "get_group_%s" % group_name))
 
        return gr.scalar()
 

	
 
    @property
 
    def parents(self):
 
        parents_recursion_limit = 5
 
        groups = []
 
        if self.parent_group is None:
 
            return groups
 
        cur_gr = self.parent_group
 
        groups.insert(0, cur_gr)
 
        cnt = 0
 
        while 1:
 
            cnt += 1
 
            gr = getattr(cur_gr, 'parent_group', None)
 
            cur_gr = cur_gr.parent_group
 
            if gr is None:
 
                break
 
            if cnt == parents_recursion_limit:
 
                # this will prevent accidental infinit loops
 
                log.error('group nested more than %s' %
 
                          parents_recursion_limit)
 
                break
 

	
 
            groups.insert(0, gr)
 
        return groups
 

	
 
    @property
 
    def children(self):
 
        return Group.query().filter(Group.parent_group == self)
 

	
 
    @property
 
    def name(self):
 
        return self.group_name.split(Group.url_sep())[-1]
 

	
 
    @property
 
    def full_path(self):
 
        return self.group_name
 

	
 
    @property
 
    def full_path_splitted(self):
 
        return self.group_name.split(Group.url_sep())
 

	
 
    @property
 
    def repositories(self):
 
        return Repository.query().filter(Repository.group == self)
 

	
 
    @property
 
    def repositories_recursive_count(self):
 
        cnt = self.repositories.count()
 

	
 
        def children_count(group):
 
            cnt = 0
 
            for child in group.children:
 
                cnt += child.repositories.count()
 
                cnt += children_count(child)
 
            return cnt
 

	
 
        return cnt + children_count(self)
 

	
 

	
 
    def get_new_name(self, group_name):
 
        """
 
        returns new full group name based on parent and new name
 

	
 
        :param group_name:
 
        """
 
        path_prefix = (self.parent_group.full_path_splitted if 
 
        path_prefix = (self.parent_group.full_path_splitted if
 
                       self.parent_group else [])
 
        return Group.url_sep().join(path_prefix + [group_name])
 

	
 

	
 
class Permission(Base, BaseModel):
 
    __tablename__ = 'permissions'
 
    __table_args__ = {'extend_existing':True}
 
    permission_id = Column("permission_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
    permission_name = Column("permission_name", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    permission_longname = Column("permission_longname", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 

	
 
    def __repr__(self):
 
        return "<%s('%s:%s')>" % (self.__class__.__name__,
 
                                  self.permission_id, self.permission_name)
 

	
 
    @classmethod
 
    def get_by_key(cls, key):
 
        return cls.query().filter(cls.permission_name == key).scalar()
 

	
 
class RepoToPerm(Base, BaseModel):
 
    __tablename__ = 'repo_to_perm'
 
    __table_args__ = (UniqueConstraint('user_id', 'repository_id'), {'extend_existing':True})
 
    repo_to_perm_id = Column("repo_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
    user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None)
 
    permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
 
    repository_id = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=False, unique=None, default=None)
 

	
 
    user = relationship('User')
 
    permission = relationship('Permission')
 
    repository = relationship('Repository')
 

	
 
class UserToPerm(Base, BaseModel):
 
    __tablename__ = 'user_to_perm'
 
    __table_args__ = (UniqueConstraint('user_id', 'permission_id'), {'extend_existing':True})
 
    user_to_perm_id = Column("user_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
    user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None)
 
    permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
 

	
 
    user = relationship('User')
 
    permission = relationship('Permission')
 

	
 
    @classmethod
 
    def has_perm(cls, user_id, perm):
 
        if not isinstance(perm, Permission):
 
            raise Exception('perm needs to be an instance of Permission class')
 

	
 
        return cls.query().filter(cls.user_id == user_id)\
 
            .filter(cls.permission == perm).scalar() is not None
 

	
 
    @classmethod
 
    def grant_perm(cls, user_id, perm):
 
        if not isinstance(perm, Permission):
 
            raise Exception('perm needs to be an instance of Permission class')
 

	
 
        new = cls()
 
        new.user_id = user_id
 
        new.permission = perm
 
        try:
 
            Session.add(new)
 
            Session.commit()
 
        except:
 
            Session.rollback()
 

	
 

	
 
    @classmethod
 
    def revoke_perm(cls, user_id, perm):
 
        if not isinstance(perm, Permission):
 
            raise Exception('perm needs to be an instance of Permission class')
 

	
 
        try:
 
            cls.query().filter(cls.user_id == user_id)\
 
                .filter(cls.permission == perm).delete()
 
            Session.commit()
 
        except:
 
            Session.rollback()
 

	
 
class UsersGroupRepoToPerm(Base, BaseModel):
 
    __tablename__ = 'users_group_repo_to_perm'
 
    __table_args__ = (UniqueConstraint('repository_id', 'users_group_id', 'permission_id'), {'extend_existing':True})
 
    users_group_to_perm_id = Column("users_group_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
    users_group_id = Column("users_group_id", Integer(), ForeignKey('users_groups.users_group_id'), nullable=False, unique=None, default=None)
 
    permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
 
    repository_id = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=False, unique=None, default=None)
 

	
 
    users_group = relationship('UsersGroup')
 
    permission = relationship('Permission')
 
    repository = relationship('Repository')
 

	
 
    def __repr__(self):
 
        return '<userGroup:%s => %s >' % (self.users_group, self.repository)
 

	
 
class UsersGroupToPerm(Base, BaseModel):
 
    __tablename__ = 'users_group_to_perm'
 
    users_group_to_perm_id = Column("users_group_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
    users_group_id = Column("users_group_id", Integer(), ForeignKey('users_groups.users_group_id'), nullable=False, unique=None, default=None)
 
    permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
 

	
 
    users_group = relationship('UsersGroup')
 
    permission = relationship('Permission')
 

	
 

	
 
    @classmethod
 
    def has_perm(cls, users_group_id, perm):
 
        if not isinstance(perm, Permission):
 
            raise Exception('perm needs to be an instance of Permission class')
 

	
 
        return cls.query().filter(cls.users_group_id ==
 
                                         users_group_id)\
 
                                         .filter(cls.permission == perm)\
 
                                         .scalar() is not None
 

	
 
    @classmethod
 
    def grant_perm(cls, users_group_id, perm):
 
        if not isinstance(perm, Permission):
 
            raise Exception('perm needs to be an instance of Permission class')
 

	
 
        new = cls()
 
        new.users_group_id = users_group_id
 
        new.permission = perm
 
        try:
 
            Session.add(new)
 
            Session.commit()
 
        except:
 
            Session.rollback()
 

	
 

	
 
    @classmethod
 
    def revoke_perm(cls, users_group_id, perm):
 
        if not isinstance(perm, Permission):
 
            raise Exception('perm needs to be an instance of Permission class')
 

	
 
        try:
 
            cls.query().filter(cls.users_group_id == users_group_id)\
 
                .filter(cls.permission == perm).delete()
 
            Session.commit()
 
        except:
 
            Session.rollback()
 

	
 

	
 
class GroupToPerm(Base, BaseModel):
 
    __tablename__ = 'group_to_perm'
 
    __table_args__ = (UniqueConstraint('group_id', 'permission_id'), {'extend_existing':True})
 

	
 
    group_to_perm_id = Column("group_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
    user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None)
 
    permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
 
    group_id = Column("group_id", Integer(), ForeignKey('groups.group_id'), nullable=False, unique=None, default=None)
 

	
 
    user = relationship('User')
 
    permission = relationship('Permission')
 
    group = relationship('Group')
 

	
 
class Statistics(Base, BaseModel):
 
    __tablename__ = 'statistics'
 
    __table_args__ = (UniqueConstraint('repository_id'), {'extend_existing':True})
 
    stat_id = Column("stat_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
    repository_id = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=False, unique=True, default=None)
 
    stat_on_revision = Column("stat_on_revision", Integer(), nullable=False)
 
    commit_activity = Column("commit_activity", LargeBinary(1000000), nullable=False)#JSON data
 
    commit_activity_combined = Column("commit_activity_combined", LargeBinary(), nullable=False)#JSON data
 
    languages = Column("languages", LargeBinary(1000000), nullable=False)#JSON data
 

	
 
    repository = relationship('Repository', single_parent=True)
 

	
 
class UserFollowing(Base, BaseModel):
 
    __tablename__ = 'user_followings'
 
    __table_args__ = (UniqueConstraint('user_id', 'follows_repository_id'),
 
                      UniqueConstraint('user_id', 'follows_user_id')
 
                      , {'extend_existing':True})
 

	
 
    user_following_id = Column("user_following_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
    user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None)
 
    follows_repo_id = Column("follows_repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=True, unique=None, default=None)
 
    follows_user_id = Column("follows_user_id", Integer(), ForeignKey('users.user_id'), nullable=True, unique=None, default=None)
 
    follows_from = Column('follows_from', DateTime(timezone=False), nullable=True, unique=None, default=datetime.datetime.now)
 

	
 
    user = relationship('User', primaryjoin='User.user_id==UserFollowing.user_id')
 

	
 
    follows_user = relationship('User', primaryjoin='User.user_id==UserFollowing.follows_user_id')
 
    follows_repository = relationship('Repository', order_by='Repository.repo_name')
 

	
 

	
 
    @classmethod
 
    def get_repo_followers(cls, repo_id):
 
        return cls.query().filter(cls.follows_repo_id == repo_id)
 

	
 
class CacheInvalidation(Base, BaseModel):
 
    __tablename__ = 'cache_invalidation'
 
    __table_args__ = (UniqueConstraint('cache_key'), {'extend_existing':True})
 
    cache_id = Column("cache_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
    cache_key = Column("cache_key", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    cache_args = Column("cache_args", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    cache_active = Column("cache_active", Boolean(), nullable=True, unique=None, default=False)
 

	
 

	
 
    def __init__(self, cache_key, cache_args=''):
 
        self.cache_key = cache_key
 
        self.cache_args = cache_args
 
        self.cache_active = False
 

	
 
    def __repr__(self):
 
        return "<%s('%s:%s')>" % (self.__class__.__name__,
 
                                  self.cache_id, self.cache_key)
 

	
 
    @classmethod
 
    def invalidate(cls, key):
 
        """
 
        Returns Invalidation object if this given key should be invalidated
 
        None otherwise. `cache_active = False` means that this cache
 
        state is not valid and needs to be invalidated
 
        
 
        :param key:
 
        """
 
        return cls.query()\
 
                .filter(CacheInvalidation.cache_key == key)\
 
                .filter(CacheInvalidation.cache_active == False)\
 
                .scalar()
 

	
 
    @classmethod
 
    def set_invalidate(cls, key):
 
        """
 
        Mark this Cache key for invalidation
 
        
 
        :param key:
 
        """
 

	
 
        log.debug('marking %s for invalidation' % key)
 
        inv_obj = Session().query(cls)\
 
            .filter(cls.cache_key == key).scalar()
 
        if inv_obj:
 
            inv_obj.cache_active = False
 
        else:
 
            log.debug('cache key not found in invalidation db -> creating one')
 
            inv_obj = CacheInvalidation(key)
 

	
 
        try:
 
            Session.add(inv_obj)
 
            Session.commit()
 
        except Exception:
 
            log.error(traceback.format_exc())
 
            Session.rollback()
 

	
 
    @classmethod
 
    def set_valid(cls, key):
 
        """
 
        Mark this cache key as active and currently cached
 
        
 
        :param key:
 
        """
 
        inv_obj = Session().query(CacheInvalidation)\
 
            .filter(CacheInvalidation.cache_key == key).scalar()
 
        inv_obj.cache_active = True
 
        Session.add(inv_obj)
 
        Session.commit()
 

	
 
class DbMigrateVersion(Base, BaseModel):
 
    __tablename__ = 'db_migrate_version'
 
    __table_args__ = {'extend_existing':True}
 
    repository_id = Column('repository_id', String(250), primary_key=True)
 
    repository_path = Column('repository_path', Text)
 
    version = Column('version', Integer)
 

	
rhodecode/model/scm.py
Show inline comments
 
@@ -8,407 +8,376 @@
 
    :created_on: Apr 9, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program 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.
 
#
 
# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 
import os
 
import time
 
import traceback
 
import logging
 

	
 
from sqlalchemy.exc import DatabaseError
 

	
 
from vcs import get_backend
 
from vcs.exceptions import RepositoryError
 
from vcs.utils.lazy import LazyProperty
 
from vcs.nodes import FileNode
 

	
 
from rhodecode import BACKENDS
 
from rhodecode.lib import helpers as h
 
from rhodecode.lib import safe_str
 
from rhodecode.lib.auth import HasRepoPermissionAny
 
from rhodecode.lib.utils import get_repos as get_filesystem_repos, make_ui, \
 
    action_logger, EmptyChangeset
 
from rhodecode.model import BaseModel
 
from rhodecode.model.db import Repository, RhodeCodeUi, CacheInvalidation, \
 
    UserFollowing, UserLog, User
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
class UserTemp(object):
 
    def __init__(self, user_id):
 
        self.user_id = user_id
 

	
 
    def __repr__(self):
 
        return "<%s('id:%s')>" % (self.__class__.__name__, self.user_id)
 

	
 

	
 
class RepoTemp(object):
 
    def __init__(self, repo_id):
 
        self.repo_id = repo_id
 

	
 
    def __repr__(self):
 
        return "<%s('id:%s')>" % (self.__class__.__name__, self.repo_id)
 

	
 
class CachedRepoList(object):
 

	
 
    def __init__(self, db_repo_list, repos_path, order_by=None):
 
        self.db_repo_list = db_repo_list
 
        self.repos_path = repos_path
 
        self.order_by = order_by
 
        self.reversed = (order_by or '').startswith('-')
 

	
 
    def __len__(self):
 
        return len(self.db_repo_list)
 

	
 
    def __repr__(self):
 
        return '<%s (%s)>' % (self.__class__.__name__, self.__len__())
 

	
 
    def __iter__(self):
 
        for dbr in self.db_repo_list:
 

	
 
            scmr = dbr.scm_instance_cached
 

	
 
            # check permission at this level
 
            if not HasRepoPermissionAny('repository.read', 'repository.write',
 
                                        'repository.admin')(dbr.repo_name,
 
                                                            'get repo check'):
 
                continue
 

	
 
            if scmr is None:
 
                log.error('%s this repository is present in database but it '
 
                          'cannot be created as an scm instance',
 
                          dbr.repo_name)
 
                continue
 

	
 
            last_change = scmr.last_change
 
            tip = h.get_changeset_safe(scmr, 'tip')
 

	
 
            tmp_d = {}
 
            tmp_d['name'] = dbr.repo_name
 
            tmp_d['name_sort'] = tmp_d['name'].lower()
 
            tmp_d['description'] = dbr.description
 
            tmp_d['description_sort'] = tmp_d['description']
 
            tmp_d['last_change'] = last_change
 
            tmp_d['last_change_sort'] = time.mktime(last_change \
 
                                                    .timetuple())
 
            tmp_d['tip'] = tip.raw_id
 
            tmp_d['tip_sort'] = tip.revision
 
            tmp_d['rev'] = tip.revision
 
            tmp_d['contact'] = dbr.user.full_contact
 
            tmp_d['contact_sort'] = tmp_d['contact']
 
            tmp_d['owner_sort'] = tmp_d['contact']
 
            tmp_d['repo_archives'] = list(scmr._get_archives())
 
            tmp_d['last_msg'] = tip.message
 
            tmp_d['author'] = tip.author
 
            tmp_d['dbrepo'] = dbr.get_dict()
 
            tmp_d['dbrepo_fork'] = dbr.fork.get_dict() if dbr.fork \
 
                                                                    else {}
 
            yield tmp_d
 

	
 
class ScmModel(BaseModel):
 
    """Generic Scm Model
 
    """
 

	
 
    @LazyProperty
 
    def repos_path(self):
 
        """Get's the repositories root path from database
 
        """
 

	
 
        q = self.sa.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == '/').one()
 

	
 
        return q.ui_value
 

	
 
    def repo_scan(self, repos_path=None):
 
        """Listing of repositories in given path. This path should not be a
 
        repository itself. Return a dictionary of repository objects
 

	
 
        :param repos_path: path to directory containing repositories
 
        """
 

	
 
        log.info('scanning for repositories in %s', repos_path)
 

	
 
        if repos_path is None:
 
            repos_path = self.repos_path
 

	
 
        baseui = make_ui('db')
 
        repos_list = {}
 

	
 
        for name, path in get_filesystem_repos(repos_path, recursive=True):
 
            
 
            # name need to be decomposed and put back together using the /
 
            # since this is internal storage separator for rhodecode
 
            name = Repository.url_sep().join(name.split(os.sep))
 
            
 
            try:
 
                if name in repos_list:
 
                    raise RepositoryError('Duplicate repository name %s '
 
                                          'found in %s' % (name, path))
 
                else:
 

	
 
                    klass = get_backend(path[0])
 

	
 
                    if path[0] == 'hg' and path[0] in BACKENDS.keys():
 

	
 
                        # for mercurial we need to have an str path
 
                        repos_list[name] = klass(safe_str(path[1]),
 
                                                 baseui=baseui)
 

	
 
                    if path[0] == 'git' and path[0] in BACKENDS.keys():
 
                        repos_list[name] = klass(path[1])
 
            except OSError:
 
                continue
 

	
 
        return repos_list
 

	
 
    def get_repos(self, all_repos=None, sort_key=None):
 
        """
 
        Get all repos from db and for each repo create it's
 
        backend instance and fill that backed with information from database
 

	
 
        :param all_repos: list of repository names as strings
 
            give specific repositories list, good for filtering
 
        """
 
        if all_repos is None:
 
            all_repos = self.sa.query(Repository)\
 
                        .filter(Repository.group_id == None)\
 
                        .order_by(Repository.repo_name).all()
 

	
 
        repo_iter = CachedRepoList(all_repos, repos_path=self.repos_path,
 
                                   order_by=sort_key)
 

	
 
        return repo_iter
 

	
 
    def mark_for_invalidation(self, repo_name):
 
        """Puts cache invalidation task into db for
 
        further global cache invalidation
 

	
 
        :param repo_name: this repo that should invalidation take place
 
        """
 

	
 
        log.debug('marking %s for invalidation', repo_name)
 
        cache = self.sa.query(CacheInvalidation)\
 
            .filter(CacheInvalidation.cache_key == repo_name).scalar()
 

	
 
        if cache:
 
            # mark this cache as inactive
 
            cache.cache_active = False
 
        else:
 
            log.debug('cache key not found in invalidation db -> creating one')
 
            cache = CacheInvalidation(repo_name)
 

	
 
        try:
 
            self.sa.add(cache)
 
            self.sa.commit()
 
        except (DatabaseError,):
 
            log.error(traceback.format_exc())
 
            self.sa.rollback()
 
        CacheInvalidation.set_invalidate(repo_name)
 
        CacheInvalidation.set_invalidate(repo_name+"_README")
 

	
 
    def toggle_following_repo(self, follow_repo_id, user_id):
 

	
 
        f = self.sa.query(UserFollowing)\
 
            .filter(UserFollowing.follows_repo_id == follow_repo_id)\
 
            .filter(UserFollowing.user_id == user_id).scalar()
 

	
 
        if f is not None:
 

	
 
            try:
 
                self.sa.delete(f)
 
                self.sa.commit()
 
                action_logger(UserTemp(user_id),
 
                              'stopped_following_repo',
 
                              RepoTemp(follow_repo_id))
 
                return
 
            except:
 
                log.error(traceback.format_exc())
 
                self.sa.rollback()
 
                raise
 

	
 
        try:
 
            f = UserFollowing()
 
            f.user_id = user_id
 
            f.follows_repo_id = follow_repo_id
 
            self.sa.add(f)
 
            self.sa.commit()
 
            action_logger(UserTemp(user_id),
 
                          'started_following_repo',
 
                          RepoTemp(follow_repo_id))
 
        except:
 
            log.error(traceback.format_exc())
 
            self.sa.rollback()
 
            raise
 

	
 
    def toggle_following_user(self, follow_user_id, user_id):
 
        f = self.sa.query(UserFollowing)\
 
            .filter(UserFollowing.follows_user_id == follow_user_id)\
 
            .filter(UserFollowing.user_id == user_id).scalar()
 

	
 
        if f is not None:
 
            try:
 
                self.sa.delete(f)
 
                self.sa.commit()
 
                return
 
            except:
 
                log.error(traceback.format_exc())
 
                self.sa.rollback()
 
                raise
 

	
 
        try:
 
            f = UserFollowing()
 
            f.user_id = user_id
 
            f.follows_user_id = follow_user_id
 
            self.sa.add(f)
 
            self.sa.commit()
 
        except:
 
            log.error(traceback.format_exc())
 
            self.sa.rollback()
 
            raise
 

	
 
    def is_following_repo(self, repo_name, user_id, cache=False):
 
        r = self.sa.query(Repository)\
 
            .filter(Repository.repo_name == repo_name).scalar()
 

	
 
        f = self.sa.query(UserFollowing)\
 
            .filter(UserFollowing.follows_repository == r)\
 
            .filter(UserFollowing.user_id == user_id).scalar()
 

	
 
        return f is not None
 

	
 
    def is_following_user(self, username, user_id, cache=False):
 
        u = User.get_by_username(username)
 

	
 
        f = self.sa.query(UserFollowing)\
 
            .filter(UserFollowing.follows_user == u)\
 
            .filter(UserFollowing.user_id == user_id).scalar()
 

	
 
        return f is not None
 

	
 
    def get_followers(self, repo_id):
 
        if not isinstance(repo_id, int):
 
            repo_id = getattr(Repository.get_by_repo_name(repo_id), 'repo_id')
 

	
 
        return self.sa.query(UserFollowing)\
 
                .filter(UserFollowing.follows_repo_id == repo_id).count()
 

	
 
    def get_forks(self, repo_id):
 
        if not isinstance(repo_id, int):
 
            repo_id = getattr(Repository.get_by_repo_name(repo_id), 'repo_id')
 

	
 
        return self.sa.query(Repository)\
 
                .filter(Repository.fork_id == repo_id).count()
 

	
 
    def pull_changes(self, repo_name, username):
 
        dbrepo = Repository.get_by_repo_name(repo_name)
 
        clone_uri = dbrepo.clone_uri
 
        if not clone_uri:
 
            raise Exception("This repository doesn't have a clone uri")
 

	
 
        repo = dbrepo.scm_instance
 
        try:
 
            extras = {'ip': '',
 
                      'username': username,
 
                      'action': 'push_remote',
 
                      'repository': repo_name}
 

	
 
            #inject ui extra param to log this action via push logger
 
            for k, v in extras.items():
 
                repo._repo.ui.setconfig('rhodecode_extras', k, v)
 

	
 
            repo.pull(clone_uri)
 
            self.mark_for_invalidation(repo_name)
 
        except:
 
            log.error(traceback.format_exc())
 
            raise
 

	
 
    def commit_change(self, repo, repo_name, cs, user, author, message, content,
 
                      f_path):
 

	
 
        if repo.alias == 'hg':
 
            from vcs.backends.hg import MercurialInMemoryChangeset as IMC
 
        elif repo.alias == 'git':
 
            from vcs.backends.git import GitInMemoryChangeset as IMC
 

	
 
        # decoding here will force that we have proper encoded values
 
        # in any other case this will throw exceptions and deny commit
 
        content = safe_str(content)
 
        message = safe_str(message)
 
        path = safe_str(f_path)
 
        author = safe_str(author)
 
        m = IMC(repo)
 
        m.change(FileNode(path, content))
 
        tip = m.commit(message=message,
 
                 author=author,
 
                 parents=[cs], branch=cs.branch)
 

	
 
        new_cs = tip.short_id
 
        action = 'push_local:%s' % new_cs
 

	
 
        action_logger(user, action, repo_name)
 

	
 
        self.mark_for_invalidation(repo_name)
 

	
 
    def create_node(self, repo, repo_name, cs, user, author, message, content,
 
                      f_path):
 
        if repo.alias == 'hg':
 
            from vcs.backends.hg import MercurialInMemoryChangeset as IMC
 
        elif repo.alias == 'git':
 
            from vcs.backends.git import GitInMemoryChangeset as IMC
 
        # decoding here will force that we have proper encoded values
 
        # in any other case this will throw exceptions and deny commit
 

	
 
        if isinstance(content, (basestring,)):
 
            content = safe_str(content)
 
        elif isinstance(content, file):
 
            content = content.read()
 

	
 
        message = safe_str(message)
 
        path = safe_str(f_path)
 
        author = safe_str(author)
 
        m = IMC(repo)
 

	
 
        if isinstance(cs, EmptyChangeset):
 
            # Emptychangeset means we we're editing empty repository
 
            parents = None
 
        else:
 
            parents = [cs]
 

	
 
        m.add(FileNode(path, content=content))
 
        tip = m.commit(message=message,
 
                 author=author,
 
                 parents=parents, branch=cs.branch)
 
        new_cs = tip.short_id
 
        action = 'push_local:%s' % new_cs
 

	
 
        action_logger(user, action, repo_name)
 

	
 
        self.mark_for_invalidation(repo_name)
 

	
 

	
 
    def get_unread_journal(self):
 
        return self.sa.query(UserLog).count()
 

	
 
    def _should_invalidate(self, repo_name):
 
        """Looks up database for invalidation signals for this repo_name
 

	
 
        :param repo_name:
 
        """
 

	
 
        ret = self.sa.query(CacheInvalidation)\
 
            .filter(CacheInvalidation.cache_key == repo_name)\
 
            .filter(CacheInvalidation.cache_active == False)\
 
            .scalar()
 

	
 
        return ret
 

	
rhodecode/public/css/style.css
Show inline comments
 
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td {
 
border:0;
 
outline:0;
 
font-size:100%;
 
vertical-align:baseline;
 
background:transparent;
 
margin:0;
 
padding:0;
 
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td
 
	{
 
	border: 0;
 
	outline: 0;
 
	font-size: 100%;
 
	vertical-align: baseline;
 
	background: transparent;
 
	margin: 0;
 
	padding: 0;
 
}
 
 
body {
 
line-height:1;
 
height:100%;
 
background:url("../images/background.png") repeat scroll 0 0 #B0B0B0;
 
font-family:Lucida Grande, Verdana, Lucida Sans Regular, Lucida Sans Unicode, Arial, sans-serif;
 
font-size:12px;
 
color:#000;
 
margin:0;
 
padding:0;
 
	line-height: 1;
 
	height: 100%;
 
	background: url("../images/background.png") repeat scroll 0 0 #B0B0B0;
 
	font-family: Lucida Grande, Verdana, Lucida Sans Regular,
 
		Lucida Sans Unicode, Arial, sans-serif; font-size : 12px;
 
	color: #000;
 
	margin: 0;
 
	padding: 0;
 
	font-size: 12px;
 
}
 
 
ol,ul {
 
list-style:none;
 
	list-style: none;
 
}
 
 
blockquote,q {
 
quotes:none;
 
	quotes: none;
 
}
 
 
blockquote:before,blockquote:after,q:before,q:after {
 
content:none;
 
	content: none;
 
}
 
 
:focus {
 
outline:0;
 
	outline: 0;
 
}
 
 
del {
 
text-decoration:line-through;
 
	text-decoration: line-through;
 
}
 
 
table {
 
border-collapse:collapse;
 
border-spacing:0;
 
	border-collapse: collapse;
 
	border-spacing: 0;
 
}
 
 
html {
 
height:100%;
 
	height: 100%;
 
}
 
 
a {
 
color:#003367;
 
text-decoration:none;
 
cursor:pointer;
 
	color: #003367;
 
	text-decoration: none;
 
	cursor: pointer;
 
}
 
 
a:hover {
 
color:#316293;
 
text-decoration:underline;
 
	color: #316293;
 
	text-decoration: underline;
 
}
 
 
h1,h2,h3,h4,h5,h6 {
 
color:#292929;
 
font-weight:700;
 
	color: #292929;
 
	font-weight: 700;
 
}
 
 
h1 {
 
font-size:22px;
 
	font-size: 22px;
 
}
 
 
h2 {
 
font-size:20px;
 
	font-size: 20px;
 
}
 
 
h3 {
 
font-size:18px;
 
	font-size: 18px;
 
}
 
 
h4 {
 
font-size:16px;
 
	font-size: 16px;
 
}
 
 
h5 {
 
font-size:14px;
 
	font-size: 14px;
 
}
 
 
h6 {
 
font-size:11px;
 
	font-size: 11px;
 
}
 
 
ul.circle {
 
list-style-type:circle;
 
	list-style-type: circle;
 
}
 
 
ul.disc {
 
list-style-type:disc;
 
	list-style-type: disc;
 
}
 
 
ul.square {
 
list-style-type:square;
 
	list-style-type: square;
 
}
 
 
ol.lower-roman {
 
list-style-type:lower-roman;
 
	list-style-type: lower-roman;
 
}
 
 
ol.upper-roman {
 
list-style-type:upper-roman;
 
	list-style-type: upper-roman;
 
}
 
 
ol.lower-alpha {
 
list-style-type:lower-alpha;
 
	list-style-type: lower-alpha;
 
}
 
 
ol.upper-alpha {
 
list-style-type:upper-alpha;
 
	list-style-type: upper-alpha;
 
}
 
 
ol.decimal {
 
list-style-type:decimal;
 
	list-style-type: decimal;
 
}
 
 
div.color {
 
clear:both;
 
overflow:hidden;
 
position:absolute;
 
background:#FFF;
 
margin:7px 0 0 60px;
 
padding:1px 1px 1px 0;
 
	clear: both;
 
	overflow: hidden;
 
	position: absolute;
 
	background: #FFF;
 
	margin: 7px 0 0 60px;
 
	padding: 1px 1px 1px 0;
 
}
 
 
div.color a {
 
width:15px;
 
height:15px;
 
display:block;
 
float:left;
 
margin:0 0 0 1px;
 
padding:0;
 
	width: 15px;
 
	height: 15px;
 
	display: block;
 
	float: left;
 
	margin: 0 0 0 1px;
 
	padding: 0;
 
}
 
 
div.options {
 
clear:both;
 
overflow:hidden;
 
position:absolute;
 
background:#FFF;
 
margin:7px 0 0 162px;
 
padding:0;
 
	clear: both;
 
	overflow: hidden;
 
	position: absolute;
 
	background: #FFF;
 
	margin: 7px 0 0 162px;
 
	padding: 0;
 
}
 
 
div.options a {
 
height:1%;
 
display:block;
 
text-decoration:none;
 
margin:0;
 
padding:3px 8px;
 
	height: 1%;
 
	display: block;
 
	text-decoration: none;
 
	margin: 0;
 
	padding: 3px 8px;
 
}
 
 
.top-left-rounded-corner {
 
-webkit-border-top-left-radius: 8px;
 
-khtml-border-radius-topleft: 8px; 
 
-moz-border-radius-topleft: 8px;
 
border-top-left-radius: 8px;
 
	-webkit-border-top-left-radius: 8px;
 
	-khtml-border-radius-topleft: 8px;
 
	-moz-border-radius-topleft: 8px;
 
	border-top-left-radius: 8px;
 
}
 
 
.top-right-rounded-corner {
 
-webkit-border-top-right-radius: 8px;
 
-khtml-border-radius-topright: 8px;    
 
-moz-border-radius-topright: 8px;
 
border-top-right-radius: 8px;
 
	-webkit-border-top-right-radius: 8px;
 
	-khtml-border-radius-topright: 8px;
 
	-moz-border-radius-topright: 8px;
 
	border-top-right-radius: 8px;
 
}
 
 
.bottom-left-rounded-corner {
 
-webkit-border-bottom-left-radius: 8px;
 
-khtml-border-radius-bottomleft: 8px;  
 
-moz-border-radius-bottomleft: 8px;
 
border-bottom-left-radius: 8px;
 
	-webkit-border-bottom-left-radius: 8px;
 
	-khtml-border-radius-bottomleft: 8px;
 
	-moz-border-radius-bottomleft: 8px;
 
	border-bottom-left-radius: 8px;
 
}
 
 
.bottom-right-rounded-corner {
 
-webkit-border-bottom-right-radius: 8px;
 
-khtml-border-radius-bottomright: 8px; 
 
-moz-border-radius-bottomright: 8px;
 
border-bottom-right-radius: 8px;
 
}
 
 
	-webkit-border-bottom-right-radius: 8px;
 
	-khtml-border-radius-bottomright: 8px;
 
	-moz-border-radius-bottomright: 8px;
 
	border-bottom-right-radius: 8px;
 
}
 
 
#header {
 
margin:0;
 
padding:0 10px;
 
}
 
 
 
#header ul#logged-user{
 
margin-bottom:5px !important;
 
-webkit-border-radius: 0px 0px 8px 8px;
 
-khtml-border-radius: 0px 0px 8px 8px; 
 
-moz-border-radius: 0px 0px 8px 8px;
 
border-radius: 0px 0px 8px 8px;
 
height:37px;
 
background:url("../images/header_inner.png") repeat-x scroll 0 0 #003367;
 
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.6);
 
	margin: 0;
 
	padding: 0 10px;
 
}
 
 
#header ul#logged-user {
 
	margin-bottom: 5px !important;
 
	-webkit-border-radius: 0px 0px 8px 8px;
 
	-khtml-border-radius: 0px 0px 8px 8px;
 
	-moz-border-radius: 0px 0px 8px 8px;
 
	border-radius: 0px 0px 8px 8px;
 
	height: 37px;
 
    background-color: #eedc94;
 
    background-repeat: repeat-x;
 
    background-image: -khtml-gradient(linear, left top, left bottom, from(#fceec1),
 
        to(#eedc94) );
 
    background-image: -moz-linear-gradient(top, #003b76, #00376e);
 
    background-image: -ms-linear-gradient(top, #003b76, #00376e);
 
    background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #003b76),
 
        color-stop(100%, #00376e) );
 
    background-image: -webkit-linear-gradient(top, #003b76, #00376e) );
 
    background-image: -o-linear-gradient(top, #003b76, #00376e) );
 
    background-image: linear-gradient(top, #003b76, #00376e);
 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#003b76',
 
        endColorstr='#00376e', GradientType=0 );
 
	box-shadow: 0 2px 2px rgba(0, 0, 0, 0.6);
 
}
 
 
#header ul#logged-user li {
 
list-style:none;
 
float:left;
 
margin:8px 0 0;
 
padding:4px 12px;
 
border-left: 1px solid #316293;
 
	list-style: none;
 
	float: left;
 
	margin: 8px 0 0;
 
	padding: 4px 12px;
 
	border-left: 1px solid #316293;
 
}
 
 
#header ul#logged-user li.first {
 
border-left:none;
 
margin:4px;
 
	border-left: none;
 
	margin: 4px;
 
}
 
 
#header ul#logged-user li.first div.gravatar {
 
margin-top:-2px;
 
	margin-top: -2px;
 
}
 
 
#header ul#logged-user li.first div.account {
 
padding-top:4px;
 
float:left;
 
	padding-top: 4px;
 
	float: left;
 
}
 
 
#header ul#logged-user li.last {
 
border-right:none;
 
	border-right: none;
 
}
 
 
#header ul#logged-user li a {
 
color:#fff;
 
font-weight:700;
 
text-decoration:none;
 
	color: #fff;
 
	font-weight: 700;
 
	text-decoration: none;
 
}
 
 
#header ul#logged-user li a:hover {
 
text-decoration:underline;
 
	text-decoration: underline;
 
}
 
 
#header ul#logged-user li.highlight a {
 
color:#fff;
 
	color: #fff;
 
}
 
 
#header ul#logged-user li.highlight a:hover {
 
color:#FFF;
 
	color: #FFF;
 
}
 
 
#header #header-inner {
 
min-height:40px;
 
clear:both;
 
position:relative;
 
background:#003367 url("../images/header_inner.png") repeat-x;
 
margin:0;
 
padding:0;
 
display:block;
 
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.6);
 
-webkit-border-radius: 4px 4px 4px 4px;
 
-khtml-border-radius: 4px 4px 4px 4px; 
 
-moz-border-radius: 4px 4px 4px 4px;
 
border-radius: 4px 4px 4px 4px;
 
}
 
 
	min-height: 40px;
 
	clear: both;
 
	position: relative;
 
    background-color: #eedc94;
 
    background-repeat: repeat-x;
 
    background-image: -khtml-gradient(linear, left top, left bottom, from(#fceec1),
 
        to(#eedc94) );
 
    background-image: -moz-linear-gradient(top, #003b76, #00376e);
 
    background-image: -ms-linear-gradient(top, #003b76, #00376e);
 
    background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #003b76),
 
        color-stop(100%, #00376e) );
 
    background-image: -webkit-linear-gradient(top, #003b76, #00376e) );
 
    background-image: -o-linear-gradient(top, #003b76, #00376e) );
 
    background-image: linear-gradient(top, #003b76, #00376e);
 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#003b76',
 
        endColorstr='#00376e', GradientType=0 );
 
	margin: 0;
 
	padding: 0;
 
	display: block;
 
	box-shadow: 0 2px 2px rgba(0, 0, 0, 0.6);
 
	-webkit-border-radius: 4px 4px 4px 4px;
 
	-khtml-border-radius: 4px 4px 4px 4px;
 
	-moz-border-radius: 4px 4px 4px 4px;
 
	border-radius: 4px 4px 4px 4px;
 
}
 
#header #header-inner.hover{
 
	position: fixed !important;
 
	width: 100% !important;
 
	margin-left: -10px !important;
 
	z-index: 10000;
 
	border-radius: 0px 0px 4px 4px;
 
}
 
#header #header-inner #home a {
 
height:40px;
 
width:46px;
 
display:block;
 
background:url("../images/button_home.png");
 
background-position:0 0;
 
margin:0;
 
padding:0;
 
	height: 40px;
 
	width: 46px;
 
	display: block;
 
	background: url("../images/button_home.png");
 
	background-position: 0 0;
 
	margin: 0;
 
	padding: 0;
 
}
 
 
#header #header-inner #home a:hover {
 
background-position:0 -40px;
 
}
 
	background-position: 0 -40px;
 
}
 
 
#header #header-inner #logo {
 
    float: left;
 
    position: absolute;	
 
}
 
	float: left;
 
	position: absolute;
 
}
 
 
#header #header-inner #logo h1 {
 
color:#FFF;
 
font-size:18px;
 
margin:10px 0 0 13px;
 
padding:0;
 
	color: #FFF;
 
	font-size: 18px;
 
	margin: 10px 0 0 13px;
 
	padding: 0;
 
}
 
 
#header #header-inner #logo a {
 
color:#fff;
 
text-decoration:none;
 
	color: #fff;
 
	text-decoration: none;
 
}
 
 
#header #header-inner #logo a:hover {
 
color:#bfe3ff;
 
	color: #bfe3ff;
 
}
 
 
#header #header-inner #quick,#header #header-inner #quick ul {
 
position:relative;
 
float:right;
 
list-style-type:none;
 
list-style-position:outside;
 
margin:6px 5px 0 0;
 
padding:0;
 
	position: relative;
 
	float: right;
 
	list-style-type: none;
 
	list-style-position: outside;
 
	margin: 6px 5px 0 0;
 
	padding: 0;
 
}
 
 
#header #header-inner #quick li {
 
position:relative;
 
float:left;
 
margin:0 5px 0 0;
 
padding:0;
 
	position: relative;
 
	float: left;
 
	margin: 0 5px 0 0;
 
	padding: 0;
 
}
 
 
#header #header-inner #quick li a {
 
top:0;
 
left:0;
 
height:1%;
 
display:block;
 
clear:both;
 
overflow:hidden;
 
color:#FFF;
 
font-weight:700;
 
text-decoration:none;
 
background:#369;
 
padding:0;
 
-webkit-border-radius: 4px 4px 4px 4px;
 
-khtml-border-radius: 4px 4px 4px 4px; 
 
-moz-border-radius: 4px 4px 4px 4px;
 
border-radius: 4px 4px 4px 4px;
 
	top: 0;
 
	left: 0;
 
	height: 1%;
 
	display: block;
 
	clear: both;
 
	overflow: hidden;
 
	color: #FFF;
 
	font-weight: 700;
 
	text-decoration: none;
 
	background: #369;
 
	padding: 0;
 
	-webkit-border-radius: 4px 4px 4px 4px;
 
	-khtml-border-radius: 4px 4px 4px 4px;
 
	-moz-border-radius: 4px 4px 4px 4px;
 
	border-radius: 4px 4px 4px 4px;
 
}
 
 
#header #header-inner #quick li span.short {
 
padding:9px 6px 8px 6px;
 
	padding: 9px 6px 8px 6px;
 
}
 
 
#header #header-inner #quick li span {
 
top:0;
 
right:0;
 
height:1%;
 
display:block;
 
float:left;
 
border-left:1px solid #3f6f9f;
 
margin:0;
 
padding:10px 12px 8px 10px;
 
	top: 0;
 
	right: 0;
 
	height: 1%;
 
	display: block;
 
	float: left;
 
	border-left: 1px solid #3f6f9f;
 
	margin: 0;
 
	padding: 10px 12px 8px 10px;
 
}
 
 
#header #header-inner #quick li span.normal {
 
border:none;
 
padding:10px 12px 8px;
 
	border: none;
 
	padding: 10px 12px 8px;
 
}
 
 
#header #header-inner #quick li span.icon {
 
top:0;
 
left:0;
 
border-left:none;
 
border-right:1px solid #2e5c89;
 
padding:8px 6px 4px;
 
	top: 0;
 
	left: 0;
 
	border-left: none;
 
	border-right: 1px solid #2e5c89;
 
	padding: 8px 6px 4px;
 
}
 
 
#header #header-inner #quick li span.icon_short {
 
top:0;
 
left:0;
 
border-left:none;
 
border-right:1px solid #2e5c89;
 
padding:8px 6px 4px;
 
}
 
#header #header-inner #quick li span.icon img, #header #header-inner #quick li span.icon_short img {
 
	top: 0;
 
	left: 0;
 
	border-left: none;
 
	border-right: 1px solid #2e5c89;
 
	padding: 8px 6px 4px;
 
}
 
 
#header #header-inner #quick li span.icon img,#header #header-inner #quick li span.icon_short img
 
	{
 
	margin: 0px -2px 0px 0px;
 
}
 
 
#header #header-inner #quick li a:hover {
 
background:#4e4e4e  no-repeat top left;
 
	background: #4e4e4e no-repeat top left;
 
}
 
 
#header #header-inner #quick li a:hover span {
 
border-left:1px solid #545454;
 
}
 
 
#header #header-inner #quick li a:hover span.icon,#header #header-inner #quick li a:hover span.icon_short {
 
border-left:none;
 
border-right:1px solid #464646;
 
	border-left: 1px solid #545454;
 
}
 
 
#header #header-inner #quick li a:hover span.icon,#header #header-inner #quick li a:hover span.icon_short
 
	{
 
	border-left: none;
 
	border-right: 1px solid #464646;
 
}
 
 
#header #header-inner #quick ul {
 
top:29px;
 
right:0;
 
min-width:200px;
 
display:none;
 
position:absolute;
 
background:#FFF;
 
border:1px solid #666;
 
border-top:1px solid #003367;
 
z-index:100;
 
margin:0;
 
padding:0;
 
	top: 29px;
 
	right: 0;
 
	min-width: 200px;
 
	display: none;
 
	position: absolute;
 
	background: #FFF;
 
	border: 1px solid #666;
 
	border-top: 1px solid #003367;
 
	z-index: 100;
 
	margin: 0;
 
	padding: 0;
 
}
 
 
#header #header-inner #quick ul.repo_switcher {
 
max-height:275px;
 
overflow-x:hidden;
 
overflow-y:auto;
 
}
 
	max-height: 275px;
 
	overflow-x: hidden;
 
	overflow-y: auto;
 
}
 
 
#header #header-inner #quick ul.repo_switcher li.qfilter_rs {
 
float:none;
 
margin:0;
 
border-bottom:2px solid #003367;
 
}
 
 
 
#header #header-inner #quick .repo_switcher_type{
 
position:absolute;
 
left:0;
 
top:9px; 
 
 
}
 
	float: none;
 
	margin: 0;
 
	border-bottom: 2px solid #003367;
 
}
 
 
#header #header-inner #quick .repo_switcher_type {
 
	position: absolute;
 
	left: 0;
 
	top: 9px;
 
}
 
 
#header #header-inner #quick li ul li {
 
border-bottom:1px solid #ddd;
 
	border-bottom: 1px solid #ddd;
 
}
 
 
#header #header-inner #quick li ul li a {
 
width:182px;
 
height:auto;
 
display:block;
 
float:left;
 
background:#FFF;
 
color:#003367;
 
font-weight:400;
 
margin:0;
 
padding:7px 9px;
 
	width: 182px;
 
	height: auto;
 
	display: block;
 
	float: left;
 
	background: #FFF;
 
	color: #003367;
 
	font-weight: 400;
 
	margin: 0;
 
	padding: 7px 9px;
 
}
 
 
#header #header-inner #quick li ul li a:hover {
 
color:#000;
 
background:#FFF;
 
	color: #000;
 
	background: #FFF;
 
}
 
 
#header #header-inner #quick ul ul {
 
top:auto;
 
	top: auto;
 
}
 
 
#header #header-inner #quick li ul ul {
 
right:200px;
 
max-height:275px;
 
overflow:auto;
 
overflow-x:hidden;
 
white-space:normal;
 
}
 
 
#header #header-inner #quick li ul li a.journal,#header #header-inner #quick li ul li a.journal:hover {
 
background:url("../images/icons/book.png") no-repeat scroll 4px 9px #FFF;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.private_repo,#header #header-inner #quick li ul li a.private_repo:hover {
 
background:url("../images/icons/lock.png") no-repeat scroll 4px 9px #FFF;
 
min-width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.public_repo,#header #header-inner #quick li ul li a.public_repo:hover {
 
background:url("../images/icons/lock_open.png") no-repeat scroll 4px 9px #FFF;
 
min-width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.hg,#header #header-inner #quick li ul li a.hg:hover {
 
background:url("../images/icons/hgicon.png") no-repeat scroll 4px 9px #FFF;
 
min-width:167px;
 
margin:0 0 0 14px;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.git,#header #header-inner #quick li ul li a.git:hover {
 
background:url("../images/icons/giticon.png") no-repeat scroll 4px 9px #FFF;
 
min-width:167px;
 
margin:0 0 0 14px;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.repos,#header #header-inner #quick li ul li a.repos:hover {
 
background:url("../images/icons/database_edit.png") no-repeat scroll 4px 9px #FFF;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.repos_groups,#header #header-inner #quick li ul li a.repos_groups:hover {
 
background:url("../images/icons/database_link.png") no-repeat scroll 4px 9px #FFF;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.users,#header #header-inner #quick li ul li a.users:hover {
 
background:#FFF url("../images/icons/user_edit.png") no-repeat 4px 9px;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.groups,#header #header-inner #quick li ul li a.groups:hover {
 
background:#FFF url("../images/icons/group_edit.png") no-repeat 4px 9px;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.settings,#header #header-inner #quick li ul li a.settings:hover {
 
background:#FFF url("../images/icons/cog.png") no-repeat 4px 9px;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.permissions,#header #header-inner #quick li ul li a.permissions:hover {
 
background:#FFF url("../images/icons/key.png") no-repeat 4px 9px;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.ldap,#header #header-inner #quick li ul li a.ldap:hover {
 
background:#FFF url("../images/icons/server_key.png") no-repeat 4px 9px;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.fork,#header #header-inner #quick li ul li a.fork:hover {
 
background:#FFF url("../images/icons/arrow_divide.png") no-repeat 4px 9px;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.search,#header #header-inner #quick li ul li a.search:hover {
 
background:#FFF url("../images/icons/search_16.png") no-repeat 4px 9px;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.delete,#header #header-inner #quick li ul li a.delete:hover {
 
background:#FFF url("../images/icons/delete.png") no-repeat 4px 9px;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.branches,#header #header-inner #quick li ul li a.branches:hover {
 
background:#FFF url("../images/icons/arrow_branch.png") no-repeat 4px 9px;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.tags,#header #header-inner #quick li ul li a.tags:hover {
 
background:#FFF url("../images/icons/tag_blue.png") no-repeat 4px 9px;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.admin,#header #header-inner #quick li ul li a.admin:hover {
 
background:#FFF url("../images/icons/cog_edit.png") no-repeat 4px 9px;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
	right: 200px;
 
	max-height: 275px;
 
	overflow: auto;
 
	overflow-x: hidden;
 
	white-space: normal;
 
}
 
 
#header #header-inner #quick li ul li a.journal,#header #header-inner #quick li ul li a.journal:hover
 
	{
 
	background: url("../images/icons/book.png") no-repeat scroll 4px 9px
 
		#FFF;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.private_repo,#header #header-inner #quick li ul li a.private_repo:hover
 
	{
 
	background: url("../images/icons/lock.png") no-repeat scroll 4px 9px
 
		#FFF;
 
	min-width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.public_repo,#header #header-inner #quick li ul li a.public_repo:hover
 
	{
 
	background: url("../images/icons/lock_open.png") no-repeat scroll 4px
 
		9px #FFF;
 
	min-width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.hg,#header #header-inner #quick li ul li a.hg:hover
 
	{
 
	background: url("../images/icons/hgicon.png") no-repeat scroll 4px 9px
 
		#FFF;
 
	min-width: 167px;
 
	margin: 0 0 0 14px;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.git,#header #header-inner #quick li ul li a.git:hover
 
	{
 
	background: url("../images/icons/giticon.png") no-repeat scroll 4px 9px
 
		#FFF;
 
	min-width: 167px;
 
	margin: 0 0 0 14px;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.repos,#header #header-inner #quick li ul li a.repos:hover
 
	{
 
	background: url("../images/icons/database_edit.png") no-repeat scroll
 
		4px 9px #FFF;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.repos_groups,#header #header-inner #quick li ul li a.repos_groups:hover
 
	{
 
	background: url("../images/icons/database_link.png") no-repeat scroll
 
		4px 9px #FFF;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.users,#header #header-inner #quick li ul li a.users:hover
 
	{
 
	background: #FFF url("../images/icons/user_edit.png") no-repeat 4px 9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.groups,#header #header-inner #quick li ul li a.groups:hover
 
	{
 
	background: #FFF url("../images/icons/group_edit.png") no-repeat 4px 9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.settings,#header #header-inner #quick li ul li a.settings:hover
 
	{
 
	background: #FFF url("../images/icons/cog.png") no-repeat 4px 9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.permissions,#header #header-inner #quick li ul li a.permissions:hover
 
	{
 
	background: #FFF url("../images/icons/key.png") no-repeat 4px 9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.ldap,#header #header-inner #quick li ul li a.ldap:hover
 
	{
 
	background: #FFF url("../images/icons/server_key.png") no-repeat 4px 9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.fork,#header #header-inner #quick li ul li a.fork:hover
 
	{
 
	background: #FFF url("../images/icons/arrow_divide.png") no-repeat 4px
 
		9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.search,#header #header-inner #quick li ul li a.search:hover
 
	{
 
	background: #FFF url("../images/icons/search_16.png") no-repeat 4px 9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.delete,#header #header-inner #quick li ul li a.delete:hover
 
	{
 
	background: #FFF url("../images/icons/delete.png") no-repeat 4px 9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.branches,#header #header-inner #quick li ul li a.branches:hover
 
	{
 
	background: #FFF url("../images/icons/arrow_branch.png") no-repeat 4px
 
		9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.tags,#header #header-inner #quick li ul li a.tags:hover
 
	{
 
	background: #FFF url("../images/icons/tag_blue.png") no-repeat 4px 9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.admin,#header #header-inner #quick li ul li a.admin:hover
 
	{
 
	background: #FFF url("../images/icons/cog_edit.png") no-repeat 4px 9px;
 
	width: 167px;
 
	margin: 0;
 
	padding: 12px 9px 7px 24px;
 
}
 
 
.groups_breadcrumbs a {
 
	color: #fff;
 
}
 
 
.groups_breadcrumbs a:hover {
 
    color: #bfe3ff;
 
    text-decoration: none;
 
}
 
 
.quick_repo_menu{
 
	background: #FFF url("../images/vertical-indicator.png") 8px 50% no-repeat !important;
 
	color: #bfe3ff;
 
	text-decoration: none;
 
}
 
 
.quick_repo_menu {
 
	background: #FFF url("../images/vertical-indicator.png") 8px 50%
 
		no-repeat !important;
 
	cursor: pointer;
 
	width: 8px;
 
}
 
.quick_repo_menu.active{
 
    background: #FFF url("../images/horizontal-indicator.png") 4px 50% no-repeat !important;
 
    cursor: pointer;
 
}
 
.quick_repo_menu .menu_items{
 
	margin-top:6px;
 
	width:150px;
 
 
.quick_repo_menu.active {
 
	background: #FFF url("../images/horizontal-indicator.png") 4px 50%
 
		no-repeat !important;
 
	cursor: pointer;
 
}
 
 
.quick_repo_menu .menu_items {
 
	margin-top: 6px;
 
	width: 150px;
 
	position: absolute;
 
	background-color:#FFF;
 
    background: none repeat scroll 0 0 #FFFFFF;
 
    border-color: #003367 #666666 #666666;
 
    border-right: 1px solid #666666;
 
    border-style: solid;
 
    border-width: 1px;
 
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
 
}
 
.quick_repo_menu .menu_items li{
 
    padding:0 !important;
 
}
 
.quick_repo_menu .menu_items a{
 
	background-color: #FFF;
 
	background: none repeat scroll 0 0 #FFFFFF;
 
	border-color: #003367 #666666 #666666;
 
	border-right: 1px solid #666666;
 
	border-style: solid;
 
	border-width: 1px;
 
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
 
}
 
 
.quick_repo_menu .menu_items li {
 
	padding: 0 !important;
 
}
 
 
.quick_repo_menu .menu_items a {
 
	display: block;
 
	padding: 4px 12px 4px 8px;
 
}
 
.quick_repo_menu .menu_items a:hover{
 
    background-color: #EEE;
 
    text-decoration: none;
 
    
 
}
 
.quick_repo_menu .menu_items .icon img{
 
	margin-bottom:-2px;
 
}
 
.quick_repo_menu .menu_items.hidden{
 
 
.quick_repo_menu .menu_items a:hover {
 
	background-color: #EEE;
 
	text-decoration: none;
 
}
 
 
.quick_repo_menu .menu_items .icon img {
 
	margin-bottom: -2px;
 
}
 
 
.quick_repo_menu .menu_items.hidden {
 
	display: none;
 
}
 
 
#content #left {
 
left:0;
 
width:280px;
 
position:absolute;
 
	left: 0;
 
	width: 280px;
 
	position: absolute;
 
}
 
 
#content #right {
 
margin:0 60px 10px 290px;
 
	margin: 0 60px 10px 290px;
 
}
 
 
#content div.box {
 
clear:both;
 
overflow:hidden;
 
background:#fff;
 
margin:0 0 10px;
 
padding:0 0 10px;
 
-webkit-border-radius: 4px 4px 4px 4px;
 
-khtml-border-radius: 4px 4px 4px 4px; 
 
-moz-border-radius: 4px 4px 4px 4px;
 
border-radius: 4px 4px 4px 4px;
 
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.6);
 
 
	clear: both;
 
	overflow: hidden;
 
	background: #fff;
 
	margin: 0 0 10px;
 
	padding: 0 0 10px;
 
	-webkit-border-radius: 4px 4px 4px 4px;
 
	-khtml-border-radius: 4px 4px 4px 4px;
 
	-moz-border-radius: 4px 4px 4px 4px;
 
	border-radius: 4px 4px 4px 4px;
 
	box-shadow: 0 2px 2px rgba(0, 0, 0, 0.6);
 
}
 
 
#content div.box-left {
 
width:49%;
 
clear:none;
 
float:left;
 
margin:0 0 10px;
 
	width: 49%;
 
	clear: none;
 
	float: left;
 
	margin: 0 0 10px;
 
}
 
 
#content div.box-right {
 
width:49%;
 
clear:none;
 
float:right;
 
margin:0 0 10px;
 
	width: 49%;
 
	clear: none;
 
	float: right;
 
	margin: 0 0 10px;
 
}
 
 
#content div.box div.title {
 
clear:both;
 
overflow:hidden;
 
background:#369 url("../images/header_inner.png") repeat-x;
 
margin:0 0 20px;
 
padding:0;
 
	clear: both;
 
	overflow: hidden;
 
	background-color: #eedc94;
 
	background-repeat: repeat-x;
 
	background-image: -khtml-gradient(linear, left top, left bottom, from(#fceec1),
 
		to(#eedc94) );
 
	background-image: -moz-linear-gradient(top, #003b76, #00376e);
 
	background-image: -ms-linear-gradient(top, #003b76, #00376e);
 
	background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #003b76),
 
		color-stop(100%, #00376e) );
 
	background-image: -webkit-linear-gradient(top, #003b76, #00376e) );
 
	background-image: -o-linear-gradient(top, #003b76, #00376e) );
 
	background-image: linear-gradient(top, #003b76, #00376e);
 
	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#003b76',
 
		endColorstr='#00376e', GradientType=0 );
 
	margin: 0 0 20px;
 
	padding: 0;
 
}
 
 
#content div.box div.title h5 {
 
float:left;
 
border:none;
 
color:#fff;
 
text-transform:uppercase;
 
margin:0;
 
padding:11px 0 11px 10px;
 
	float: left;
 
	border: none;
 
	color: #fff;
 
	text-transform: uppercase;
 
	margin: 0;
 
	padding: 11px 0 11px 10px;
 
}
 
 
#content div.box div.title ul.links li {
 
list-style:none;
 
float:left;
 
margin:0;
 
padding:0;
 
	list-style: none;
 
	float: left;
 
	margin: 0;
 
	padding: 0;
 
}
 
 
#content div.box div.title ul.links li a {
 
    border-left: 1px solid #316293;
 
    color: #FFFFFF;
 
    display: block;
 
    float: left;
 
    font-size: 13px;
 
    font-weight: 700;
 
    height: 1%;
 
    margin: 0;
 
    padding: 11px 22px 12px;
 
    text-decoration: none;
 
}
 
 
#content div.box h1,#content div.box h2,#content div.box h3,#content div.box h4,#content div.box h5,#content div.box h6 {
 
clear:both;
 
overflow:hidden;
 
border-bottom:1px solid #DDD;
 
margin:10px 20px;
 
padding:0 0 15px;
 
	border-left: 1px solid #316293;
 
	color: #FFFFFF;
 
	display: block;
 
	float: left;
 
	font-size: 13px;
 
	font-weight: 700;
 
	height: 1%;
 
	margin: 0;
 
	padding: 11px 22px 12px;
 
	text-decoration: none;
 
}
 
 
#content div.box h1,#content div.box h2,#content div.box h3,#content div.box h4,#content div.box h5,#content div.box h6
 
	{
 
	clear: both;
 
	overflow: hidden;
 
	border-bottom: 1px solid #DDD;
 
	margin: 10px 20px;
 
	padding: 0 0 15px;
 
}
 
 
#content div.box p {
 
color:#5f5f5f;
 
font-size:12px;
 
line-height:150%;
 
margin:0 24px 10px;
 
padding:0;
 
	color: #5f5f5f;
 
	font-size: 12px;
 
	line-height: 150%;
 
	margin: 0 24px 10px;
 
	padding: 0;
 
}
 
 
#content div.box blockquote {
 
border-left:4px solid #DDD;
 
color:#5f5f5f;
 
font-size:11px;
 
line-height:150%;
 
margin:0 34px;
 
padding:0 0 0 14px;
 
	border-left: 4px solid #DDD;
 
	color: #5f5f5f;
 
	font-size: 11px;
 
	line-height: 150%;
 
	margin: 0 34px;
 
	padding: 0 0 0 14px;
 
}
 
 
#content div.box blockquote p {
 
margin:10px 0;
 
padding:0;
 
	margin: 10px 0;
 
	padding: 0;
 
}
 
 
#content div.box dl {
 
margin:10px 24px;
 
	margin: 10px 24px;
 
}
 
 
#content div.box dt {
 
font-size:12px;
 
margin:0;
 
	font-size: 12px;
 
	margin: 0;
 
}
 
 
#content div.box dd {
 
font-size:12px;
 
margin:0;
 
padding:8px 0 8px 15px;
 
	font-size: 12px;
 
	margin: 0;
 
	padding: 8px 0 8px 15px;
 
}
 
 
#content div.box li {
 
font-size:12px;
 
padding:4px 0;
 
	font-size: 12px;
 
	padding: 4px 0;
 
}
 
 
#content div.box ul.disc,#content div.box ul.circle {
 
margin:10px 24px 10px 38px;
 
	margin: 10px 24px 10px 38px;
 
}
 
 
#content div.box ul.square {
 
margin:10px 24px 10px 40px;
 
	margin: 10px 24px 10px 40px;
 
}
 
 
#content div.box img.left {
 
border:none;
 
float:left;
 
margin:10px 10px 10px 0;
 
	border: none;
 
	float: left;
 
	margin: 10px 10px 10px 0;
 
}
 
 
#content div.box img.right {
 
border:none;
 
float:right;
 
margin:10px 0 10px 10px;
 
	border: none;
 
	float: right;
 
	margin: 10px 0 10px 10px;
 
}
 
 
#content div.box div.messages {
 
clear:both;
 
overflow:hidden;
 
margin:0 20px;
 
padding:0;
 
	clear: both;
 
	overflow: hidden;
 
	margin: 0 20px;
 
	padding: 0;
 
}
 
 
#content div.box div.message {
 
clear:both;
 
overflow:hidden;
 
margin:0;
 
padding:10px 0;
 
	clear: both;
 
	overflow: hidden;
 
	margin: 0;
 
	padding: 10px 0;
 
}
 
 
#content div.box div.message a {
 
font-weight:400 !important;
 
	font-weight: 400 !important;
 
}
 
 
#content div.box div.message div.image {
 
float:left;
 
margin:9px 0 0 5px;
 
padding:6px;
 
	float: left;
 
	margin: 9px 0 0 5px;
 
	padding: 6px;
 
}
 
 
#content div.box div.message div.image img {
 
vertical-align:middle;
 
margin:0;
 
	vertical-align: middle;
 
	margin: 0;
 
}
 
 
#content div.box div.message div.text {
 
float:left;
 
margin:0;
 
padding:9px 6px;
 
	float: left;
 
	margin: 0;
 
	padding: 9px 6px;
 
}
 
 
#content div.box div.message div.dismiss a {
 
height:16px;
 
width:16px;
 
display:block;
 
background:url("../images/icons/cross.png") no-repeat;
 
margin:15px 14px 0 0;
 
padding:0;
 
}
 
 
#content div.box div.message div.text h1,#content div.box div.message div.text h2,#content div.box div.message div.text h3,#content div.box div.message div.text h4,#content div.box div.message div.text h5,#content div.box div.message div.text h6 {
 
border:none;
 
margin:0;
 
padding:0;
 
	height: 16px;
 
	width: 16px;
 
	display: block;
 
	background: url("../images/icons/cross.png") no-repeat;
 
	margin: 15px 14px 0 0;
 
	padding: 0;
 
}
 
 
#content div.box div.message div.text h1,#content div.box div.message div.text h2,#content div.box div.message div.text h3,#content div.box div.message div.text h4,#content div.box div.message div.text h5,#content div.box div.message div.text h6
 
	{
 
	border: none;
 
	margin: 0;
 
	padding: 0;
 
}
 
 
#content div.box div.message div.text span {
 
height:1%;
 
display:block;
 
margin:0;
 
padding:5px 0 0;
 
	height: 1%;
 
	display: block;
 
	margin: 0;
 
	padding: 5px 0 0;
 
}
 
 
#content div.box div.message-error {
 
height:1%;
 
clear:both;
 
overflow:hidden;
 
background:#FBE3E4;
 
border:1px solid #FBC2C4;
 
color:#860006;
 
	height: 1%;
 
	clear: both;
 
	overflow: hidden;
 
	background: #FBE3E4;
 
	border: 1px solid #FBC2C4;
 
	color: #860006;
 
}
 
 
#content div.box div.message-error h6 {
 
color:#860006;
 
	color: #860006;
 
}
 
 
#content div.box div.message-warning {
 
height:1%;
 
clear:both;
 
overflow:hidden;
 
background:#FFF6BF;
 
border:1px solid #FFD324;
 
color:#5f5200;
 
	height: 1%;
 
	clear: both;
 
	overflow: hidden;
 
	background: #FFF6BF;
 
	border: 1px solid #FFD324;
 
	color: #5f5200;
 
}
 
 
#content div.box div.message-warning h6 {
 
color:#5f5200;
 
	color: #5f5200;
 
}
 
 
#content div.box div.message-notice {
 
height:1%;
 
clear:both;
 
overflow:hidden;
 
background:#8FBDE0;
 
border:1px solid #6BACDE;
 
color:#003863;
 
	height: 1%;
 
	clear: both;
 
	overflow: hidden;
 
	background: #8FBDE0;
 
	border: 1px solid #6BACDE;
 
	color: #003863;
 
}
 
 
#content div.box div.message-notice h6 {
 
color:#003863;
 
	color: #003863;
 
}
 
 
#content div.box div.message-success {
 
height:1%;
 
clear:both;
 
overflow:hidden;
 
background:#E6EFC2;
 
border:1px solid #C6D880;
 
color:#4e6100;
 
	height: 1%;
 
	clear: both;
 
	overflow: hidden;
 
	background: #E6EFC2;
 
	border: 1px solid #C6D880;
 
	color: #4e6100;
 
}
 
 
#content div.box div.message-success h6 {
 
color:#4e6100;
 
	color: #4e6100;
 
}
 
 
#content div.box div.form div.fields div.field {
 
height:1%;
 
border-bottom:1px solid #DDD;
 
clear:both;
 
margin:0;
 
padding:10px 0;
 
	height: 1%;
 
	border-bottom: 1px solid #DDD;
 
	clear: both;
 
	margin: 0;
 
	padding: 10px 0;
 
}
 
 
#content div.box div.form div.fields div.field-first {
 
padding:0 0 10px;
 
	padding: 0 0 10px;
 
}
 
 
#content div.box div.form div.fields div.field-noborder {
 
border-bottom:0 !important;
 
	border-bottom: 0 !important;
 
}
 
 
#content div.box div.form div.fields div.field span.error-message {
 
height:1%;
 
display:inline-block;
 
color:red;
 
margin:8px 0 0 4px;
 
padding:0;
 
	height: 1%;
 
	display: inline-block;
 
	color: red;
 
	margin: 8px 0 0 4px;
 
	padding: 0;
 
}
 
 
#content div.box div.form div.fields div.field span.success {
 
height:1%;
 
display:block;
 
color:#316309;
 
margin:8px 0 0;
 
padding:0;
 
	height: 1%;
 
	display: block;
 
	color: #316309;
 
	margin: 8px 0 0;
 
	padding: 0;
 
}
 
 
#content div.box div.form div.fields div.field div.label {
 
left:70px;
 
width:155px;
 
position:absolute;
 
margin:0;
 
padding:8px 0 0 5px;
 
}
 
 
#content div.box-left div.form div.fields div.field div.label,#content div.box-right div.form div.fields div.field div.label {
 
clear:both;
 
overflow:hidden;
 
left:0;
 
width:auto;
 
position:relative;
 
margin:0;
 
padding:0 0 8px;
 
	left: 70px;
 
	width: 155px;
 
	position: absolute;
 
	margin: 0;
 
	padding: 8px 0 0 5px;
 
}
 
 
#content div.box-left div.form div.fields div.field div.label,#content div.box-right div.form div.fields div.field div.label
 
	{
 
	clear: both;
 
	overflow: hidden;
 
	left: 0;
 
	width: auto;
 
	position: relative;
 
	margin: 0;
 
	padding: 0 0 8px;
 
}
 
 
#content div.box div.form div.fields div.field div.label-select {
 
padding:5px 0 0 5px;
 
}
 
 
#content div.box-left div.form div.fields div.field div.label-select,#content div.box-right div.form div.fields div.field div.label-select {
 
padding:0 0 8px;
 
}
 
 
#content div.box-left div.form div.fields div.field div.label-textarea,#content div.box-right div.form div.fields div.field div.label-textarea {
 
padding:0 0 8px !important;
 
}
 
 
#content div.box div.form div.fields div.field div.label label, div.label label{
 
color:#393939;
 
font-weight:700;
 
	padding: 5px 0 0 5px;
 
}
 
 
#content div.box-left div.form div.fields div.field div.label-select,#content div.box-right div.form div.fields div.field div.label-select
 
	{
 
	padding: 0 0 8px;
 
}
 
 
#content div.box-left div.form div.fields div.field div.label-textarea,#content div.box-right div.form div.fields div.field div.label-textarea
 
	{
 
	padding: 0 0 8px !important;
 
}
 
 
#content div.box div.form div.fields div.field div.label label,div.label label
 
	{
 
	color: #393939;
 
	font-weight: 700;
 
}
 
 
#content div.box div.form div.fields div.field div.input {
 
margin:0 0 0 200px;
 
}
 
	margin: 0 0 0 200px;
 
}
 
 
#content div.box div.form div.fields div.field div.file {
 
margin:0 0 0 200px;
 
}
 
#content div.box-left div.form div.fields div.field div.input,#content div.box-right div.form div.fields div.field div.input {
 
margin:0 0 0 0px;
 
	margin: 0 0 0 200px;
 
}
 
 
#content div.box-left div.form div.fields div.field div.input,#content div.box-right div.form div.fields div.field div.input
 
	{
 
	margin: 0 0 0 0px;
 
}
 
 
#content div.box div.form div.fields div.field div.input input {
 
background:#FFF;
 
border-top:1px solid #b3b3b3;
 
border-left:1px solid #b3b3b3;
 
border-right:1px solid #eaeaea;
 
border-bottom:1px solid #eaeaea;
 
color:#000;
 
font-family:Lucida Grande, Verdana, Lucida Sans Regular, Lucida Sans Unicode, Arial, sans-serif;
 
font-size:11px;
 
margin:0;
 
padding:7px 7px 6px;
 
	background: #FFF;
 
	border-top: 1px solid #b3b3b3;
 
	border-left: 1px solid #b3b3b3;
 
	border-right: 1px solid #eaeaea;
 
	border-bottom: 1px solid #eaeaea;
 
	color: #000;
 
	font-size: 11px;
 
	margin: 0;
 
	padding: 7px 7px 6px;
 
}
 
 
#content div.box div.form div.fields div.field div.file input {
 
    background: none repeat scroll 0 0 #FFFFFF;
 
    border-color: #B3B3B3 #EAEAEA #EAEAEA #B3B3B3;
 
    border-style: solid;
 
    border-width: 1px;
 
    color: #000000;
 
    font-family: Lucida Grande,Verdana,Lucida Sans Regular,Lucida Sans Unicode,Arial,sans-serif;
 
    font-size: 11px;
 
    margin: 0;
 
    padding: 7px 7px 6px;
 
}
 
 
	background: none repeat scroll 0 0 #FFFFFF;
 
	border-color: #B3B3B3 #EAEAEA #EAEAEA #B3B3B3;
 
	border-style: solid;
 
	border-width: 1px;
 
	color: #000000;
 
	font-size: 11px;
 
	margin: 0;
 
	padding: 7px 7px 6px;
 
}
 
 
#content div.box div.form div.fields div.field div.input input.small {
 
width:30%;
 
	width: 30%;
 
}
 
 
#content div.box div.form div.fields div.field div.input input.medium {
 
width:55%;
 
	width: 55%;
 
}
 
 
#content div.box div.form div.fields div.field div.input input.large {
 
width:85%;
 
	width: 85%;
 
}
 
 
#content div.box div.form div.fields div.field div.input input.date {
 
width:177px;
 
	width: 177px;
 
}
 
 
#content div.box div.form div.fields div.field div.input input.button {
 
background:#D4D0C8;
 
border-top:1px solid #FFF;
 
border-left:1px solid #FFF;
 
border-right:1px solid #404040;
 
border-bottom:1px solid #404040;
 
color:#000;
 
margin:0;
 
padding:4px 8px;
 
	background: #D4D0C8;
 
	border-top: 1px solid #FFF;
 
	border-left: 1px solid #FFF;
 
	border-right: 1px solid #404040;
 
	border-bottom: 1px solid #404040;
 
	color: #000;
 
	margin: 0;
 
	padding: 4px 8px;
 
}
 
 
#content div.box div.form div.fields div.field div.textarea {
 
border-top:1px solid #b3b3b3;
 
border-left:1px solid #b3b3b3;
 
border-right:1px solid #eaeaea;
 
border-bottom:1px solid #eaeaea;
 
margin:0 0 0 200px;
 
padding:10px;
 
	border-top: 1px solid #b3b3b3;
 
	border-left: 1px solid #b3b3b3;
 
	border-right: 1px solid #eaeaea;
 
	border-bottom: 1px solid #eaeaea;
 
	margin: 0 0 0 200px;
 
	padding: 10px;
 
}
 
 
#content div.box div.form div.fields div.field div.textarea-editor {
 
border:1px solid #ddd;
 
padding:0;
 
	border: 1px solid #ddd;
 
	padding: 0;
 
}
 
 
#content div.box div.form div.fields div.field div.textarea textarea {
 
width:100%;
 
height:220px;
 
overflow:hidden;
 
background:#FFF;
 
color:#000;
 
font-family:Lucida Grande, Verdana, Lucida Sans Regular, Lucida Sans Unicode, Arial, sans-serif;
 
font-size:11px;
 
outline:none;
 
border-width:0;
 
margin:0;
 
padding:0;
 
}
 
 
#content div.box-left div.form div.fields div.field div.textarea textarea,#content div.box-right div.form div.fields div.field div.textarea textarea {
 
width:100%;
 
height:100px;
 
	width: 100%;
 
	height: 220px;
 
	overflow: hidden;
 
	background: #FFF;
 
	color: #000;
 
	font-size: 11px;
 
	outline: none;
 
	border-width: 0;
 
	margin: 0;
 
	padding: 0;
 
}
 
 
#content div.box-left div.form div.fields div.field div.textarea textarea,#content div.box-right div.form div.fields div.field div.textarea textarea
 
	{
 
	width: 100%;
 
	height: 100px;
 
}
 
 
#content div.box div.form div.fields div.field div.textarea table {
 
width:100%;
 
border:none;
 
margin:0;
 
padding:0;
 
	width: 100%;
 
	border: none;
 
	margin: 0;
 
	padding: 0;
 
}
 
 
#content div.box div.form div.fields div.field div.textarea table td {
 
background:#DDD;
 
border:none;
 
padding:0;
 
}
 
 
#content div.box div.form div.fields div.field div.textarea table td table {
 
width:auto;
 
border:none;
 
margin:0;
 
padding:0;
 
}
 
 
#content div.box div.form div.fields div.field div.textarea table td table td {
 
font-family:Lucida Grande, Verdana, Lucida Sans Regular, Lucida Sans Unicode, Arial, sans-serif;
 
font-size:11px;
 
padding:5px 5px 5px 0;
 
}
 
 
#content div.box div.form div.fields div.field input[type=text]:focus,#content div.box div.form div.fields div.field input[type=password]:focus,#content div.box div.form div.fields div.field input[type=file]:focus,#content div.box div.form div.fields div.field textarea:focus,#content div.box div.form div.fields div.field select:focus {
 
background:#f6f6f6;
 
border-color:#666;
 
	background: #DDD;
 
	border: none;
 
	padding: 0;
 
}
 
 
#content div.box div.form div.fields div.field div.textarea table td table
 
	{
 
	width: auto;
 
	border: none;
 
	margin: 0;
 
	padding: 0;
 
}
 
 
#content div.box div.form div.fields div.field div.textarea table td table td
 
	{
 
	font-size: 11px;
 
	padding: 5px 5px 5px 0;
 
}
 
 
#content div.box div.form div.fields div.field input[type=text]:focus,#content div.box div.form div.fields div.field input[type=password]:focus,#content div.box div.form div.fields div.field input[type=file]:focus,#content div.box div.form div.fields div.field textarea:focus,#content div.box div.form div.fields div.field select:focus
 
	{
 
	background: #f6f6f6;
 
	border-color: #666;
 
}
 
 
div.form div.fields div.field div.button {
 
margin:0;
 
padding:0 0 0 8px;
 
}
 
 
	margin: 0;
 
	padding: 0 0 0 8px;
 
}
 
#content div.box table.noborder {
 
	border: 1px solid transparent;
 
}
 
 
#content div.box table {
 
width:100%;
 
border-collapse:collapse;
 
margin:0;
 
padding:0;
 
border: 1px solid #eee;
 
	width: 100%;
 
	border-collapse: separate;
 
	margin: 0;
 
	padding: 0;
 
	border: 1px solid #eee;
 
    -webkit-border-radius: 4px;
 
    -moz-border-radius: 4px;
 
    border-radius: 4px;	
 
}
 
 
#content div.box table th {
 
background:#eee;
 
border-bottom:1px solid #ddd;
 
padding:5px 0px 5px 5px;
 
	background: #eee;
 
	border-bottom: 1px solid #ddd;
 
	padding: 5px 0px 5px 5px;
 
}
 
 
#content div.box table th.left {
 
text-align:left;
 
	text-align: left;
 
}
 
 
#content div.box table th.right {
 
text-align:right;
 
	text-align: right;
 
}
 
 
#content div.box table th.center {
 
text-align:center;
 
	text-align: center;
 
}
 
 
#content div.box table th.selected {
 
vertical-align:middle;
 
padding:0;
 
	vertical-align: middle;
 
	padding: 0;
 
}
 
 
#content div.box table td {
 
background:#fff;
 
border-bottom:1px solid #cdcdcd;
 
vertical-align:middle;
 
padding:5px;
 
	background: #fff;
 
	border-bottom: 1px solid #cdcdcd;
 
	vertical-align: middle;
 
	padding: 5px;
 
}
 
 
#content div.box table tr.selected td {
 
background:#FFC;
 
	background: #FFC;
 
}
 
 
#content div.box table td.selected {
 
width:3%;
 
text-align:center;
 
vertical-align:middle;
 
padding:0;
 
	width: 3%;
 
	text-align: center;
 
	vertical-align: middle;
 
	padding: 0;
 
}
 
 
#content div.box table td.action {
 
width:45%;
 
text-align:left;
 
	width: 45%;
 
	text-align: left;
 
}
 
 
#content div.box table td.date {
 
width:33%;
 
text-align:center;
 
	width: 33%;
 
	text-align: center;
 
}
 
 
#content div.box div.action {
 
float:right;
 
background:#FFF;
 
text-align:right;
 
margin:10px 0 0;
 
padding:0;
 
	float: right;
 
	background: #FFF;
 
	text-align: right;
 
	margin: 10px 0 0;
 
	padding: 0;
 
}
 
 
#content div.box div.action select {
 
font-family:Lucida Grande, Verdana, Lucida Sans Regular, Lucida Sans Unicode, Arial, sans-serif;
 
font-size:11px;
 
margin:0;
 
	font-size: 11px;
 
	margin: 0;
 
}
 
 
#content div.box div.action .ui-selectmenu {
 
margin:0;
 
padding:0;
 
	margin: 0;
 
	padding: 0;
 
}
 
 
#content div.box div.pagination {
 
height:1%;
 
clear:both;
 
overflow:hidden;
 
margin:10px 0 0;
 
padding:0;
 
	height: 1%;
 
	clear: both;
 
	overflow: hidden;
 
	margin: 10px 0 0;
 
	padding: 0;
 
}
 
 
#content div.box div.pagination ul.pager {
 
float:right;
 
text-align:right;
 
margin:0;
 
padding:0;
 
	float: right;
 
	text-align: right;
 
	margin: 0;
 
	padding: 0;
 
}
 
 
#content div.box div.pagination ul.pager li {
 
height:1%;
 
float:left;
 
list-style:none;
 
background:#ebebeb url("../images/pager.png") repeat-x;
 
border-top:1px solid #dedede;
 
border-left:1px solid #cfcfcf;
 
border-right:1px solid #c4c4c4;
 
border-bottom:1px solid #c4c4c4;
 
color:#4A4A4A;
 
font-weight:700;
 
margin:0 0 0 4px;
 
padding:0;
 
	height: 1%;
 
	float: left;
 
	list-style: none;
 
	background: #ebebeb url("../images/pager.png") repeat-x;
 
	border-top: 1px solid #dedede;
 
	border-left: 1px solid #cfcfcf;
 
	border-right: 1px solid #c4c4c4;
 
	border-bottom: 1px solid #c4c4c4;
 
	color: #4A4A4A;
 
	font-weight: 700;
 
	margin: 0 0 0 4px;
 
	padding: 0;
 
}
 
 
#content div.box div.pagination ul.pager li.separator {
 
padding:6px;
 
	padding: 6px;
 
}
 
 
#content div.box div.pagination ul.pager li.current {
 
background:#b4b4b4 url("../images/pager_selected.png") repeat-x;
 
border-top:1px solid #ccc;
 
border-left:1px solid #bebebe;
 
border-right:1px solid #b1b1b1;
 
border-bottom:1px solid #afafaf;
 
color:#515151;
 
padding:6px;
 
	background: #b4b4b4 url("../images/pager_selected.png") repeat-x;
 
	border-top: 1px solid #ccc;
 
	border-left: 1px solid #bebebe;
 
	border-right: 1px solid #b1b1b1;
 
	border-bottom: 1px solid #afafaf;
 
	color: #515151;
 
	padding: 6px;
 
}
 
 
#content div.box div.pagination ul.pager li a {
 
height:1%;
 
display:block;
 
float:left;
 
color:#515151;
 
text-decoration:none;
 
margin:0;
 
padding:6px;
 
}
 
 
#content div.box div.pagination ul.pager li a:hover,#content div.box div.pagination ul.pager li a:active {
 
background:#b4b4b4 url("../images/pager_selected.png") repeat-x;
 
border-top:1px solid #ccc;
 
border-left:1px solid #bebebe;
 
border-right:1px solid #b1b1b1;
 
border-bottom:1px solid #afafaf;
 
margin:-1px;
 
	height: 1%;
 
	display: block;
 
	float: left;
 
	color: #515151;
 
	text-decoration: none;
 
	margin: 0;
 
	padding: 6px;
 
}
 
 
#content div.box div.pagination ul.pager li a:hover,#content div.box div.pagination ul.pager li a:active
 
	{
 
	background: #b4b4b4 url("../images/pager_selected.png") repeat-x;
 
	border-top: 1px solid #ccc;
 
	border-left: 1px solid #bebebe;
 
	border-right: 1px solid #b1b1b1;
 
	border-bottom: 1px solid #afafaf;
 
	margin: -1px;
 
}
 
 
#content div.box div.pagination-wh {
 
height:1%;
 
clear:both;
 
overflow:hidden;
 
text-align:right;
 
margin:10px 0 0;
 
padding:0;
 
	height: 1%;
 
	clear: both;
 
	overflow: hidden;
 
	text-align: right;
 
	margin: 10px 0 0;
 
	padding: 0;
 
}
 
 
#content div.box div.pagination-right {
 
float:right;
 
}
 
 
#content div.box div.pagination-wh a,#content div.box div.pagination-wh span.pager_dotdot {
 
height:1%;
 
float:left;
 
background:#ebebeb url("../images/pager.png") repeat-x;
 
border-top:1px solid #dedede;
 
border-left:1px solid #cfcfcf;
 
border-right:1px solid #c4c4c4;
 
border-bottom:1px solid #c4c4c4;
 
color:#4A4A4A;
 
font-weight:700;
 
margin:0 0 0 4px;
 
padding:6px;
 
	float: right;
 
}
 
 
#content div.box div.pagination-wh a,#content div.box div.pagination-wh span.pager_dotdot
 
	{
 
	height: 1%;
 
	float: left;
 
	background: #ebebeb url("../images/pager.png") repeat-x;
 
	border-top: 1px solid #dedede;
 
	border-left: 1px solid #cfcfcf;
 
	border-right: 1px solid #c4c4c4;
 
	border-bottom: 1px solid #c4c4c4;
 
	color: #4A4A4A;
 
	font-weight: 700;
 
	margin: 0 0 0 4px;
 
	padding: 6px;
 
}
 
 
#content div.box div.pagination-wh span.pager_curpage {
 
height:1%;
 
float:left;
 
background:#b4b4b4 url("../images/pager_selected.png") repeat-x;
 
border-top:1px solid #ccc;
 
border-left:1px solid #bebebe;
 
border-right:1px solid #b1b1b1;
 
border-bottom:1px solid #afafaf;
 
color:#515151;
 
font-weight:700;
 
margin:0 0 0 4px;
 
padding:6px;
 
}
 
 
#content div.box div.pagination-wh a:hover,#content div.box div.pagination-wh a:active {
 
background:#b4b4b4 url("../images/pager_selected.png") repeat-x;
 
border-top:1px solid #ccc;
 
border-left:1px solid #bebebe;
 
border-right:1px solid #b1b1b1;
 
border-bottom:1px solid #afafaf;
 
text-decoration:none;
 
	height: 1%;
 
	float: left;
 
	background: #b4b4b4 url("../images/pager_selected.png") repeat-x;
 
	border-top: 1px solid #ccc;
 
	border-left: 1px solid #bebebe;
 
	border-right: 1px solid #b1b1b1;
 
	border-bottom: 1px solid #afafaf;
 
	color: #515151;
 
	font-weight: 700;
 
	margin: 0 0 0 4px;
 
	padding: 6px;
 
}
 
 
#content div.box div.pagination-wh a:hover,#content div.box div.pagination-wh a:active
 
	{
 
	background: #b4b4b4 url("../images/pager_selected.png") repeat-x;
 
	border-top: 1px solid #ccc;
 
	border-left: 1px solid #bebebe;
 
	border-right: 1px solid #b1b1b1;
 
	border-bottom: 1px solid #afafaf;
 
	text-decoration: none;
 
}
 
 
#content div.box div.traffic div.legend {
 
clear:both;
 
overflow:hidden;
 
border-bottom:1px solid #ddd;
 
margin:0 0 10px;
 
padding:0 0 10px;
 
	clear: both;
 
	overflow: hidden;
 
	border-bottom: 1px solid #ddd;
 
	margin: 0 0 10px;
 
	padding: 0 0 10px;
 
}
 
 
#content div.box div.traffic div.legend h6 {
 
float:left;
 
border:none;
 
margin:0;
 
padding:0;
 
	float: left;
 
	border: none;
 
	margin: 0;
 
	padding: 0;
 
}
 
 
#content div.box div.traffic div.legend li {
 
list-style:none;
 
float:left;
 
font-size:11px;
 
margin:0;
 
padding:0 8px 0 4px;
 
	list-style: none;
 
	float: left;
 
	font-size: 11px;
 
	margin: 0;
 
	padding: 0 8px 0 4px;
 
}
 
 
#content div.box div.traffic div.legend li.visits {
 
border-left:12px solid #edc240;
 
	border-left: 12px solid #edc240;
 
}
 
 
#content div.box div.traffic div.legend li.pageviews {
 
border-left:12px solid #afd8f8;
 
	border-left: 12px solid #afd8f8;
 
}
 
 
#content div.box div.traffic table {
 
width:auto;
 
	width: auto;
 
}
 
 
#content div.box div.traffic table td {
 
background:transparent;
 
border:none;
 
padding:2px 3px 3px;
 
	background: transparent;
 
	border: none;
 
	padding: 2px 3px 3px;
 
}
 
 
#content div.box div.traffic table td.legendLabel {
 
padding:0 3px 2px;
 
}
 
 
#summary{
 
 
}
 
 
#summary .desc{
 
white-space: pre;
 
width: 100%;
 
}
 
 
#summary .repo_name{
 
font-size: 1.6em;
 
font-weight: bold;
 
vertical-align: baseline;
 
clear:right
 
}
 
 
	padding: 0 3px 2px;
 
}
 
 
#summary {
 
	
 
}
 
 
#summary .desc {
 
	white-space: pre;
 
	width: 100%;
 
}
 
 
#summary .repo_name {
 
	font-size: 1.6em;
 
	font-weight: bold;
 
	vertical-align: baseline;
 
	clear: right
 
}
 
 
#footer {
 
clear:both;
 
overflow:hidden;
 
text-align:right;
 
margin:0;
 
padding:0 10px 4px;
 
margin:-10px 0 0;
 
	clear: both;
 
	overflow: hidden;
 
	text-align: right;
 
	margin: 0;
 
	padding: 0 10px 4px;
 
	margin: -10px 0 0;
 
}
 
 
#footer div#footer-inner {
 
background:url("../images/header_inner.png") repeat-x scroll 0 0 #003367;
 
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.6);
 
-webkit-border-radius: 4px 4px 4px 4px;
 
-khtml-border-radius: 4px 4px 4px 4px; 
 
-moz-border-radius: 4px 4px 4px 4px;
 
border-radius: 4px 4px 4px 4px;
 
	background-color: #eedc94; background-repeat : repeat-x;
 
	background-image : -khtml-gradient( linear, left top, left bottom,
 
	from( #fceec1), to( #eedc94)); background-image : -moz-linear-gradient(
 
	top, #003b76, #00376e); background-image : -ms-linear-gradient( top,
 
	#003b76, #00376e); background-image : -webkit-gradient( linear, left
 
	top, left bottom, color-stop( 0%, #003b76), color-stop( 100%, #00376e));
 
	background-image : -webkit-linear-gradient( top, #003b76, #00376e));
 
	background-image : -o-linear-gradient( top, #003b76, #00376e));
 
	background-image : linear-gradient( top, #003b76, #00376e); filter :
 
	progid : DXImageTransform.Microsoft.gradient ( startColorstr =
 
	'#003b76', endColorstr = '#00376e', GradientType = 0);
 
	box-shadow: 0 2px 2px rgba(0, 0, 0, 0.6);
 
	-webkit-border-radius: 4px 4px 4px 4px;
 
	-khtml-border-radius: 4px 4px 4px 4px;
 
	-moz-border-radius: 4px 4px 4px 4px;
 
	border-radius: 4px 4px 4px 4px;
 
	background-repeat: repeat-x;
 
	background-image: -khtml-gradient(linear, left top, left bottom, from(#fceec1),
 
		to(#eedc94) );
 
	background-image: -moz-linear-gradient(top, #003b76, #00376e);
 
	background-image: -ms-linear-gradient(top, #003b76, #00376e);
 
	background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #003b76),
 
		color-stop(100%, #00376e) );
 
	background-image: -webkit-linear-gradient(top, #003b76, #00376e) );
 
	background-image: -o-linear-gradient(top, #003b76, #00376e) );
 
	background-image: linear-gradient(top, #003b76, #00376e);
 
	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#003b76',
 
		endColorstr='#00376e', GradientType=0 );
 
}
 
 
#footer div#footer-inner p {
 
padding:15px 25px 15px 0;
 
color:#FFF;
 
font-weight:700;
 
}
 
	padding: 15px 25px 15px 0;
 
	color: #FFF;
 
	font-weight: 700;
 
}
 
 
#footer div#footer-inner .footer-link {
 
float:left;
 
padding-left:10px;
 
}
 
#footer div#footer-inner .footer-link a,#footer div#footer-inner .footer-link-right a {
 
color:#FFF; 
 
	float: left;
 
	padding-left: 10px;
 
}
 
 
#footer div#footer-inner .footer-link a,#footer div#footer-inner .footer-link-right a
 
	{
 
	color: #FFF;
 
}
 
 
#login div.title {
 
width:420px;
 
clear:both;
 
overflow:hidden;
 
position:relative;
 
background:#003367 url("../images/header_inner.png") repeat-x;
 
margin:0 auto;
 
padding:0;
 
	width: 420px;
 
	clear: both;
 
	overflow: hidden;
 
	position: relative;
 
	background-color: #eedc94; background-repeat : repeat-x;
 
	background-image : -khtml-gradient( linear, left top, left bottom,
 
	from( #fceec1), to( #eedc94)); background-image : -moz-linear-gradient(
 
	top, #003b76, #00376e); background-image : -ms-linear-gradient( top,
 
	#003b76, #00376e); background-image : -webkit-gradient( linear, left
 
	top, left bottom, color-stop( 0%, #003b76), color-stop( 100%, #00376e));
 
	background-image : -webkit-linear-gradient( top, #003b76, #00376e));
 
	background-image : -o-linear-gradient( top, #003b76, #00376e));
 
	background-image : linear-gradient( top, #003b76, #00376e); filter :
 
	progid : DXImageTransform.Microsoft.gradient ( startColorstr =
 
	'#003b76', endColorstr = '#00376e', GradientType = 0);
 
	margin: 0 auto;
 
	padding: 0;
 
	background-repeat: repeat-x;
 
	background-image: -khtml-gradient(linear, left top, left bottom, from(#fceec1),
 
		to(#eedc94) );
 
	background-image: -moz-linear-gradient(top, #003b76, #00376e);
 
	background-image: -ms-linear-gradient(top, #003b76, #00376e);
 
	background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #003b76),
 
		color-stop(100%, #00376e) );
 
	background-image: -webkit-linear-gradient(top, #003b76, #00376e) );
 
	background-image: -o-linear-gradient(top, #003b76, #00376e) );
 
	background-image: linear-gradient(top, #003b76, #00376e);
 
	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#003b76',
 
		endColorstr='#00376e', GradientType=0 );
 
}
 
 
#login div.inner {
 
width:380px;
 
background:#FFF url("../images/login.png") no-repeat top left;
 
border-top:none;
 
border-bottom:none;
 
margin:0 auto;
 
padding:20px;
 
	width: 380px;
 
	background: #FFF url("../images/login.png") no-repeat top left;
 
	border-top: none;
 
	border-bottom: none;
 
	margin: 0 auto;
 
	padding: 20px;
 
}
 
 
#login div.form div.fields div.field div.label {
 
width:173px;
 
float:left;
 
text-align:right;
 
margin:2px 10px 0 0;
 
padding:5px 0 0 5px;
 
	width: 173px;
 
	float: left;
 
	text-align: right;
 
	margin: 2px 10px 0 0;
 
	padding: 5px 0 0 5px;
 
}
 
 
#login div.form div.fields div.field div.input input {
 
width:176px;
 
background:#FFF;
 
border-top:1px solid #b3b3b3;
 
border-left:1px solid #b3b3b3;
 
border-right:1px solid #eaeaea;
 
border-bottom:1px solid #eaeaea;
 
color:#000;
 
font-family:Lucida Grande, Verdana, Lucida Sans Regular, Lucida Sans Unicode, Arial, sans-serif;
 
font-size:11px;
 
margin:0;
 
padding:7px 7px 6px;
 
	width: 176px;
 
	background: #FFF;
 
	border-top: 1px solid #b3b3b3;
 
	border-left: 1px solid #b3b3b3;
 
	border-right: 1px solid #eaeaea;
 
	border-bottom: 1px solid #eaeaea;
 
	color: #000;
 
	font-size: 11px;
 
	margin: 0;
 
	padding: 7px 7px 6px;
 
}
 
 
#login div.form div.fields div.buttons {
 
clear:both;
 
overflow:hidden;
 
border-top:1px solid #DDD;
 
text-align:right;
 
margin:0;
 
padding:10px 0 0;
 
	clear: both;
 
	overflow: hidden;
 
	border-top: 1px solid #DDD;
 
	text-align: right;
 
	margin: 0;
 
	padding: 10px 0 0;
 
}
 
 
#login div.form div.links {
 
clear:both;
 
overflow:hidden;
 
margin:10px 0 0;
 
padding:0 0 2px;
 
}
 
 
#quick_login{
 
top: 31px;
 
background-color: rgb(0, 51, 103);
 
z-index: 999; 
 
height: 150px;
 
position: absolute;
 
margin-left: -16px;
 
width: 281px;
 
-webkit-border-radius: 0px 0px 4px 4px;
 
-khtml-border-radius: 0px 0px 4px 4px; 
 
-moz-border-radius: 0px 0px 4px 4px;
 
border-radius: 0px 0px 4px 4px;
 
 
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.6);
 
}
 
 
#quick_login .password_forgoten{
 
padding-right:10px;
 
padding-top:0px;
 
float:left;
 
}
 
#quick_login .password_forgoten a{
 
	clear: both;
 
	overflow: hidden;
 
	margin: 10px 0 0;
 
	padding: 0 0 2px;
 
}
 
 
#quick_login {
 
	top: 31px;
 
	background-color: rgb(0, 51, 103);
 
	z-index: 999;
 
	height: 150px;
 
	position: absolute;
 
	margin-left: -16px;
 
	width: 281px;
 
	-webkit-border-radius: 0px 0px 4px 4px;
 
	-khtml-border-radius: 0px 0px 4px 4px;
 
	-moz-border-radius: 0px 0px 4px 4px;
 
	border-radius: 0px 0px 4px 4px;
 
	box-shadow: 0 2px 2px rgba(0, 0, 0, 0.6);
 
}
 
 
#quick_login .password_forgoten {
 
	padding-right: 10px;
 
	padding-top: 0px;
 
	float: left;
 
}
 
 
#quick_login .password_forgoten a {
 
	font-size: 10px
 
}
 
 
#quick_login .register{
 
padding-right:10px;
 
padding-top:5px;
 
float:left;
 
}
 
 
#quick_login .register a{
 
#quick_login .register {
 
	padding-right: 10px;
 
	padding-top: 5px;
 
	float: left;
 
}
 
 
#quick_login .register a {
 
	font-size: 10px
 
}
 
#quick_login div.form div.fields{
 
padding-top: 2px;
 
padding-left:10px;
 
}
 
 
#quick_login div.form div.fields div.field{
 
 padding: 5px;
 
}
 
 
#quick_login div.form div.fields div.field div.label label{
 
color:#fff;
 
padding-bottom: 3px;
 
 
#quick_login div.form div.fields {
 
	padding-top: 2px;
 
	padding-left: 10px;
 
}
 
 
#quick_login div.form div.fields div.field {
 
	padding: 5px;
 
}
 
 
#quick_login div.form div.fields div.field div.label label {
 
	color: #fff;
 
	padding-bottom: 3px;
 
}
 
 
#quick_login div.form div.fields div.field div.input input {
 
width:236px;
 
background:#FFF;
 
border-top:1px solid #b3b3b3;
 
border-left:1px solid #b3b3b3;
 
border-right:1px solid #eaeaea;
 
border-bottom:1px solid #eaeaea;
 
color:#000;
 
font-family:Lucida Grande, Verdana, Lucida Sans Regular, Lucida Sans Unicode, Arial, sans-serif;
 
font-size:11px;
 
margin:0;
 
padding:5px 7px 4px;
 
	width: 236px;
 
	background: #FFF;
 
	border-top: 1px solid #b3b3b3;
 
	border-left: 1px solid #b3b3b3;
 
	border-right: 1px solid #eaeaea;
 
	border-bottom: 1px solid #eaeaea;
 
	color: #000;
 
	font-size: 11px;
 
	margin: 0;
 
	padding: 5px 7px 4px;
 
}
 
 
#quick_login div.form div.fields div.buttons {
 
clear:both;
 
overflow:hidden;
 
text-align:right;
 
margin:0;
 
padding:10px 14px 0px 5px;
 
	clear: both;
 
	overflow: hidden;
 
	text-align: right;
 
	margin: 0;
 
	padding: 10px 14px 0px 5px;
 
}
 
 
#quick_login div.form div.links {
 
clear:both;
 
overflow:hidden;
 
margin:10px 0 0;
 
padding:0 0 2px;
 
	clear: both;
 
	overflow: hidden;
 
	margin: 10px 0 0;
 
	padding: 0 0 2px;
 
}
 
 
#register div.title {
 
clear:both;
 
overflow:hidden;
 
position:relative;
 
background:#003367 url("../images/header_inner.png") repeat-x;
 
margin:0 auto;
 
padding:0;
 
	clear: both;
 
	overflow: hidden;
 
	position: relative;
 
    background-color: #eedc94;
 
    background-repeat: repeat-x;
 
    background-image: -khtml-gradient(linear, left top, left bottom, from(#fceec1),
 
        to(#eedc94) );
 
    background-image: -moz-linear-gradient(top, #003b76, #00376e);
 
    background-image: -ms-linear-gradient(top, #003b76, #00376e);
 
    background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #003b76),
 
        color-stop(100%, #00376e) );
 
    background-image: -webkit-linear-gradient(top, #003b76, #00376e) );
 
    background-image: -o-linear-gradient(top, #003b76, #00376e) );
 
    background-image: linear-gradient(top, #003b76, #00376e);
 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#003b76',
 
        endColorstr='#00376e', GradientType=0 );
 
	margin: 0 auto;
 
	padding: 0;
 
}
 
 
#register div.inner {
 
background:#FFF;
 
border-top:none;
 
border-bottom:none;
 
margin:0 auto;
 
padding:20px;
 
	background: #FFF;
 
	border-top: none;
 
	border-bottom: none;
 
	margin: 0 auto;
 
	padding: 20px;
 
}
 
 
#register div.form div.fields div.field div.label {
 
width:135px;
 
float:left;
 
text-align:right;
 
margin:2px 10px 0 0;
 
padding:5px 0 0 5px;
 
	width: 135px;
 
	float: left;
 
	text-align: right;
 
	margin: 2px 10px 0 0;
 
	padding: 5px 0 0 5px;
 
}
 
 
#register div.form div.fields div.field div.input input {
 
width:300px;
 
background:#FFF;
 
border-top:1px solid #b3b3b3;
 
border-left:1px solid #b3b3b3;
 
border-right:1px solid #eaeaea;
 
border-bottom:1px solid #eaeaea;
 
color:#000;
 
font-family:Lucida Grande, Verdana, Lucida Sans Regular, Lucida Sans Unicode, Arial, sans-serif;
 
font-size:11px;
 
margin:0;
 
padding:7px 7px 6px;
 
	width: 300px;
 
	background: #FFF;
 
	border-top: 1px solid #b3b3b3;
 
	border-left: 1px solid #b3b3b3;
 
	border-right: 1px solid #eaeaea;
 
	border-bottom: 1px solid #eaeaea;
 
	color: #000;
 
	font-size: 11px;
 
	margin: 0;
 
	padding: 7px 7px 6px;
 
}
 
 
#register div.form div.fields div.buttons {
 
clear:both;
 
overflow:hidden;
 
border-top:1px solid #DDD;
 
text-align:left;
 
margin:0;
 
padding:10px 0 0 150px;
 
}
 
 
	clear: both;
 
	overflow: hidden;
 
	border-top: 1px solid #DDD;
 
	text-align: left;
 
	margin: 0;
 
	padding: 10px 0 0 150px;
 
}
 
 
#register div.form div.activation_msg {
 
padding-top:4px;
 
padding-bottom:4px;
 
}
 
 
#journal .journal_day{
 
font-size:20px;
 
padding:10px 0px;
 
border-bottom:2px solid #DDD;
 
margin-left:10px;
 
margin-right:10px;
 
}
 
 
#journal .journal_container{
 
padding:5px;
 
clear:both;
 
margin:0px 5px 0px 10px;
 
}
 
 
#journal .journal_action_container{
 
padding-left:38px;
 
}
 
 
#journal .journal_user{
 
color: #747474;
 
font-size: 14px;
 
font-weight: bold;
 
height: 30px;
 
}
 
#journal .journal_icon{
 
clear: both;
 
float: left;
 
padding-right: 4px;
 
padding-top: 3px;
 
}
 
#journal .journal_action{
 
padding-top:4px;
 
min-height:2px;
 
float:left
 
}
 
#journal .journal_action_params{
 
clear: left;
 
padding-left: 22px;
 
}
 
#journal .journal_repo{
 
float: left;
 
margin-left: 6px;
 
padding-top: 3px;
 
}
 
#journal .date{
 
clear: both;
 
color: #777777;
 
font-size: 11px;
 
padding-left: 22px;
 
}
 
#journal .journal_repo .journal_repo_name{
 
font-weight: bold;
 
font-size: 1.1em;
 
}
 
#journal .compare_view{
 
padding: 5px 0px 5px 0px;
 
width: 95px;
 
}
 
.journal_highlight{
 
font-weight: bold;
 
padding: 0 2px;
 
vertical-align: bottom;
 
}
 
	padding-top: 4px;
 
	padding-bottom: 4px;
 
}
 
 
#journal .journal_day {
 
	font-size: 20px;
 
	padding: 10px 0px;
 
	border-bottom: 2px solid #DDD;
 
	margin-left: 10px;
 
	margin-right: 10px;
 
}
 
 
#journal .journal_container {
 
	padding: 5px;
 
	clear: both;
 
	margin: 0px 5px 0px 10px;
 
}
 
 
#journal .journal_action_container {
 
	padding-left: 38px;
 
}
 
 
#journal .journal_user {
 
	color: #747474;
 
	font-size: 14px;
 
	font-weight: bold;
 
	height: 30px;
 
}
 
 
#journal .journal_icon {
 
	clear: both;
 
	float: left;
 
	padding-right: 4px;
 
	padding-top: 3px;
 
}
 
 
#journal .journal_action {
 
	padding-top: 4px;
 
	min-height: 2px;
 
	float: left
 
}
 
 
#journal .journal_action_params {
 
	clear: left;
 
	padding-left: 22px;
 
}
 
 
#journal .journal_repo {
 
	float: left;
 
	margin-left: 6px;
 
	padding-top: 3px;
 
}
 
 
#journal .date {
 
	clear: both;
 
	color: #777777;
 
	font-size: 11px;
 
	padding-left: 22px;
 
}
 
 
#journal .journal_repo .journal_repo_name {
 
	font-weight: bold;
 
	font-size: 1.1em;
 
}
 
 
#journal .compare_view {
 
	padding: 5px 0px 5px 0px;
 
	width: 95px;
 
}
 
 
.journal_highlight {
 
	font-weight: bold;
 
	padding: 0 2px;
 
	vertical-align: bottom;
 
}
 
 
.trending_language_tbl,.trending_language_tbl td {
 
border:0 !important;
 
margin:0 !important;
 
padding:0 !important;
 
	border: 0 !important;
 
	margin: 0 !important;
 
	padding: 0 !important;
 
}
 
 
.trending_language {
 
background-color:#003367;
 
color:#FFF;
 
display:block;
 
min-width:20px;
 
text-decoration:none;
 
height:12px;
 
margin-bottom:4px;
 
margin-left:5px;
 
white-space:pre;
 
padding:3px;
 
	background-color: #003367;
 
	color: #FFF;
 
	display: block;
 
	min-width: 20px;
 
	text-decoration: none;
 
	height: 12px;
 
	margin-bottom: 4px;
 
	margin-left: 5px;
 
	white-space: pre;
 
	padding: 3px;
 
}
 
 
h3.files_location {
 
font-size:1.8em;
 
font-weight:700;
 
border-bottom:none !important;
 
margin:10px 0 !important;
 
	font-size: 1.8em;
 
	font-weight: 700;
 
	border-bottom: none !important;
 
	margin: 10px 0 !important;
 
}
 
 
#files_data dl dt {
 
float:left;
 
width:115px;
 
margin:0 !important;
 
padding:5px;
 
	float: left;
 
	width: 115px;
 
	margin: 0 !important;
 
	padding: 5px;
 
}
 
 
#files_data dl dd {
 
margin:0 !important;
 
padding:5px !important;
 
	margin: 0 !important;
 
	padding: 5px !important;
 
}
 
 
#changeset_content {
 
border:1px solid #CCC;
 
padding:5px;
 
}
 
#changeset_compare_view_content{
 
border:1px solid #CCC;
 
padding:5px;
 
	border: 1px solid #CCC;
 
	padding: 5px;
 
}
 
 
#changeset_compare_view_content {
 
	border: 1px solid #CCC;
 
	padding: 5px;
 
}
 
 
#changeset_content .container {
 
min-height:120px;
 
font-size:1.2em;
 
overflow:hidden;
 
}
 
 
#changeset_compare_view_content .compare_view_commits{
 
width: auto !important;
 
}
 
 
#changeset_compare_view_content .compare_view_commits td{
 
padding:0px 0px 0px 12px !important;
 
	min-height: 120px;
 
	font-size: 1.2em;
 
	overflow: hidden;
 
}
 
 
#changeset_compare_view_content .compare_view_commits {
 
	width: auto !important;
 
}
 
 
#changeset_compare_view_content .compare_view_commits td {
 
	padding: 0px 0px 0px 12px !important;
 
}
 
 
#changeset_content .container .right {
 
float:right;
 
width:25%;
 
text-align:right;
 
	float: right;
 
	width: 25%;
 
	text-align: right;
 
}
 
 
#changeset_content .container .left .message {
 
font-style:italic;
 
color:#556CB5;
 
white-space:pre-wrap;
 
}
 
 
.cs_files .cur_cs{
 
margin:10px 2px;
 
font-weight: bold;
 
}
 
 
.cs_files .node{
 
float: left;
 
}
 
.cs_files .changes{
 
float: right;
 
}
 
.cs_files .changes .added{
 
background-color: #BBFFBB;
 
float: left;
 
text-align: center;
 
font-size: 90%; 
 
}
 
.cs_files .changes .deleted{
 
background-color: #FF8888;
 
float: left;
 
text-align: center;
 
font-size: 90%;
 
}
 
	font-style: italic;
 
	color: #556CB5;
 
	white-space: pre-wrap;
 
}
 
 
.cs_files .cur_cs {
 
	margin: 10px 2px;
 
	font-weight: bold;
 
}
 
 
.cs_files .node {
 
	float: left;
 
}
 
 
.cs_files .changes {
 
	float: right;
 
}
 
 
.cs_files .changes .added {
 
	background-color: #BBFFBB;
 
	float: left;
 
	text-align: center;
 
	font-size: 90%;
 
}
 
 
.cs_files .changes .deleted {
 
	background-color: #FF8888;
 
	float: left;
 
	text-align: center;
 
	font-size: 90%;
 
}
 
 
.cs_files .cs_added {
 
background:url("../images/icons/page_white_add.png") no-repeat scroll 3px;
 
height:16px;
 
padding-left:20px;
 
margin-top:7px;
 
text-align:left;
 
	background: url("../images/icons/page_white_add.png") no-repeat scroll
 
		3px;
 
	height: 16px;
 
	padding-left: 20px;
 
	margin-top: 7px;
 
	text-align: left;
 
}
 
 
.cs_files .cs_changed {
 
background:url("../images/icons/page_white_edit.png") no-repeat scroll 3px;
 
height:16px;
 
padding-left:20px;
 
margin-top:7px;
 
text-align:left;
 
	background: url("../images/icons/page_white_edit.png") no-repeat scroll
 
		3px;
 
	height: 16px;
 
	padding-left: 20px;
 
	margin-top: 7px;
 
	text-align: left;
 
}
 
 
.cs_files .cs_removed {
 
background:url("../images/icons/page_white_delete.png") no-repeat scroll 3px;
 
height:16px;
 
padding-left:20px;
 
margin-top:7px;
 
text-align:left;
 
	background: url("../images/icons/page_white_delete.png") no-repeat
 
		scroll 3px;
 
	height: 16px;
 
	padding-left: 20px;
 
	margin-top: 7px;
 
	text-align: left;
 
}
 
 
#graph {
 
overflow:hidden;
 
	overflow: hidden;
 
}
 
 
#graph_nodes {
 
float: left;
 
margin-right: -6px;
 
margin-top: -4px;
 
	float: left;
 
	margin-right: -6px;
 
	margin-top: -4px;
 
}
 
 
#graph_content {
 
width:800px;
 
float:left;
 
 
	width: 800px;
 
	float: left;
 
}
 
 
#graph_content .container_header {
 
border:1px solid #CCC;
 
padding:10px;
 
}
 
#graph_content #rev_range_container{
 
padding:10px 0px;
 
}
 
	border: 1px solid #CCC;
 
	padding: 10px;
 
}
 
 
#graph_content #rev_range_container {
 
	padding: 10px 0px;
 
}
 
 
#graph_content .container {
 
border-bottom:1px solid #CCC;
 
border-left:1px solid #CCC;
 
border-right:1px solid #CCC;
 
min-height:70px;
 
overflow:hidden;
 
font-size:1.2em;
 
	border-bottom: 1px solid #CCC;
 
	border-left: 1px solid #CCC;
 
	border-right: 1px solid #CCC;
 
	min-height: 70px;
 
	overflow: hidden;
 
	font-size: 1.2em;
 
}
 
 
#graph_content .container .right {
 
float:right;
 
width:28%;
 
text-align:right;
 
padding-bottom:5px;
 
	float: right;
 
	width: 28%;
 
	text-align: right;
 
	padding-bottom: 5px;
 
}
 
 
#graph_content .container .left .date {
 
font-weight:700;
 
padding-bottom:5px;
 
}
 
#graph_content .container .left .date span{
 
vertical-align: text-top;    
 
}
 
 
#graph_content .container .left .author{
 
    height: 22px;
 
}
 
#graph_content .container .left .author .user{
 
color: #444444;
 
float: left;
 
font-size: 12px;
 
margin-left: -4px;
 
margin-top: 4px;
 
	font-weight: 700;
 
	padding-bottom: 5px;
 
}
 
 
#graph_content .container .left .date span {
 
	vertical-align: text-top;
 
}
 
 
#graph_content .container .left .author {
 
	height: 22px;
 
}
 
 
#graph_content .container .left .author .user {
 
	color: #444444;
 
	float: left;
 
	font-size: 12px;
 
	margin-left: -4px;
 
	margin-top: 4px;
 
}
 
 
#graph_content .container .left .message {
 
font-size:100%;
 
padding-top:3px;
 
white-space:pre-wrap;
 
	font-size: 100%;
 
	padding-top: 3px;
 
	white-space: pre-wrap;
 
}
 
 
#graph_content .container .left .message a:hover{
 
	text-decoration: none;
 
}
 
 
.right div {
 
clear:both;
 
}
 
 
.right .changes .changed_total{
 
border:1px solid #DDD;
 
display:block;
 
float:right;
 
text-align:center;
 
min-width:45px;
 
cursor: pointer;
 
background:#FD8;
 
font-weight: bold;
 
}
 
	clear: both;
 
}
 
 
.right .changes .changed_total {
 
	border: 1px solid #DDD;
 
	display: block;
 
	float: right;
 
	text-align: center;
 
	min-width: 45px;
 
	cursor: pointer;
 
	background: #FD8;
 
	font-weight: bold;
 
}
 
 
.right .changes .added,.changed,.removed {
 
border:1px solid #DDD;
 
display:block;
 
float:right;
 
text-align:center;
 
min-width:15px;
 
cursor: help;
 
}
 
	border: 1px solid #DDD;
 
	display: block;
 
	float: right;
 
	text-align: center;
 
	min-width: 15px;
 
	cursor: help;
 
}
 
 
.right .changes .large {
 
border:1px solid #DDD;
 
display:block;
 
float:right;
 
text-align:center;
 
min-width:45px;
 
cursor: help;
 
background: #54A9F7;
 
	border: 1px solid #DDD;
 
	display: block;
 
	float: right;
 
	text-align: center;
 
	min-width: 45px;
 
	cursor: help;
 
	background: #54A9F7;
 
}
 
 
.right .changes .added {
 
background:#BFB;
 
	background: #BFB;
 
}
 
 
.right .changes .changed {
 
background:#FD8;
 
	background: #FD8;
 
}
 
 
.right .changes .removed {
 
background:#F88;
 
	background: #F88;
 
}
 
 
.right .merge {
 
vertical-align:top;
 
font-size:0.75em;
 
font-weight:700;
 
	vertical-align: top;
 
	font-size: 0.75em;
 
	font-weight: 700;
 
}
 
 
.right .parent {
 
font-size:90%;
 
font-family:monospace;
 
	font-size: 90%;
 
	font-family: monospace;
 
}
 
 
.right .logtags .branchtag {
 
background:#FFF url("../images/icons/arrow_branch.png") no-repeat right 6px;
 
display:block;
 
font-size:0.8em;
 
padding:11px 16px 0 0;
 
	background: #FFF url("../images/icons/arrow_branch.png") no-repeat right
 
		6px;
 
	display: block;
 
	font-size: 0.8em;
 
	padding: 11px 16px 0 0;
 
}
 
 
.right .logtags .tagtag {
 
background:#FFF url("../images/icons/tag_blue.png") no-repeat right 6px;
 
display:block;
 
font-size:0.8em;
 
padding:11px 16px 0 0;
 
	background: #FFF url("../images/icons/tag_blue.png") no-repeat right 6px;
 
	display: block;
 
	font-size: 0.8em;
 
	padding: 11px 16px 0 0;
 
}
 
 
div.browserblock {
 
overflow:hidden;
 
border:1px solid #ccc;
 
background:#f8f8f8;
 
font-size:100%;
 
line-height:125%;
 
padding:0;
 
	overflow: hidden;
 
	border: 1px solid #ccc;
 
	background: #f8f8f8;
 
	font-size: 100%;
 
	line-height: 125%;
 
	padding: 0;
 
}
 
 
div.browserblock .browser-header {
 
background:#FFF;
 
padding:10px 0px 15px 0px;
 
width: 100%;
 
}
 
	background: #FFF;
 
	padding: 10px 0px 15px 0px;
 
	width: 100%;
 
}
 
 
div.browserblock .browser-nav {
 
float:left
 
	float: left
 
}
 
 
div.browserblock .browser-branch {
 
float:left;
 
	float: left;
 
}
 
 
div.browserblock .browser-branch label {
 
color:#4A4A4A;
 
vertical-align:text-top;
 
	color: #4A4A4A;
 
	vertical-align: text-top;
 
}
 
 
div.browserblock .browser-header span {
 
margin-left:5px;
 
font-weight:700;
 
}
 
 
div.browserblock .browser-search{
 
	clear:both;
 
	padding:8px 8px 0px 5px;
 
	margin-left: 5px;
 
	font-weight: 700;
 
}
 
 
div.browserblock .browser-search {
 
	clear: both;
 
	padding: 8px 8px 0px 5px;
 
	height: 20px;
 
}
 
 
div.browserblock #node_filter_box {
 
}
 
 
div.browserblock .search_activate{
 
    float: left
 
}
 
 
div.browserblock .add_node{
 
    float: left;
 
    padding-left: 5px;
 
}
 
 
div.browserblock .search_activate a:hover,div.browserblock .add_node a:hover{
 
    text-decoration: none !important;    
 
	
 
}
 
 
div.browserblock .search_activate {
 
	float: left
 
}
 
 
div.browserblock .add_node {
 
	float: left;
 
	padding-left: 5px;
 
}
 
 
div.browserblock .search_activate a:hover,div.browserblock .add_node a:hover
 
	{
 
	text-decoration: none !important;
 
}
 
 
div.browserblock .browser-body {
 
background:#EEE;
 
border-top:1px solid #CCC;
 
	background: #EEE;
 
	border-top: 1px solid #CCC;
 
}
 
 
table.code-browser {
 
border-collapse:collapse;
 
width:100%;
 
	border-collapse: collapse;
 
	width: 100%;
 
}
 
 
table.code-browser tr {
 
margin:3px;
 
	margin: 3px;
 
}
 
 
table.code-browser thead th {
 
background-color:#EEE;
 
height:20px;
 
font-size:1.1em;
 
font-weight:700;
 
text-align:left;
 
padding-left:10px;
 
	background-color: #EEE;
 
	height: 20px;
 
	font-size: 1.1em;
 
	font-weight: 700;
 
	text-align: left;
 
	padding-left: 10px;
 
}
 
 
table.code-browser tbody td {
 
padding-left:10px;
 
height:20px;
 
	padding-left: 10px;
 
	height: 20px;
 
}
 
 
table.code-browser .browser-file {
 
background:url("../images/icons/document_16.png") no-repeat scroll 3px;
 
height:16px;
 
padding-left:20px;
 
text-align:left;
 
}
 
.diffblock .changeset_file{
 
background:url("../images/icons/file.png") no-repeat scroll 3px;
 
height:16px;
 
padding-left:22px;
 
text-align:left;
 
font-size: 14px;
 
}
 
 
.diffblock .changeset_header{
 
margin-left: 6px !important;
 
	background: url("../images/icons/document_16.png") no-repeat scroll 3px;
 
	height: 16px;
 
	padding-left: 20px;
 
	text-align: left;
 
}
 
 
.diffblock .changeset_file {
 
	background: url("../images/icons/file.png") no-repeat scroll 3px;
 
	height: 16px;
 
	padding-left: 22px;
 
	text-align: left;
 
	font-size: 14px;
 
}
 
 
.diffblock .changeset_header {
 
	margin-left: 6px !important;
 
}
 
 
table.code-browser .browser-dir {
 
background:url("../images/icons/folder_16.png") no-repeat scroll 3px;
 
height:16px;
 
padding-left:20px;
 
text-align:left;
 
	background: url("../images/icons/folder_16.png") no-repeat scroll 3px;
 
	height: 16px;
 
	padding-left: 20px;
 
	text-align: left;
 
}
 
 
.box .search {
 
	clear: both;
 
	overflow: hidden;
 
	margin: 0;
 
	padding: 0 20px 10px;
 
}
 
 
.box .search div.search_path {
 
	background: none repeat scroll 0 0 #EEE;
 
	border: 1px solid #CCC;
 
	color: blue;
 
	margin-bottom: 10px;
 
	padding: 10px 0;
 
}
 
 
.box .search div.search_path div.link {
 
	font-weight: 700;
 
	margin-left: 25px;
 
}
 
 
.box .search div.search_path div.link a {
 
	color: #003367;
 
	cursor: pointer;
 
	text-decoration: none;
 
}
 
 
#path_unlock {
 
	color: red;
 
	font-size: 1.2em;
 
	padding-left: 4px;
 
}
 
 
.info_box span {
 
	margin-left: 3px;
 
	margin-right: 3px;
 
}
 
 
.info_box .rev {
 
	color: #003367;
 
	font-size: 1.6em;
 
	font-weight: bold;
 
	vertical-align: sub;
 
}
 
 
.info_box input#at_rev,.info_box input#size {
 
	background: #FFF;
 
	border-top: 1px solid #b3b3b3;
 
	border-left: 1px solid #b3b3b3;
 
	border-right: 1px solid #eaeaea;
 
	border-bottom: 1px solid #eaeaea;
 
	color: #000;
 
	font-size: 12px;
 
	margin: 0;
 
	padding: 1px 5px 1px;
 
}
 
 
.info_box input#view {
 
	text-align: center;
 
	padding: 4px 3px 2px 2px;
 
}
 
 
.yui-overlay,.yui-panel-container {
 
	visibility: hidden;
 
	position: absolute;
 
	z-index: 2;
 
}
 
 
.yui-tt {
 
	visibility: hidden;
 
	position: absolute;
 
	color: #666;
 
	background-color: #FFF;
 
	border: 2px solid #003367;
 
	font: 100% sans-serif;
 
	width: auto;
 
	opacity: 1px;
 
	padding: 8px;
 
	white-space: pre-wrap;
 
	-webkit-border-radius: 8px 8px 8px 8px;
 
	-khtml-border-radius: 8px 8px 8px 8px;
 
	-moz-border-radius: 8px 8px 8px 8px;
 
	border-radius: 8px 8px 8px 8px;
 
	box-shadow: 0 2px 2px rgba(0, 0, 0, 0.6);
 
}
 
 
.ac {
 
	vertical-align: top;
 
}
 
 
.ac .yui-ac {
 
	position: relative;
 
	font-size: 100%;
 
}
 
 
.ac .perm_ac {
 
	width: 15em;
 
}
 
 
.ac .yui-ac-input {
 
	width: 100%;
 
}
 
 
.ac .yui-ac-container {
 
	position: absolute;
 
	top: 1.6em;
 
	width: 100%;
 
}
 
 
.ac .yui-ac-content {
 
	position: absolute;
 
	width: 100%;
 
	border: 1px solid gray;
 
	background: #fff;
 
	overflow: hidden;
 
	z-index: 9050;
 
}
 
 
.ac .yui-ac-shadow {
 
	position: absolute;
 
	width: 100%;
 
	background: #000;
 
	-moz-opacity: 0.1px;
 
	opacity: .10;
 
	filter: alpha(opacity =     10);
 
	z-index: 9049;
 
	margin: .3em;
 
}
 
 
.ac .yui-ac-content ul {
 
	width: 100%;
 
	margin: 0;
 
	padding: 0;
 
}
 
 
.ac .yui-ac-content li {
 
	cursor: default;
 
	white-space: nowrap;
 
	margin: 0;
 
	padding: 2px 5px;
 
}
 
 
.ac .yui-ac-content li.yui-ac-prehighlight {
 
	background: #B3D4FF;
 
}
 
 
.ac .yui-ac-content li.yui-ac-highlight {
 
	background: #556CB5;
 
	color: #FFF;
 
}
 
 
.follow {
 
	background: url("../images/icons/heart_add.png") no-repeat scroll 3px;
 
	height: 16px;
 
	width: 20px;
 
	cursor: pointer;
 
	display: block;
 
	float: right;
 
	margin-top: 2px;
 
}
 
 
.following {
 
	background: url("../images/icons/heart_delete.png") no-repeat scroll 3px;
 
	height: 16px;
 
	width: 20px;
 
	cursor: pointer;
 
	display: block;
 
	float: right;
 
	margin-top: 2px;
 
}
 
 
.currently_following {
 
	padding-left: 10px;
 
	padding-bottom: 5px;
 
}
 
 
.add_icon {
 
	background: url("../images/icons/add.png") no-repeat scroll 3px;
 
	padding-left: 20px;
 
	padding-top: 0px;
 
	text-align: left;
 
}
 
 
.edit_icon {
 
	background: url("../images/icons/folder_edit.png") no-repeat scroll 3px;
 
	padding-left: 20px;
 
	padding-top: 0px;
 
	text-align: left;
 
}
 
 
.delete_icon {
 
	background: url("../images/icons/delete.png") no-repeat scroll 3px;
 
	padding-left: 20px;
 
	padding-top: 0px;
 
	text-align: left;
 
}
 
 
.refresh_icon {
 
	background: url("../images/icons/arrow_refresh.png") no-repeat scroll
 
		3px;
 
	padding-left: 20px;
 
	padding-top: 0px;
 
	text-align: left;
 
}
 
 
.pull_icon {
 
	background: url("../images/icons/connect.png") no-repeat scroll 3px;
 
	padding-left: 20px;
 
	padding-top: 0px;
 
	text-align: left;
 
}
 
 
.rss_icon {
 
	background: url("../images/icons/rss_16.png") no-repeat scroll 3px;
 
	padding-left: 20px;
 
	padding-top: 0px;
 
	text-align: left;
 
}
 
 
.atom_icon {
 
	background: url("../images/icons/atom.png") no-repeat scroll 3px;
 
	padding-left: 20px;
 
	padding-top: 0px;
 
	text-align: left;
 
}
 
 
.archive_icon {
 
	background: url("../images/icons/compress.png") no-repeat scroll 3px;
 
	padding-left: 20px;
 
	text-align: left;
 
	padding-top: 1px;
 
}
 
 
.start_following_icon {
 
	background: url("../images/icons/heart_add.png") no-repeat scroll 3px;
 
	padding-left: 20px;
 
	text-align: left;
 
	padding-top: 0px;
 
}
 
 
.stop_following_icon {
 
	background: url("../images/icons/heart_delete.png") no-repeat scroll 3px;
 
	padding-left: 20px;
 
	text-align: left;
 
	padding-top: 0px;
 
}
 
 
.action_button {
 
	border: 0;
 
	display: inline;
 
}
 
 
.action_button:hover {
 
	border: 0;
 
	text-decoration: underline;
 
	cursor: pointer;
 
}
 
 
#switch_repos {
 
	position: absolute;
 
	height: 25px;
 
	z-index: 1;
 
}
 
 
#switch_repos select {
 
	min-width: 150px;
 
	max-height: 250px;
 
	z-index: 1;
 
}
 
 
.breadcrumbs {
 
	border: medium none;
 
	color: #FFF;
 
	float: left;
 
	text-transform: uppercase;
 
	font-weight: 700;
 
	font-size: 14px;
 
	margin: 0;
 
	padding: 11px 0 11px 10px;
 
}
 
 
.breadcrumbs a {
 
	color: #FFF;
 
}
 
 
.flash_msg {
 
	
 
}
 
 
.flash_msg ul {
 
	
 
}
 
 
.error_msg {
 
	background-color: #c43c35;
 
	background-repeat: repeat-x;
 
	background-image: -khtml-gradient(linear, left top, left bottom, from(#ee5f5b),
 
		to(#c43c35) );
 
	background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35);
 
	background-image: -ms-linear-gradient(top, #ee5f5b, #c43c35);
 
	background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ee5f5b),
 
		color-stop(100%, #c43c35) );
 
	background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35);
 
	background-image: -o-linear-gradient(top, #ee5f5b, #c43c35);
 
	background-image: linear-gradient(top, #ee5f5b, #c43c35);
 
	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b',
 
		endColorstr='#c43c35', GradientType=0 );
 
	border-color: #c43c35 #c43c35 #882a25;
 
}
 
 
.warning_msg {
 
	color: #404040 !important;
 
	background-color: #eedc94;
 
	background-repeat: repeat-x;
 
	background-image: -khtml-gradient(linear, left top, left bottom, from(#fceec1),
 
		to(#eedc94) );
 
	background-image: -moz-linear-gradient(top, #fceec1, #eedc94);
 
	background-image: -ms-linear-gradient(top, #fceec1, #eedc94);
 
	background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fceec1),
 
		color-stop(100%, #eedc94) );
 
	background-image: -webkit-linear-gradient(top, #fceec1, #eedc94);
 
	background-image: -o-linear-gradient(top, #fceec1, #eedc94);
 
	background-image: linear-gradient(top, #fceec1, #eedc94);
 
	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fceec1',
 
		endColorstr='#eedc94', GradientType=0 );
 
	border-color: #eedc94 #eedc94 #e4c652;
 
}
 
 
.success_msg {
 
	background-color: #57a957;
 
	background-repeat: repeat-x !important;
 
	background-image: -khtml-gradient(linear, left top, left bottom, from(#62c462),
 
		to(#57a957) );
 
	background-image: -moz-linear-gradient(top, #62c462, #57a957);
 
	background-image: -ms-linear-gradient(top, #62c462, #57a957);
 
	background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #62c462),
 
		color-stop(100%, #57a957) );
 
	background-image: -webkit-linear-gradient(top, #62c462, #57a957);
 
	background-image: -o-linear-gradient(top, #62c462, #57a957);
 
	background-image: linear-gradient(top, #62c462, #57a957);
 
	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462',
 
		endColorstr='#57a957', GradientType=0 );
 
	border-color: #57a957 #57a957 #3d773d;
 
}
 
 
.notice_msg {
 
	background-color: #339bb9;
 
	background-repeat: repeat-x;
 
	background-image: -khtml-gradient(linear, left top, left bottom, from(#5bc0de),
 
		to(#339bb9) );
 
	background-image: -moz-linear-gradient(top, #5bc0de, #339bb9);
 
	background-image: -ms-linear-gradient(top, #5bc0de, #339bb9);
 
	background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #5bc0de),
 
		color-stop(100%, #339bb9) );
 
	background-image: -webkit-linear-gradient(top, #5bc0de, #339bb9);
 
	background-image: -o-linear-gradient(top, #5bc0de, #339bb9);
 
	background-image: linear-gradient(top, #5bc0de, #339bb9);
 
	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5bc0de',
 
		endColorstr='#339bb9', GradientType=0 );
 
	border-color: #339bb9 #339bb9 #22697d;
 
}
 
 
.success_msg,.error_msg,.notice_msg,.warning_msg {
 
	font-size: 12px;
 
	font-weight: 700;
 
	min-height: 14px;
 
	line-height: 14px;
 
	margin-bottom: 10px;
 
	margin-top: 0;
 
	display: block;
 
	overflow: auto;
 
	padding: 6px 10px 6px 10px;
 
	border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
 
	position: relative;
 
	color: #FFF;
 
	border-width: 1px;
 
	border-style: solid;
 
	-webkit-border-radius: 4px;
 
	-moz-border-radius: 4px;
 
	border-radius: 4px;
 
	-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
 
	-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
 
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
 
}
 
 
#msg_close {
 
	background: transparent url("../icons/cross_grey_small.png") no-repeat
 
		scroll 0 0;
 
	cursor: pointer;
 
	height: 16px;
 
	position: absolute;
 
	right: 5px;
 
	top: 5px;
 
	width: 16px;
 
}
 
 
div#legend_container table,div#legend_choices table {
 
	width: auto !important;
 
}
 
 
table#permissions_manage {
 
	width: 0 !important;
 
}
 
 
table#permissions_manage span.private_repo_msg {
 
	font-size: 0.8em;
 
	opacity: 0.6px;
 
}
 
 
table#permissions_manage td.private_repo_msg {
 
	font-size: 0.8em;
 
}
 
 
table#permissions_manage tr#add_perm_input td {
 
	vertical-align: middle;
 
}
 
 
div.gravatar {
 
	background-color: #FFF;
 
	border: 1px solid #D0D0D0;
 
	float: left;
 
	margin-right: 0.7em;
 
	padding: 2px 2px 0;
 
	-webkit-border-radius: 6px;
 
	-khtml-border-radius: 6px;
 
	-moz-border-radius: 6px;
 
	border-radius: 6px;
 
}
 
 
div.gravatar img {
 
	-webkit-border-radius: 4px;
 
	-khtml-border-radius: 4px;
 
	-moz-border-radius: 4px;
 
	border-radius: 4px;
 
}
 
 
#header,#content,#footer {
 
	min-width: 978px;
 
}
 
 
#content {
 
	clear: both;
 
	overflow: hidden;
 
	padding: 14px 10px;
 
}
 
 
#content div.box div.title div.search {
 
	
 
	border-left: 1px solid #316293;
 
}
 
 
#content div.box div.title div.search div.input input {
 
	border: 1px solid #316293;
 
}
 
 
.ui-button-small a:hover {
 
	
 
}
 
 
input.ui-button-small,.ui-button-small {
 
	background: #e5e3e3 url("../images/button.png") repeat-x !important;
 
	border-top: 1px solid #DDD !important;
 
	border-left: 1px solid #c6c6c6 !important;
 
	border-right: 1px solid #DDD !important;
 
	border-bottom: 1px solid #c6c6c6 !important;
 
	color: #515151 !important;
 
	outline: none !important;
 
	margin: 0 !important;
 
	-webkit-border-radius: 4px 4px 4px 4px !important;
 
	-khtml-border-radius: 4px 4px 4px 4px !important;
 
	-moz-border-radius: 4px 4px 4px 4px !important;
 
	border-radius: 4px 4px 4px 4px !important;
 
	box-shadow: 0 1px 0 #ececec !important;
 
	cursor: pointer !important;
 
	padding: 0px 2px 1px 2px;
 
}
 
 
input.ui-button-small:hover,.ui-button-small:hover {
 
	background: #b4b4b4 url("../images/button_selected.png") repeat-x
 
		!important;
 
	border-top: 1px solid #ccc !important;
 
	border-left: 1px solid #bebebe !important;
 
	border-right: 1px solid #b1b1b1 !important;
 
	border-bottom: 1px solid #afafaf !important;
 
	text-decoration: none;
 
}
 
 
input.ui-button-small-blue,.ui-button-small-blue {
 
	background: #4e85bb url("../images/button_highlight.png") repeat-x;
 
	border-top: 1px solid #5c91a4;
 
	border-left: 1px solid #2a6f89;
 
	border-right: 1px solid #2b7089;
 
	border-bottom: 1px solid #1a6480;
 
	color: #fff;
 
	-webkit-border-radius: 4px 4px 4px 4px;
 
	-khtml-border-radius: 4px 4px 4px 4px;
 
	-moz-border-radius: 4px 4px 4px 4px;
 
	border-radius: 4px 4px 4px 4px;
 
	box-shadow: 0 1px 0 #ececec;
 
	cursor: pointer;
 
	padding: 0px 2px 1px 2px;
 
}
 
 
input.ui-button-small-blue:hover {
 
	
 
}
 
 
ins,div.options a:hover {
 
	text-decoration: none;
 
}
 
 
img,#header #header-inner #quick li a:hover span.normal,#header #header-inner #quick li ul li.last,#content div.box div.form div.fields div.field div.textarea table td table td a,#clone_url
 
	{
 
	border: none;
 
}
 
 
img.icon,.right .merge img {
 
	vertical-align: bottom;
 
}
 
 
#header ul#logged-user,#content div.box div.title ul.links,#content div.box div.message div.dismiss,#content div.box div.traffic div.legend ul
 
	{
 
	float: right;
 
	margin: 0;
 
	padding: 0;
 
}
 
 
#header #header-inner #home,#header #header-inner #logo,#content div.box ul.left,#content div.box ol.left,#content div.box div.pagination-left,div#commit_history,div#legend_data,div#legend_container,div#legend_choices
 
	{
 
	float: left;
 
}
 
 
#header #header-inner #quick li:hover ul ul,#header #header-inner #quick li:hover ul ul ul,#header #header-inner #quick li:hover ul ul ul ul,#content #left #menu ul.closed,#content #left #menu li ul.collapsed,.yui-tt-shadow
 
	{
 
	display: none;
 
}
 
 
#header #header-inner #quick li:hover ul,#header #header-inner #quick li li:hover ul,#header #header-inner #quick li li li:hover ul,#header #header-inner #quick li li li li:hover ul,#content #left #menu ul.opened,#content #left #menu li ul.expanded
 
	{
 
	display: block;
 
}
 
 
#content div.graph {
 
	padding: 0 10px 10px;
 
}
 
 
#content div.box div.title ul.links li a:hover,#content div.box div.title ul.links li.ui-tabs-selected a
 
	{
 
	color: #bfe3ff;
 
}
 
 
#content div.box ol.lower-roman,#content div.box ol.upper-roman,#content div.box ol.lower-alpha,#content div.box ol.upper-alpha,#content div.box ol.decimal
 
	{
 
	margin: 10px 24px 10px 44px;
 
}
 
 
#content div.box div.form,#content div.box div.table,#content div.box div.traffic
 
	{
 
	clear: both;
 
	overflow: hidden;
 
	margin: 0;
 
	padding: 0 20px 10px;
 
}
 
 
#content div.box div.form div.fields,#login div.form,#login div.form div.fields,#register div.form,#register div.form div.fields
 
	{
 
	clear: both;
 
	overflow: hidden;
 
	margin: 0;
 
	padding: 0;
 
}
 
 
#content div.box div.form div.fields div.field div.label span,#login div.form div.fields div.field div.label span,#register div.form div.fields div.field div.label span
 
	{
 
	height: 1%;
 
	display: block;
 
	color: #363636;
 
	margin: 0;
 
	padding: 2px 0 0;
 
}
 
 
#content div.box div.form div.fields div.field div.input input.error,#login div.form div.fields div.field div.input input.error,#register div.form div.fields div.field div.input input.error
 
	{
 
	background: #FBE3E4;
 
	border-top: 1px solid #e1b2b3;
 
	border-left: 1px solid #e1b2b3;
 
	border-right: 1px solid #FBC2C4;
 
	border-bottom: 1px solid #FBC2C4;
 
}
 
 
#content div.box div.form div.fields div.field div.input input.success,#login div.form div.fields div.field div.input input.success,#register div.form div.fields div.field div.input input.success
 
	{
 
	background: #E6EFC2;
 
	border-top: 1px solid #cebb98;
 
	border-left: 1px solid #cebb98;
 
	border-right: 1px solid #c6d880;
 
	border-bottom: 1px solid #c6d880;
 
}
 
 
#content div.box-left div.form div.fields div.field div.textarea,#content div.box-right div.form div.fields div.field div.textarea,#content div.box div.form div.fields div.field div.select select,#content div.box table th.selected input,#content div.box table td.selected input
 
	{
 
	margin: 0;
 
}
 
 
#content div.box-left div.form div.fields div.field div.select,#content div.box-left div.form div.fields div.field div.checkboxes,#content div.box-left div.form div.fields div.field div.radios,#content div.box-right div.form div.fields div.field div.select,#content div.box-right div.form div.fields div.field div.checkboxes,#content div.box-right div.form div.fields div.field div.radios
 
	{
 
	margin: 0 0 0 0px !important;
 
	padding: 0;
 
}
 
 
#content div.box div.form div.fields div.field div.select,#content div.box div.form div.fields div.field div.checkboxes,#content div.box div.form div.fields div.field div.radios
 
	{
 
	margin: 0 0 0 200px;
 
	padding: 0;
 
}
 
 
#content div.box div.form div.fields div.field div.select a:hover,#content div.box div.form div.fields div.field div.select a.ui-selectmenu:hover,#content div.box div.action a:hover
 
	{
 
	color: #000;
 
	text-decoration: none;
 
}
 
 
#content div.box div.form div.fields div.field div.select a.ui-selectmenu-focus,#content div.box div.action a.ui-selectmenu-focus
 
	{
 
	border: 1px solid #666;
 
}
 
 
#content div.box div.form div.fields div.field div.checkboxes div.checkbox,#content div.box div.form div.fields div.field div.radios div.radio
 
	{
 
	clear: both;
 
	overflow: hidden;
 
	margin: 0;
 
	padding: 8px 0 2px;
 
}
 
 
#content div.box div.form div.fields div.field div.checkboxes div.checkbox input,#content div.box div.form div.fields div.field div.radios div.radio input
 
	{
 
	float: left;
 
	margin: 0;
 
}
 
 
#content div.box div.form div.fields div.field div.checkboxes div.checkbox label,#content div.box div.form div.fields div.field div.radios div.radio label
 
	{
 
	height: 1%;
 
	display: block;
 
	float: left;
 
	margin: 2px 0 0 4px;
 
}
 
 
div.form div.fields div.field div.button input,#content div.box div.form div.fields div.buttons input,div.form div.fields div.buttons input,#content div.box div.action div.button input
 
	{
 
	color: #000;
 
	font-size: 11px;
 
	font-weight: 700;
 
	margin: 0;
 
}
 
 
input.ui-button {
 
	background: #e5e3e3 url("../images/button.png") repeat-x;
 
	border-top: 1px solid #DDD;
 
	border-left: 1px solid #c6c6c6;
 
	border-right: 1px solid #DDD;
 
	border-bottom: 1px solid #c6c6c6;
 
	color: #515151 !important;
 
	outline: none;
 
	margin: 0;
 
	padding: 6px 12px;
 
	-webkit-border-radius: 4px 4px 4px 4px;
 
	-khtml-border-radius: 4px 4px 4px 4px;
 
	-moz-border-radius: 4px 4px 4px 4px;
 
	border-radius: 4px 4px 4px 4px;
 
	box-shadow: 0 1px 0 #ececec;
 
	cursor: pointer;
 
}
 
 
input.ui-button:hover {
 
	background: #b4b4b4 url("../images/button_selected.png") repeat-x;
 
	border-top: 1px solid #ccc;
 
	border-left: 1px solid #bebebe;
 
	border-right: 1px solid #b1b1b1;
 
	border-bottom: 1px solid #afafaf;
 
}
 
 
div.form div.fields div.field div.highlight,#content div.box div.form div.fields div.buttons div.highlight
 
	{
 
	display: inline;
 
}
 
 
#content div.box div.form div.fields div.buttons,div.form div.fields div.buttons
 
	{
 
	margin: 10px 0 0 200px;
 
	padding: 0;
 
}
 
 
#content div.box-left div.form div.fields div.buttons,#content div.box-right div.form div.fields div.buttons,div.box-left div.form div.fields div.buttons,div.box-right div.form div.fields div.buttons
 
	{
 
	margin: 10px 0 0;
 
}
 
 
#content div.box table td.user,#content div.box table td.address {
 
	width: 10%;
 
	text-align: center;
 
}
 
 
#content div.box div.action div.button,#login div.form div.fields div.field div.input div.link,#register div.form div.fields div.field div.input div.link
 
	{
 
	text-align: right;
 
	margin: 6px 0 0;
 
	padding: 0;
 
}
 
 
#content div.box div.action div.button input.ui-state-hover,#login div.form div.fields div.buttons input.ui-state-hover,#register div.form div.fields div.buttons input.ui-state-hover
 
	{
 
	background: #b4b4b4 url("../images/button_selected.png") repeat-x;
 
	border-top: 1px solid #ccc;
 
	border-left: 1px solid #bebebe;
 
	border-right: 1px solid #b1b1b1;
 
	border-bottom: 1px solid #afafaf;
 
	color: #515151;
 
	margin: 0;
 
	padding: 6px 12px;
 
}
 
 
#content div.box div.pagination div.results,#content div.box div.pagination-wh div.results
 
	{
 
	text-align: left;
 
	float: left;
 
	margin: 0;
 
	padding: 0;
 
}
 
 
#content div.box div.pagination div.results span,#content div.box div.pagination-wh div.results span
 
	{
 
	height: 1%;
 
	display: block;
 
	float: left;
 
	background: #ebebeb url("../images/pager.png") repeat-x;
 
	border-top: 1px solid #dedede;
 
	border-left: 1px solid #cfcfcf;
 
	border-right: 1px solid #c4c4c4;
 
	border-bottom: 1px solid #c4c4c4;
 
	color: #4A4A4A;
 
	font-weight: 700;
 
	margin: 0;
 
	padding: 6px 8px;
 
}
 
 
#content div.box div.pagination ul.pager li.disabled,#content div.box div.pagination-wh a.disabled
 
	{
 
	color: #B4B4B4;
 
	padding: 6px;
 
}
 
 
#login,#register {
 
	width: 520px;
 
	margin: 10% auto 0;
 
	padding: 0;
 
}
 
 
#login div.color,#register div.color {
 
	clear: both;
 
	overflow: hidden;
 
	background: #FFF;
 
	margin: 10px auto 0;
 
	padding: 3px 3px 3px 0;
 
}
 
 
#login div.color a,#register div.color a {
 
	width: 20px;
 
	height: 20px;
 
	display: block;
 
	float: left;
 
	margin: 0 0 0 3px;
 
	padding: 0;
 
}
 
 
#login div.title h5,#register div.title h5 {
 
	color: #fff;
 
	margin: 10px;
 
	padding: 0;
 
}
 
 
#login div.form div.fields div.field,#register div.form div.fields div.field
 
	{
 
	clear: both;
 
	overflow: hidden;
 
	margin: 0;
 
	padding: 0 0 10px;
 
}
 
 
#login div.form div.fields div.field span.error-message,#register div.form div.fields div.field span.error-message
 
	{
 
	height: 1%;
 
	display: block;
 
	color: red;
 
	margin: 8px 0 0;
 
	padding: 0;
 
	max-width: 320px;
 
}
 
 
#login div.form div.fields div.field div.label label,#register div.form div.fields div.field div.label label
 
	{
 
	color: #000;
 
	font-weight: 700;
 
}
 
 
#login div.form div.fields div.field div.input,#register div.form div.fields div.field div.input
 
	{
 
	float: left;
 
	margin: 0;
 
	padding: 0;
 
}
 
 
#login div.form div.fields div.field div.checkbox,#register div.form div.fields div.field div.checkbox
 
	{
 
	margin: 0 0 0 184px;
 
	padding: 0;
 
}
 
 
#login div.form div.fields div.field div.checkbox label,#register div.form div.fields div.field div.checkbox label
 
	{
 
	color: #565656;
 
	font-weight: 700;
 
}
 
 
#login div.form div.fields div.buttons input,#register div.form div.fields div.buttons input
 
	{
 
	color: #000;
 
	font-size: 1em;
 
	font-weight: 700;
 
	margin: 0;
 
}
 
 
#changeset_content .container .wrapper,#graph_content .container .wrapper
 
	{
 
	width: 600px;
 
}
 
 
#changeset_content .container .left,#graph_content .container .left {
 
	float: left;
 
	width: 70%;
 
	padding-left: 5px;
 
}
 
 
#changeset_content .container .left .date,.ac .match {
 
	font-weight: 700;
 
	padding-top: 5px;
 
	padding-bottom: 5px;
 
}
 
 
div#legend_container table td,div#legend_choices table td {
 
	border: none !important;
 
	height: 20px !important;
 
	padding: 0 !important;
 
}
 
 
#q_filter {
 
	border: 0 none;
 
	color: #AAAAAA;
 
	margin-bottom: -4px;
 
	margin-top: -4px;
 
	padding-left: 3px;
 
}
 
 
#node_filter {
 
	border: 0px solid #545454;
 
	color: #AAAAAA;
 
	padding-left: 3px;
 
}
 
 
/*README STYLE*/
 
 
div.readme {
 
	padding:0px;
 
}
 
 
div.readme h2 {
 
    font-weight: normal;
 
}
 
 
div.readme .readme_box {
 
    background-color: #fafafa;
 
}
 
 
div.readme .readme_box {
 
clear:both;
 
overflow:hidden;
 
margin:0;
 
padding:0 20px 10px;
 
}
 
 
.box .search div.search_path {
 
background:none repeat scroll 0 0 #EEE;
 
border:1px solid #CCC;
 
color:blue;
 
margin-bottom:10px;
 
padding:10px 0;
 
}
 
 
.box .search div.search_path div.link {
 
font-weight:700;
 
margin-left:25px;
 
}
 
 
.box .search div.search_path div.link a {
 
color:#003367;
 
cursor:pointer;
 
text-decoration:none;
 
}
 
 
#path_unlock {
 
color:red;
 
font-size:1.2em;
 
padding-left:4px;
 
}
 
 
.info_box span {
 
margin-left:3px;
 
margin-right:3px;
 
}
 
 
.info_box .rev {
 
color: #003367;
 
font-size: 1.6em;
 
font-weight: bold;
 
vertical-align: sub;
 
}
 
 
 
.info_box input#at_rev,.info_box input#size {
 
background:#FFF;
 
border-top:1px solid #b3b3b3;
 
border-left:1px solid #b3b3b3;
 
border-right:1px solid #eaeaea;
 
border-bottom:1px solid #eaeaea;
 
color:#000;
 
font-family:Lucida Grande, Verdana, Lucida Sans Regular, Lucida Sans Unicode, Arial, sans-serif;
 
font-size:12px;
 
margin:0;
 
padding:1px 5px 1px;
 
}
 
 
.info_box input#view {
 
text-align:center;
 
padding:4px 3px 2px 2px;
 
}
 
 
.yui-overlay,.yui-panel-container {
 
visibility:hidden;
 
position:absolute;
 
z-index:2;
 
}
 
 
.yui-tt {
 
visibility:hidden;
 
position:absolute;
 
color:#666;
 
background-color:#FFF;
 
font-family:arial, helvetica, verdana, sans-serif;
 
border:2px solid #003367;
 
font:100% sans-serif;
 
width:auto;
 
opacity:1px;
 
padding:8px;
 
white-space: pre-wrap;
 
-webkit-border-radius: 8px 8px 8px 8px;
 
-khtml-border-radius: 8px 8px 8px 8px; 
 
-moz-border-radius: 8px 8px 8px 8px;
 
border-radius: 8px 8px 8px 8px;
 
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.6);
 
}
 
 
.ac {
 
vertical-align:top;
 
}
 
 
.ac .yui-ac {
 
position:relative;
 
font-family:arial;
 
font-size:100%;
 
}
 
 
.ac .perm_ac {
 
width:15em;
 
}
 
 
.ac .yui-ac-input {
 
width:100%;
 
}
 
 
.ac .yui-ac-container {
 
position:absolute;
 
top:1.6em;
 
width:100%;
 
}
 
 
.ac .yui-ac-content {
 
position:absolute;
 
width:100%;
 
border:1px solid gray;
 
background:#fff;
 
overflow:hidden;
 
z-index:9050;
 
}
 
 
.ac .yui-ac-shadow {
 
position:absolute;
 
width:100%;
 
background:#000;
 
-moz-opacity:0.1px;
 
opacity:.10;
 
filter:alpha(opacity =   10);
 
z-index:9049;
 
margin:.3em;
 
}
 
 
.ac .yui-ac-content ul {
 
width:100%;
 
margin:0;
 
padding:0;
 
}
 
 
.ac .yui-ac-content li {
 
cursor:default;
 
white-space:nowrap;
 
margin:0;
 
padding:2px 5px;
 
}
 
 
.ac .yui-ac-content li.yui-ac-prehighlight {
 
background:#B3D4FF;
 
}
 
 
.ac .yui-ac-content li.yui-ac-highlight {
 
background:#556CB5;
 
color:#FFF;
 
}
 
 
 
.follow{
 
background:url("../images/icons/heart_add.png") no-repeat scroll 3px;
 
height: 16px;
 
width: 20px;
 
cursor: pointer;
 
display: block;
 
float: right;
 
margin-top: 2px;
 
}
 
 
.following{
 
background:url("../images/icons/heart_delete.png") no-repeat scroll 3px;
 
height: 16px;
 
width: 20px;
 
cursor: pointer;
 
display: block;
 
float: right;
 
margin-top: 2px;
 
}
 
 
.currently_following{
 
padding-left: 10px;
 
padding-bottom:5px;
 
}
 
 
.add_icon {
 
background:url("../images/icons/add.png") no-repeat scroll 3px;
 
padding-left:20px;
 
padding-top:0px;
 
text-align:left;
 
}
 
 
.edit_icon {
 
background:url("../images/icons/folder_edit.png") no-repeat scroll 3px;
 
padding-left:20px;
 
padding-top:0px;
 
text-align:left;
 
}
 
 
.delete_icon {
 
background:url("../images/icons/delete.png") no-repeat scroll 3px;
 
padding-left:20px;
 
padding-top:0px;
 
text-align:left;
 
}
 
 
.refresh_icon {
 
background:url("../images/icons/arrow_refresh.png") no-repeat scroll 3px;
 
padding-left:20px;
 
padding-top:0px;
 
text-align:left;
 
}
 
 
.pull_icon {
 
background:url("../images/icons/connect.png") no-repeat scroll 3px;
 
padding-left:20px;
 
padding-top:0px;
 
text-align:left;
 
}
 
 
.rss_icon {
 
background:url("../images/icons/rss_16.png") no-repeat scroll 3px;
 
padding-left:20px;
 
padding-top:0px;
 
text-align:left;
 
}
 
 
.atom_icon {
 
background:url("../images/icons/atom.png") no-repeat scroll 3px;
 
padding-left:20px;
 
padding-top:0px;
 
text-align:left;
 
}
 
 
.archive_icon {
 
background:url("../images/icons/compress.png") no-repeat scroll 3px;
 
padding-left:20px;
 
text-align:left;
 
padding-top:1px;
 
}
 
 
.start_following_icon {
 
background:url("../images/icons/heart_add.png") no-repeat scroll 3px;
 
padding-left:20px;
 
text-align:left;
 
padding-top:0px;
 
}
 
 
.stop_following_icon {
 
background:url("../images/icons/heart_delete.png") no-repeat scroll 3px;
 
padding-left:20px;
 
text-align:left;
 
padding-top:0px;
 
}
 
 
.action_button {
 
border:0;
 
display:inline;
 
}
 
 
.action_button:hover {
 
border:0;
 
text-decoration:underline;
 
cursor:pointer;
 
}
 
 
#switch_repos {
 
position:absolute;
 
height:25px;
 
z-index:1;
 
}
 
 
#switch_repos select {
 
min-width:150px;
 
max-height:250px;
 
z-index:1;
 
}
 
 
.breadcrumbs {
 
border:medium none;
 
color:#FFF;
 
float:left;
 
text-transform:uppercase;
 
font-weight:700;
 
font-size:14px;
 
margin:0;
 
padding:11px 0 11px 10px;
 
}
 
 
.breadcrumbs a {
 
color:#FFF;
 
}
 
 
.flash_msg ul {
 
margin:0;
 
padding:0 0 10px;
 
}
 
 
.error_msg {
 
background-color:#FFCFCF;
 
background-image:url("../images/icons/error_msg.png");
 
border:1px solid #FF9595;
 
color:#C30;
 
}
 
 
.warning_msg {
 
background-color:#FFFBCC;
 
background-image:url("../images/icons/warning_msg.png");
 
border:1px solid #FFF35E;
 
color:#C69E00;
 
}
 
 
.success_msg {
 
background-color:#D5FFCF;
 
background-image:url("../images/icons/success_msg.png");
 
border:1px solid #97FF88;
 
color:#090;
 
}
 
 
.notice_msg {
 
background-color:#DCE3FF;
 
background-image:url("../images/icons/notice_msg.png");
 
border:1px solid #93A8FF;
 
color:#556CB5;
 
}
 
 
.success_msg,.error_msg,.notice_msg,.warning_msg {
 
background-position:10px center;
 
background-repeat:no-repeat;
 
font-size:12px;
 
font-weight:700;
 
min-height:14px;
 
line-height:14px;
 
margin-bottom:0;
 
margin-top:0;
 
display:block;
 
overflow:auto;
 
padding:6px 10px 6px 40px;
 
}
 
 
#msg_close {
 
background:transparent url("../icons/cross_grey_small.png") no-repeat scroll 0 0;
 
cursor:pointer;
 
height:16px;
 
position:absolute;
 
right:5px;
 
top:5px;
 
width:16px;
 
}
 
 
div#legend_container table,div#legend_choices table {
 
width:auto !important;
 
}
 
 
table#permissions_manage {
 
width:0 !important;
 
}
 
 
table#permissions_manage span.private_repo_msg {
 
font-size:0.8em;
 
opacity:0.6px;
 
}
 
 
table#permissions_manage td.private_repo_msg {
 
font-size:0.8em;
 
}
 
 
table#permissions_manage tr#add_perm_input td {
 
vertical-align:middle;
 
}
 
 
div.gravatar {
 
background-color:#FFF;
 
border:1px solid #D0D0D0;
 
float:left;
 
margin-right:0.7em;
 
padding:2px 2px 0;
 
 
-webkit-border-radius: 6px;
 
-khtml-border-radius: 6px; 
 
-moz-border-radius: 6px;
 
border-radius: 6px;
 
 
}
 
 
div.gravatar img {
 
-webkit-border-radius: 4px;
 
-khtml-border-radius: 4px; 
 
-moz-border-radius: 4px;
 
border-radius: 4px;	
 
}
 
 
#header,#content,#footer {
 
min-width:978px;
 
}
 
 
#content {
 
clear:both;
 
overflow:hidden;
 
padding:14px 10px;
 
}
 
 
#content div.box div.title div.search {
 
background:url("../images/title_link.png") no-repeat top left;
 
border-left:1px solid #316293;
 
}
 
 
#content div.box div.title div.search div.input input {
 
border:1px solid #316293;
 
}
 
 
.ui-button-small a:hover {
 
	
 
}
 
input.ui-button-small,.ui-button-small {
 
background:#e5e3e3 url("../images/button.png") repeat-x !important;
 
border-top:1px solid #DDD !important;
 
border-left:1px solid #c6c6c6 !important;
 
border-right:1px solid #DDD !important;
 
border-bottom:1px solid #c6c6c6 !important;
 
color:#515151 !important;
 
outline:none !important;
 
margin:0 !important;
 
-webkit-border-radius: 4px 4px 4px 4px !important;
 
-khtml-border-radius: 4px 4px 4px 4px !important; 
 
-moz-border-radius: 4px 4px 4px 4px !important;
 
border-radius: 4px 4px 4px 4px !important;
 
box-shadow: 0 1px 0 #ececec !important;
 
cursor: pointer !important;
 
padding:0px 2px 1px 2px;
 
}
 
 
input.ui-button-small:hover,.ui-button-small:hover {
 
background:#b4b4b4 url("../images/button_selected.png") repeat-x !important;
 
border-top:1px solid #ccc !important;
 
border-left:1px solid #bebebe !important;
 
border-right:1px solid #b1b1b1 !important;
 
border-bottom:1px solid #afafaf !important;
 
text-decoration: none;
 
}
 
 
input.ui-button-small-blue,.ui-button-small-blue {
 
background:#4e85bb url("../images/button_highlight.png") repeat-x;
 
border-top:1px solid #5c91a4;
 
border-left:1px solid #2a6f89;
 
border-right:1px solid #2b7089;
 
border-bottom:1px solid #1a6480;
 
color:#fff;
 
-webkit-border-radius: 4px 4px 4px 4px;
 
-khtml-border-radius: 4px 4px 4px 4px; 
 
-moz-border-radius: 4px 4px 4px 4px;
 
border-radius: 4px 4px 4px 4px;
 
box-shadow: 0 1px 0 #ececec;
 
cursor: pointer;
 
padding:0px 2px 1px 2px;
 
}
 
 
input.ui-button-small-blue:hover {
 
	
 
}
 
 
 
ins,div.options a:hover {
 
text-decoration:none;
 
}
 
 
img,#header #header-inner #quick li a:hover span.normal,#header #header-inner #quick li ul li.last,#content div.box div.form div.fields div.field div.textarea table td table td a,#clone_url {
 
border:none;
 
}
 
 
img.icon,.right .merge img {
 
vertical-align:bottom;
 
}
 
 
#header ul#logged-user,#content div.box div.title ul.links,#content div.box div.message div.dismiss,#content div.box div.traffic div.legend ul {
 
float:right;
 
margin:0;
 
padding:0;
 
}
 
 
 
#header #header-inner #home,#header #header-inner #logo,#content div.box ul.left,#content div.box ol.left,#content div.box div.pagination-left,div#commit_history,div#legend_data,div#legend_container,div#legend_choices {
 
float:left;
 
}
 
 
#header #header-inner #quick li:hover ul ul,#header #header-inner #quick li:hover ul ul ul,#header #header-inner #quick li:hover ul ul ul ul,#content #left #menu ul.closed,#content #left #menu li ul.collapsed,.yui-tt-shadow {
 
display:none;
 
}
 
 
#header #header-inner #quick li:hover ul,#header #header-inner #quick li li:hover ul,#header #header-inner #quick li li li:hover ul,#header #header-inner #quick li li li li:hover ul,#content #left #menu ul.opened,#content #left #menu li ul.expanded {
 
display:block;
 
}
 
 
#content div.graph{
 
padding:0 10px 10px;
 
}
 
 
#content div.box div.title ul.links li a:hover,#content div.box div.title ul.links li.ui-tabs-selected a {
 
color:#bfe3ff;
 
}
 
 
#content div.box ol.lower-roman,#content div.box ol.upper-roman,#content div.box ol.lower-alpha,#content div.box ol.upper-alpha,#content div.box ol.decimal {
 
margin:10px 24px 10px 44px;
 
}
 
 
#content div.box div.form,#content div.box div.table,#content div.box div.traffic {
 
clear:both;
 
overflow:hidden;
 
margin:0;
 
padding:0 20px 10px;
 
}
 
 
#content div.box div.form div.fields,#login div.form,#login div.form div.fields,#register div.form,#register div.form div.fields {
 
clear:both;
 
overflow:hidden;
 
margin:0;
 
padding:0;
 
}
 
 
#content div.box div.form div.fields div.field div.label span,#login div.form div.fields div.field div.label span,#register div.form div.fields div.field div.label span {
 
height:1%;
 
display:block;
 
color:#363636;
 
margin:0;
 
padding:2px 0 0;
 
}
 
 
#content div.box div.form div.fields div.field div.input input.error,#login div.form div.fields div.field div.input input.error,#register div.form div.fields div.field div.input input.error {
 
background:#FBE3E4;
 
border-top:1px solid #e1b2b3;
 
border-left:1px solid #e1b2b3;
 
border-right:1px solid #FBC2C4;
 
border-bottom:1px solid #FBC2C4;
 
}
 
 
#content div.box div.form div.fields div.field div.input input.success,#login div.form div.fields div.field div.input input.success,#register div.form div.fields div.field div.input input.success {
 
background:#E6EFC2;
 
border-top:1px solid #cebb98;
 
border-left:1px solid #cebb98;
 
border-right:1px solid #c6d880;
 
border-bottom:1px solid #c6d880;
 
}
 
 
#content div.box-left div.form div.fields div.field div.textarea,#content div.box-right div.form div.fields div.field div.textarea,#content div.box div.form div.fields div.field div.select select,#content div.box table th.selected input,#content div.box table td.selected input {
 
margin:0;
 
}
 
 
#content div.box-left div.form div.fields div.field div.select,#content div.box-left div.form div.fields div.field div.checkboxes,#content div.box-left div.form div.fields div.field div.radios,#content div.box-right div.form div.fields div.field div.select,#content div.box-right div.form div.fields div.field div.checkboxes,#content div.box-right div.form div.fields div.field div.radios{
 
margin:0 0 0 0px !important;
 
padding:0;
 
}
 
 
#content div.box div.form div.fields div.field div.select,#content div.box div.form div.fields div.field div.checkboxes,#content div.box div.form div.fields div.field div.radios {
 
margin:0 0 0 200px;
 
padding:0;
 
}
 
 
 
#content div.box div.form div.fields div.field div.select a:hover,#content div.box div.form div.fields div.field div.select a.ui-selectmenu:hover,#content div.box div.action a:hover {
 
color:#000;
 
text-decoration:none;
 
}
 
 
#content div.box div.form div.fields div.field div.select a.ui-selectmenu-focus,#content div.box div.action a.ui-selectmenu-focus {
 
border:1px solid #666;
 
}
 
 
#content div.box div.form div.fields div.field div.checkboxes div.checkbox,#content div.box div.form div.fields div.field div.radios div.radio {
 
clear:both;
 
overflow:hidden;
 
margin:0;
 
padding:8px 0 2px;
 
}
 
 
#content div.box div.form div.fields div.field div.checkboxes div.checkbox input,#content div.box div.form div.fields div.field div.radios div.radio input {
 
float:left;
 
margin:0;
 
}
 
 
#content div.box div.form div.fields div.field div.checkboxes div.checkbox label,#content div.box div.form div.fields div.field div.radios div.radio label {
 
height:1%;
 
display:block;
 
float:left;
 
margin:2px 0 0 4px;
 
}
 
 
div.form div.fields div.field div.button input,#content div.box div.form div.fields div.buttons input,div.form div.fields div.buttons input,#content div.box div.action div.button input {
 
color:#000;
 
font-family:Lucida Grande, Verdana, Lucida Sans Regular, Lucida Sans Unicode, Arial, sans-serif;
 
font-size:11px;
 
font-weight:700;
 
margin:0;
 
}
 
 
input.ui-button {
 
background:#e5e3e3 url("../images/button.png") repeat-x;
 
border-top:1px solid #DDD;
 
border-left:1px solid #c6c6c6;
 
border-right:1px solid #DDD;
 
border-bottom:1px solid #c6c6c6;
 
color:#515151 !important;
 
outline:none;
 
margin:0;
 
padding:6px 12px;
 
-webkit-border-radius: 4px 4px 4px 4px;
 
-khtml-border-radius: 4px 4px 4px 4px; 
 
-moz-border-radius: 4px 4px 4px 4px;
 
border-radius: 4px 4px 4px 4px;
 
box-shadow: 0 1px 0 #ececec;
 
cursor: pointer;
 
}
 
 
input.ui-button:hover {
 
background:#b4b4b4 url("../images/button_selected.png") repeat-x;
 
border-top:1px solid #ccc;
 
border-left:1px solid #bebebe;
 
border-right:1px solid #b1b1b1;
 
border-bottom:1px solid #afafaf;
 
}
 
 
div.form div.fields div.field div.highlight,#content div.box div.form div.fields div.buttons div.highlight {
 
display:inline;
 
}
 
 
#content div.box div.form div.fields div.buttons,div.form div.fields div.buttons {
 
margin:10px 0 0 200px;
 
padding:0;
 
}
 
 
#content div.box-left div.form div.fields div.buttons,#content div.box-right div.form div.fields div.buttons,div.box-left div.form div.fields div.buttons,div.box-right div.form div.fields div.buttons {
 
margin:10px 0 0;
 
}
 
 
#content div.box table td.user,#content div.box table td.address {
 
width:10%;
 
text-align:center;
 
}
 
 
#content div.box div.action div.button,#login div.form div.fields div.field div.input div.link,#register div.form div.fields div.field div.input div.link {
 
text-align:right;
 
margin:6px 0 0;
 
padding:0;
 
}
 
 
 
#content div.box div.action div.button input.ui-state-hover,#login div.form div.fields div.buttons input.ui-state-hover,#register div.form div.fields div.buttons input.ui-state-hover {
 
background:#b4b4b4 url("../images/button_selected.png") repeat-x;
 
border-top:1px solid #ccc;
 
border-left:1px solid #bebebe;
 
border-right:1px solid #b1b1b1;
 
border-bottom:1px solid #afafaf;
 
color:#515151;
 
margin:0;
 
padding:6px 12px;
 
}
 
 
#content div.box div.pagination div.results,#content div.box div.pagination-wh div.results {
 
text-align:left;
 
float:left;
 
margin:0;
 
padding:0;
 
}
 
 
#content div.box div.pagination div.results span,#content div.box div.pagination-wh div.results span {
 
height:1%;
 
display:block;
 
float:left;
 
background:#ebebeb url("../images/pager.png") repeat-x;
 
border-top:1px solid #dedede;
 
border-left:1px solid #cfcfcf;
 
border-right:1px solid #c4c4c4;
 
border-bottom:1px solid #c4c4c4;
 
color:#4A4A4A;
 
font-weight:700;
 
margin:0;
 
padding:6px 8px;
 
}
 
 
#content div.box div.pagination ul.pager li.disabled,#content div.box div.pagination-wh a.disabled {
 
color:#B4B4B4;
 
padding:6px;
 
}
 
 
#login,#register {
 
width:520px;
 
margin:10% auto 0;
 
padding:0;
 
}
 
 
#login div.color,#register div.color {
 
clear:both;
 
overflow:hidden;
 
background:#FFF;
 
margin:10px auto 0;
 
padding:3px 3px 3px 0;
 
}
 
 
#login div.color a,#register div.color a {
 
width:20px;
 
height:20px;
 
display:block;
 
float:left;
 
margin:0 0 0 3px;
 
padding:0;
 
}
 
 
#login div.title h5,#register div.title h5 {
 
color:#fff;
 
margin:10px;
 
padding:0;
 
}
 
 
#login div.form div.fields div.field,#register div.form div.fields div.field {
 
clear:both;
 
overflow:hidden;
 
margin:0;
 
padding:0 0 10px;
 
}
 
 
#login div.form div.fields div.field span.error-message,#register div.form div.fields div.field span.error-message {
 
height:1%;
 
display:block;
 
color:red;
 
margin:8px 0 0;
 
padding:0;
 
max-width: 320px;
 
}
 
 
#login div.form div.fields div.field div.label label,#register div.form div.fields div.field div.label label {
 
color:#000;
 
font-weight:700;
 
}
 
 
#login div.form div.fields div.field div.input,#register div.form div.fields div.field div.input {
 
float:left;
 
margin:0;
 
padding:0;
 
}
 
 
#login div.form div.fields div.field div.checkbox,#register div.form div.fields div.field div.checkbox {
 
margin:0 0 0 184px;
 
padding:0;
 
}
 
 
#login div.form div.fields div.field div.checkbox label,#register div.form div.fields div.field div.checkbox label {
 
color:#565656;
 
font-weight:700;
 
}
 
 
#login div.form div.fields div.buttons input,#register div.form div.fields div.buttons input {
 
color:#000;
 
font-size:1em;
 
font-weight:700;
 
font-family:Verdana, Helvetica, Sans-Serif;
 
margin:0;
 
}
 
 
#changeset_content .container .wrapper,#graph_content .container .wrapper {
 
width:600px;
 
}
 
 
#changeset_content .container .left,#graph_content .container .left {
 
float:left;
 
width:70%;
 
padding-left:5px;
 
}
 
 
#changeset_content .container .left .date,.ac .match {
 
font-weight:700;
 
padding-top: 5px;
 
padding-bottom:5px;
 
}
 
 
div#legend_container table td,div#legend_choices table td {
 
border:none !important;
 
height:20px !important;
 
padding:0 !important;
 
}
 
 
#q_filter{
 
border:0 none;
 
color:#AAAAAA;
 
margin-bottom:-4px;
 
margin-top:-4px;
 
padding-left:3px;
 
}
 
 
#node_filter{
 
border:0px solid #545454;
 
color:#AAAAAA;
 
padding-left:3px;
 
}
 
div.readme .readme_box h1, div.readme .readme_box h2, div.readme .readme_box h3, div.readme .readme_box h4, div.readme .readme_box h5, div.readme .readme_box h6 {
 
border-bottom: 0 !important;
 
margin: 0 !important;
 
padding: 0 !important;
 
line-height: 1.5em !important;
 
}
 
 
 
div.readme .readme_box h1:first-child {
 
padding-top: .25em !important;
 
}
 
 
div.readme .readme_box h2, div.readme .readme_box h3 {
 
margin: 1em 0 !important;
 
}
 
 
div.readme .readme_box h2 {
 
margin-top: 1.5em !important;
 
border-top: 4px solid #e0e0e0 !important;
 
padding-top: .5em !important;
 
}
 
 
div.readme .readme_box p {
 
color: black !important;
 
margin: 1em 0 !important;
 
line-height: 1.5em !important;
 
}
 
 
div.readme .readme_box ul {
 
list-style: disc !important;
 
margin: 1em 0 1em 2em !important;
 
}
 
 
div.readme .readme_box ol {
 
list-style: decimal;
 
margin: 1em 0 1em 2em !important;
 
}
 
 
div.readme .readme_box pre, code {
 
font: 12px "Bitstream Vera Sans Mono","Courier",monospace;
 
}
 
 
div.readme .readme_box code {
 
    font-size: 12px !important;
 
    background-color: ghostWhite !important;
 
    color: #444 !important;
 
    padding: 0 .2em !important;
 
    border: 1px solid #dedede !important;
 
}
 
 
div.readme .readme_box pre code {
 
padding: 0 !important;
 
font-size: 12px !important;
 
background-color: #eee !important;
 
border: none !important;
 
}
 
 
div.readme .readme_box pre {
 
margin: 1em 0;
 
font-size: 12px;
 
background-color: #eee;
 
border: 1px solid #ddd;
 
padding: 5px;
 
color: #444;
 
overflow: auto;
 
-webkit-box-shadow: rgba(0,0,0,0.07) 0 1px 2px inset;
 
-webkit-border-radius: 3px;
 
-moz-border-radius: 3px;
 
border-radius: 3px;
 
}
rhodecode/public/images/button_highlight_selected.png
Show inline comments
 
deleted file
 
binary diff not shown
Show images
rhodecode/public/images/header_inner.png
Show inline comments
 
deleted file
 
binary diff not shown
Show images
rhodecode/public/images/title.png
Show inline comments
 
deleted file
 
binary diff not shown
Show images
rhodecode/public/images/title_link.png
Show inline comments
 
deleted file
 
binary diff not shown
Show images
rhodecode/public/js/codemirror.js
Show inline comments
 
// All functions that need access to the editor's state live inside
 
// the CodeMirror function. Below that, at the bottom of the file,
 
// some utilities are defined.
 

	
 
// CodeMirror is the only global var we claim
 
var CodeMirror = (function() {
 
  // This is the function that produces an editor instance. It's
 
  // closure is used to store the editor state.
 
  function CodeMirror(place, givenOptions) {
 
    // Determine effective options based on given values and defaults.
 
    var options = {}, defaults = CodeMirror.defaults;
 
    for (var opt in defaults)
 
      if (defaults.hasOwnProperty(opt))
 
        options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];
 

	
 
    // The element in which the editor lives. Takes care of scrolling
 
    // (if enabled).
 
    var wrapper = document.createElement("div");
 
    var targetDocument = options["document"];
 
    // The element in which the editor lives.
 
    var wrapper = targetDocument.createElement("div");
 
    wrapper.className = "CodeMirror";
 
    // This mess creates the base DOM structure for the editor.
 
    wrapper.innerHTML =
 
      '<div style="position: relative">' + // Set to the height of the text, causes scrolling
 
        '<pre style="position: relative; height: 0; visibility: hidden; overflow: hidden;">' + // To measure line/char size
 
           '<span>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</span></pre>' +
 
        '<div style="position: relative">' + // Moved around its parent to cover visible view
 
          '<div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div>' +
 
          '<div style="overflow: hidden; position: absolute; width: 0; left: 0">' + // Wraps and hides input textarea
 
            '<textarea style="height: 1px; position: absolute; width: 1px;" wrap="off"></textarea></div>' +
 
          // Provides positioning relative to (visible) text origin
 
          '<div class="CodeMirror-lines"><div style="position: relative">' +
 
            '<pre class="CodeMirror-cursor">&#160;</pre>' + // Absolutely positioned blinky cursor
 
            '<div></div></div></div></div></div>'; // This DIV contains the actual code
 
      '<div style="overflow: hidden; position: relative; width: 1px; height: 0px;">' + // Wraps and hides input textarea
 
        '<textarea style="position: absolute; width: 10000px;" wrap="off" ' +
 
          'autocorrect="off" autocapitalize="off"></textarea></div>' +
 
      '<div class="CodeMirror-scroll cm-s-' + options.theme + '">' +
 
        '<div style="position: relative">' + // Set to the height of the text, causes scrolling
 
          '<div style="position: absolute; height: 0; width: 0; overflow: hidden;"></div>' +
 
          '<div style="position: relative">' + // Moved around its parent to cover visible view
 
            '<div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div>' +
 
            // Provides positioning relative to (visible) text origin
 
            '<div class="CodeMirror-lines"><div style="position: relative" draggable="true">' +
 
              '<pre class="CodeMirror-cursor">&#160;</pre>' + // Absolutely positioned blinky cursor
 
              '<div></div>' + // This DIV contains the actual code
 
            '</div></div></div></div></div>';
 
    if (place.appendChild) place.appendChild(wrapper); else place(wrapper);
 
    // I've never seen more elegant code in my life.
 
    var code = wrapper.firstChild, measure = code.firstChild, mover = measure.nextSibling,
 
    var inputDiv = wrapper.firstChild, input = inputDiv.firstChild,
 
        scroller = wrapper.lastChild, code = scroller.firstChild,
 
        measure = code.firstChild, mover = measure.nextSibling,
 
        gutter = mover.firstChild, gutterText = gutter.firstChild,
 
        inputDiv = gutter.nextSibling, input = inputDiv.firstChild,
 
        lineSpace = inputDiv.nextSibling.firstChild, cursor = lineSpace.firstChild, lineDiv = cursor.nextSibling;
 
        lineSpace = gutter.nextSibling.firstChild,
 
        cursor = lineSpace.firstChild, lineDiv = cursor.nextSibling;
 
    if (options.tabindex != null) input.tabindex = options.tabindex;
 
    if (!options.gutter && !options.lineNumbers) gutter.style.display = "none";
 

	
 
    // Check for problem with IE innerHTML not working when we have a
 
    // P (or similar) parent node.
 
    try { stringWidth("x"); }
 
    catch (e) {
 
      if (e.message.match(/unknown runtime/i))
 
        e = new Error("A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)");
 
      throw e;
 
    }
 

	
 
    // Delayed object wrap timeouts, making sure only one is active. blinker holds an interval.
 
    var poll = new Delayed(), highlight = new Delayed(), blinker;
 

	
 
    // mode holds a mode API object. lines an array of Line objects
 
    // (see Line constructor), work an array of lines that should be
 
    // parsed, and history the undo history (instance of History
 
    // constructor).
 
    var mode, lines = [new Line("")], work, history = new History(), focused;
 
    var mode, lines = [new Line("")], work, focused;
 
    loadMode();
 
    // The selection. These are always maintained to point at valid
 
    // positions. Inverted is used to remember that the user is
 
    // selecting bottom-to-top.
 
    var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false};
 
    // Selection-related flags. shiftSelecting obviously tracks
 
    // whether the user is holding shift. reducedSelection is a hack
 
    // to get around the fact that we can't create inverted
 
    // selections. See below.
 
    var shiftSelecting, reducedSelection;
 
    var shiftSelecting, reducedSelection, lastClick, lastDoubleClick, draggingText;
 
    // Variables used by startOperation/endOperation to track what
 
    // happened during the operation.
 
    var updateInput, changes, textChanged, selectionChanged, leaveInputAlone;
 
    var updateInput, changes, textChanged, selectionChanged, leaveInputAlone, gutterDirty;
 
    // Current visible range (may be bigger than the view window).
 
    var showingFrom = 0, showingTo = 0, lastHeight = 0, curKeyId = null;
 
    // editing will hold an object describing the things we put in the
 
    // textarea, to help figure out whether something changed.
 
    // bracketHighlighted is used to remember that a backet has been
 
    // marked.
 
    var editing, bracketHighlighted;
 
    // Tracks the maximum line length so that the horizontal scrollbar
 
    // can be kept static when scrolling.
 
    var maxLine = "", maxWidth;
 

	
 
    // Initialize the content. Somewhat hacky (delayed prepareInput)
 
    // to work around browser issues.
 
    // Initialize the content.
 
    operation(function(){setValue(options.value || ""); updateInput = false;})();
 
    setTimeout(prepareInput, 20);
 
    var history = new History();
 

	
 
    // Register our event handlers.
 
    connect(wrapper, "mousedown", operation(onMouseDown));
 
    connect(scroller, "mousedown", operation(onMouseDown));
 
    connect(scroller, "dblclick", operation(onDoubleClick));
 
    connect(lineSpace, "dragstart", onDragStart);
 
    // Gecko browsers fire contextmenu *after* opening the menu, at
 
    // which point we can't mess with it anymore. Context menu is
 
    // handled in onMouseDown for Gecko.
 
    if (!gecko) connect(wrapper, "contextmenu", operation(onContextMenu));
 
    connect(code, "dblclick", operation(onDblClick));
 
    connect(wrapper, "scroll", function() {updateDisplay([]); if (options.onScroll) options.onScroll(instance);});
 
    if (!gecko) connect(scroller, "contextmenu", onContextMenu);
 
    connect(scroller, "scroll", function() {
 
      updateDisplay([]);
 
      if (options.fixedGutter) gutter.style.left = scroller.scrollLeft + "px";
 
      if (options.onScroll) options.onScroll(instance);
 
    });
 
    connect(window, "resize", function() {updateDisplay(true);});
 
    connect(input, "keyup", operation(onKeyUp));
 
    connect(input, "input", function() {fastPoll(curKeyId);});
 
    connect(input, "keydown", operation(onKeyDown));
 
    connect(input, "keypress", operation(onKeyPress));
 
    connect(input, "focus", onFocus);
 
    connect(input, "blur", onBlur);
 

	
 
    connect(wrapper, "dragenter", function(e){e.stop();});
 
    connect(wrapper, "dragover", function(e){e.stop();});
 
    connect(wrapper, "drop", operation(onDrop));
 
    connect(wrapper, "paste", function(){input.focus(); fastPoll();});
 
    connect(scroller, "dragenter", e_stop);
 
    connect(scroller, "dragover", e_stop);
 
    connect(scroller, "drop", operation(onDrop));
 
    connect(scroller, "paste", function(){focusInput(); fastPoll();});
 
    connect(input, "paste", function(){fastPoll();});
 
    connect(input, "cut", function(){fastPoll();});
 

	
 
    if (document.activeElement == input) onFocus();
 
    // IE throws unspecified error in certain cases, when
 
    // trying to access activeElement before onload
 
    var hasFocus; try { hasFocus = (targetDocument.activeElement == input); } catch(e) { }
 
    if (hasFocus) setTimeout(onFocus, 20);
 
    else onBlur();
 

	
 
    function isLine(l) {return l >= 0 && l < lines.length;}
 
    // The instance object that we'll return. Mostly calls out to
 
    // local functions in the CodeMirror function. Some do some extra
 
    // range checking and/or clipping. operation is used to wrap the
 
    // call so that changes it makes are tracked, and the display is
 
    // updated afterwards.
 
    var instance = {
 
    var instance = wrapper.CodeMirror = {
 
      getValue: getValue,
 
      setValue: operation(setValue),
 
      getSelection: getSelection,
 
      replaceSelection: operation(replaceSelection),
 
      focus: function(){input.focus(); onFocus(); fastPoll();},
 
      focus: function(){focusInput(); onFocus(); fastPoll();},
 
      setOption: function(option, value) {
 
        options[option] = value;
 
        if (option == "lineNumbers" || option == "gutter") gutterChanged();
 
        if (option == "lineNumbers" || option == "gutter" || option == "firstLineNumber")
 
          operation(gutterChanged)();
 
        else if (option == "mode" || option == "indentUnit") loadMode();
 
        else if (option == "readOnly" && value == "nocursor") input.blur();
 
        else if (option == "theme") scroller.className = scroller.className.replace(/cm-s-\w+/, "cm-s-" + value);
 
      },
 
      getOption: function(option) {return options[option];},
 
      undo: operation(undo),
 
      redo: operation(redo),
 
      indentLine: operation(function(n) {if (isLine(n)) indentLine(n, "smart");}),
 
      indentLine: operation(function(n, dir) {
 
        if (isLine(n)) indentLine(n, dir == null ? "smart" : dir ? "add" : "subtract");
 
      }),
 
      historySize: function() {return {undo: history.done.length, redo: history.undone.length};},
 
      clearHistory: function() {history = new History();},
 
      matchBrackets: operation(function(){matchBrackets(true);}),
 
      getTokenAt: function(pos) {
 
        pos = clipPos(pos);
 
        return lines[pos.line].getTokenAt(mode, getStateBefore(pos.line), pos.ch);
 
      },
 
      getStateAfter: function(line) {
 
        line = clipLine(line == null ? lines.length - 1: line);
 
        return getStateBefore(line + 1);
 
      },
 
      cursorCoords: function(start){
 
        if (start == null) start = sel.inverted;
 
        return pageCoords(start ? sel.from : sel.to);
 
      },
 
      charCoords: function(pos){return pageCoords(clipPos(pos));},
 
      coordsChar: function(coords) {
 
        var off = eltOffset(lineSpace);
 
        var line = Math.min(showingTo - 1, showingFrom + Math.floor(coords.y / lineHeight()));
 
        return clipPos({line: line, ch: charFromX(clipLine(line), coords.x)});
 
        var line = clipLine(Math.min(lines.length - 1, showingFrom + Math.floor((coords.y - off.top) / lineHeight())));
 
        return clipPos({line: line, ch: charFromX(clipLine(line), coords.x - off.left)});
 
      },
 
      getSearchCursor: function(query, pos, caseFold) {return new SearchCursor(query, pos, caseFold);},
 
      markText: operation(function(a, b, c){return operation(markText(a, b, c));}),
 
      setMarker: addGutterMarker,
 
      clearMarker: removeGutterMarker,
 
      markText: operation(markText),
 
      setMarker: operation(addGutterMarker),
 
      clearMarker: operation(removeGutterMarker),
 
      setLineClass: operation(setLineClass),
 
      lineInfo: lineInfo,
 
      addWidget: function(pos, node, scroll) {
 
        var pos = localCoords(clipPos(pos), true);
 
        node.style.top = (showingFrom * lineHeight() + pos.yBot + paddingTop()) + "px";
 
        node.style.left = (pos.x + paddingLeft()) + "px";
 
      addWidget: function(pos, node, scroll, vert, horiz) {
 
        pos = localCoords(clipPos(pos));
 
        var top = pos.yBot, left = pos.x;
 
        node.style.position = "absolute";
 
        code.appendChild(node);
 
        if (vert == "over") top = pos.y;
 
        else if (vert == "near") {
 
          var vspace = Math.max(scroller.offsetHeight, lines.length * lineHeight()),
 
              hspace = Math.max(code.clientWidth, lineSpace.clientWidth) - paddingLeft();
 
          if (pos.yBot + node.offsetHeight > vspace && pos.y > node.offsetHeight)
 
            top = pos.y - node.offsetHeight;
 
          if (left + node.offsetWidth > hspace)
 
            left = hspace - node.offsetWidth;
 
        }
 
        node.style.top = (top + paddingTop()) + "px";
 
        node.style.left = node.style.right = "";
 
        if (horiz == "right") {
 
          left = code.clientWidth - node.offsetWidth;
 
          node.style.right = "0px";
 
        } else {
 
          if (horiz == "left") left = 0;
 
          else if (horiz == "middle") left = (code.clientWidth - node.offsetWidth) / 2;
 
          node.style.left = (left + paddingLeft()) + "px";
 
        }
 
        if (scroll)
 
          scrollIntoView(pos.x, pos.yBot, pos.x + node.offsetWidth, pos.yBot + node.offsetHeight);
 
          scrollIntoView(left, top, left + node.offsetWidth, top + node.offsetHeight);
 
      },
 

	
 
      lineCount: function() {return lines.length;},
 
      getCursor: function(start) {
 
        if (start == null) start = sel.inverted;
 
        return copyPos(start ? sel.from : sel.to);
 
      },
 
      somethingSelected: function() {return !posEq(sel.from, sel.to);},
 
      setCursor: operation(function(line, ch) {
 
        if (ch == null && typeof line.line == "number") setCursor(line.line, line.ch);
 
        else setCursor(line, ch);
 
      }),
 
      setSelection: operation(function(from, to) {setSelection(clipPos(from), clipPos(to || from));}),
 
      getLine: function(line) {if (isLine(line)) return lines[line].text;},
 
      setLine: operation(function(line, text) {
 
        if (isLine(line)) replaceRange(text, {line: line, ch: 0}, {line: line, ch: lines[line].text.length});
 
      }),
 
      removeLine: operation(function(line) {
 
        if (isLine(line)) replaceRange("", {line: line, ch: 0}, clipPos({line: line+1, ch: 0}));
 
      }),
 
      replaceRange: operation(replaceRange),
 
      getRange: function(from, to) {return getRange(clipPos(from), clipPos(to));},
 

	
 
      coordsFromIndex: function(index) {        
 
        var total = lines.length, pos = 0, line, ch, len;
 
        
 
        for (line = 0; line < total; line++) {
 
          len = lines[line].text.length + 1;
 
          if (pos + len > index) { ch = index - pos; break; }
 
          pos += len;
 
        }
 
        return clipPos({line: line, ch: ch});
 
      },
 

	
 
      operation: function(f){return operation(f)();},
 
      refresh: function(){updateDisplay(true);},
 
      getInputField: function(){return input;},
 
      getWrapperElement: function(){return wrapper;}
 
      getWrapperElement: function(){return wrapper;},
 
      getScrollerElement: function(){return scroller;},
 
      getGutterElement: function(){return gutter;}
 
    };
 

	
 
    function setValue(code) {
 
      history = null;
 
      var top = {line: 0, ch: 0};
 
      updateLines(top, {line: lines.length - 1, ch: lines[lines.length-1].text.length},
 
                  splitLines(code), top, top);
 
      history = new History();
 
      updateInput = true;
 
    }
 
    function getValue(code) {
 
      var text = [];
 
      for (var i = 0, l = lines.length; i < l; ++i)
 
        text.push(lines[i].text);
 
      return text.join("\n");
 
    }
 

	
 
    function onMouseDown(e) {
 
      // Check whether this is a click in a widget
 
      for (var n = e_target(e); n != wrapper; n = n.parentNode)
 
        if (n.parentNode == code && n != mover) return;
 

	
 
      // First, see if this is a click in the gutter
 
      for (var n = e.target(); n != wrapper; n = n.parentNode)
 
      for (var n = e_target(e); n != wrapper; n = n.parentNode)
 
        if (n.parentNode == gutterText) {
 
          if (options.onGutterClick)
 
            options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom);
 
          return e.stop();
 
            options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom, e);
 
          return e_preventDefault(e);
 
        }
 

	
 
      if (gecko && e.button() == 3) onContextMenu(e);
 
      if (e.button() != 1) return;
 
      var start = posFromMouse(e);
 

	
 
      switch (e_button(e)) {
 
      case 3:
 
        if (gecko && !mac) onContextMenu(e);
 
        return;
 
      case 2:
 
        if (start) setCursor(start.line, start.ch, true);
 
        return;
 
      }
 
      // For button 1, if it was clicked inside the editor
 
      // (posFromMouse returning non-null), we have to adjust the
 
      // selection.
 
      var start = posFromMouse(e), last = start, going;
 
      if (!start) {if (e.target() == wrapper) e.stop(); return;}
 
      setCursor(start.line, start.ch, false);
 
      if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;}
 

	
 
      if (!focused) onFocus();
 
      e.stop();
 
      // And then we have to see if it's a drag event, in which case
 
      // the dragged-over text must be selected.
 
      function end() {
 
        input.focus();
 
        updateInput = true;
 
        move(); up();
 

	
 
      var now = +new Date;
 
      if (lastDoubleClick > now - 400) {
 
        e_preventDefault(e);
 
        return selectLine(start.line);
 
      } else if (lastClick > now - 400) {
 
        lastDoubleClick = now;
 
        e_preventDefault(e);
 
        return selectWordAt(start);
 
      } else { lastClick = now; }
 

	
 
      var last = start, going;
 
      if (dragAndDrop && !posEq(sel.from, sel.to) &&
 
          !posLess(start, sel.from) && !posLess(sel.to, start)) {
 
        // Let the drag handler handle this.
 
        var up = connect(targetDocument, "mouseup", operation(function(e2) {
 
          draggingText = false;
 
          up();
 
          if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
 
            e_preventDefault(e2);
 
            setCursor(start.line, start.ch, true);
 
            focusInput();
 
          }
 
        }), true);
 
        draggingText = true;
 
        return;
 
      }
 
      e_preventDefault(e);
 
      setCursor(start.line, start.ch, true);
 

	
 
      function extend(e) {
 
        var cur = posFromMouse(e, true);
 
        if (cur && !posEq(cur, last)) {
 
          if (!focused) onFocus();
 
          last = cur;
 
          setSelection(start, cur);
 
          setSelectionUser(start, cur);
 
          updateInput = false;
 
          var visible = visibleLines();
 
          if (cur.line >= visible.to || cur.line < visible.from)
 
            going = setTimeout(operation(function(){extend(e);}), 150);
 
        }
 
      }
 

	
 
      var move = connect(document, "mousemove", operation(function(e) {
 
      var move = connect(targetDocument, "mousemove", operation(function(e) {
 
        clearTimeout(going);
 
        e.stop();
 
        e_preventDefault(e);
 
        extend(e);
 
      }), true);
 
      var up = connect(document, "mouseup", operation(function(e) {
 
      var up = connect(targetDocument, "mouseup", operation(function(e) {
 
        clearTimeout(going);
 
        var cur = posFromMouse(e);
 
        if (cur) setSelection(start, cur);
 
        e.stop();
 
        end();
 
        if (cur) setSelectionUser(start, cur);
 
        e_preventDefault(e);
 
        focusInput();
 
        updateInput = true;
 
        move(); up();
 
      }), true);
 
    }
 
    function onDblClick(e) {
 
      var pos = posFromMouse(e);
 
      if (!pos) return;
 
      selectWordAt(pos);
 
      e.stop();
 
    function onDoubleClick(e) {
 
      var start = posFromMouse(e);
 
      if (!start) return;
 
      lastDoubleClick = +new Date;
 
      e_preventDefault(e);
 
      selectWordAt(start);
 
    }
 
    function onDrop(e) {
 
      var pos = posFromMouse(e, true), files = e.e.dataTransfer.files;
 
      e.preventDefault();
 
      var pos = posFromMouse(e, true), files = e.dataTransfer.files;
 
      if (!pos || options.readOnly) return;
 
      if (files && files.length && window.FileReader && window.File) {
 
        var n = files.length, text = Array(n), read = 0;
 
        for (var i = 0; i < n; ++i) loadFile(files[i], i);
 
        function loadFile(file, i) {
 
          var reader = new FileReader;
 
          reader.onload = function() {
 
            text[i] = reader.result;
 
            if (++read == n) replaceRange(text.join(""), clipPos(pos), clipPos(pos));
 
            if (++read == n) {
 
	      pos = clipPos(pos);
 
	      var end = replaceRange(text.join(""), pos, pos);
 
	      setSelectionUser(pos, end);
 
	    }
 
          };
 
          reader.readAsText(file);
 
        }
 
        var n = files.length, text = Array(n), read = 0;
 
        for (var i = 0; i < n; ++i) loadFile(files[i], i);
 
      }
 
      else {
 
        try {
 
          var text = e.e.dataTransfer.getData("Text");
 
          if (text) replaceRange(text, pos, pos);
 
          var text = e.dataTransfer.getData("Text");
 
          if (text) {
 
	    var end = replaceRange(text, pos, pos);
 
	    var curFrom = sel.from, curTo = sel.to;
 
	    setSelectionUser(pos, end);
 
            if (draggingText) replaceRange("", curFrom, curTo);
 
	    focusInput();
 
	  }
 
        }
 
        catch(e){}
 
      }
 
    }
 
    function onDragStart(e) {
 
      var txt = getSelection();
 
      // This will reset escapeElement
 
      htmlEscape(txt);
 
      e.dataTransfer.setDragImage(escapeElement, 0, 0);
 
      e.dataTransfer.setData("Text", txt);
 
    }
 
    function onKeyDown(e) {
 
      if (!focused) onFocus();
 

	
 
      var code = e.e.keyCode;
 
      var code = e.keyCode;
 
      // IE does strange things with escape.
 
      if (ie && code == 27) { e.returnValue = false; }
 
      // Tries to detect ctrl on non-mac, cmd on mac.
 
      var mod = (mac ? e.e.metaKey : e.e.ctrlKey) && !e.e.altKey, anyMod = e.e.ctrlKey || e.e.altKey || e.e.metaKey;
 
      if (code == 16 || e.e.shiftKey) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from);
 
      var mod = (mac ? e.metaKey : e.ctrlKey) && !e.altKey, anyMod = e.ctrlKey || e.altKey || e.metaKey;
 
      if (code == 16 || e.shiftKey) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from);
 
      else shiftSelecting = null;
 
      // First give onKeyEvent option a chance to handle this.
 
      if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e.e))) return;
 
      if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
 

	
 
      if (code == 33 || code == 34) {scrollPage(code == 34); return e.stop();} // page up/down
 
      if (mod && (code == 36 || code == 35)) {scrollEnd(code == 36); return e.stop();} // ctrl-home/end
 
      if (mod && code == 65) {selectAll(); return e.stop();} // ctrl-a
 
      if (code == 33 || code == 34) {scrollPage(code == 34); return e_preventDefault(e);} // page up/down
 
      if (mod && ((code == 36 || code == 35) || // ctrl-home/end
 
                  mac && (code == 38 || code == 40))) { // cmd-up/down
 
        scrollEnd(code == 36 || code == 38); return e_preventDefault(e);
 
      }
 
      if (mod && code == 65) {selectAll(); return e_preventDefault(e);} // ctrl-a
 
      if (!options.readOnly) {
 
        if (!anyMod && code == 13) {return;} // enter
 
        if (!anyMod && code == 9 && handleTab(e.e.shiftKey)) return e.stop(); // tab
 
        if (mod && code == 90) {undo(); return e.stop();} // ctrl-z
 
        if (mod && ((e.e.shiftKey && code == 90) || code == 89)) {redo(); return e.stop();} // ctrl-shift-z, ctrl-y
 
        if (!anyMod && code == 9 && handleTab(e.shiftKey)) return e_preventDefault(e); // tab
 
        if (mod && code == 90) {undo(); return e_preventDefault(e);} // ctrl-z
 
        if (mod && ((e.shiftKey && code == 90) || code == 89)) {redo(); return e_preventDefault(e);} // ctrl-shift-z, ctrl-y
 
      }
 
      if (code == 36) { if (options.smartHome) { smartHome(); return e_preventDefault(e); } }
 

	
 
      // Key id to use in the movementKeys map. We also pass it to
 
      // fastPoll in order to 'self learn'. We need this because
 
      // reducedSelection, the hack where we collapse the selection to
 
      // its start when it is inverted and a movement key is pressed
 
      // (and later restore it again), shouldn't be used for
 
      // non-movement keys.
 
      curKeyId = (mod ? "c" : "") + code;
 
      if (sel.inverted && movementKeys.hasOwnProperty(curKeyId)) {
 
      curKeyId = (mod ? "c" : "") + (e.altKey ? "a" : "") + code;
 
      if (sel.inverted && movementKeys[curKeyId] === true) {
 
        var range = selRange(input);
 
        if (range) {
 
          reducedSelection = {anchor: range.start};
 
          setSelRange(input, range.start, range.start);
 
        }
 
      }
 
      // Don't save the key as a movementkey unless it had a modifier
 
      if (!mod && !e.altKey) curKeyId = null;
 
      fastPoll(curKeyId);
 
    }
 
    function onKeyUp(e) {
 
      if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
 
      if (reducedSelection) {
 
        reducedSelection = null;
 
        updateInput = true;
 
      }
 
      if (e.e.keyCode == 16) shiftSelecting = null;
 
      if (e.keyCode == 16) shiftSelecting = null;
 
    }
 
    function onKeyPress(e) {
 
      if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e.e))) return;
 
      if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
 
      if (options.electricChars && mode.electricChars) {
 
        var ch = String.fromCharCode(e.e.charCode == null ? e.e.keyCode : e.e.charCode);
 
        var ch = String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode);
 
        if (mode.electricChars.indexOf(ch) > -1)
 
          setTimeout(operation(function() {indentLine(sel.to.line, "smart");}), 50);
 
      }
 
      var code = e.e.keyCode;
 
      var code = e.keyCode;
 
      // Re-stop tab and enter. Necessary on some browsers.
 
      if (code == 13) {handleEnter(); e.stop();}
 
      else if (code == 9 && options.tabMode != "default") e.stop();
 
      if (code == 13) {if (!options.readOnly) handleEnter(); e_preventDefault(e);}
 
      else if (!e.ctrlKey && !e.altKey && !e.metaKey && code == 9 && options.tabMode != "default") e_preventDefault(e);
 
      else fastPoll(curKeyId);
 
    }
 

	
 
    function onFocus() {
 
      if (!focused && options.onFocus) options.onFocus(instance);
 
      focused = true;
 
      if (options.readOnly == "nocursor") return;
 
      if (!focused) {
 
        if (options.onFocus) options.onFocus(instance);
 
        focused = true;
 
        if (wrapper.className.search(/\bCodeMirror-focused\b/) == -1)
 
          wrapper.className += " CodeMirror-focused";
 
        if (!leaveInputAlone) prepareInput();
 
      }
 
      slowPoll();
 
      if (wrapper.className.search(/\bCodeMirror-focused\b/) == -1)
 
        wrapper.className += " CodeMirror-focused";
 
      restartBlink();
 
    }
 
    function onBlur() {
 
      if (focused && options.onBlur) options.onBlur(instance);
 
      if (focused) {
 
        if (options.onBlur) options.onBlur(instance);
 
        focused = false;
 
        wrapper.className = wrapper.className.replace(" CodeMirror-focused", "");
 
      }
 
      clearInterval(blinker);
 
      shiftSelecting = null;
 
      focused = false;
 
      wrapper.className = wrapper.className.replace(" CodeMirror-focused", "");
 
      setTimeout(function() {if (!focused) shiftSelecting = null;}, 150);
 
    }
 

	
 
    // Replace the range from from to to by the strings in newText.
 
    // Afterwards, set the selection to selFrom, selTo.
 
    function updateLines(from, to, newText, selFrom, selTo) {
 
      if (history) {
 
        var old = [];
 
        for (var i = from.line, e = to.line + 1; i < e; ++i) old.push(lines[i].text);
 
        history.addChange(from.line, newText.length, old);
 
        while (history.done.length > options.undoDepth) history.done.shift();
 
      }
 
      updateLinesNoUndo(from, to, newText, selFrom, selTo);
 
    }
 
    function unredoHelper(from, to) {
 
      var change = from.pop();
 
      if (change) {
 
        var replaced = [], end = change.start + change.added;
 
        for (var i = change.start; i < end; ++i) replaced.push(lines[i].text);
 
        to.push({start: change.start, added: change.old.length, old: replaced});
 
        var pos = clipPos({line: change.start + change.old.length - 1,
 
                           ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])});
 
        updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: lines[end-1].text.length}, change.old, pos, pos);
 
        updateInput = true;
 
      }
 
    }
 
    function undo() {unredoHelper(history.done, history.undone);}
 
    function redo() {unredoHelper(history.undone, history.done);}
 

	
 
    function updateLinesNoUndo(from, to, newText, selFrom, selTo) {
 
      var recomputeMaxLength = false, maxLineLength = maxLine.length;
 
      for (var i = from.line; i <= to.line; ++i) {
 
        if (lines[i].text.length == maxLineLength) {recomputeMaxLength = true; break;}
 
      }
 

	
 
      var nlines = to.line - from.line, firstLine = lines[from.line], lastLine = lines[to.line];
 
      // First adjust the line structure, taking some care to leave highlighting intact.
 
      if (firstLine == lastLine) {
 
        if (newText.length == 1)
 
          firstLine.replace(from.ch, to.ch, newText[0]);
 
        else {
 
          lastLine = firstLine.split(to.ch, newText[newText.length-1]);
 
          var spliceargs = [from.line + 1, nlines];
 
          firstLine.replace(from.ch, firstLine.text.length, newText[0]);
 
          for (var i = 1, e = newText.length - 1; i < e; ++i) spliceargs.push(new Line(newText[i]));
 
          firstLine.replace(from.ch, null, newText[0]);
 
          for (var i = 1, e = newText.length - 1; i < e; ++i)
 
            spliceargs.push(Line.inheritMarks(newText[i], firstLine));
 
          spliceargs.push(lastLine);
 
          lines.splice.apply(lines, spliceargs);
 
        }
 
      }
 
      else if (newText.length == 1) {
 
        firstLine.replace(from.ch, firstLine.text.length, newText[0] + lastLine.text.slice(to.ch));
 
        firstLine.replace(from.ch, null, newText[0]);
 
        lastLine.replace(null, to.ch, "");
 
        firstLine.append(lastLine);
 
        lines.splice(from.line + 1, nlines);
 
      }
 
      else {
 
        var spliceargs = [from.line + 1, nlines - 1];
 
        firstLine.replace(from.ch, firstLine.text.length, newText[0]);
 
        lastLine.replace(0, to.ch, newText[newText.length-1]);
 
        for (var i = 1, e = newText.length - 1; i < e; ++i) spliceargs.push(new Line(newText[i]));
 
        firstLine.replace(from.ch, null, newText[0]);
 
        lastLine.replace(null, to.ch, newText[newText.length-1]);
 
        for (var i = 1, e = newText.length - 1; i < e; ++i)
 
          spliceargs.push(Line.inheritMarks(newText[i], firstLine));
 
        lines.splice.apply(lines, spliceargs);
 
      }
 

	
 

	
 
      for (var i = from.line, e = i + newText.length; i < e; ++i) {
 
        var l = lines[i].text;
 
        if (l.length > maxLineLength) {
 
          maxLine = l; maxLineLength = l.length; maxWidth = null;
 
          recomputeMaxLength = false;
 
        }
 
      }
 
      if (recomputeMaxLength) {
 
        maxLineLength = 0; maxLine = ""; maxWidth = null;
 
        for (var i = 0, e = lines.length; i < e; ++i) {
 
          var l = lines[i].text;
 
          if (l.length > maxLineLength) {
 
            maxLineLength = l.length; maxLine = l;
 
          }
 
        }
 
      }
 

	
 
      // Add these lines to the work array, so that they will be
 
      // highlighted. Adjust work lines if lines were added/removed.
 
      var newWork = [], lendiff = newText.length - nlines - 1;
 
      for (var i = 0, l = work.length; i < l; ++i) {
 
        var task = work[i];
 
        if (task < from.line) newWork.push(task);
 
        else if (task > to.line) newWork.push(task + lendiff);
 
      }
 
      if (newText.length) newWork.push(from.line);
 
      if (newText.length < 5) {
 
        highlightLines(from.line, from.line + newText.length);
 
        newWork.push(from.line + newText.length);
 
      } else {
 
        newWork.push(from.line);
 
      }
 
      work = newWork;
 
      startWorker(100);
 
      // Remember that these lines changed, for updating the display
 
      changes.push({from: from.line, to: to.line + 1, diff: lendiff});
 
      textChanged = true;
 
      textChanged = {from: from, to: to, text: newText};
 

	
 
      // Update the selection
 
      function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;}
 
      setSelection(selFrom, selTo, updateLine(sel.from.line), updateLine(sel.to.line));
 

	
 
      // Make sure the scroll-size div has the correct height.
 
      code.style.height = (lines.length * lineHeight() + 2 * paddingTop()) + "px";
 
    }
 

	
 
    function replaceRange(code, from, to) {
 
      from = clipPos(from);
 
      if (!to) to = from; else to = clipPos(to);
 
      code = splitLines(code);
 
      function adjustPos(pos) {
 
        if (posLess(pos, from)) return pos;
 
        if (!posLess(to, pos)) return end;
 
        var line = pos.line + code.length - (to.line - from.line) - 1;
 
        var ch = pos.ch;
 
        if (pos.line == to.line)
 
          ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0));
 
        return {line: line, ch: ch};
 
      }
 
      var end;
 
      replaceRange1(code, from, to, function(end1) {
 
        end = end1;
 
        return {from: adjustPos(sel.from), to: adjustPos(sel.to)};
 
      });
 
      return end;
 
    }
 
    function replaceSelection(code, collapse) {
 
      replaceRange1(splitLines(code), sel.from, sel.to, function(end) {
 
        if (collapse == "end") return {from: end, to: end};
 
        else if (collapse == "start") return {from: sel.from, to: sel.from};
 
        else return {from: sel.from, to: end};
 
      });
 
    }
 
    function replaceRange1(code, from, to, computeSel) {
 
      var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length;
 
      var newSel = computeSel({line: from.line + code.length - 1, ch: endch});
 
      updateLines(from, to, code, newSel.from, newSel.to);
 
    }
 

	
 
    function getRange(from, to) {
 
      var l1 = from.line, l2 = to.line;
 
      if (l1 == l2) return lines[l1].text.slice(from.ch, to.ch);
 
      var code = [lines[l1].text.slice(from.ch)];
 
      for (var i = l1 + 1; i < l2; ++i) code.push(lines[i].text);
 
      code.push(lines[l2].text.slice(0, to.ch));
 
      return code.join("\n");
 
    }
 
    function getSelection() {
 
      return getRange(sel.from, sel.to);
 
    }
 

	
 
    var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll
 
    function slowPoll() {
 
      if (pollingFast) return;
 
      poll.set(2000, function() {
 
        startOperation();
 
        readInput();
 
        if (focused) slowPoll();
 
        endOperation();
 
      });
 
    }
 
    function fastPoll(keyId) {
 
      var missed = false;
 
      pollingFast = true;
 
      function p() {
 
        startOperation();
 
        var changed = readInput();
 
        if (changed == "moved" && keyId) movementKeys[keyId] = true;
 
        if (changed && keyId) {
 
          if (changed == "moved" && movementKeys[keyId] == null) movementKeys[keyId] = true;
 
          if (changed == "changed") movementKeys[keyId] = false;
 
        }
 
        if (!changed && !missed) {missed = true; poll.set(80, p);}
 
        else {pollingFast = false; slowPoll();}
 
        endOperation();
 
      }
 
      poll.set(20, p);
 
    }
 

	
 
    // Inspects the textarea, compares its state (content, selection)
 
    // to the data in the editing variable, and updates the editor
 
    // content or cursor if something changed.
 
    function readInput() {
 
      if (leaveInputAlone || !focused) return;
 
      var changed = false, text = input.value, sr = selRange(input);
 
      if (!sr) return false;
 
      var changed = editing.text != text, rs = reducedSelection;
 
      var moved = changed || sr.start != editing.start || sr.end != (rs ? editing.start : editing.end);
 
      if (reducedSelection && !moved && sel.from.line == 0 && sel.from.ch == 0)
 
        reducedSelection = null;
 
      else if (!moved) return false;
 
      if (!moved && !rs) return false;
 
      if (changed) {
 
        shiftSelecting = reducedSelection = null;
 
        if (options.readOnly) {updateInput = true; return "changed";}
 
      }
 

	
 
      // Compute selection start and end based on start/end offsets in textarea
 
      function computeOffset(n, startLine) {
 
        var pos = 0;
 
        for (;;) {
 
          var found = text.indexOf("\n", pos);
 
          if (found == -1 || (text.charAt(found-1) == "\r" ? found - 1 : found) >= n)
 
            return {line: startLine, ch: n - pos};
 
          ++startLine;
 
          pos = found + 1;
 
        }
 
      }
 
      var from = computeOffset(sr.start, editing.from),
 
          to = computeOffset(sr.end, editing.from);
 
      // Here we have to take the reducedSelection hack into account,
 
      // so that you can, for example, press shift-up at the start of
 
      // your selection and have the right thing happen.
 
      if (rs) {
 
        from = sr.start == rs.anchor ? to : from;
 
        to = shiftSelecting ? sel.to : sr.start == rs.anchor ? from : to;
 
        if (!posLess(from, to)) {
 
          reducedSelection = null;
 
          sel.inverted = false;
 
          var tmp = from; from = to; to = tmp;
 
        }
 
        var head = sr.start == rs.anchor ? to : from;
 
        var tail = shiftSelecting ? sel.to : sr.start == rs.anchor ? from : to;
 
        if (sel.inverted = posLess(head, tail)) { from = head; to = tail; }
 
        else { reducedSelection = null; from = tail; to = head; }
 
      }
 

	
 
      // In some cases (cursor on same line as before), we don't have
 
      // to update the textarea content at all.
 
      if (from.line == to.line && from.line == sel.from.line && from.line == sel.to.line && !shiftSelecting)
 
        updateInput = false;
 

	
 
      // Magic mess to extract precise edited range from the changed
 
      // string.
 
      if (changed) {
 
        var start = 0, end = text.length, len = Math.min(end, editing.text.length);
 
        var c, line = editing.from, nl = -1;
 
        while (start < len && (c = text.charAt(start)) == editing.text.charAt(start)) {
 
          ++start;
 
          if (c == "\n") {line++; nl = start;}
 
        }
 
        var ch = nl > -1 ? start - nl : start, endline = editing.to - 1, edend = editing.text.length;
 
        for (;;) {
 
          c = editing.text.charAt(edend);
 
          if (text.charAt(end) != c) {++end; ++edend; break;}
 
          if (c == "\n") endline--;
 
          if (text.charAt(end) != c) {++end; ++edend; break;}
 
          if (edend <= start || end <= start) break;
 
          --end; --edend;
 
        }
 
        var nl = editing.text.lastIndexOf("\n", edend - 1), endch = nl == -1 ? edend : edend - nl - 1;
 
        updateLines({line: line, ch: ch}, {line: endline, ch: endch}, splitLines(text.slice(start, end)), from, to);
 
        if (line != endline || from.line != line) updateInput = true;
 
      }
 
      else setSelection(from, to);
 

	
 
      editing.text = text; editing.start = sr.start; editing.end = sr.end;
 
      return changed ? "changed" : moved ? "moved" : false;
 
    }
 

	
 
    // Set the textarea content and selection range to match the
 
    // editor state.
 
    function prepareInput() {
 
      var text = [];
 
      var from = Math.max(0, sel.from.line - 1), to = Math.min(lines.length, sel.to.line + 2);
 
      for (var i = from; i < to; ++i) text.push(lines[i].text);
 
      text = input.value = text.join(lineSep);
 
      var startch = sel.from.ch, endch = sel.to.ch;
 
      for (var i = from; i < sel.from.line; ++i)
 
        startch += lineSep.length + lines[i].text.length;
 
      for (var i = from; i < sel.to.line; ++i)
 
        endch += lineSep.length + lines[i].text.length;
 
      editing = {text: text, from: from, to: to, start: startch, end: endch};
 
      setSelRange(input, startch, reducedSelection ? startch : endch);
 
    }
 
    function focusInput() {
 
      if (options.readOnly != "nocursor") input.focus();
 
    }
 

	
 
    function scrollEditorIntoView() {
 
      if (!cursor.getBoundingClientRect) return;
 
      var rect = cursor.getBoundingClientRect();
 
      var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight);
 
      if (rect.top < 0 || rect.bottom > winH) cursor.scrollIntoView();
 
    }
 
    function scrollCursorIntoView() {
 
      var cursor = localCoords(sel.inverted ? sel.from : sel.to);
 
      return scrollIntoView(cursor.x, cursor.y, cursor.x, cursor.yBot);
 
    }
 
    function scrollIntoView(x1, y1, x2, y2) {
 
      var pl = paddingLeft(), pt = paddingTop();
 
      var pl = paddingLeft(), pt = paddingTop(), lh = lineHeight();
 
      y1 += pt; y2 += pt; x1 += pl; x2 += pl;
 
      var screen = wrapper.clientHeight, screentop = wrapper.scrollTop, scrolled = false, result = true;
 
      if (y1 < screentop) {wrapper.scrollTop = Math.max(0, y1 - 10); scrolled = true;}
 
      else if (y2 > screentop + screen) {wrapper.scrollTop = y2 + 10 - screen; scrolled = true;}
 
      var screen = scroller.clientHeight, screentop = scroller.scrollTop, scrolled = false, result = true;
 
      if (y1 < screentop) {scroller.scrollTop = Math.max(0, y1 - 2*lh); scrolled = true;}
 
      else if (y2 > screentop + screen) {scroller.scrollTop = y2 + lh - screen; scrolled = true;}
 

	
 
      var screenw = wrapper.clientWidth, screenleft = wrapper.scrollLeft;
 
      if (x1 < screenleft) {wrapper.scrollLeft = Math.max(0, x1 - 10); scrolled = true;}
 
      var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft;
 
      var gutterw = options.fixedGutter ? gutter.clientWidth : 0;
 
      if (x1 < screenleft + gutterw) {
 
        if (x1 < 50) x1 = 0;
 
        scroller.scrollLeft = Math.max(0, x1 - 10 - gutterw);
 
        scrolled = true;
 
      }
 
      else if (x2 > screenw + screenleft) {
 
        wrapper.scrollLeft = x2 + 10 - screenw;
 
        scroller.scrollLeft = x2 + 10 - screenw;
 
        scrolled = true;
 
        if (x2 > code.clientWidth) result = false;
 
      }
 
      if (scrolled && options.onScroll) options.onScroll(instance);
 
      return result;
 
    }
 

	
 
    function visibleLines() {
 
      var lh = lineHeight(), top = wrapper.scrollTop - paddingTop();
 
      var lh = lineHeight(), top = scroller.scrollTop - paddingTop();
 
      return {from: Math.min(lines.length, Math.max(0, Math.floor(top / lh))),
 
              to: Math.min(lines.length, Math.ceil((top + wrapper.clientHeight) / lh))};
 
              to: Math.min(lines.length, Math.ceil((top + scroller.clientHeight) / lh))};
 
    }
 
    // Uses a set of changes plus the current scroll position to
 
    // determine which DOM updates have to be made, and makes the
 
    // updates.
 
    function updateDisplay(changes) {
 
      if (!wrapper.clientWidth) {
 
      if (!scroller.clientWidth) {
 
        showingFrom = showingTo = 0;
 
        return;
 
      }
 
      // First create a range of theoretically intact lines, and punch
 
      // holes in that using the change info.
 
      var intact = changes === true ? [] : [{from: showingFrom, to: showingTo, domStart: 0}];
 
      for (var i = 0, l = changes.length || 0; i < l; ++i) {
 
        var change = changes[i], intact2 = [], diff = change.diff || 0;
 
        for (var j = 0, l2 = intact.length; j < l2; ++j) {
 
          var range = intact[j];
 
          if (change.to <= range.from)
 
            intact2.push({from: range.from + diff, to: range.to + diff, domStart: range.domStart});
 
          else if (range.to <= change.from)
 
            intact2.push(range);
 
          else {
 
            if (change.from > range.from)
 
              intact2.push({from: range.from, to: change.from, domStart: range.domStart})
 
              intact2.push({from: range.from, to: change.from, domStart: range.domStart});
 
            if (change.to < range.to)
 
              intact2.push({from: change.to + diff, to: range.to + diff,
 
                            domStart: range.domStart + (change.to - range.from)});
 
          }
 
        }
 
        intact = intact2;
 
      }
 

	
 
      // Then, determine which lines we'd want to see, and which
 
      // updates have to be made to get there.
 
      var visible = visibleLines();
 
      var from = Math.min(showingFrom, Math.max(visible.from - 3, 0)),
 
          to = Math.min(lines.length, Math.max(showingTo, visible.to + 3)),
 
          updates = [], domPos = 0, domEnd = showingTo - showingFrom, pos = from, changedLines = 0;
 

	
 
      for (var i = 0, l = intact.length; i < l; ++i) {
 
        var range = intact[i];
 
        if (range.to <= from) continue;
 
        if (range.from >= to) break;
 
        if (range.domStart > domPos || range.from > pos) {
 
          updates.push({from: pos, to: range.from, domSize: range.domStart - domPos, domStart: domPos});
 
          changedLines += range.from - pos;
 
        }
 
        pos = range.to;
 
        domPos = range.domStart + (range.to - range.from);
 
      }
 
      if (domPos != domEnd || pos != to) {
 
        changedLines += Math.abs(to - pos);
 
        updates.push({from: pos, to: to, domSize: domEnd - domPos, domStart: domPos});
 
        if (to - pos != domEnd - domPos) gutterDirty = true;
 
      }
 

	
 
      if (!updates.length) return;
 
      lineDiv.style.display = "none";
 
      // If more than 30% of the screen needs update, just do a full
 
      // redraw (which is quicker than patching)
 
      if (changedLines > (visible.to - visible.from) * .3)
 
        refreshDisplay(from = Math.max(visible.from - 10, 0), to = Math.min(visible.to + 7, lines.length));
 
      // Otherwise, only update the stuff that needs updating.
 
      else
 
        patchDisplay(updates);
 
      lineDiv.style.display = "";
 

	
 
      // Position the mover div to align with the lines it's supposed
 
      // to be showing (which will cover the visible display)
 
      var different = from != showingFrom || to != showingTo || lastHeight != wrapper.clientHeight;
 
      var different = from != showingFrom || to != showingTo || lastHeight != scroller.clientHeight;
 
      showingFrom = from; showingTo = to;
 
      mover.style.top = (from * lineHeight()) + "px";
 
      if (different) {
 
        lastHeight = wrapper.clientHeight;
 
        lastHeight = scroller.clientHeight;
 
        code.style.height = (lines.length * lineHeight() + 2 * paddingTop()) + "px";
 
        updateGutter();
 
      }
 
      if (different || gutterDirty) updateGutter();
 

	
 
      if (maxWidth == null) maxWidth = stringWidth(maxLine);
 
      if (maxWidth > scroller.clientWidth) {
 
        lineSpace.style.width = maxWidth + "px";
 
        // Needed to prevent odd wrapping/hiding of widgets placed in here.
 
        code.style.width = "";
 
        code.style.width = scroller.scrollWidth + "px";
 
      } else {
 
        lineSpace.style.width = code.style.width = "";
 
      }
 

	
 
      // Since this is all rather error prone, it is honoured with the
 
      // only assertion in the whole file.
 
      if (lineDiv.childNodes.length != showingTo - showingFrom)
 
        throw new Error("BAD PATCH! " + JSON.stringify(updates) + " size=" + (showingTo - showingFrom) +
 
                        " nodes=" + lineDiv.childNodes.length);
 
      updateCursor();
 
    }
 

	
 
    function refreshDisplay(from, to) {
 
      var html = [], start = {line: from, ch: 0}, inSel = posLess(sel.from, start) && !posLess(sel.to, start);
 
      for (var i = from; i < to; ++i) {
 
        var ch1 = null, ch2 = null;
 
        if (inSel) {
 
          ch1 = 0;
 
          if (sel.to.line == i) {inSel = false; ch2 = sel.to.ch;}
 
        }
 
        else if (sel.from.line == i) {
 
          if (sel.to.line == i) {ch1 = sel.from.ch; ch2 = sel.to.ch;}
 
          else {inSel = true; ch1 = sel.from.ch;}
 
        }
 
        html.push(lines[i].getHTML(ch1, ch2, true));
 
      }
 
      lineDiv.innerHTML = html.join("");
 
    }
 
    function patchDisplay(updates) {
 
      // Slightly different algorithm for IE (badInnerHTML), since
 
      // there .innerHTML on PRE nodes is dumb, and discards
 
      // whitespace.
 
      var sfrom = sel.from.line, sto = sel.to.line, off = 0,
 
          scratch = badInnerHTML && document.createElement("div");
 
          scratch = badInnerHTML && targetDocument.createElement("div");
 
      for (var i = 0, e = updates.length; i < e; ++i) {
 
        var rec = updates[i];
 
        var extra = (rec.to - rec.from) - rec.domSize;
 
        var nodeAfter = lineDiv.childNodes[rec.domStart + rec.domSize + off] || null;
 
        if (badInnerHTML)
 
          for (var j = Math.max(-extra, rec.domSize); j > 0; --j)
 
            lineDiv.removeChild(nodeAfter ? nodeAfter.previousSibling : lineDiv.lastChild);
 
        else if (extra) {
 
          for (var j = Math.max(0, extra); j > 0; --j)
 
            lineDiv.insertBefore(document.createElement("pre"), nodeAfter);
 
            lineDiv.insertBefore(targetDocument.createElement("pre"), nodeAfter);
 
          for (var j = Math.max(0, -extra); j > 0; --j)
 
            lineDiv.removeChild(nodeAfter ? nodeAfter.previousSibling : lineDiv.lastChild);
 
        }
 
        var node = lineDiv.childNodes[rec.domStart + off], inSel = sfrom < rec.from && sto >= rec.from;
 
        for (var j = rec.from; j < rec.to; ++j) {
 
          var ch1 = null, ch2 = null;
 
          if (inSel) {
 
            ch1 = 0;
 
            if (sto == j) {inSel = false; ch2 = sel.to.ch;}
 
          }
 
          else if (sfrom == j) {
 
            if (sto == j) {ch1 = sel.from.ch; ch2 = sel.to.ch;}
 
            else {inSel = true; ch1 = sel.from.ch;}
 
          }
 
          if (badInnerHTML) {
 
            scratch.innerHTML = lines[j].getHTML(ch1, ch2, true);
 
            lineDiv.insertBefore(scratch.firstChild, nodeAfter);
 
          }
 
          else {
 
            node.innerHTML = lines[j].getHTML(ch1, ch2, false);
 
            node.className = lines[j].className || "";
 
            node = node.nextSibling;
 
          }
 
        }
 
        off += extra;
 
      }
 
    }
 

	
 
    function updateGutter() {
 
      if (!options.gutter && !options.lineNumbers) return;
 
      var hText = mover.offsetHeight, hEditor = wrapper.clientHeight;
 
      var hText = mover.offsetHeight, hEditor = scroller.clientHeight;
 
      gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + "px";
 
      var html = [];
 
      for (var i = showingFrom; i < showingTo; ++i) {
 
      for (var i = showingFrom; i < Math.max(showingTo, showingFrom + 1); ++i) {
 
        var marker = lines[i].gutterMarker;
 
        var text = options.lineNumbers ? i + options.firstLineNumber : null;
 
        if (marker && marker.text)
 
          text = marker.text.replace("%N%", text != null ? text : "");
 
        else if (text == null)
 
          text = "\u00a0";
 
        html.push((marker && marker.style ? '<pre class="' + marker.style + '">' : "<pre>"), text, "</pre>");
 
      }
 
      gutter.style.display = "none";
 
      gutterText.innerHTML = html.join("");
 
      var minwidth = String(lines.length).length, firstNode = gutterText.firstChild, val = eltText(firstNode), pad = "";
 
      while (val.length + pad.length < minwidth) pad += "\u00a0";
 
      if (pad) firstNode.insertBefore(document.createTextNode(pad), firstNode.firstChild);
 
      if (pad) firstNode.insertBefore(targetDocument.createTextNode(pad), firstNode.firstChild);
 
      gutter.style.display = "";
 
      lineSpace.style.marginLeft = gutter.offsetWidth + "px";
 
      gutterDirty = false;
 
    }
 
    function updateCursor() {
 
      var head = sel.inverted ? sel.from : sel.to;
 
      var x = charX(head.line, head.ch) + "px", y = (head.line - showingFrom) * lineHeight() + "px";
 
      inputDiv.style.top = y; inputDiv.style.left = x;
 
      var head = sel.inverted ? sel.from : sel.to, lh = lineHeight();
 
      var x = charX(head.line, head.ch);
 
      var top = head.line * lh - scroller.scrollTop;
 
      inputDiv.style.top = Math.max(Math.min(top, scroller.offsetHeight), 0) + "px";
 
      inputDiv.style.left = (x - scroller.scrollLeft) + "px";
 
      if (posEq(sel.from, sel.to)) {
 
        cursor.style.top = y; cursor.style.left = x;
 
        cursor.style.top = (head.line - showingFrom) * lh + "px";
 
        cursor.style.left = x + "px";
 
        cursor.style.display = "";
 
      }
 
      else cursor.style.display = "none";
 
    }
 

	
 
    function setSelectionUser(from, to) {
 
      var sh = shiftSelecting && clipPos(shiftSelecting);
 
      if (sh) {
 
        if (posLess(sh, from)) from = sh;
 
        else if (posLess(to, sh)) to = sh;
 
      }
 
      setSelection(from, to);
 
    }
 
    // Update the selection. Last two args are only used by
 
    // updateLines, since they have to be expressed in the line
 
    // numbers before the update.
 
    function setSelection(from, to, oldFrom, oldTo) {
 
      if (posEq(sel.from, from) && posEq(sel.to, to)) return;
 
      var sh = shiftSelecting && clipPos(shiftSelecting);
 
      if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}
 
      if (sh) {
 
        if (posLess(sh, from)) from = sh;
 
        else if (posLess(to, sh)) to = sh;
 
      }
 

	
 
      var startEq = posEq(sel.to, to), endEq = posEq(sel.from, from);
 
      if (posEq(from, to)) sel.inverted = false;
 
      else if (startEq && !endEq) sel.inverted = true;
 
      else if (endEq && !startEq) sel.inverted = false;
 
      else if (posEq(from, sel.to)) sel.inverted = false;
 
      else if (posEq(to, sel.from)) sel.inverted = true;
 

	
 
      // Some ugly logic used to only mark the lines that actually did
 
      // see a change in selection as changed, rather than the whole
 
      // selected range.
 
      if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}
 
      if (posEq(from, to)) {
 
        if (!posEq(sel.from, sel.to))
 
          changes.push({from: oldFrom, to: oldTo + 1});
 
      }
 
      else if (posEq(sel.from, sel.to)) {
 
        changes.push({from: from.line, to: to.line + 1});
 
      }
 
      else {
 
        if (!posEq(from, sel.from)) {
 
          if (from.line < oldFrom)
 
            changes.push({from: from.line, to: Math.min(to.line, oldFrom) + 1});
 
          else
 
            changes.push({from: oldFrom, to: Math.min(oldTo, from.line) + 1});
 
        }
 
        if (!posEq(to, sel.to)) {
 
          if (to.line < oldTo)
 
            changes.push({from: Math.max(oldFrom, from.line), to: oldTo + 1});
 
          else
 
            changes.push({from: Math.max(from.line, oldTo), to: to.line + 1});
 
        }
 
      }
 
      sel.from = from; sel.to = to;
 
      selectionChanged = true;
 
    }
 
    function setCursor(line, ch) {
 
    function setCursor(line, ch, user) {
 
      var pos = clipPos({line: line, ch: ch || 0});
 
      setSelection(pos, pos);
 
      (user ? setSelectionUser : setSelection)(pos, pos);
 
    }
 

	
 
    function clipLine(n) {return Math.max(0, Math.min(n, lines.length-1));}
 
    function clipPos(pos) {
 
      if (pos.line < 0) return {line: 0, ch: 0};
 
      if (pos.line >= lines.length) return {line: lines.length-1, ch: lines[lines.length-1].text.length};
 
      var ch = pos.ch, linelen = lines[pos.line].text.length;
 
      if (ch == null || ch > linelen) return {line: pos.line, ch: linelen};
 
      else if (ch < 0) return {line: pos.line, ch: 0};
 
      else return pos;
 
    }
 

	
 
    function scrollPage(down) {
 
      var linesPerPage = Math.floor(wrapper.clientHeight / lineHeight()), head = sel.inverted ? sel.from : sel.to;
 
      setCursor(head.line + (Math.max(linesPerPage - 1, 1) * (down ? 1 : -1)), head.ch);
 
      var linesPerPage = Math.floor(scroller.clientHeight / lineHeight()), head = sel.inverted ? sel.from : sel.to;
 
      setCursor(head.line + (Math.max(linesPerPage - 1, 1) * (down ? 1 : -1)), head.ch, true);
 
    }
 
    function scrollEnd(top) {
 
      setCursor(top ? 0 : lines.length - 1);
 
      var pos = top ? {line: 0, ch: 0} : {line: lines.length - 1, ch: lines[lines.length-1].text.length};
 
      setSelectionUser(pos, pos);
 
    }
 
    function selectAll() {
 
      var endLine = lines.length - 1;
 
      setSelection({line: 0, ch: 0}, {line: endLine, ch: lines[endLine].text.length});
 
    }
 
    function selectWordAt(pos) {
 
      var line = lines[pos.line].text;
 
      var start = pos.ch, end = pos.ch;
 
      while (start > 0 && /\w/.test(line.charAt(start - 1))) --start;
 
      while (end < line.length - 1 && /\w/.test(line.charAt(end))) ++end;
 
      setSelection({line: pos.line, ch: start}, {line: pos.line, ch: end});
 
      while (end < line.length && /\w/.test(line.charAt(end))) ++end;
 
      setSelectionUser({line: pos.line, ch: start}, {line: pos.line, ch: end});
 
    }
 
    function selectLine(line) {
 
      setSelectionUser({line: line, ch: 0}, {line: line, ch: lines[line].text.length});
 
    }
 
    function handleEnter() {
 
      replaceSelection("\n", "end");
 
      if (options.enterMode != "flat")
 
        indentLine(sel.from.line, options.enterMode == "keep" ? "prev" : "smart");
 
    }
 
    function handleTab(shift) {
 
      function indentSelected(mode) {
 
        if (posEq(sel.from, sel.to)) return indentLine(sel.from.line, mode);
 
        var e = sel.to.line - (sel.to.ch ? 0 : 1);
 
        for (var i = sel.from.line; i <= e; ++i) indentLine(i, mode);
 
      }
 
      shiftSelecting = null;
 
      switch (options.tabMode) {
 
      case "default":
 
        return false;
 
      case "indent":
 
        for (var i = sel.from.line, e = sel.to.line; i <= e; ++i) indentLine(i, "smart");
 
        indentSelected("smart");
 
        break;
 
      case "classic":
 
        if (posEq(sel.from, sel.to)) {
 
          if (shift) indentLine(sel.from.line, "smart");
 
          else replaceSelection("\t", "end");
 
          break;
 
        }
 
      case "shift":
 
        for (var i = sel.from.line, e = sel.to.line; i <= e; ++i) indentLine(i, shift ? "subtract" : "add");
 
        indentSelected(shift ? "subtract" : "add");
 
        break;
 
      }
 
      return true;
 
    }
 
    function smartHome() {
 
      var firstNonWS = Math.max(0, lines[sel.from.line].text.search(/\S/));
 
      setCursor(sel.from.line, sel.from.ch <= firstNonWS && sel.from.ch ? 0 : firstNonWS, true);
 
    }
 

	
 
    function indentLine(n, how) {
 
      if (how == "smart") {
 
        if (!mode.indent) how = "prev";
 
        else var state = getStateBefore(n);
 
      }
 

	
 
      var line = lines[n], curSpace = line.indentation(), curSpaceString = line.text.match(/^\s*/)[0], indentation;
 
      if (how == "prev") {
 
        if (n) indentation = lines[n-1].indentation();
 
        else indentation = 0;
 
      }
 
      else if (how == "smart") indentation = mode.indent(state, line.text.slice(curSpaceString.length));
 
      else if (how == "add") indentation = curSpace + options.indentUnit;
 
      else if (how == "subtract") indentation = curSpace - options.indentUnit;
 
      indentation = Math.max(0, indentation);
 
      var diff = indentation - curSpace;
 

	
 
      if (!diff) {
 
        if (sel.from.line != n && sel.to.line != n) return;
 
        var indentString = curSpaceString;
 
      }
 
      else {
 
        var indentString = "", pos = 0;
 
        if (options.indentWithTabs)
 
          for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";}
 
        while (pos < indentation) {++pos; indentString += " ";}
 
      }
 

	
 
      replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length});
 
    }
 

	
 
    function loadMode() {
 
      mode = CodeMirror.getMode(options, options.mode);
 
      for (var i = 0, l = lines.length; i < l; ++i)
 
        lines[i].stateAfter = null;
 
      work = [0];
 
      startWorker();
 
    }
 
    function gutterChanged() {
 
      var visible = options.gutter || options.lineNumbers;
 
      gutter.style.display = visible ? "" : "none";
 
      if (visible) updateGutter();
 
      if (visible) gutterDirty = true;
 
      else lineDiv.parentNode.style.marginLeft = 0;
 
    }
 

	
 
    function markText(from, to, className) {
 
      from = clipPos(from); to = clipPos(to);
 
      var accum = [];
 
      var set = [];
 
      function add(line, from, to, className) {
 
        var line = lines[line], mark = line.addMark(from, to, className);
 
        mark.line = line;
 
        accum.push(mark);
 
        mark = lines[line].addMark(from, to, className, set);
 
      }
 
      if (from.line == to.line) add(from.line, from.ch, to.ch, className);
 
      else {
 
        add(from.line, from.ch, null, className);
 
        for (var i = from.line + 1, e = to.line; i < e; ++i)
 
          add(i, 0, null, className);
 
        add(to.line, 0, to.ch, className);
 
      }
 
      changes.push({from: from.line, to: to.line + 1});
 
      return function() {
 
        var start, end;
 
        for (var i = 0; i < accum.length; ++i) {
 
          var mark = accum[i], found = indexOf(lines, mark.line);
 
          mark.line.removeMark(mark);
 
          if (found > -1) {
 
            if (start == null) start = found;
 
            end = found;
 
      return new TextMarker(set);
 
    }
 

	
 
    function TextMarker(set) { this.set = set; }
 
    TextMarker.prototype.clear = operation(function() {
 
      for (var i = 0, e = this.set.length; i < e; ++i) {
 
        var mk = this.set[i].marked;
 
        for (var j = 0; j < mk.length; ++j) {
 
          if (mk[j].set == this.set) mk.splice(j--, 1);
 
        }
 
      }
 
      // We don't know the exact lines that changed. Refreshing is
 
      // cheaper than finding them.
 
      changes.push({from: 0, to: lines.length});
 
    });
 
    TextMarker.prototype.find = function() {
 
      var from, to;
 
      for (var i = 0, e = this.set.length; i < e; ++i) {
 
        var line = this.set[i], mk = line.marked;
 
        for (var j = 0; j < mk.length; ++j) {
 
          var mark = mk[j];
 
          if (mark.set == this.set) {
 
            if (mark.from != null || mark.to != null) {
 
              var found = indexOf(lines, line);
 
              if (found > -1) {
 
                if (mark.from != null) from = {line: found, ch: mark.from};
 
                if (mark.to != null) to = {line: found, ch: mark.to};
 
              }
 
            }
 
          }
 
        }
 
        if (start != null) changes.push({from: start, to: end + 1});
 
      };
 
    }
 
      }
 
      return {from: from, to: to};
 
    };
 

	
 
    function addGutterMarker(line, text, className) {
 
      if (typeof line == "number") line = lines[clipLine(line)];
 
      line.gutterMarker = {text: text, style: className};
 
      updateGutter();
 
      gutterDirty = true;
 
      return line;
 
    }
 
    function removeGutterMarker(line) {
 
      if (typeof line == "number") line = lines[clipLine(line)];
 
      line.gutterMarker = null;
 
      updateGutter();
 
      gutterDirty = true;
 
    }
 
    function setLineClass(line, className) {
 
      if (typeof line == "number") {
 
        var no = line;
 
        line = lines[clipLine(line)];
 
      }
 
      else {
 
        var no = indexOf(lines, line);
 
        if (no == -1) return null;
 
      }
 
      line.className = className;
 
      changes.push({from: no, to: no + 1});
 
      if (line.className != className) {
 
        line.className = className;
 
        changes.push({from: no, to: no + 1});
 
      }
 
      return line;
 
    }
 

	
 
    function lineInfo(line) {
 
      if (typeof line == "number") {
 
        var n = line;
 
        line = lines[line];
 
        if (!line) return null;
 
      }
 
      else {
 
        var n = indexOf(lines, line);
 
        if (n == -1) return null;
 
      }
 
      var marker = line.gutterMarker;
 
      return {line: n, text: line.text, markerText: marker && marker.text, markerClass: marker && marker.style};
 
    }
 

	
 
    function stringWidth(str) {
 
      measure.innerHTML = "<pre><span>x</span></pre>";
 
      measure.firstChild.firstChild.firstChild.nodeValue = str;
 
      return measure.firstChild.firstChild.offsetWidth || 10;
 
    }
 
    // These are used to go from pixel positions to character
 
    // positions, taking tabs into account.
 
    // positions, taking varying character widths into account.
 
    function charX(line, pos) {
 
      var text = lines[line].text, span = measure.firstChild;
 
      if (text.lastIndexOf("\t", pos) == -1) return pos * charWidth();
 
      var old = span.firstChild.nodeValue;
 
      try {
 
        span.firstChild.nodeValue = text.slice(0, pos);
 
        return span.offsetWidth;
 
      } finally {span.firstChild.nodeValue = old;}
 
      if (pos == 0) return 0;
 
      measure.innerHTML = "<pre><span>" + lines[line].getHTML(null, null, false, pos) + "</span></pre>";
 
      return measure.firstChild.firstChild.offsetWidth;
 
    }
 
    function charFromX(line, x) {
 
      var text = lines[line].text, cw = charWidth();
 
      if (x <= 0) return 0;
 
      if (text.indexOf("\t") == -1) return Math.min(text.length, Math.round(x / cw));
 
      var mspan = measure.firstChild, mtext = mspan.firstChild, old = mtext.nodeValue;
 
      try {
 
        mtext.nodeValue = text;
 
        var from = 0, fromX = 0, to = text.length, toX = mspan.offsetWidth;
 
        if (x > toX) return to;
 
        for (;;) {
 
          if (to - from <= 1) return (toX - x > x - fromX) ? from : to;
 
          var middle = Math.ceil((from + to) / 2);
 
          mtext.nodeValue = text.slice(0, middle);
 
          var curX = mspan.offsetWidth;
 
          if (curX > x) {to = middle; toX = curX;}
 
          else {from = middle; fromX = curX;}
 
        }
 
      } finally {mtext.nodeValue = old;}
 
      var lineObj = lines[line], text = lineObj.text;
 
      function getX(len) {
 
        measure.innerHTML = "<pre><span>" + lineObj.getHTML(null, null, false, len) + "</span></pre>";
 
        return measure.firstChild.firstChild.offsetWidth;
 
      }
 
      var from = 0, fromX = 0, to = text.length, toX;
 
      // Guess a suitable upper bound for our search.
 
      var estimated = Math.min(to, Math.ceil(x / stringWidth("x")));
 
      for (;;) {
 
        var estX = getX(estimated);
 
        if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));
 
        else {toX = estX; to = estimated; break;}
 
      }
 
      if (x > toX) return to;
 
      // Try to guess a suitable lower bound as well.
 
      estimated = Math.floor(to * 0.8); estX = getX(estimated);
 
      if (estX < x) {from = estimated; fromX = estX;}
 
      // Do a binary search between these bounds.
 
      for (;;) {
 
        if (to - from <= 1) return (toX - x > x - fromX) ? from : to;
 
        var middle = Math.ceil((from + to) / 2), middleX = getX(middle);
 
        if (middleX > x) {to = middle; toX = middleX;}
 
        else {from = middle; fromX = middleX;}
 
      }
 
    }
 

	
 
    function localCoords(pos, inLineWrap) {
 
      var lh = lineHeight(), line = pos.line - (inLineWrap ? showingFrom : 0);
 
      return {x: charX(pos.line, pos.ch), y: line * lh, yBot: (line + 1) * lh};
 
    }
 
    function pageCoords(pos) {
 
      var local = localCoords(pos, true), off = eltOffset(lineSpace);
 
      return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot};
 
    }
 

	
 
    function lineHeight() {
 
      var nlines = lineDiv.childNodes.length;
 
      if (nlines) return lineDiv.offsetHeight / nlines;
 
      else return measure.firstChild.offsetHeight || 1;
 
      if (nlines) return (lineDiv.offsetHeight / nlines) || 1;
 
      measure.innerHTML = "<pre>x</pre>";
 
      return measure.firstChild.offsetHeight || 1;
 
    }
 
    function charWidth() {return (measure.firstChild.offsetWidth || 320) / 40;}
 
    function paddingTop() {return lineSpace.offsetTop;}
 
    function paddingLeft() {return lineSpace.offsetLeft;}
 

	
 
    function posFromMouse(e, liberal) {
 
      var off = eltOffset(lineSpace),
 
          x = e.pageX() - off.left,
 
          y = e.pageY() - off.top;
 
      if (!liberal && e.target() != lineSpace.parentNode && !(e.target() == wrapper && y > (lines.length * lineHeight())))
 
        for (var n = e.target(); n != lineDiv && n != cursor; n = n.parentNode)
 
          if (!n || n == wrapper) return null;
 
      var line = showingFrom + Math.floor(y / lineHeight());
 
      return clipPos({line: line, ch: charFromX(clipLine(line), x)});
 
      var offW = eltOffset(scroller, true), x, y;
 
      // Fails unpredictably on IE[67] when mouse is dragged around quickly.
 
      try { x = e.clientX; y = e.clientY; } catch (e) { return null; }
 
      // This is a mess of a heuristic to try and determine whether a
 
      // scroll-bar was clicked or not, and to return null if one was
 
      // (and !liberal).
 
      if (!liberal && (x - offW.left > scroller.clientWidth || y - offW.top > scroller.clientHeight))
 
        return null;
 
      var offL = eltOffset(lineSpace, true);
 
      var line = showingFrom + Math.floor((y - offL.top) / lineHeight());
 
      return clipPos({line: line, ch: charFromX(clipLine(line), x - offL.left)});
 
    }
 
    function onContextMenu(e) {
 
      var pos = posFromMouse(e);
 
      if (!pos || window.opera) return; // Opera is difficult.
 
      if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))
 
        setCursor(pos.line, pos.ch);
 
        operation(setCursor)(pos.line, pos.ch);
 

	
 
      var oldCSS = input.style.cssText;
 
      input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.pageY() - 1) +
 
        "px; left: " + (e.pageX() - 1) + "px; z-index: 1000; background: white; " +
 
        "border-width: 0; outline: none; overflow: hidden;";
 
      inputDiv.style.position = "absolute";
 
      input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) +
 
        "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: white; " +
 
        "border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
 
      leaveInputAlone = true;
 
      var val = input.value = getSelection();
 
      input.focus();
 
      setSelRange(input, 0, val.length);
 
      if (gecko) e.stop();
 
      leaveInputAlone = true;
 
      setTimeout(function() {
 
        if (input.value != val) operation(replaceSelection)(input.value, "end");
 
      focusInput();
 
      setSelRange(input, 0, input.value.length);
 
      function rehide() {
 
        var newVal = splitLines(input.value).join("\n");
 
        if (newVal != val) operation(replaceSelection)(newVal, "end");
 
        inputDiv.style.position = "relative";
 
        input.style.cssText = oldCSS;
 
        leaveInputAlone = false;
 
        prepareInput();
 
        slowPoll();
 
      }, 50);
 
      }
 

	
 
      if (gecko) {
 
        e_stop(e);
 
        var mouseup = connect(window, "mouseup", function() {
 
          mouseup();
 
          setTimeout(rehide, 20);
 
        }, true);
 
      }
 
      else {
 
        setTimeout(rehide, 50);
 
      }
 
    }
 

	
 
    // Cursor-blinking
 
    function restartBlink() {
 
      clearInterval(blinker);
 
      var on = true;
 
      cursor.style.visibility = "";
 
      blinker = setInterval(function() {
 
        cursor.style.visibility = (on = !on) ? "" : "hidden";
 
      }, 650);
 
    }
 

	
 
    var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
 
    function matchBrackets(autoclear) {
 
      var head = sel.inverted ? sel.from : sel.to, line = lines[head.line], pos = head.ch - 1;
 
      var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
 
      if (!match) return;
 
      var ch = match.charAt(0), forward = match.charAt(1) == ">", d = forward ? 1 : -1, st = line.styles;
 
      for (var off = pos + 1, i = 0, e = st.length; i < e; i+=2)
 
        if ((off -= st[i].length) <= 0) {var style = st[i+1]; break;}
 

	
 
      var stack = [line.text.charAt(pos)], re = /[(){}[\]]/;
 
      function scan(line, from, to) {
 
        if (!line.text) return;
 
        var st = line.styles, pos = forward ? 0 : line.text.length - 1, cur;
 
        for (var i = forward ? 0 : st.length - 2, e = forward ? st.length : -2; i != e; i += 2*d) {
 
          var text = st[i];
 
          if (st[i+1] != null && st[i+1] != style) {pos += d * text.length; continue;}
 
          for (var j = forward ? 0 : text.length - 1, te = forward ? text.length : -1; j != te; j += d, pos+=d) {
 
            if (pos >= from && pos < to && re.test(cur = text.charAt(j))) {
 
              var match = matching[cur];
 
              if (match.charAt(1) == ">" == forward) stack.push(cur);
 
              else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};
 
              else if (!stack.length) return {pos: pos, match: true};
 
            }
 
          }
 
        }
 
      }
 
      for (var i = head.line, e = forward ? Math.min(i + 50, lines.length) : Math.max(0, i - 50); i != e; i+=d) {
 
      for (var i = head.line, e = forward ? Math.min(i + 100, lines.length) : Math.max(-1, i - 100); i != e; i+=d) {
 
        var line = lines[i], first = i == head.line;
 
        var found = scan(line, first && forward ? pos + 1 : 0, first && !forward ? pos : line.text.length);
 
        if (found) {
 
          var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
 
          var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style),
 
              two = markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style);
 
          var clear = operation(function(){one(); two();});
 
          if (autoclear) setTimeout(clear, 800);
 
          else bracketHighlighted = clear;
 
          break;
 
        }
 
        if (found) break;
 
      }
 
      if (!found) found = {pos: null, match: false};
 
      var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
 
      var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style),
 
          two = found.pos != null && markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style);
 
      var clear = operation(function(){one.clear(); two && two.clear();});
 
      if (autoclear) setTimeout(clear, 800);
 
      else bracketHighlighted = clear;
 
    }
 

	
 
    // Finds the line to start with when starting a parse. Tries to
 
    // find a line with a stateAfter, so that it can start with a
 
    // valid state. If that fails, it returns the line with the
 
    // smallest indentation, which tends to need the least context to
 
    // parse correctly.
 
    function findStartLine(n) {
 
      var minindent, minline;
 
      for (var search = n, lim = n - 40; search > lim; --search) {
 
        if (search == 0) return 0;
 
        var line = lines[search-1];
 
        if (line.stateAfter) return search;
 
        var indented = line.indentation();
 
        if (minline == null || minindent > indented) {
 
          minline = search;
 
          minline = search - 1;
 
          minindent = indented;
 
        }
 
      }
 
      return minline;
 
    }
 
    function getStateBefore(n) {
 
      var start = findStartLine(n), state = start && lines[start-1].stateAfter;
 
      if (!state) state = startState(mode);
 
      else state = copyState(mode, state);
 
      for (var i = start; i < n; ++i) {
 
        var line = lines[i];
 
        line.highlight(mode, state);
 
        line.stateAfter = copyState(mode, state);
 
      }
 
      if (!lines[n].stateAfter) work.push(n);
 
      changes.push({from: start, to: n});
 
      if (n < lines.length && !lines[n].stateAfter) work.push(n);
 
      return state;
 
    }
 
    function highlightLines(start, end) {
 
      var state = getStateBefore(start);
 
      for (var i = start; i < end; ++i) {
 
        var line = lines[i];
 
        line.highlight(mode, state);
 
        line.stateAfter = copyState(mode, state);
 
      }
 
    }
 
    function highlightWorker() {
 
      var end = +new Date + options.workTime;
 
      var foundWork = work.length;
 
      while (work.length) {
 
        if (!lines[showingFrom].stateAfter) var task = showingFrom;
 
        else var task = work.pop();
 
        if (task >= lines.length) continue;
 
        var start = findStartLine(task), state = start && lines[start-1].stateAfter;
 
        if (state) state = copyState(mode, state);
 
        else state = startState(mode);
 

	
 
        var unchanged = 0, compare = mode.compareStates, realChange = false;
 
        for (var i = start, l = lines.length; i < l; ++i) {
 
          var line = lines[i], hadState = line.stateAfter;
 
          if (+new Date > end) {
 
            work.push(i);
 
            startWorker(options.workDelay);
 
            changes.push({from: task, to: i});
 
            if (realChange) changes.push({from: task, to: i + 1});
 
            return;
 
          }
 
          var changed = line.highlight(mode, state);
 
          if (changed) realChange = true;
 
          line.stateAfter = copyState(mode, state);
 
          if (hadState && !changed && line.text) break;
 
          if (compare) {
 
            if (hadState && compare(hadState, state)) break;
 
          } else {
 
            if (changed !== false || !hadState) unchanged = 0;
 
            else if (++unchanged > 3) break;
 
          }
 
        }
 
        changes.push({from: task, to: i});
 
        if (realChange) changes.push({from: task, to: i + 1});
 
      }
 
      if (foundWork && options.onHighlightComplete)
 
        options.onHighlightComplete(instance);
 
    }
 
    function startWorker(time) {
 
      if (!work.length) return;
 
      highlight.set(time, operation(highlightWorker));
 
    }
 

	
 
    // Operations are used to wrap changes in such a way that each
 
    // change won't have to update the cursor and display (which would
 
    // be awkward, slow, and error-prone), but instead updates are
 
    // batched and then all combined and executed at once.
 
    function startOperation() {
 
      updateInput = null; changes = []; textChanged = selectionChanged = false;
 
    }
 
    function endOperation() {
 
      var reScroll = false;
 
      if (selectionChanged) reScroll = !scrollCursorIntoView();
 
      if (changes.length) updateDisplay(changes);
 
      else if (selectionChanged) updateCursor();
 
      else {
 
        if (selectionChanged) updateCursor();
 
        if (gutterDirty) updateGutter();
 
      }
 
      if (reScroll) scrollCursorIntoView();
 
      if (selectionChanged) restartBlink();
 
      if (selectionChanged) {scrollEditorIntoView(); restartBlink();}
 

	
 
      // updateInput can be set to a boolean value to force/prevent an
 
      // update.
 
      if (!leaveInputAlone && (updateInput === true || (updateInput !== false && selectionChanged)))
 
      if (focused && !leaveInputAlone &&
 
          (updateInput === true || (updateInput !== false && selectionChanged)))
 
        prepareInput();
 

	
 
      if (selectionChanged && options.onCursorActivity)
 
        options.onCursorActivity(instance);
 
      if (textChanged && options.onChange)
 
        options.onChange(instance);
 
      if (selectionChanged && options.matchBrackets)
 
        setTimeout(operation(function() {
 
          if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;}
 
          matchBrackets(false);
 
        }), 20);
 
      var tc = textChanged; // textChanged can be reset by cursoractivity callback
 
      if (selectionChanged && options.onCursorActivity)
 
        options.onCursorActivity(instance);
 
      if (tc && options.onChange && instance)
 
        options.onChange(instance, tc);
 
    }
 
    var nestedOperation = 0;
 
    function operation(f) {
 
      return function() {
 
        if (!nestedOperation++) startOperation();
 
        try {var result = f.apply(this, arguments);}
 
        finally {if (!--nestedOperation) endOperation();}
 
        return result;
 
      };
 
    }
 

	
 
    function SearchCursor(query, pos, caseFold) {
 
      this.atOccurrence = false;
 
      if (caseFold == null) caseFold = typeof query == "string" && query == query.toLowerCase();
 

	
 
      if (pos && typeof pos == "object") pos = clipPos(pos);
 
      else pos = {line: 0, ch: 0};
 
      this.pos = {from: pos, to: pos};
 

	
 
      // The matches method is filled in based on the type of query.
 
      // It takes a position and a direction, and returns an object
 
      // describing the next occurrence of the query, or null if no
 
      // more matches were found.
 
      if (typeof query != "string") // Regexp match
 
        this.matches = function(reverse, pos) {
 
          if (reverse) {
 
            var line = lines[pos.line].text.slice(0, pos.ch), match = line.match(query), start = 0;
 
            while (match) {
 
              var ind = line.indexOf(match[0]);
 
              start += ind;
 
              line = line.slice(ind + 1);
 
              var newmatch = line.match(query);
 
              if (newmatch) match = newmatch;
 
              else break;
 
              start++;
 
            }
 
          }
 
          else {
 
            var line = lines[pos.line].text.slice(pos.ch), match = line.match(query),
 
                start = match && pos.ch + line.indexOf(match[0]);
 
          }
 
          if (match)
 
            return {from: {line: pos.line, ch: start},
 
                    to: {line: pos.line, ch: start + match[0].length},
 
                    match: match};
 
        };
 
      else { // String query
 
        if (caseFold) query = query.toLowerCase();
 
        var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;};
 
        var target = query.split("\n");
 
        // Different methods for single-line and multi-line queries
 
        if (target.length == 1)
 
          this.matches = function(reverse, pos) {
 
            var line = fold(lines[pos.line].text), len = query.length, match;
 
            if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1)
 
                        : (match = line.indexOf(query, pos.ch)) != -1)
 
              return {from: {line: pos.line, ch: match},
 
                      to: {line: pos.line, ch: match + len}};
 
          };
 
        else
 
          this.matches = function(reverse, pos) {
 
            var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(lines[ln].text);
 
            var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));
 
            if (reverse ? offsetA >= pos.ch || offsetA != match.length
 
                        : offsetA <= pos.ch || offsetA != line.length - match.length)
 
              return;
 
            for (;;) {
 
              if (reverse ? !ln : ln == lines.length - 1) return;
 
              line = fold(lines[ln += reverse ? -1 : 1].text);
 
              match = target[reverse ? --idx : ++idx];
 
              if (idx > 0 && idx < target.length - 1) {
 
                if (line != match) return;
 
                else continue;
 
              }
 
              var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length);
 
              if (reverse ? offsetB != line.length - match.length : offsetB != match.length)
 
                return;
 
              var start = {line: pos.line, ch: offsetA}, end = {line: ln, ch: offsetB};
 
              return {from: reverse ? end : start, to: reverse ? start : end};
 
            }
 
          };
 
      }
 
    }
 

	
 
    SearchCursor.prototype = {
 
      findNext: function() {return this.find(false);},
 
      findPrevious: function() {return this.find(true);},
 

	
 
      find: function(reverse) {
 
        var self = this, pos = clipPos(reverse ? this.pos.from : this.pos.to);
 
        function savePosAndFail(line) {
 
          var pos = {line: line, ch: 0};
 
          self.pos = {from: pos, to: pos};
 
          self.atOccurrence = false;
 
          return false;
 
        }
 

	
 
        for (;;) {
 
          if (this.pos = this.matches(reverse, pos)) {
 
            this.atOccurrence = true;
 
            return this.pos.match || true;
 
          }
 
          if (reverse) {
 
            if (!pos.line) return savePosAndFail(0);
 
            pos = {line: pos.line-1, ch: lines[pos.line-1].text.length};
 
          }
 
          else {
 
            if (pos.line == lines.length - 1) return savePosAndFail(lines.length);
 
            pos = {line: pos.line+1, ch: 0};
 
          }
 
        }
 
      },
 

	
 
      from: function() {if (this.atOccurrence) return copyPos(this.pos.from);},
 
      to: function() {if (this.atOccurrence) return copyPos(this.pos.to);}
 
      to: function() {if (this.atOccurrence) return copyPos(this.pos.to);},
 

	
 
      replace: function(newText) {
 
        var self = this;
 
        if (this.atOccurrence)
 
          operation(function() {
 
            self.pos.to = replaceRange(newText, self.pos.from, self.pos.to);
 
          })();
 
      }
 
    };
 

	
 
    for (var ext in extensions)
 
      if (extensions.propertyIsEnumerable(ext) &&
 
          !instance.propertyIsEnumerable(ext))
 
        instance[ext] = extensions[ext];
 
    return instance;
 
  } // (end of function CodeMirror)
 

	
 
  // The default configuration options.
 
  CodeMirror.defaults = {
 
    value: "",
 
    mode: null,
 
    theme: "default",
 
    indentUnit: 2,
 
    indentWithTabs: false,
 
    tabMode: "classic",
 
    enterMode: "indent",
 
    electricChars: true,
 
    onKeyEvent: null,
 
    lineNumbers: false,
 
    gutter: false,
 
    fixedGutter: false,
 
    firstLineNumber: 1,
 
    readOnly: false,
 
    smartHome: true,
 
    onChange: null,
 
    onCursorActivity: null,
 
    onGutterClick: null,
 
    onHighlightComplete: null,
 
    onFocus: null, onBlur: null, onScroll: null,
 
    matchBrackets: false,
 
    workTime: 100,
 
    workDelay: 200,
 
    undoDepth: 40,
 
    tabindex: null
 
    tabindex: null,
 
    document: window.document
 
  };
 

	
 
  // Known modes, by name and by MIME
 
  var modes = {}, mimeModes = {};
 
  CodeMirror.defineMode = function(name, mode) {
 
    if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name;
 
    modes[name] = mode;
 
  };
 
  CodeMirror.defineMIME = function(mime, spec) {
 
    mimeModes[mime] = spec;
 
  };
 
  CodeMirror.getMode = function(options, spec) {
 
    if (typeof spec == "string" && mimeModes.hasOwnProperty(spec))
 
      spec = mimeModes[spec];
 
    if (typeof spec == "string")
 
      var mname = spec, config = {};
 
    else
 
    else if (spec != null)
 
      var mname = spec.name, config = spec;
 
    var mfactory = modes[mname];
 
    if (!mfactory) {
 
      if (window.console) console.warn("No mode " + mname + " found, falling back to plain text.");
 
      return CodeMirror.getMode(options, "text/plain");
 
    }
 
    return mfactory(options, config);
 
  }
 
    return mfactory(options, config || {});
 
  };
 
  CodeMirror.listModes = function() {
 
    var list = [];
 
    for (var m in modes)
 
      if (modes.propertyIsEnumerable(m)) list.push(m);
 
    return list;
 
  };
 
  CodeMirror.listMIMEs = function() {
 
    var list = [];
 
    for (var m in mimeModes)
 
      if (mimeModes.propertyIsEnumerable(m)) list.push(m);
 
      if (mimeModes.propertyIsEnumerable(m)) list.push({mime: m, mode: mimeModes[m]});
 
    return list;
 
  };
 

	
 
  var extensions = {};
 
  CodeMirror.defineExtension = function(name, func) {
 
    extensions[name] = func;
 
  };
 

	
 
  CodeMirror.fromTextArea = function(textarea, options) {
 
    if (!options) options = {};
 
    options.value = textarea.value;
 
    if (!options.tabindex && textarea.tabindex)
 
      options.tabindex = textarea.tabindex;
 

	
 
    function save() {textarea.value = instance.getValue();}
 
    if (textarea.form) {
 
      // Deplorable hack to make the submit method do the right thing.
 
      var rmSubmit = connect(textarea.form, "submit", save, true);
 
      if (typeof textarea.form.submit == "function") {
 
        var realSubmit = textarea.form.submit;
 
        function wrappedSubmit() {
 
          save();
 
          textarea.form.submit = realSubmit;
 
          textarea.form.submit();
 
          textarea.form.submit = wrappedSubmit;
 
        }
 
        textarea.form.submit = wrappedSubmit;
 
      }
 
    }
 

	
 
    textarea.style.display = "none";
 
    var instance = CodeMirror(function(node) {
 
      textarea.parentNode.insertBefore(node, textarea.nextSibling);
 
    }, options);
 
    instance.save = save;
 
    instance.toTextArea = function() {
 
      save();
 
      textarea.parentNode.removeChild(instance.getWrapperElement());
 
      textarea.style.display = "";
 
      if (textarea.form) {
 
        rmSubmit();
 
        if (typeof textarea.form.submit == "function")
 
          textarea.form.submit = realSubmit;
 
      }
 
    };
 
    return instance;
 
  };
 

	
 
  // Utility functions for working with state. Exported because modes
 
  // sometimes need to do this.
 
  function copyState(mode, state) {
 
    if (state === true) return state;
 
    if (mode.copyState) return mode.copyState(state);
 
    var nstate = {};
 
    for (var n in state) {
 
      var val = state[n];
 
      if (val instanceof Array) val = val.concat([]);
 
      nstate[n] = val;
 
    }
 
    return nstate;
 
  }
 
  CodeMirror.startState = startState;
 
  function startState(mode, a1, a2) {
 
    return mode.startState ? mode.startState(a1, a2) : true;
 
  }
 
  CodeMirror.copyState = copyState;
 

	
 
  // The character stream used by a mode's parser.
 
  function StringStream(string) {
 
    this.pos = this.start = 0;
 
    this.string = string;
 
  }
 
  StringStream.prototype = {
 
    eol: function() {return this.pos >= this.string.length;},
 
    sol: function() {return this.pos == 0;},
 
    peek: function() {return this.string.charAt(this.pos);},
 
    next: function() {
 
      if (this.pos < this.string.length)
 
        return this.string.charAt(this.pos++);
 
    },
 
    eat: function(match) {
 
      var ch = this.string.charAt(this.pos);
 
      if (typeof match == "string") var ok = ch == match;
 
      else var ok = ch && (match.test ? match.test(ch) : match(ch));
 
      if (ok) {++this.pos; return ch;}
 
    },
 
    eatWhile: function(match) {
 
      var start = this.start;
 
      var start = this.pos;
 
      while (this.eat(match)){}
 
      return this.pos > start;
 
    },
 
    eatSpace: function() {
 
      var start = this.pos;
 
      while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;
 
      return this.pos > start;
 
    },
 
    skipToEnd: function() {this.pos = this.string.length;},
 
    skipTo: function(ch) {
 
      var found = this.string.indexOf(ch, this.pos);
 
      if (found > -1) {this.pos = found; return true;}
 
    },
 
    backUp: function(n) {this.pos -= n;},
 
    column: function() {return countColumn(this.string, this.start);},
 
    indentation: function() {return countColumn(this.string);},
 
    match: function(pattern, consume, caseInsensitive) {
 
      if (typeof pattern == "string") {
 
        function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
 
        if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
 
          if (consume !== false) this.pos += pattern.length;
 
          return true;
 
        }
 
      }
 
      else {
 
        var match = this.string.slice(this.pos).match(pattern);
 
        if (match && consume !== false) this.pos += match[0].length;
 
        return match;
 
      }
 
    },
 
    current: function(){return this.string.slice(this.start, this.pos);}
 
  };
 
  CodeMirror.StringStream = StringStream;
 

	
 
  // Line objects. These hold state related to a line, including
 
  // highlighting info (the styles array).
 
  function Line(text, styles) {
 
    this.styles = styles || [text, null];
 
    this.stateAfter = null;
 
    this.text = text;
 
    this.marked = this.gutterMarker = this.className = null;
 
  }
 
  Line.inheritMarks = function(text, orig) {
 
    var ln = new Line(text), mk = orig.marked;
 
    if (mk) {
 
      for (var i = 0; i < mk.length; ++i) {
 
        if (mk[i].to == null) {
 
          var newmk = ln.marked || (ln.marked = []), mark = mk[i];
 
          newmk.push({from: null, to: null, style: mark.style, set: mark.set});
 
          mark.set.push(ln);
 
        }
 
      }
 
    }
 
    return ln;
 
  }
 
  Line.prototype = {
 
    // Replace a piece of a line, keeping the styles around it intact.
 
    replace: function(from, to, text) {
 
      var st = [], mk = this.marked;
 
    replace: function(from, to_, text) {
 
      var st = [], mk = this.marked, to = to_ == null ? this.text.length : to_;
 
      copyStyles(0, from, this.styles, st);
 
      if (text) st.push(text, null);
 
      copyStyles(to, this.text.length, this.styles, st);
 
      this.styles = st;
 
      this.text = this.text.slice(0, from) + text + this.text.slice(to);
 
      this.stateAfter = null;
 
      if (mk) {
 
        var diff = text.length - (to - from), end = this.text.length;
 
        function fix(n) {return n <= Math.min(to, to + diff) ? n : n + diff;}
 
        var changeStart = Math.min(from, from + diff);
 
        for (var i = 0; i < mk.length; ++i) {
 
          var mark = mk[i], del = false;
 
          if (mark.from >= end) del = true;
 
          else {mark.from = fix(mark.from); if (mark.to != null) mark.to = fix(mark.to);}
 
          if (del || mark.from >= mark.to) {mk.splice(i, 1); i--;}
 
          if (mark.from != null && mark.from >= end) del = true;
 
          else {
 
            if (mark.from != null && mark.from >= from) {
 
              mark.from += diff;
 
              if (mark.from <= 0) mark.from = from == null ? null : 0;
 
            }
 
            else if (to_ == null) mark.to = null;
 
            if (mark.to != null && mark.to > from) {
 
              mark.to += diff;
 
              if (mark.to < 0) del = true;
 
            }
 
          }
 
          if (del || (mark.from != null && mark.to != null && mark.from >= mark.to)) mk.splice(i--, 1);
 
        }
 
      }
 
    },
 
    // Split a line in two, again keeping styles intact.
 
    // Split a part off a line, keeping styles and markers intact.
 
    split: function(pos, textBefore) {
 
      var st = [textBefore, null];
 
      var st = [textBefore, null], mk = this.marked;
 
      copyStyles(pos, this.text.length, this.styles, st);
 
      return new Line(textBefore + this.text.slice(pos), st);
 
      var taken = new Line(textBefore + this.text.slice(pos), st);
 
      if (mk) {
 
        for (var i = 0; i < mk.length; ++i) {
 
          var mark = mk[i];
 
          if (mark.to > pos || mark.to == null) {
 
            if (!taken.marked) taken.marked = [];
 
            taken.marked.push({
 
              from: mark.from < pos || mark.from == null ? null : mark.from - pos + textBefore.length,
 
              to: mark.to == null ? null : mark.to - pos + textBefore.length,
 
              style: mark.style, set: mark.set
 
            });
 
            mark.set.push(taken);
 
          }
 
        }
 
      }
 
      return taken;
 
    },
 
    addMark: function(from, to, style) {
 
      var mk = this.marked, mark = {from: from, to: to, style: style};
 
    append: function(line) {
 
      if (!line.text.length) return;
 
      var mylen = this.text.length, mk = line.marked;
 
      this.text += line.text;
 
      copyStyles(0, line.text.length, line.styles, this.styles);
 
      if (mk && mk.length) {
 
        var mymk = this.marked || (this.marked = []);
 
        for (var i = 0; i < mymk.length; ++i)
 
          if (mymk[i].to == null) mymk[i].to = mylen;
 
        outer: for (var i = 0; i < mk.length; ++i) {
 
          var mark = mk[i];
 
          if (!mark.from) {
 
            for (var j = 0; j < mymk.length; ++j) {
 
              var mymark = mymk[j];
 
              if (mymark.to == mylen && mymark.set == mark.set) {
 
                mymark.to = mark.to == null ? null : mark.to + mylen;
 
                continue outer;
 
              }
 
            }
 
          }
 
          mymk.push(mark);
 
          mark.set.push(this);
 
          mark.from += mylen;
 
          if (mark.to != null) mark.to += mylen;
 
        }
 
      }
 
    },
 
    addMark: function(from, to, style, set) {
 
      set.push(this);
 
      if (this.marked == null) this.marked = [];
 
      this.marked.push(mark);
 
      this.marked.sort(function(a, b){return a.from - b.from;});
 
      return mark;
 
    },
 
    removeMark: function(mark) {
 
      var mk = this.marked;
 
      if (!mk) return;
 
      for (var i = 0; i < mk.length; ++i)
 
        if (mk[i] == mark) {mk.splice(i, 1); break;}
 
      this.marked.push({from: from, to: to, style: style, set: set});
 
      this.marked.sort(function(a, b){return (a.from || 0) - (b.from || 0);});
 
    },
 
    // Run the given mode's parser over a line, update the styles
 
    // array, which contains alternating fragments of text and CSS
 
    // classes.
 
    highlight: function(mode, state) {
 
      var stream = new StringStream(this.text), st = this.styles, pos = 0, changed = false;
 
      var stream = new StringStream(this.text), st = this.styles, pos = 0;
 
      var changed = false, curWord = st[0], prevWord;
 
      if (this.text == "" && mode.blankLine) mode.blankLine(state);
 
      while (!stream.eol()) {
 
        var style = mode.token(stream, state);
 
        var substr = this.text.slice(stream.start, stream.pos);
 
        stream.start = stream.pos;
 
        if (pos && st[pos-1] == style)
 
          st[pos-2] += substr;
 
        else if (substr) {
 
          if (!changed && st[pos] != substr || st[pos+1] != style) changed = true;
 
          if (!changed && (st[pos+1] != style || (pos && st[pos-2] != prevWord))) changed = true;
 
          st[pos++] = substr; st[pos++] = style;
 
          prevWord = curWord; curWord = st[pos];
 
        }
 
        // Give up when line is ridiculously long
 
        if (stream.pos > 5000) {
 
          st[pos++] = this.text.slice(stream.pos); st[pos++] = null;
 
          break;
 
        }
 
      }
 
      if (st.length != pos) {st.length = pos; changed = true;}
 
      return changed;
 
      if (pos && st[pos-2] != prevWord) changed = true;
 
      // Short lines with simple highlights return null, and are
 
      // counted as changed by the driver because they are likely to
 
      // highlight the same way in various contexts.
 
      return changed || (st.length < 5 && this.text.length < 10 ? null : false);
 
    },
 
    // Fetch the parser token for a given character. Useful for hacks
 
    // that want to inspect the mode state (say, for completion).
 
    getTokenAt: function(mode, state, ch) {
 
      var txt = this.text, stream = new StringStream(txt);
 
      while (stream.pos < ch && !stream.eol()) {
 
        stream.start = stream.pos;
 
        var style = mode.token(stream, state);
 
      }
 
      return {start: stream.start,
 
              end: stream.pos,
 
              string: stream.current(),
 
              className: style || null,
 
              state: state};
 
    },
 
    indentation: function() {return countColumn(this.text);},
 
    // Produces an HTML fragment for the line, taking selection,
 
    // marking, and highlighting into account.
 
    getHTML: function(sfrom, sto, includePre) {
 
    getHTML: function(sfrom, sto, includePre, endAt) {
 
      var html = [];
 
      if (includePre)
 
        html.push(this.className ? '<pre class="' + this.className + '">': "<pre>");
 
      function span(text, style) {
 
        if (!text) return;
 
        if (style) html.push('<span class="', style, '">', htmlEscape(text), "</span>");
 
        else html.push(htmlEscape(text));
 
      }
 
      var st = this.styles, allText = this.text, marked = this.marked;
 
      if (sfrom == sto) sfrom = null;
 
      var len = allText.length;
 
      if (endAt != null) len = Math.min(endAt, len);
 

	
 
      if (!allText)
 
      if (!allText && endAt == null)
 
        span(" ", sfrom != null && sto == null ? "CodeMirror-selected" : null);
 
      else if (!marked && sfrom == null)
 
        for (var i = 0, e = st.length; i < e; i+=2) span(st[i], st[i+1]);
 
        for (var i = 0, ch = 0; ch < len; i+=2) {
 
          var str = st[i], style = st[i+1], l = str.length;
 
          if (ch + l > len) str = str.slice(0, len - ch);
 
          ch += l;
 
          span(str, style && "cm-" + style);
 
        }
 
      else {
 
        var pos = 0, i = 0, text = "", style, sg = 0;
 
        var markpos = -1, mark = null;
 
        function nextMark() {
 
          if (marked) {
 
            markpos += 1;
 
            mark = (markpos < marked.length) ? marked[markpos] : null;
 
          }
 
        }
 
        nextMark();        
 
        while (pos < allText.length) {
 
          var upto = allText.length;
 
        nextMark();
 
        while (pos < len) {
 
          var upto = len;
 
          var extraStyle = "";
 
          if (sfrom != null) {
 
            if (sfrom > pos) upto = sfrom;
 
            else if (sto == null || sto > pos) {
 
              extraStyle = " CodeMirror-selected";
 
              if (sto != null) upto = Math.min(upto, sto);
 
            }
 
          }
 
          while (mark && mark.to != null && mark.to <= pos) nextMark();
 
          if (mark) {
 
            if (mark.from > pos) upto = Math.min(upto, mark.from);
 
            else {
 
              extraStyle += " " + mark.style;
 
              if (mark.to != null) upto = Math.min(upto, mark.to);
 
            }
 
          }
 
          for (;;) {
 
            var end = pos + text.length;
 
            var apliedStyle = style;
 
            if (extraStyle) apliedStyle = style ? style + extraStyle : extraStyle;
 
            span(end > upto ? text.slice(0, upto - pos) : text, apliedStyle);
 
            var appliedStyle = style;
 
            if (extraStyle) appliedStyle = style ? style + extraStyle : extraStyle;
 
            span(end > upto ? text.slice(0, upto - pos) : text, appliedStyle);
 
            if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}
 
            pos = end;
 
            text = st[i++]; style = st[i++];
 
            text = st[i++]; style = "cm-" + st[i++];
 
          }
 
        }
 
        if (sfrom != null && sto == null) span(" ", "CodeMirror-selected");
 
      }
 
      if (includePre) html.push("</pre>");
 
      return html.join("");
 
    }
 
  };
 
  // Utility used by replace and split above
 
  function copyStyles(from, to, source, dest) {
 
    for (var i = 0, pos = 0, state = 0; pos < to; i+=2) {
 
      var part = source[i], end = pos + part.length;
 
      if (state == 0) {
 
        if (end > from) dest.push(part.slice(from - pos, Math.min(part.length, to - pos)), source[i+1]);
 
        if (end >= from) state = 1;
 
      }
 
      else if (state == 1) {
 
        if (end > to) dest.push(part.slice(0, to - pos), source[i+1]);
 
        else dest.push(part, source[i+1]);
 
      }
 
      pos = end;
 
    }
 
  }
 

	
 
  // The history object 'chunks' changes that are made close together
 
  // and at almost the same time into bigger undoable units.
 
  function History() {
 
    this.time = 0;
 
    this.done = []; this.undone = [];
 
  }
 
  History.prototype = {
 
    addChange: function(start, added, old) {
 
      this.undone.length = 0;
 
      var time = +new Date, last = this.done[this.done.length - 1];
 
      if (time - this.time > 400 || !last ||
 
          last.start > start + added || last.start + last.added < start - last.added + last.old.length)
 
        this.done.push({start: start, added: added, old: old});
 
      else {
 
        var oldoff = 0;
 
        if (start < last.start) {
 
          for (var i = last.start - start - 1; i >= 0; --i)
 
            last.old.unshift(old[i]);
 
          last.added += last.start - start;
 
          last.start = start;
 
        }
 
        else if (last.start < start) {
 
          oldoff = start - last.start;
 
          added += oldoff;
 
        }
 
        for (var i = last.added - oldoff, e = old.length; i < e; ++i)
 
          last.old.push(old[i]);
 
        if (last.added < added) last.added = added;
 
      }
 
      this.time = time;
 
    }
 
  };
 

	
 
  // Event stopping compatibility wrapper.
 
  function stopEvent() {
 
    if (this.preventDefault) {this.preventDefault(); this.stopPropagation();}
 
    else {this.returnValue = false; this.cancelBubble = true;}
 
  }
 
  function stopMethod() {e_stop(this);}
 
  // Ensure an event has a stop method.
 
  function addStop(event) {
 
    if (!event.stop) event.stop = stopEvent;
 
    if (!event.stop) event.stop = stopMethod;
 
    return event;
 
  }
 

	
 
  // Event wrapper, exposing the few operations we need.
 
  function Event(orig) {this.e = orig;}
 
  Event.prototype = {
 
    stop: function() {stopEvent.call(this.e);},
 
    target: function() {return this.e.target || this.e.srcElement;},
 
    button: function() {
 
      if (this.e.which) return this.e.which;
 
      else if (this.e.button & 1) return 1;
 
      else if (this.e.button & 2) return 3;
 
      else if (this.e.button & 4) return 2;
 
    },
 
    pageX: function() {
 
      if (this.e.pageX != null) return this.e.pageX;
 
      else return this.e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
 
    },
 
    pageY: function() {
 
      if (this.e.pageY != null) return this.e.pageY;
 
      else return this.e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
 
    }
 
  };
 
  function e_preventDefault(e) {
 
    if (e.preventDefault) e.preventDefault();
 
    else e.returnValue = false;
 
  }
 
  function e_stopPropagation(e) {
 
    if (e.stopPropagation) e.stopPropagation();
 
    else e.cancelBubble = true;
 
  }
 
  function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
 
  function e_target(e) {return e.target || e.srcElement;}
 
  function e_button(e) {
 
    if (e.which) return e.which;
 
    else if (e.button & 1) return 1;
 
    else if (e.button & 2) return 3;
 
    else if (e.button & 4) return 2;
 
  }
 

	
 
  // Event handler registration. If disconnect is true, it'll return a
 
  // function that unregisters the handler.
 
  function connect(node, type, handler, disconnect) {
 
    function wrapHandler(event) {handler(new Event(event || window.event));}
 
    function wrapHandler(event) {handler(event || window.event);}
 
    if (typeof node.addEventListener == "function") {
 
      node.addEventListener(type, wrapHandler, false);
 
      if (disconnect) return function() {node.removeEventListener(type, wrapHandler, false);};
 
    }
 
    else {
 
      node.attachEvent("on" + type, wrapHandler);
 
      if (disconnect) return function() {node.detachEvent("on" + type, wrapHandler);};
 
    }
 
  }
 

	
 
  function Delayed() {this.id = null;}
 
  Delayed.prototype = {set: function(ms, f) {clearTimeout(this.id); this.id = setTimeout(f, ms);}};
 

	
 
  // Some IE versions don't preserve whitespace when setting the
 
  // innerHTML of a PRE tag.
 
  var badInnerHTML = (function() {
 
    var pre = document.createElement("pre");
 
    pre.innerHTML = " "; return !pre.innerHTML;
 
  })();
 

	
 
  // Detect drag-and-drop
 
  var dragAndDrop = (function() {
 
    // IE8 has ondragstart and ondrop properties, but doesn't seem to
 
    // actually support ondragstart the way it's supposed to work.
 
    if (/MSIE [1-8]\b/.test(navigator.userAgent)) return false;
 
    var div = document.createElement('div');
 
    return "ondragstart" in div && "ondrop" in div;
 
  })();
 

	
 
  var gecko = /gecko\/\d{7}/i.test(navigator.userAgent);
 
  var ie = /MSIE \d/.test(navigator.userAgent);
 
  var safari = /Apple Computer/.test(navigator.vendor);
 

	
 
  var lineSep = "\n";
 
  // Feature-detect whether newlines in textareas are converted to \r\n
 
  (function () {
 
    var te = document.createElement("textarea");
 
    te.value = "foo\nbar";
 
    if (te.value.indexOf("\r") > -1) lineSep = "\r\n";
 
  }());
 

	
 
  var tabSize = 8;
 
  var mac = /Mac/.test(navigator.platform);
 
  var movementKeys = {};
 
  for (var i = 35; i <= 40; ++i)
 
    movementKeys[i] = movementKeys["c" + i] = true;
 

	
 
  // Counts the column offset in a string, taking tabs into account.
 
  // Used mostly to find indentation.
 
  function countColumn(string, end) {
 
    if (end == null) {
 
      end = string.search(/[^\s\u00a0]/);
 
      if (end == -1) end = string.length;
 
    }
 
    for (var i = 0, n = 0; i < end; ++i) {
 
      if (string.charAt(i) == "\t") n += tabSize - (n % tabSize);
 
      else ++n;
 
    }
 
    return n;
 
  }
 

	
 
  function computedStyle(elt) {
 
    if (elt.currentStyle) return elt.currentStyle;
 
    return window.getComputedStyle(elt, null);
 
  }
 
  // Find the position of an element by following the offsetParent chain.
 
  function eltOffset(node) {
 
    var x = 0, y = 0, n2 = node;
 
    for (var n = node; n; n = n.offsetParent) {x += n.offsetLeft; y += n.offsetTop;}
 
    for (var n = node; n != document.body; n = n.parentNode) {x -= n.scrollLeft; y -= n.scrollTop;}
 
  // If screen==true, it returns screen (rather than page) coordinates.
 
  function eltOffset(node, screen) {
 
    var doc = node.ownerDocument.body;
 
    var x = 0, y = 0, skipDoc = false;
 
    for (var n = node; n; n = n.offsetParent) {
 
      x += n.offsetLeft; y += n.offsetTop;
 
      if (screen && computedStyle(n).position == "fixed")
 
        skipDoc = true;
 
    }
 
    var e = screen && !skipDoc ? null : doc;
 
    for (var n = node.parentNode; n != e; n = n.parentNode)
 
      if (n.scrollLeft != null) { x -= n.scrollLeft; y -= n.scrollTop;}
 
    return {left: x, top: y};
 
  }
 
  // Get a node's text content.
 
  function eltText(node) {
 
    return node.textContent || node.innerText || node.nodeValue || "";
 
  }
 

	
 
  // Operations on {line, ch} objects.
 
  function posEq(a, b) {return a.line == b.line && a.ch == b.ch;}
 
  function posLess(a, b) {return a.line < b.line || (a.line == b.line && a.ch < b.ch);}
 
  function copyPos(x) {return {line: x.line, ch: x.ch};}
 

	
 
  var escapeElement = document.createElement("pre");
 
  function htmlEscape(str) {
 
    return str.replace(/[<&]/g, function(str) {return str == "&" ? "&amp;" : "&lt;";});
 
    if (badTextContent) {
 
      escapeElement.innerHTML = "";
 
      escapeElement.appendChild(document.createTextNode(str));
 
    } else {
 
      escapeElement.textContent = str;
 
    }
 
    return escapeElement.innerHTML;
 
  }
 
  var badTextContent = htmlEscape("\t") != "\t";
 
  CodeMirror.htmlEscape = htmlEscape;
 

	
 
  // Used to position the cursor after an undo/redo by finding the
 
  // last edited character.
 
  function editEnd(from, to) {
 
    if (!to) return from ? from.length : 0;
 
    if (!from) return to.length;
 
    for (var i = from.length, j = to.length; i >= 0 && j >= 0; --i, --j)
 
      if (from.charAt(i) != to.charAt(j)) break;
 
    return j + 1;
 
  }
 

	
 
  function indexOf(collection, elt) {
 
    if (collection.indexOf) return collection.indexOf(elt);
 
    for (var i = 0, e = collection.length; i < e; ++i)
 
      if (collection[i] == elt) return i;
 
    return -1;
 
  }
 

	
 
  // See if "".split is the broken IE version, if so, provide an
 
  // alternative way to split lines.
 
  var splitLines, selRange, setSelRange;
 
  if ("\n\nb".split(/\n/).length != 3)
 
    var splitLines = function(string) {
 
    splitLines = function(string) {
 
      var pos = 0, nl, result = [];
 
      while ((nl = string.indexOf("\n", pos)) > -1) {
 
        result.push(string.slice(pos, string.charAt(nl-1) == "\r" ? nl - 1 : nl));
 
        pos = nl + 1;
 
      }
 
      result.push(string.slice(pos));
 
      return result;
 
    };
 
  else
 
    var splitLines = function(string){return string.split(/\r?\n/);};
 
    splitLines = function(string){return string.split(/\r?\n/);};
 
  CodeMirror.splitLines = splitLines;
 

	
 
  // Sane model of finding and setting the selection in a textarea
 
  if (window.getSelection) {
 
    var selRange = function(te) {
 
    selRange = function(te) {
 
      try {return {start: te.selectionStart, end: te.selectionEnd};}
 
      catch(e) {return null;}
 
    };
 
    var setSelRange = function(te, start, end) {
 
      try {te.setSelectionRange(start, end);}
 
      catch(e) {} // Fails on Firefox when textarea isn't part of the document
 
    };
 
    if (safari)
 
      // On Safari, selection set with setSelectionRange are in a sort
 
      // of limbo wrt their anchor. If you press shift-left in them,
 
      // the anchor is put at the end, and the selection expanded to
 
      // the left. If you press shift-right, the anchor ends up at the
 
      // front. This is not what CodeMirror wants, so it does a
 
      // spurious modify() call to get out of limbo.
 
      setSelRange = function(te, start, end) {
 
        if (start == end)
 
          te.setSelectionRange(start, end);
 
        else {
 
          te.setSelectionRange(start, end - 1);
 
          window.getSelection().modify("extend", "forward", "character");
 
        }
 
      };
 
    else
 
      setSelRange = function(te, start, end) {
 
        try {te.setSelectionRange(start, end);}
 
        catch(e) {} // Fails on Firefox when textarea isn't part of the document
 
      };
 
  }
 
  // IE model. Don't ask.
 
  else {
 
    var selRange = function(te) {
 
      try {var range = document.selection.createRange();}
 
    selRange = function(te) {
 
      try {var range = te.ownerDocument.selection.createRange();}
 
      catch(e) {return null;}
 
      if (!range || range.parentElement() != te) return null;
 
      var val = te.value, len = val.length, localRange = te.createTextRange();
 
      localRange.moveToBookmark(range.getBookmark());
 
      var endRange = te.createTextRange();
 
      endRange.collapse(false);
 

	
 
      if (localRange.compareEndPoints("StartToEnd", endRange) > -1)
 
        return {start: len, end: len};
 

	
 
      var start = -localRange.moveStart("character", -len);
 
      for (var i = val.indexOf("\r"); i > -1 && i < start; i = val.indexOf("\r", i+1), start++) {}
 

	
 
      if (localRange.compareEndPoints("EndToEnd", endRange) > -1)
 
        return {start: start, end: len};
 

	
 
      var end = -localRange.moveEnd("character", -len);
 
      for (var i = val.indexOf("\r"); i > -1 && i < end; i = val.indexOf("\r", i+1), end++) {}
 
      return {start: start, end: end};
 
    };
 
    var setSelRange = function(te, start, end) {
 
    setSelRange = function(te, start, end) {
 
      var range = te.createTextRange();
 
      range.collapse(true);
 
      var endrange = range.duplicate();
 
      var newlines = 0, txt = te.value;
 
      for (var pos = txt.indexOf("\n"); pos > -1 && pos < start; pos = txt.indexOf("\n", pos + 1))
 
        ++newlines;
 
      range.move("character", start - newlines);
 
      for (; pos > -1 && pos < end; pos = txt.indexOf("\n", pos + 1))
 
        ++newlines;
 
      endrange.move("character", end - newlines);
 
      range.setEndPoint("EndToEnd", endrange);
 
      range.select();
 
    };
 
  }
 

	
 
  CodeMirror.defineMode("null", function() {
 
    return {token: function(stream) {stream.skipToEnd();}};
 
  });
 
  CodeMirror.defineMIME("text/plain", "null");
 

	
 
  return CodeMirror;
 
})();
rhodecode/templates/admin/repos/repo_edit_perms.html
Show inline comments
 
<table id="permissions_manage">
 
<table id="permissions_manage" class="noborder">
 
    <tr>
 
        <td>${_('none')}</td>
 
        <td>${_('read')}</td>
 
        <td>${_('write')}</td>
 
        <td>${_('admin')}</td>
 
        <td>${_('member')}</td>
 
        <td></td>
 
    </tr>
 
    ## USERS                        
 
    %for r2p in c.repo_info.repo_to_perm:
 
        %if r2p.user.username =='default' and c.repo_info.private:
 
            <tr>
 
                <td colspan="4">
 
                    <span class="private_repo_msg">
 
                    ${_('private repository')}
 
                    </span>
 
                </td>
 
                <td class="private_repo_msg"><img style="vertical-align:bottom" src="${h.url("/images/icons/user.png")}"/>${r2p.user.username}</td>
 
            </tr>
 
        %else:
 
        <tr id="id${id(r2p.user.username)}">
 
            <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.none')}</td>
 
            <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.read')}</td>
 
            <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.write')}</td>
 
            <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.admin')}</td>
 
            <td style="white-space: nowrap;">
 
                <img style="vertical-align:bottom" src="${h.url('/images/icons/user.png')}"/>${r2p.user.username}
 
            </td>
 
            <td>
 
              %if r2p.user.username !='default':
 
                <span class="delete_icon action_button" onclick="ajaxActionUser(${r2p.user.user_id},'${'id%s'%id(r2p.user.username)}')">
 
                ${_('revoke')}
 
                </span>
 
              %endif                    
 
            </td>
 
        </tr>
 
        %endif
 
    %endfor
 
    
 
    ## USERS GROUPS                          
 
    %for g2p in c.repo_info.users_group_to_perm:
 
        <tr id="id${id(g2p.users_group.users_group_name)}">
 
            <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.none')}</td>
 
            <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.read')}</td>
 
            <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.write')}</td>
 
            <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.admin')}</td>
 
            <td style="white-space: nowrap;">
 
                <img  style="vertical-align:bottom" src="${h.url('/images/icons/group.png')}"/>${g2p.users_group.users_group_name}
 
            </td>
 
            <td>
 
                <span class="delete_icon action_button" onclick="ajaxActionUsersGroup(${g2p.users_group.users_group_id},'${'id%s'%id(g2p.users_group.users_group_name)}')">
 
                ${_('revoke')}
 
                </span>
 
            </td>
 
        </tr>
 
    %endfor
 
    <tr id="add_perm_input">
 
        <td>${h.radio('perm_new_member','repository.none')}</td>
 
        <td>${h.radio('perm_new_member','repository.read')}</td>
 
        <td>${h.radio('perm_new_member','repository.write')}</td>
 
        <td>${h.radio('perm_new_member','repository.admin')}</td>
 
        <td class='ac'>
 
            <div class="perm_ac" id="perm_ac">
 
                ${h.text('perm_new_member_name',class_='yui-ac-input')}
 
                ${h.hidden('perm_new_member_type')}
 
                <div id="perm_container"></div>
 
            </div>
 
        </td>
 
        <td></td>
 
    </tr>
 
    <tr>
 
        <td colspan="6">
 
            <span id="add_perm" class="add_icon" style="cursor: pointer;">
 
            ${_('Add another member')}
 
            </span>
 
        </td>
 
    </tr>
 
</table>
 
<script type="text/javascript">
 
function ajaxActionUser(user_id, field_id) {
 
    var sUrl = "${h.url('delete_repo_user',repo_name=c.repo_name)}";
 
    var callback = {
 
        success: function (o) {
 
            var tr = YUD.get(String(field_id));
 
            tr.parentNode.removeChild(tr);
 
        },
 
        failure: function (o) {
 
            alert("${_('Failed to remove user')}");
 
        },
 
    };
 
    var postData = '_method=delete&user_id=' + user_id;
 
    var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
 
};
 
            
 
function ajaxActionUsersGroup(users_group_id,field_id){
 
    var sUrl = "${h.url('delete_repo_users_group',repo_name=c.repo_name)}";
 
    var callback = { 
 
    	success:function(o){
 
    	    var tr = YUD.get(String(field_id));
 
    		tr.parentNode.removeChild(tr);
 
    	},
 
        failure:function(o){
 
            alert("${_('Failed to remove users group')}");
 
        },
 
    };
 
    var postData = '_method=delete&users_group_id='+users_group_id; 
 
    var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
 
};
 

	
 
YUE.onDOMReady(function () {
 
    if (!YUD.hasClass('perm_new_member_name', 'error')) {
 
        YUD.setStyle('add_perm_input', 'display', 'none');
 
    }
 
    YAHOO.util.Event.addListener('add_perm', 'click', function () {
 
        YUD.setStyle('add_perm_input', 'display', '');
 
        YUD.setStyle('add_perm', 'opacity', '0.6');
 
        YUD.setStyle('add_perm', 'cursor', 'default');
 
    });
 
});
 

	
 
YAHOO.example.FnMultipleFields = function () {
 
    var myUsers = ${c.users_array|n};
 
    var myGroups = ${c.users_groups_array|n};
 

	
 
    // Define a custom search function for the DataSource of users
 
    var matchUsers = function (sQuery) {
 
            // Case insensitive matching
 
            var query = sQuery.toLowerCase();
 
            var i = 0;
 
            var l = myUsers.length;
 
            var matches = [];
 

	
 
            // Match against each name of each contact
 
            for (; i < l; i++) {
 
                contact = myUsers[i];
 
                if ((contact.fname.toLowerCase().indexOf(query) > -1) || (contact.lname.toLowerCase().indexOf(query) > -1) || (contact.nname && (contact.nname.toLowerCase().indexOf(query) > -1))) {
 
                    matches[matches.length] = contact;
 
                }
 
            }
 
            return matches;
 
        };
 

	
 
    // Define a custom search function for the DataSource of usersGroups
 
    var matchGroups = function (sQuery) {
 
            // Case insensitive matching
 
            var query = sQuery.toLowerCase();
 
            var i = 0;
 
            var l = myGroups.length;
 
            var matches = [];
 

	
 
            // Match against each name of each contact
 
            for (; i < l; i++) {
 
                matched_group = myGroups[i];
 
                if (matched_group.grname.toLowerCase().indexOf(query) > -1) {
 
                    matches[matches.length] = matched_group;
 
                }
 
            }
 
            return matches;
 
        };
 

	
 
    //match all
 
    var matchAll = function (sQuery) {
 
            u = matchUsers(sQuery);
 
            g = matchGroups(sQuery);
 
            return u.concat(g);
 
        };
 

	
 
    // DataScheme for members
 
    var memberDS = new YAHOO.util.FunctionDataSource(matchAll);
 
    memberDS.responseSchema = {
 
        fields: ["id", "fname", "lname", "nname", "grname", "grmembers"]
 
    };
 

	
 
    // DataScheme for owner
 
    var ownerDS = new YAHOO.util.FunctionDataSource(matchUsers);
 
    ownerDS.responseSchema = {
 
        fields: ["id", "fname", "lname", "nname"]
 
    };
 

	
 
    // Instantiate AutoComplete for perms
 
    var membersAC = new YAHOO.widget.AutoComplete("perm_new_member_name", "perm_container", memberDS);
 
    membersAC.useShadow = false;
 
    membersAC.resultTypeList = false;
 

	
 
    // Instantiate AutoComplete for owner
 
    var ownerAC = new YAHOO.widget.AutoComplete("user", "owner_container", ownerDS);
 
    ownerAC.useShadow = false;
 
    ownerAC.resultTypeList = false;
 

	
 

	
 
    // Helper highlight function for the formatter
 
    var highlightMatch = function (full, snippet, matchindex) {
rhodecode/templates/base/base.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="root.html"/>
 

	
 
<!-- HEADER -->
 
<div id="header">
 
    <!-- user -->
 
    <ul id="logged-user">
 
         <li class="first">
 
			<div id="quick_login" style="display:none">
 
			${h.form(h.url('login_home',came_from=h.url.current()))}
 
			<div class="form">
 
			    <div class="fields">
 
			        <div class="field">
 
			            <div class="label">
 
			                <label for="username">${_('Username')}:</label>
 
			            </div>
 
			            <div class="input">
 
			                ${h.text('username',class_='focus',size=40)}
 
			            </div>
 
			            
 
			        </div>                     
 
			        <div class="field">
 
			            <div class="label">
 
			                <label for="password">${_('Password')}:</label>
 
			            </div>
 
			            <div class="input">
 
			                ${h.password('password',class_='focus',size=40)}
 
			            </div>
 
			            
 
			        </div>
 
			        <div class="buttons">
 
			            <div class="password_forgoten">${h.link_to(_('Forgot password ?'),h.url('reset_password'))}</div>
 
                        <div class="register">
 
                        %if h.HasPermissionAny('hg.admin', 'hg.register.auto_activate', 'hg.register.manual_activate')():
 
                         ${h.link_to(_("Don't have an account ?"),h.url('register'))}
 
                        %endif                        
 
                        </div>
 
                            ${h.submit('sign_in',_('Sign In'),class_="ui-button")}
 
			        </div>
 
			    </div>
 
			</div>
 
			${h.end_form()}
 
			</div>         
 
         
 
             <div class="gravatar">
 
                 <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_user.email,20)}" />
 
             </div>
 
          <div class="account">
 
          %if c.rhodecode_user.username == 'default':
 
              <a href="${h.url('public_journal')}">${_('Public journal')}</a>   
 
          %else:                        		            
 
          	${h.link_to(c.rhodecode_user.username,h.url('admin_settings_my_account'),title='%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname))}
 
          %endif
 
          </div>	
 
         </li>
 
         <li>
 
            <a href="${h.url('home')}">${_('Home')}</a>
 
         </li>
 
         %if c.rhodecode_user.username != 'default':
 
            <li>
 
               <a href="${h.url('journal')}">${_('Journal')}</a> 
 
               ##(${c.unread_journal}
 
            </li>
 
            %endif
 
            %if c.rhodecode_user.username == 'default':
 
                <li class="last highlight">${h.link_to(_(u'Login'),h.url('login_home'),id='quick_login_link')}</li>
 
            %else:
 
                <li class="last highlight">${h.link_to(_(u'Log Out'),h.url('logout_home'))}</li>
 
            %endif
 
    </ul>
 
    <!-- end user -->
 
    <div id="header-inner" class="title">
 
        <div id="logo">
 
            <h1><a href="${h.url('home')}">${c.rhodecode_name}</a></h1>
 
        </div>
 
        <!-- MENU -->
 
        ${self.page_nav()}
 
        <!-- END MENU -->
 
        ${self.body()}
 
    </div>
 
</div>     
 
<!-- END HEADER -->
 
    
 
<!-- CONTENT -->
 
<div id="content"> 
 
    <div class="flash_msg">
 
        <% messages = h.flash.pop_messages() %>
 
        % if messages:
 
        <ul id="flash-messages">
 
            % for message in messages:
 
            <li class="${message.category}_msg">${message}</li>
 
            % endfor
 
        </ul>
 
        % endif
 
    </div>	    
 
    <div id="main"> 
 
        ${next.main()}
 
    </div>
 
</div> 
 
<!-- END CONTENT -->
 

	
 
<!-- FOOTER -->
 
<div id="footer">
 
   <div id="footer-inner" class="title">
 
       <div>
 
           <p class="footer-link">
 
                <a href="${h.url('bugtracker')}">${_('Submit a bug')}</a>
 
           </p>
 
	       <p class="footer-link-right">
 
	           <a href="${h.url('rhodecode_official')}">RhodeCode</a> 
 
	           ${c.rhodecode_version} &copy; 2010-${h.datetime.today().year} by Marcin Kuzminski
 
	       </p>
 
       </div>
 
   </div>
 
</div>
 
<!-- END FOOTER -->
 

	
 
### MAKO DEFS ###
 
<%def name="page_nav()">
 
    ${self.menu()}
 
</%def>
 

	
 
<%def name="breadcrumbs()">
 
    <div class="breadcrumbs">
 
    ${self.breadcrumbs_links()}
 
    </div>
 
</%def>
 

	
 

	
 
<%def name="menu(current=None)">
 
		<% 
 
		def is_current(selected):
 
			if selected == current:
 
				return h.literal('class="current"')
 
		%>
 
		%if current not in ['home','admin']:           		
 
		   ##REGULAR MENU            
 
	        <ul id="quick">
 
				<!-- repo switcher -->
 
				<li>
 
					<a id="repo_switcher" title="${_('Switch repository')}" href="#">
 
                    <span class="icon">
 
                        <img src="${h.url('/images/icons/database.png')}" alt="${_('Products')}" />
 
                    </span>
 
                    <span>&darr;</span>					
 
					</a>
 
					<ul id="repo_switcher_list" class="repo_switcher">
 
                        <li>
 
                            <a href="#">${_('loading...')}</a>
 
                        </li>
 
					</ul>
 
					<script type="text/javascript">
 
					   YUE.on('repo_switcher','mouseover',function(){
 
						      function qfilter(){
 
						         var S = YAHOO.util.Selector;
 
						         
 
						         var q_filter = YUD.get('q_filter_rs');
 
						         var F = YAHOO.namespace('q_filter_rs'); 
 
						         
 
						         YUE.on(q_filter,'click',function(){
 
						            q_filter.value = '';
 
						         });
 
						    
 
						         F.filterTimeout = null;
 
						         
 
						         F.updateFilter  = function() { 
 
						            // Reset timeout 
 
						            F.filterTimeout = null;
 
						            
 
						            var obsolete = [];
 
						            var nodes = S.query('ul#repo_switcher_list li a.repo_name');
 
						            var req = YUD.get('q_filter_rs').value;
 
						            for (n in nodes){
 
						                YUD.setStyle(nodes[n].parentNode,'display','')
 
						            }
 
						            if (req){
 
						                for (n in nodes){
 
						                    if (nodes[n].innerHTML.toLowerCase().indexOf(req) == -1) {
 
						                        obsolete.push(nodes[n]); 
 
						                    }
 
						                }
 
						                if(obsolete){
 
						                    for (n in obsolete){
 
						                        YUD.setStyle(obsolete[n].parentNode,'display','none');
 
						                    }
 
						                }
 
						            }
 
						         }
 
						         
 
						         YUE.on(q_filter,'keyup',function(e){
 
						             clearTimeout(F.filterTimeout); 
 
						             F.filterTimeout = setTimeout(F.updateFilter,600); 
 
						         });
 
						}
 
						   var loaded = YUD.hasClass('repo_switcher','loaded');
 
						   if(!loaded){
 
							   YUD.addClass('repo_switcher','loaded');
 
							   ypjax("${h.url('repo_switcher')}",'repo_switcher_list',
 
								   function(o){qfilter();},
 
								   function(o){YUD.removeClass('repo_switcher','loaded');}
 
								   ,null);
 
						   }
 
						   return false;
 
					   });
 
					</script>	
 
				</li>
 
				
 
	            <li ${is_current('summary')}>
 
	               <a title="${_('Summary')}" href="${h.url('summary_home',repo_name=c.repo_name)}">
 
	               <span class="icon">
 
	                   <img src="${h.url('/images/icons/clipboard_16.png')}" alt="${_('Summary')}" />
 
	               </span>
 
	               <span>${_('Summary')}</span>                 
 
	               </a>	            
 
	            </li>
 
                ##<li ${is_current('shortlog')}>
 
                ##   <a title="${_('Shortlog')}" href="${h.url('shortlog_home',repo_name=c.repo_name)}">
 
                ##   <span class="icon">
 
                ##       <img src="${h.url('/images/icons/application_view_list.png')}" alt="${_('Shortlog')}" />
 
                ##   </span>
 
                ##   <span>${_('Shortlog')}</span>                 
 
                ##   </a>             
 
                ##</li>	            
 
                <li ${is_current('changelog')}>
 
                   <a title="${_('Changelog')}" href="${h.url('changelog_home',repo_name=c.repo_name)}">
 
                   <span class="icon">
 
                       <img src="${h.url('/images/icons/time.png')}" alt="${_('Changelog')}" />
 
                   </span>
 
                   <span>${_('Changelog')}</span>                 
 
                   </a>             
 
                </li>   	
 
                
 
                <li ${is_current('switch_to')}>
 
                   <a title="${_('Switch to')}" href="#">
 
                   <a id="branch_tag_switcher" title="${_('Switch to')}" href="#">
 
                   <span class="icon">
 
                       <img src="${h.url('/images/icons/arrow_switch.png')}" alt="${_('Switch to')}" />
 
                   </span>
 
                   <span>${_('Switch to')}</span>                 
 
                   </a>    
 
                    <ul>
 
                        <li>
 
                            ${h.link_to('%s (%s)' % (_('branches'),len(c.rhodecode_repo.branches.values()),),h.url('branches_home',repo_name=c.repo_name),class_='branches childs')}
 
                            <ul>
 
                            %if c.rhodecode_repo.branches.values():
 
						        %for cnt,branch in enumerate(c.rhodecode_repo.branches.items()):
 
						            <li>${h.link_to('%s - %s' % (branch[0],h.short_id(branch[1])),h.url('files_home',repo_name=c.repo_name,revision=branch[1]))}</li>
 
						        %endfor
 
						    %else:
 
						    	<li>${h.link_to(_('There are no branches yet'),'#')}</li>
 
						    %endif
 
                            </ul>                        
 
                        </li>
 
                        <li>
 
                            ${h.link_to('%s (%s)' % (_('tags'),len(c.rhodecode_repo.tags.values()),),h.url('tags_home',repo_name=c.repo_name),class_='tags childs')}
 
                            <ul>
 
                            %if c.rhodecode_repo.tags.values():
 
                                %for cnt,tag in enumerate(c.rhodecode_repo.tags.items()):
 
                                 <li>${h.link_to('%s - %s' % (tag[0],h.short_id(tag[1])),h.url('files_home',repo_name=c.repo_name,revision=tag[1]))}</li>
 
                                %endfor
 
                            %else:
 
                            	<li>${h.link_to(_('There are no tags yet'),'#')}</li>
 
                            %endif
 
                            </ul>                        
 
                        </li>                        
 
                    </ul>
 
                    <ul id="switch_to_list" class="switch_to">
 
                        <li><a href="#">${_('loading...')}</a></li>
 
                    </ul>                     
 
                </li>
 
                <li ${is_current('files')}>
 
                   <a title="${_('Files')}" href="${h.url('files_home',repo_name=c.repo_name)}">
 
                   <span class="icon">
 
                       <img src="${h.url('/images/icons/file.png')}" alt="${_('Files')}" />
 
                   </span>
 
                   <span>${_('Files')}</span>                 
 
                   </a>             
 
                </li>                            
 
				
 
                <li ${is_current('options')}>
 
                   <a title="${_('Options')}" href="#">
 
                   <span class="icon">
 
                       <img src="${h.url('/images/icons/table_gear.png')}" alt="${_('Admin')}" />
 
                   </span>
 
                   <span>${_('Options')}</span>                 
 
                   </a>
 
                   <ul>
 
                   %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
 
                     %if h.HasPermissionAll('hg.admin')('access settings on repository'):
 
                         <li>${h.link_to(_('settings'),h.url('edit_repo',repo_name=c.repo_name),class_='settings')}</li>
 
                     %else:
 
                         <li>${h.link_to(_('settings'),h.url('repo_settings_home',repo_name=c.repo_name),class_='settings')}</li>
 
                     %endif
 
                   %endif
 
                   	<li>${h.link_to(_('fork'),h.url('repo_fork_home',repo_name=c.repo_name),class_='fork')}</li>
 
                   	<li>${h.link_to(_('search'),h.url('search_repo',search_repo=c.repo_name),class_='search')}</li>
 
                    
 
                    % if h.HasPermissionAll('hg.admin')('access admin main page'):
 
                     <li>
 
                       ${h.link_to(_('admin'),h.url('admin_home'),class_='admin')}  
 
                        <%def name="admin_menu()">
 
                        <ul>
 
                            <li>${h.link_to(_('journal'),h.url('admin_home'),class_='journal')}</li>
 
                            <li>${h.link_to(_('repositories'),h.url('repos'),class_='repos')}</li>
 
                            <li>${h.link_to(_('repositories groups'),h.url('repos_groups'),class_='repos_groups')}</li>
 
                            <li>${h.link_to(_('users'),h.url('users'),class_='users')}</li>
 
                            <li>${h.link_to(_('users groups'),h.url('users_groups'),class_='groups')}</li>
 
                            <li>${h.link_to(_('permissions'),h.url('edit_permission',id='default'),class_='permissions')}</li>
 
                            <li>${h.link_to(_('ldap'),h.url('ldap_home'),class_='ldap')}</li>
 
                            <li class="last">${h.link_to(_('settings'),h.url('admin_settings'),class_='settings')}</li>        
 
                        </ul>
 
                        </%def>
 
                        
 
                        ${admin_menu()}
 
                     </li>
 
                    % endif
 
                   </ul>             
 
                </li>
 
                
 
                <li>
 
                    <a title="${_('Followers')}" href="${h.url('repo_followers_home',repo_name=c.repo_name)}">
 
                    <span class="icon_short">
 
                        <img src="${h.url('/images/icons/heart.png')}" alt="${_('Followers')}" />
 
                    </span>
 
                    <span id="current_followers_count" class="short">${c.repository_followers}</span>
 
                    </a>
 
                </li>
 
                <li>
 
                    <a title="${_('Forks')}" href="${h.url('repo_forks_home',repo_name=c.repo_name)}">
 
                    <span class="icon_short">
 
                        <img src="${h.url('/images/icons/arrow_divide.png')}" alt="${_('Forks')}" />
 
                    </span>
 
                    <span class="short">${c.repository_forks}</span>
 
                    </a>
 
                </li>                
 
                
 
	        </ul>
 
            <script type="text/javascript">
 
               YUE.on('repo_switcher','mouseover',function(){
 
                      function qfilter(){
 
                         var S = YAHOO.util.Selector;
 
                         
 
                         var q_filter = YUD.get('q_filter_rs');
 
                         var F = YAHOO.namespace('q_filter_rs'); 
 
                         
 
                         YUE.on(q_filter,'click',function(){
 
                            q_filter.value = '';
 
                         });
 
                    
 
                         F.filterTimeout = null;
 
                         
 
                         F.updateFilter  = function() { 
 
                            // Reset timeout 
 
                            F.filterTimeout = null;
 
                            
 
                            var obsolete = [];
 
                            var nodes = S.query('ul#repo_switcher_list li a.repo_name');
 
                            var req = YUD.get('q_filter_rs').value.toLowerCase();
 
                            for (n in nodes){
 
                                YUD.setStyle(nodes[n].parentNode,'display','')
 
                            }
 
                            if (req){
 
                                for (n in nodes){
 
                                    if (nodes[n].innerHTML.toLowerCase().indexOf(req) == -1) {
 
                                        obsolete.push(nodes[n]); 
 
                                    }
 
                                }
 
                                if(obsolete){
 
                                    for (n in obsolete){
 
                                        YUD.setStyle(obsolete[n].parentNode,'display','none');
 
                                    }
 
                                }
 
                            }
 
                         }
 
                         
 
                         YUE.on(q_filter,'keyup',function(e){
 
                             clearTimeout(F.filterTimeout); 
 
                             F.filterTimeout = setTimeout(F.updateFilter,600); 
 
                         });
 
                }
 
                   var loaded = YUD.hasClass('repo_switcher','loaded');
 
                   if(!loaded){
 
                       YUD.addClass('repo_switcher','loaded');
 
                       ypjax("${h.url('repo_switcher')}",'repo_switcher_list',
 
                           function(o){qfilter();},
 
                           function(o){YUD.removeClass('repo_switcher','loaded');}
 
                           ,null);
 
                   }
 
                   return false;
 
               });
 

	
 
            YUE.on('branch_tag_switcher','mouseover',function(){
 
               var loaded = YUD.hasClass('branch_tag_switcher','loaded');
 
               if(!loaded){
 
                   YUD.addClass('branch_tag_switcher','loaded');
 
                   ypjax("${h.url('branch_tag_switcher',repo_name=c.repo_name)}",'switch_to_list',
 
                       function(o){},
 
                       function(o){YUD.removeClass('branch_tag_switcher','loaded');}
 
                       ,null);
 
               }
 
               return false;
 
            });
 
            </script>             
 
		%else:
 
		    ##ROOT MENU
 
            <ul id="quick">
 
                <li>
 
                    <a title="${_('Home')}"  href="${h.url('home')}">
 
                    <span class="icon">
 
                        <img src="${h.url('/images/icons/home_16.png')}" alt="${_('Home')}" />
 
                    </span>
 
                    <span>${_('Home')}</span>                 
 
                    </a>        
 
                </li>
 
                % if c.rhodecode_user.username != 'default':
 
                 <li>
 
                    <a title="${_('Journal')}"  href="${h.url('journal')}">
 
                    <span class="icon">
 
                        <img src="${h.url('/images/icons/book.png')}" alt="${_('Journal')}" />
 
                    </span>
 
                    <span>${_('Journal')}</span>                 
 
                    </a>        
 
                 </li>
 
                % endif
 
                <li>
 
                    <a title="${_('Search')}"  href="${h.url('search')}">
 
                    <span class="icon">
 
                        <img src="${h.url('/images/icons/search_16.png')}" alt="${_('Search')}" />
 
                    </span>
 
                    <span>${_('Search')}</span>                 
 
                    </a>        
 
                </li>
 
                
 
				%if h.HasPermissionAll('hg.admin')('access admin main page'):
 
                <li ${is_current('admin')}>
 
                   <a title="${_('Admin')}" href="${h.url('admin_home')}">
 
                   <span class="icon">
 
                       <img src="${h.url('/images/icons/cog_edit.png')}" alt="${_('Admin')}" />
 
                   </span>
 
                   <span>${_('Admin')}</span>                 
 
                   </a>
 
                    ${admin_menu()}
 
                </li>
 
				%endif
 
			</ul>
 
		%endif    
 
		%endif
 
</%def>
rhodecode/templates/base/root.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
 
    <head>
 
        <title>${self.title()}</title>
 
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
 
        <meta name="robots" content="index, nofollow"/>
 
        <link rel="icon" href="${h.url('/images/icons/database_gear.png')}" type="image/png" />
 

	
 
        ## CSS ###
 
        <%def name="css()">
 
            <link rel="stylesheet" type="text/css" href="${h.url('/css/style.css')}" media="screen"/>
 
            <link rel="stylesheet" type="text/css" href="${h.url('/css/pygments.css')}"/>
 
            <link rel="stylesheet" type="text/css" href="${h.url('/css/diff.css')}"/>
 
            ## EXTRA FOR CSS
 
            ${self.css_extra()}
 
        </%def>
 
        <%def name="css_extra()">
 
        </%def>
 
                    
 
        ${self.css()}
 
        
 
        %if c.ga_code:
 
        <!-- Analytics -->
 
	     <script type="text/javascript">
 
	      var _gaq = _gaq || [];
 
	      _gaq.push(['_setAccount', '${c.ga_code}']);
 
	      _gaq.push(['_trackPageview']);
 
	    
 
	      (function() {
 
	        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
 
	        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
 
	        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
 
	      })();
 
	     </script>
 
	    %endif
 
        
 
        ## JAVASCRIPT ##
 
        <%def name="js()">
 
            <script type="text/javascript" src="${h.url('/js/yui.2.9.js')}"></script>
 
            <!--[if IE]>
 
               <script language="javascript" type="text/javascript" src="${h.url('/js/excanvas.min.js')}"></script>
 
            <![endif]-->
 
            <script type="text/javascript" src="${h.url('/js/yui.flot.js')}"></script>
 
            <script type="text/javascript" src="${h.url('/js/rhodecode.js')}"></script>
 
           ## EXTRA FOR JS
 
           ${self.js_extra()}
 
        
 
            <script type="text/javascript">
 
            var base_url  = "${h.url('toggle_following')}";
 
            function onSuccess(target){
 
                var f = YUD.get(target.id);
 
                var f_cnt = YUD.get('current_followers_count');
 
                
 
                if(f.getAttribute('class')=='follow'){
 
                    f.setAttribute('class','following');
 
                    f.setAttribute('title',"${_('Stop following this repository')}");
 
                    
 
                    if(f_cnt){
 
                        var cnt = Number(f_cnt.innerHTML)+1;
 
                        f_cnt.innerHTML = cnt;
 
                    }
 
                }
 
                else{
 
                    f.setAttribute('class','follow');
 
                    f.setAttribute('title',"${_('Start following this repository')}");
 
                    if(f_cnt){
 
                        var cnt = Number(f_cnt.innerHTML)+1;
 
                        f_cnt.innerHTML = cnt;
 
                    }      
 
                }
 
            }
 
            
 
            function toggleFollowingUser(target,fallows_user_id,token,user_id){
 
                args = 'follows_user_id='+fallows_user_id;
 
                args+= '&amp;auth_token='+token;
 
                if(user_id != undefined){
 
                    args+="&amp;user_id="+user_id;
 
                }
 
                YUC.asyncRequest('POST',base_url,{
 
                    success:function(o){
 
                        onSuccess(target);
 
                    }
 
                },args);
 
                return false;
 
            }
 
            
 
            function toggleFollowingRepo(target,fallows_repo_id,token,user_id){
 
            
 
                args = 'follows_repo_id='+fallows_repo_id;
 
                args+= '&amp;auth_token='+token;
 
                if(user_id != undefined){
 
                    args+="&amp;user_id="+user_id;
 
                }    
 
                YUC.asyncRequest('POST',base_url,{
 
                    success:function(o){
 
                        onSuccess(target);
 
                    }
 
                },args); 
 
                return false;
 
            }
 
           YUE.onDOMReady(function(){
 
               
 
             YUE.on('quick_login_link','click',function(e){
 
                 
 
                 if(YUD.hasClass('quick_login_link','enabled')){
 
                     YUD.setStyle('quick_login','display','none');
 
                     YUD.removeClass('quick_login_link','enabled');
 
                 }
 
                 else{
 
                     YUD.setStyle('quick_login','display','');
 
                     YUD.addClass('quick_login_link','enabled');
 
                     YUD.get('username').focus();
 
                 }
 
                 //make sure we don't redirect 
 
                 YUE.preventDefault(e);
 
             });
 
               
 
            tooltip_activate();
 
            show_more_event();
 
            
 
            YUE.on(YUQ('.quick_repo_menu'),'click',function(e){
 
            	var menu = e.currentTarget.firstElementChild;
 
            	if(YUD.hasClass(menu,'hidden')){
 
            		YUD.addClass(e.currentTarget,'active');
 
            		YUD.removeClass(menu,'hidden');
 
            	}else{
 
            		YUD.removeClass(e.currentTarget,'active');
 
            		YUD.addClass(menu,'hidden');
 
            	}
 
            })
 
            
 
            YUE.on(window,'scroll',function(){
 
                if(YUD.getDocumentScrollTop() > 45){
 
                      YUD.addClass('header-inner','hover');
 
                }
 
                else{
 
                    YUD.removeClass('header-inner','hover');
 
                }
 
            }) 
 
           })   
 
            </script>
 
        
 
        </%def>
 
        <%def name="js_extra()">
 
        </%def>      
 
        ${self.js()}
 
    </head>
 
    <body id="body">
 
        ${next.body()}
 
    </body>
 
</html>
 
\ No newline at end of file
rhodecode/templates/changeset/changeset_range.html
Show inline comments
 
<%inherit file="/base/base.html"/>
 

	
 
<%def name="title()">
 
    ${c.repo_name} ${_('Changesets')} - r${c.cs_ranges[0].revision}:${h.short_id(c.cs_ranges[0].raw_id)} -> r${c.cs_ranges[-1].revision}:${h.short_id(c.cs_ranges[-1].raw_id)} - ${c.rhodecode_name}
 
</%def>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${h.link_to(u'Home',h.url('/'))}
 
    &raquo;
 
    ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
 
    &raquo;
 
    ${_('Changesets')} - r${c.cs_ranges[0].revision}:${h.short_id(c.cs_ranges[0].raw_id)} -> r${c.cs_ranges[-1].revision}:${h.short_id(c.cs_ranges[-1].raw_id)}
 
</%def>
 

	
 
<%def name="page_nav()">
 
    ${self.menu('changelog')}     
 
</%def>
 

	
 
<%def name="main()">
 
<div class="box">
 
    <!-- box / title -->
 
    <div class="title">
 
        ${self.breadcrumbs()}
 
    </div>
 
    <div class="table">
 
		<div id="body" class="diffblock">
 
			<div class="code-header">
 
				<div>
 
				${_('Changesets')} - r${c.cs_ranges[0].revision}:${h.short_id(c.cs_ranges[0].raw_id)} -> r${c.cs_ranges[-1].revision}:${h.short_id(c.cs_ranges[-1].raw_id)}
 
				<h3>${_('Compare View')}</h3>
 
				 ##&raquo; <span>${h.link_to(_('raw diff'),
 
				##h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='show'))}</span>
 
				 ##&raquo; <span>${h.link_to(_('download diff'),
 
				##h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='download'))}</span>
 
				</div>
 
			</div>
 
		</div>
 
	    <div id="changeset_compare_view_content">
 
			<div class="container">
 
			<table class="compare_view_commits">
 
			<table class="compare_view_commits noborder">
 
            %for cs in c.cs_ranges:
 
                <tr>
 
                <td><div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(h.email(cs.author),14)}"/></div></td>
 
                <td>${h.link_to('r%s:%s' % (cs.revision,h.short_id(cs.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</td>
 
                <td><div class="author">${h.person(cs.author)}</div></td>
 
                <td><span class="tooltip" title="${h.age(cs.date)}">${cs.date}</span></td>
 
                <td><div class="message">${h.link_to(h.wrap_paragraphs(cs.message),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</div></td>
 
                </tr>
 
            %endfor
 
            </table>
 
	        </div>
 
	        <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">${_('Files affected')}</div>
 
	        <div class="cs_files">
 
	               %for cs in c.cs_ranges:
 
	                   <div class="cur_cs">r${cs}</div>
 
	                %for change,filenode,diff,cs1,cs2,st in c.changes[cs.raw_id]:
 
	                    <div class="cs_${change}">${h.link_to(h.safe_unicode(filenode.path),h.url.current(anchor=h.repo_name_slug('C%s-%s' % (cs.short_id,h.safe_unicode(filenode.path)))))}</div>
 
	                %endfor
 
	               %endfor 
 
	        </div>         
 
	    </div>
 
	    
 
    </div>
 
   %for cs in c.cs_ranges:    	
 
	%for change,filenode,diff,cs1,cs2,st in c.changes[cs.raw_id]:
 
		%if change !='removed':
 
		<div style="clear:both;height:10px"></div>
 
		<div class="diffblock">
 
			<div id="${h.repo_name_slug('C%s-%s' % (cs.short_id,h.safe_unicode(filenode.path)))}" class="code-header">
 
				<div class="changeset_header">
 
					<span class="changeset_file">
 
						${h.link_to_if(change!='removed',h.safe_unicode(filenode.path),h.url('files_home',repo_name=c.repo_name,
 
						revision=filenode.changeset.raw_id,f_path=h.safe_unicode(filenode.path)))}
 
					</span>
 
					%if 1:
 
					&raquo; <span>${h.link_to(_('diff'),
 
					h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='diff'))}</span>
 
					&raquo; <span>${h.link_to(_('raw diff'),
 
					h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='raw'))}</span>
 
					&raquo; <span>${h.link_to(_('download diff'),
 
					h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='download'))}</span>
 
					%endif
 
				</div>
 
			</div>
 
			<div class="code-body">        
 
					%if diff:
 
						${diff|n}
 
					%else:
 
						${_('No changes in this file')}
 
					%endif
 
			</div>
 
		</div>
 
		%endif
 
	%endfor
 
   %endfor  
 
    </div>
 
</%def>
 
\ No newline at end of file
rhodecode/templates/files/files_add.html
Show inline comments
 
<%inherit file="/base/base.html"/>
 

	
 
<%def name="title()">
 
    ${c.repo_name} ${_('Edit file')} - ${c.rhodecode_name}
 
</%def>
 

	
 
<%def name="js_extra()">
 
<script type="text/javascript" src="${h.url('/js/codemirror.js')}"></script>
 
</%def>
 
<%def name="css_extra()">
 
<link rel="stylesheet" type="text/css" href="${h.url('/css/codemirror.css')}"/>
 
</%def>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${h.link_to(u'Home',h.url('/'))}
 
    &raquo;
 
    ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
 
    &raquo;
 
    ${_('add file')} @ R${c.cs.revision}:${h.short_id(c.cs.raw_id)}
 
</%def>
 

	
 
<%def name="page_nav()">
 
		${self.menu('files')}     
 
</%def>
 
<%def name="main()">
 
<div class="box">
 
    <!-- box / title -->
 
    <div class="title">
 
        ${self.breadcrumbs()}
 
        <ul class="links">
 
            <li>
 
              <span style="text-transform: uppercase;">
 
              <a href="#">${_('branch')}: ${c.cs.branch}</a></span>
 
            </li>          
 
        </ul>          
 
    </div>
 
    <div class="table">
 
		<div id="files_data">
 
		  ${h.form(h.url.current(),method='post',id='eform',enctype="multipart/form-data")}
 
            <h3>${_('Add new file')}</h3>
 
            <div class="form">
 
                    <div class="fields">
 
                         <div class="field">
 
                            <div class="label">
 
                                <label for="location">${_('Location')}</label>
 
                            </div>
 
                            <div class="input">
 
                                <input type="text" value="${c.f_path}" size="30" name="location" id="location">
 
                                ${_('use / to separate directories')}
 
                            </div>
 
                         </div>
 
                                      
 
                        <div id="filename_container" class="field file">
 
                            <div class="label">
 
                                <label for="filename">${_('File Name')}:</label>
 
                            </div>
 
                            <div class="input">
 
                                <input type="text" value="" size="30" name="filename" id="filename">
 
                                <input type="button" class="ui-button-small" value="upload file" id="upload_file_enable">
 
                            </div>
 
                        </div>
 
                        <div id="upload_file_container" class="field" style="display:none">
 
                          <div class="label">
 
                              <label for="location">${_('Upload file')}</label>
 
                          </div>
 
                          <div class="file">
 
                              <input type="file"  size="30" name="upload_file" id="upload_file">
 
                              <input type="button" class="ui-button-small" value="create file" id="file_enable">                        
 
                          </div>
 
                        </div>                                                                      
 
              <div class="fields">
 
                  <div id="filename_container" class="field file">
 
                      <div class="label">
 
                          <label for="filename">${_('File Name')}:</label>
 
                      </div>
 
                      <div class="input">
 
                          <input type="text" value="" size="30" name="filename" id="filename">
 
                          <input type="button" class="ui-button-small" value="upload file" id="upload_file_enable">
 
                      </div>
 
                  </div>                    
 
                  <div id="upload_file_container" class="field" style="display:none">
 
                    <div class="label">
 
                        <label for="location">${_('Upload file')}</label>
 
                    </div>
 
                    <div class="file">
 
                        <input type="file"  size="30" name="upload_file" id="upload_file">
 
                        <input type="button" class="ui-button-small" value="create file" id="file_enable">                        
 
                    </div>
 
                  </div>
 
                   <div class="field">
 
                      <div class="label">
 
                          <label for="location">${_('Location')}</label>
 
                      </div>
 
                      <div class="input">
 
                          <input type="text" value="${c.f_path}" size="30" name="location" id="location">
 
                          ${_('use / to separate directories')}
 
                      </div>
 
                   </div>                                                                    
 
              </div>
 
            </div>            
 
			<div id="body" class="codeblock">
 
			    <div id="editor_container">    
 
                    <pre id="editor_pre"></pre>
 
				    <textarea id="editor" name="content" style="display:none"></textarea>
 
                </div>
 
				<div style="padding: 10px;color:#666666">${_('commit message')}</div>
 
				<textarea id="commit" name="message" style="height: 100px;width: 99%;margin-left:4px"></textarea>
 
			</div>
 
			<div style="text-align: right;padding-top: 5px">
 
			<input id="reset" type="button" value="${_('Reset')}" class="ui-button-small" />
 
			${h.submit('commit',_('Commit changes'),class_="ui-button-small-blue")}
 
			</div>
 
			${h.end_form()}
 
			<script type="text/javascript">
 
			 var myCodeMirror = CodeMirror.fromTextArea(YUD.get('editor'),{
 
	                mode:  "null",
 
	                lineNumbers:true
 
	              });
 
			 YUE.on('reset','click',function(e){
 
				 window.location="${h.url('files_home',repo_name=c.repo_name,revision=c.cs.revision,f_path=c.f_path)}";
 
			 });
 
             
 
			 YUE.on('file_enable','click',function(){
 
                 YUD.setStyle('editor_container','display','');
 
                 YUD.setStyle('upload_file_container','display','none');
 
                 YUD.setStyle('filename_container','display','');
 
             });
 
             
 
			 YUE.on('upload_file_enable','click',function(){
 
				 YUD.setStyle('editor_container','display','none');
 
				 YUD.setStyle('upload_file_container','display','');
 
				 YUD.setStyle('filename_container','display','none');
 
			 });
 
			 
 
			</script>
 
		</div>    
 
    </div>
 
</div>    
 
</%def>   
 
\ No newline at end of file
rhodecode/templates/search/search_path.html
Show inline comments
 
##path search
 
<div class="search">
 
	%for cnt,sr in enumerate(c.formated_results):
 
	    %if h.HasRepoPermissionAny('repository.write','repository.read','repository.admin')(sr['repository'],'search results check'):
 
		    <div class="search_path">
 

	
 
%for cnt,sr in enumerate(c.formated_results):
 
    %if h.HasRepoPermissionAny('repository.write','repository.read','repository.admin')(sr['repository'],'search results check'):
 
	    <div class="search_path">
 
	        <div class="link">
 
	            ${h.link_to(h.literal('%s &raquo; %s' % (sr['repository'],sr['f_path'])),
 
	                h.url('files_home',repo_name=sr['repository'],revision='tip',f_path=sr['f_path']))}        
 
	        </div>
 
	    </div>
 
    %else:
 
        %if cnt == 0:
 
		    <div class="error">
 
		        <div class="link">
 
		            ${h.link_to(h.literal('%s &raquo; %s' % (sr['repository'],sr['f_path'])),
 
		                h.url('files_home',repo_name=sr['repository'],revision='tip',f_path=sr['f_path']))}        
 
		            ${_('Permission denied')}        
 
		        </div>
 
		    </div>
 
	    %else:
 
	        %if cnt == 0:
 
			    <div class="error">
 
			        <div class="link">
 
			            ${_('Permission denied')}        
 
			        </div>
 
			    </div>        
 
	        %endif
 
	        
 
	    %endif      
 
	%endfor
 
	%if c.cur_query and c.formated_results:
 
	<div class="pagination-wh pagination-left">
 
	    ${c.formated_results.pager('$link_previous ~2~ $link_next')}
 
	</div>  
 
	%endif
 
</div>
 
\ No newline at end of file
 
		    </div>        
 
        %endif
 
        
 
    %endif      
 
%endfor
 
%if c.cur_query and c.formated_results:
 
<div class="pagination-wh pagination-left">
 
    ${c.formated_results.pager('$link_previous ~2~ $link_next')}
 
</div>  
 
%endif
rhodecode/templates/summary/summary.html
Show inline comments
 
<%inherit file="/base/base.html"/>
 

	
 
<%def name="title()">
 
    ${c.repo_name} ${_('Summary')} - ${c.rhodecode_name}
 
</%def>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${h.link_to(u'Home',h.url('/'))}
 
    &raquo; 
 
    ${h.link_to(c.dbrepo.just_name,h.url('summary_home',repo_name=c.repo_name))}
 
    &raquo;
 
    ${_('summary')}
 
</%def>
 

	
 
<%def name="page_nav()">
 
	${self.menu('summary')}    
 
</%def>
 

	
 
<%def name="main()">
 
<div class="box box-left">
 
    <!-- box / title -->
 
    <div class="title">
 
        ${self.breadcrumbs()}
 
    </div>
 
    <!-- end box / title -->
 
	<div class="form">
 
	  <div id="summary" class="fields">
 
		 
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Name')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
                  %if c.rhodecode_user.username != 'default':
 
                      %if c.following:
 
                      <span id="follow_toggle" class="following" title="${_('Stop following this repository')}"
 
                            onclick="javascript:toggleFollowingRepo(this,${c.dbrepo.repo_id},'${str(h.get_token())}')">
 
                      </span>                 
 
                      %else:
 
                      <span id="follow_toggle" class="follow" title="${_('Start following this repository')}"
 
                            onclick="javascript:toggleFollowingRepo(this,${c.dbrepo.repo_id},'${str(h.get_token())}')">
 
                      </span>
 
                      %endif
 
                  %endif:			  
 
                 
 
                 ##REPO TYPE
 
		         %if c.dbrepo.repo_type =='hg':
 
		           <img style="margin-bottom:2px" class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
 
		         %endif
 
		         %if c.dbrepo.repo_type =='git':
 
		           <img style="margin-bottom:2px" class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
 
		         %endif 
 
                            
 
                 ##PUBLIC/PRIVATE     			  
 
	             %if c.dbrepo.private:
 
	                <img style="margin-bottom:2px" class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="${h.url('/images/icons/lock.png')}"/>
 
	             %else:
 
	                <img style="margin-bottom:2px" class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="${h.url('/images/icons/lock_open.png')}"/>
 
	             %endif
 
	             
 
	              ##REPO NAME
 
			      <span class="repo_name">${h.repo_link(c.dbrepo.groups_and_repo)}</span>
 
                  
 
                  ##FORK
 
		          %if c.dbrepo.fork:
 
	            	<div style="margin-top:5px;clear:both"">
 
	            	<a href="${h.url('summary_home',repo_name=c.dbrepo.fork.repo_name)}">
 
	            	<img class="icon" alt="${_('public')}"
 
	            	title="${_('Fork of')} ${c.dbrepo.fork.repo_name}" 
 
	            	src="${h.url('/images/icons/arrow_divide.png')}"/>
 
	            	${_('Fork of')} ${c.dbrepo.fork.repo_name}
 
	            	<a href="${h.url('summary_home',repo_name=c.dbrepo.fork.repo_name)}"><img class="icon" alt="${_('public')}" title="${_('Fork of')} ${c.dbrepo.fork.repo_name}" src="${h.url('/images/icons/arrow_divide.png')}"/>
 
	            	    ${_('Fork of')} ${c.dbrepo.fork.repo_name}
 
	            	</a>
 
	            	</div>
 
		          %endif
 
		          ##REMOTE
 
				  %if c.dbrepo.clone_uri:
 
                    <div style="margin-top:5px;clear:both">
 
                    <a href="${h.url(str(h.hide_credentials(c.dbrepo.clone_uri)))}">
 
                    <img class="icon" alt="${_('remote clone')}"
 
                    title="${_('Clone from')} ${h.hide_credentials(c.dbrepo.clone_uri)}" 
 
                    src="${h.url('/images/icons/connect.png')}"/>
 
                    ${_('Clone from')} ${h.hide_credentials(c.dbrepo.clone_uri)}
 
                    <a href="${h.url(str(h.hide_credentials(c.dbrepo.clone_uri)))}"><img class="icon" alt="${_('remote clone')}" title="${_('Clone from')} ${h.hide_credentials(c.dbrepo.clone_uri)}" src="${h.url('/images/icons/connect.png')}"/>
 
                        ${_('Clone from')} ${h.hide_credentials(c.dbrepo.clone_uri)}
 
                    </a>
 
                    </div>					
 
				  %endif		            		      
 
			  </div>
 
			 </div>
 
			
 
			
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Description')}:</label>
 
			  </div>
 
			  <div class="input-short desc">${h.urlify_text(c.dbrepo.description)}</div>
 
			 </div>
 
			
 
			
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Contact')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
			  	<div class="gravatar">
 
			  		<img alt="gravatar" src="${h.gravatar_url(c.dbrepo.user.email)}"/>
 
			  	</div>
 
			  		${_('Username')}: ${c.dbrepo.user.username}<br/>
 
			  		${_('Name')}: ${c.dbrepo.user.name} ${c.dbrepo.user.lastname}<br/>
 
			  		${_('Email')}: <a href="mailto:${c.dbrepo.user.email}">${c.dbrepo.user.email}</a>
 
			  </div>
 
			 </div>
 
			
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Last change')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
                  <b>${'r%s:%s' % (h.get_changeset_safe(c.rhodecode_repo,'tip').revision,
 
                            h.get_changeset_safe(c.rhodecode_repo,'tip').short_id)}</b> - 
 
			      <span class="tooltip" title="${c.rhodecode_repo.last_change}">
 
			      ${h.age(c.rhodecode_repo.last_change)}</span><br/>
 
			      ${_('by')} ${h.get_changeset_safe(c.rhodecode_repo,'tip').author} 
 
			      
 
			  </div>
 
			 </div>
 
			
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Clone url')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
			      <input type="text" id="clone_url" readonly="readonly" value="${c.rhodecode_repo.alias} clone ${c.clone_repo_url}" size="70"/>
 
			  </div>
 
			 </div>
 
			 
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Trending source files')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
			    <div id="lang_stats"></div> 			   
 
			  </div>
 
			 </div>
 
			 			
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Download')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
		        %if len(c.rhodecode_repo.revisions) == 0:
 
		          ${_('There are no downloads yet')}
 
		        %elif c.enable_downloads is False:
 
		          ${_('Downloads are disabled for this repository')}
 
                    %if h.HasPermissionAll('hg.admin')('enable stats on from summary'):
 
                        ${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name),class_="ui-button-small")}
 
                    %endif  		          
 
		        %else:
 
			        ${h.select('download_options',c.rhodecode_repo.get_changeset().raw_id,c.download_options)}
 
			        %for cnt,archive in enumerate(c.rhodecode_repo._get_archives()):
 
			             %if cnt >=1:
 
			             |
 
			             %endif
 
			             <span class="tooltip" title="${_('Download %s as %s') %('tip',archive['type'])}" 
 
			                  id="${archive['type']+'_link'}">${h.link_to(archive['type'],
 
			                h.url('files_archive_home',repo_name=c.dbrepo.repo_name,
 
			                fname='tip'+archive['extension']),class_="archive_icon")}</span>
 
			        %endfor
 
                    <span style="vertical-align: bottom">
 
                        <input id="archive_subrepos" type="checkbox" name="subrepos"/> <span class="tooltip" title="${_('Check this to download archive with subrepos')}" >${_('with subrepos')}</span>
 
                    </span>
 
			    %endif
 
			  </div>
 
			 </div>
 
			 
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Feeds')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
			   %if c.rhodecode_user.username != 'default':
 
	            ${h.link_to(_('RSS'),h.url('rss_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key),class_='rss_icon')}
 
	            ${h.link_to(_('Atom'),h.url('atom_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key),class_='atom_icon')}
 
	           %else:
 
                ${h.link_to(_('RSS'),h.url('rss_feed_home',repo_name=c.dbrepo.repo_name),class_='rss_icon')}
 
                ${h.link_to(_('Atom'),h.url('atom_feed_home',repo_name=c.dbrepo.repo_name),class_='atom_icon')}	           
 
	           %endif 
 
			  </div>
 
			 </div>				 			 			 
 
	  </div>		 
 
	</div>
 
  	<script type="text/javascript">
 
	  	YUE.onDOMReady(function(e){
 
	  	    id = 'clone_url';
 
	  	    YUE.on(id,'click',function(e){
 
	  	    	if(YUD.hasClass(id,'selected')){
 
	  	    		return
 
	  	    	}
 
	  	    	else{
 
	                YUD.addClass(id,'selected');
 
	                YUD.get(id).select();	  	    		
 
	  	    	}
 

	
 
	  	    })
 
	  	})
 
  		var data = ${c.trending_languages|n};
 
  		var total = 0;
 
  		var no_data = true;
 
  		for (k in data){
 
  		    total += data[k].count;
 
  		    no_data = false;
 
  		} 
 
		var tbl = document.createElement('table');
 
		tbl.setAttribute('class','trending_language_tbl');
 
		var cnt = 0;
 
  		for (k in data){
 
  			cnt += 1;
 
  			var hide = cnt>2;
 
	  		var tr = document.createElement('tr');
 
	  		if (hide){
 
	  			tr.setAttribute('style','display:none');
 
	  			tr.setAttribute('class','stats_hidden');
 
	  		}
 
	  		var percentage = Math.round((data[k].count/total*100),2);
 
			var value = data[k].count;
 
	  		var td1 = document.createElement('td');
 
	  		td1.width = 150;
 
	  		var trending_language_label = document.createElement('div');
 
	  		trending_language_label.innerHTML = data[k].desc+" ("+k+")";
 
	  		td1.appendChild(trending_language_label);
 

	
 
	  		var td2 = document.createElement('td');
 
	  		td2.setAttribute('style','padding-right:14px !important');
 
  		    var trending_language = document.createElement('div');
 
  		    var nr_files = value+" ${_('files')}";
 
  		    
 
  		    trending_language.title = k+" "+nr_files;
 
  		    
 
  		    if (percentage>22){
 
  		    	trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"% "+nr_files+ "</b>";	
 
  		    }
 
  		    else{
 
  		    	trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"%</b>";
 
  		    }
 
  		    
 
  		    trending_language.setAttribute("class", 'trending_language top-right-rounded-corner bottom-right-rounded-corner');
 
  		    trending_language.style.width=percentage+"%";
 
			td2.appendChild(trending_language);
 
			
 
			tr.appendChild(td1);
 
			tr.appendChild(td2);
 
  		    tbl.appendChild(tr);
 
  		    if(cnt == 3){
 
  		    	var show_more = document.createElement('tr');
 
  		    	var td = document.createElement('td');
 
  		    	lnk = document.createElement('a');
 
  		    	
 
  		    	lnk.href='#';
 
  		    	lnk.innerHTML = "${_('show more')}";
 
  		    	lnk.id='code_stats_show_more';
 
  		        td.appendChild(lnk);
 
  		        
 
  		    	show_more.appendChild(td);
 
  		    	show_more.appendChild(document.createElement('td'));
 
  		    	tbl.appendChild(show_more);
 
  		    }
 
  		    
 
  		}
 
  		if(no_data){
 
  			var tr = document.createElement('tr');
 
  			var td1 = document.createElement('td');
 
  			td1.innerHTML = "${c.no_data_msg}";
 
  			tr.appendChild(td1);
 
  			tbl.appendChild(tr);
 
		}
 
  		YUD.get('lang_stats').appendChild(tbl);
 
  		YUE.on('code_stats_show_more','click',function(){
 
  			l = YUD.getElementsByClassName('stats_hidden')
 
  			for (e in l){
 
  			    YUD.setStyle(l[e],'display','');
 
  			};
 
  			YUD.setStyle(YUD.get('code_stats_show_more'),
 
  					'display','none');
 
  		})
 
  	
 
             var tmpl_links = {}
 
              %for cnt,archive in enumerate(c.rhodecode_repo._get_archives()):
 
                tmpl_links['${archive['type']}'] = '${h.link_to(archive['type'],
 
                     h.url('files_archive_home',repo_name=c.dbrepo.repo_name,
 
                     fname='__CS__'+archive['extension'],subrepos='__SUB__'),class_="archive_icon")}';
 
              %endfor
 
              
 
             YUE.on(['download_options','archive_subrepos'],'change',function(e){
 
            	 var sm = YUD.get('download_options');
 
                 var new_cs = sm.options[sm.selectedIndex];
 
                 
 
                 for(k in tmpl_links){
 
                	 var s = YUD.get(k+'_link');
 
                	 title_tmpl = "${_('Download %s as %s') % ('__CS_NAME__','__CS_EXT__')}";
 
                	 s.title = title_tmpl.replace('__CS_NAME__',new_cs.text);
 
                	 s.title = s.title.replace('__CS_EXT__',k);
 
                	 var url = tmpl_links[k].replace('__CS__',new_cs.value);
 
                	 var subrepos = YUD.get('archive_subrepos').checked
 
                	 url = url.replace('__SUB__',subrepos);
 
                	 s.innerHTML = url 
 
                 }
 
             });
 
  	</script>    				
 
</div>
 
        
 
<div class="box box-right"  style="min-height:455px">
 
    <!-- box / title -->
 
    <div class="title">
 
        <h5>${_('Commit activity by day / author')}</h5>
 
    </div>
 
    
 
    <div class="graph">
 
         <div style="padding:0 10px 10px 15px;font-size: 1.2em;">
 
         %if c.no_data:
 
           ${c.no_data_msg}
 
           %if h.HasPermissionAll('hg.admin')('enable stats on from summary'):
 
                ${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name),class_="ui-button-small")}
 
           %endif         
 
           
 
        %else:
 
            ${_('Loaded in')} ${c.stats_percentage} %
 
        %endif
 
        </div>  
 
        <div id="commit_history" style="width:450px;height:300px;float:left"></div>
 
        <div style="clear: both;height: 10px"></div>
 
        <div id="overview" style="width:450px;height:100px;float:left"></div>
 
        
 
    	<div id="legend_data" style="clear:both;margin-top:10px;">
 
	    	<div id="legend_container"></div>
 
	    	<div id="legend_choices">
 
				<table id="legend_choices_tables" style="font-size:smaller;color:#545454"></table>
 
				<table id="legend_choices_tables" class="noborder" style="font-size:smaller;color:#545454"></table>
 
	    	</div>
 
    	</div>
 
		<script type="text/javascript">
 
		/**
 
		 * Plots summary graph
 
		 *
 
		 * @class SummaryPlot
 
		 * @param {from} initial from for detailed graph
 
		 * @param {to} initial to for detailed graph
 
		 * @param {dataset}
 
		 * @param {overview_dataset}
 
		 */
 
		function SummaryPlot(from,to,dataset,overview_dataset) {
 
			var initial_ranges = {
 
			    "xaxis":{
 
				    "from":from,
 
				   	"to":to,
 
				},
 
			};
 
		    var dataset = dataset;
 
		    var overview_dataset = [overview_dataset];
 
		    var choiceContainer = YUD.get("legend_choices");
 
		    var choiceContainerTable = YUD.get("legend_choices_tables");
 
		    var plotContainer = YUD.get('commit_history');
 
		    var overviewContainer = YUD.get('overview');
 
		    
 
		    var plot_options = {
 
				bars: {show:true,align:'center',lineWidth:4},
 
				legend: {show:true, container:"legend_container"},
 
				points: {show:true,radius:0,fill:false},
 
				yaxis: {tickDecimals:0,},
 
				xaxis: {
 
					mode: "time", 
 
					timeformat: "%d/%m",
 
				    min:from,
 
				    max:to,	
 
				}, 
 
				grid: {
 
					hoverable: true, 
 
				    clickable: true,
 
				    autoHighlight:true,
 
				    color: "#999"
 
				},
 
				//selection: {mode: "x"}
 
		    };
 
		    var overview_options = {
 
				legend:{show:false},
 
			    bars: {show:true,barWidth: 2,},
 
			    shadowSize: 0,
 
			    xaxis: {mode: "time", timeformat: "%d/%m/%y",},
 
			    yaxis: {ticks: 3, min: 0,tickDecimals:0,},
 
			    grid: {color: "#999",},
 
			    selection: {mode: "x"}
 
			};
 

	
 
			/**
 
			*get dummy data needed in few places
 
			*/
 
		    function getDummyData(label){
 
		    	return {"label":label,
 
               	 "data":[{"time":0,
 
               		 "commits":0,
 
	                     "added":0,
 
	                     "changed":0,
 
	                     "removed":0,
 
                    }],
 
                    "schema":["commits"],
 
                    "color":'#ffffff',
 
           		}
 
			}
 
			
 
		    /**
 
		     * generate checkboxes accordindly to data
 
		     * @param keys
 
		     * @returns
 
		     */
 
		    function generateCheckboxes(data) {
 
			    //append checkboxes
 
			    var i = 0;
 
			    choiceContainerTable.innerHTML = '';
 
			    for(var pos in data) {
 
			    	
 
			    	data[pos].color = i;
 
			        i++;
 
			        if(data[pos].label != ''){
 
				        choiceContainerTable.innerHTML += '<tr><td>'+
 
				        '<input type="checkbox" name="' + data[pos].label +'" checked="checked" />'
 
				        +data[pos].label+
 
				        '</td></tr>';
 
			        }
 
			    }	
 
		    }
 
		    
 
		    /**
 
		     * ToolTip show
 
		     */
 
		    function showTooltip(x, y, contents) {
 
		        var div=document.getElementById('tooltip');
 
		        if(!div) {
 
		            div = document.createElement('div');
 
		            div.id="tooltip";
 
		            div.style.position="absolute";
 
		            div.style.border='1px solid #fdd';
 
		            div.style.padding='2px';
 
		            div.style.backgroundColor='#fee';
 
		            document.body.appendChild(div);
 
		        }
 
		        YUD.setStyle(div, 'opacity', 0);
 
		        div.innerHTML = contents;
 
		        div.style.top=(y + 5) + "px";
 
		        div.style.left=(x + 5) + "px";
 

	
 
		        var anim = new YAHOO.util.Anim(div, {opacity: {to: 0.8}}, 0.2);
 
		        anim.animate();
 
		    }
 
		    
 
			/**
 
			 * This function will detect if selected period has some changesets 
 
			   for this user if it does this data is then pushed for displaying
 
			   Additionally it will only display users that are selected by the checkbox
 
			*/
 
		    function getDataAccordingToRanges(ranges) {
 
		    	
 
		        var data = [];
 
		        var new_dataset = {};
 
		        var keys = [];
 
		        var max_commits = 0;
 
				for(var key in dataset){
 
					
 
		            for(var ds in dataset[key].data){
 
			            commit_data = dataset[key].data[ds];
 
			            if (commit_data.time >= ranges.xaxis.from && commit_data.time <= ranges.xaxis.to){
 

	
 
			            	if(new_dataset[key] === undefined){
 
			            		new_dataset[key] = {data:[],schema:["commits"],label:key};	
 
			            	}
 
			            	new_dataset[key].data.push(commit_data);
 
					    }
 
				    }
 
		            if (new_dataset[key] !== undefined){
 
		            	data.push(new_dataset[key]);	
 
		            }
 
				}
 

	
 
				if (data.length > 0){
 
					return data;	
 
				}
 
				else{
 
					//just return dummy data for graph to plot itself
 
					return [getDummyData('')];	
 
				}
 
		    }
 
		    
 
			/**
 
			* redraw using new checkbox data
 
			*/
 
		    function plotchoiced(e,args){
 
			    var cur_data = args[0];
 
			    var cur_ranges = args[1];
 
		    	
 
				var new_data = [];
 
		    	var inputs = choiceContainer.getElementsByTagName("input");
 

	
 
		    	//show only checked labels
 
		        for(var i=0; i<inputs.length; i++) {
 
		            var checkbox_key = inputs[i].name;
 
		            
 
	                if(inputs[i].checked){
 
						for(var d in cur_data){
 
							if(cur_data[d].label == checkbox_key){
 
								new_data.push(cur_data[d]);
 
							}
 
						}			                
 
	    	        }
 
	                else{
 
		                //push dummy data to not hide the label
 
						new_data.push(getDummyData(checkbox_key));
 
			        }
 
		        }
 
					        
 
		    	var new_options = YAHOO.lang.merge(plot_options, {
 
		            xaxis: { 
 
		  	      		min: cur_ranges.xaxis.from, 
 
		  	      		max: cur_ranges.xaxis.to,
 
		  	      		mode:"time",
 
		  	      		timeformat: "%d/%m",
 
		        	},
 
		    	});
 
		    	if (!new_data){
 
					new_data = [[0,1]];
 
				}
 
		    	// do the zooming
 
		       plot = YAHOO.widget.Flot(plotContainer, new_data, new_options);
 
		       
 
		       plot.subscribe("plotselected", plotselected);
 
	
 
		       //resubscribe plothover
 
		       plot.subscribe("plothover", plothover);
 
		        
 
		       // don't fire event on the overview to prevent eternal loop 
 
		       overview.setSelection(cur_ranges, true);
 
	
 
		    }
 
		    
 
			/**
 
		     * plot only selected items from overview
 
		     * @param ranges
 
		     * @returns
 
		     */
 
		    function plotselected(ranges,cur_data) {
 
			    //updates the data for new plot
 
	    		var data = getDataAccordingToRanges(ranges);
 
	    		generateCheckboxes(data);
 
	    		
 
		    	var new_options = YAHOO.lang.merge(plot_options, {
 
		            xaxis: { 
 
		  	      		min: ranges.xaxis.from, 
 
		  	      		max: ranges.xaxis.to,
 
		  	      		mode:"time",
 
		  	      		timeformat: "%d/%m",
 
		        	},
 
		    	});
 
		    	// do the zooming 
 
		        plot = YAHOO.widget.Flot(plotContainer, data, new_options);
 

	
 
		        plot.subscribe("plotselected", plotselected);
 

	
 
		        //resubscribe plothover
 
		        plot.subscribe("plothover", plothover);
 
		        
 
		        // don't fire event on the overview to prevent eternal loop
 
		        overview.setSelection(ranges, true);
 

	
 
		        //resubscribe choiced 
 
		        YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, ranges]);
 
		    }
 
		    
 
		    var previousPoint = null;
 

	
 
			function plothover(o) {
 
		        var pos = o.pos;
 
		        var item = o.item;
 
		        
 
		        //YUD.get("x").innerHTML = pos.x.toFixed(2);
 
		        //YUD.get("y").innerHTML = pos.y.toFixed(2);
 
		        if (item) {
 
		            if (previousPoint != item.datapoint) {
 
		                previousPoint = item.datapoint;
 
		                
 
		                var tooltip = YUD.get("tooltip");
 
		                if(tooltip) {
 
		                	  tooltip.parentNode.removeChild(tooltip);
 
		                }
 
		                var x = item.datapoint.x.toFixed(2);
 
		                var y = item.datapoint.y.toFixed(2);
 
						
 
		                if (!item.series.label){
 
		                    item.series.label = 'commits';
 
		                }
 
		                var d = new Date(x*1000);
 
		                var fd = d.toDateString()
 
		                var nr_commits = parseInt(y);
 
		                
 
		                var cur_data = dataset[item.series.label].data[item.dataIndex];
 
		                var added = cur_data.added;
 
		                var changed = cur_data.changed;
 
		                var removed = cur_data.removed;
 
		                
 
		                var nr_commits_suffix = " ${_('commits')} ";
 
		                var added_suffix = " ${_('files added')} ";
 
		                var changed_suffix = " ${_('files changed')} ";
 
		                var removed_suffix = " ${_('files removed')} ";
 

	
 
		                
 
		                if(nr_commits == 1){nr_commits_suffix = " ${_('commit')} ";}
 
						if(added==1){added_suffix=" ${_('file added')} ";}
 
						if(changed==1){changed_suffix=" ${_('file changed')} ";}
 
						if(removed==1){removed_suffix=" ${_('file removed')} ";}
 
										                
 
		                showTooltip(item.pageX, item.pageY, item.series.label + " on " + fd
 
								 +'<br/>'+
 
		                         nr_commits + nr_commits_suffix+'<br/>'+
 
		                         added + added_suffix +'<br/>'+
 
		                         changed + changed_suffix + '<br/>'+
 
		                         removed + removed_suffix + '<br/>');
 
		            }
 
		        }
 
		        else {
 
		        	  var tooltip = YUD.get("tooltip");
 
		        	  
 
			          if(tooltip) {
 
			                tooltip.parentNode.removeChild(tooltip);
 
			          }
 
		            previousPoint = null;
 
		        }
 
		    }
 
			
 
		    /**
 
		     * MAIN EXECUTION
 
		     */
 
			
 
			var data = getDataAccordingToRanges(initial_ranges);    
 
			generateCheckboxes(data);
 
			
 
		    //main plot 
 
		    var plot = YAHOO.widget.Flot(plotContainer,data,plot_options);
 
		    
 
			//overview 
 
			var overview = YAHOO.widget.Flot(overviewContainer, 
 
					overview_dataset, overview_options);
 
			
 
			//show initial selection on overview 
 
			overview.setSelection(initial_ranges);    
 
			
 
		    plot.subscribe("plotselected", plotselected);
 
		    plot.subscribe("plothover", plothover)
 
		    
 
		    overview.subscribe("plotselected", function (ranges) {
 
		        plot.setSelection(ranges);
 
		    });		
 

	
 
		    YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, initial_ranges]);
 
		}
 
			SummaryPlot(${c.ts_min},${c.ts_max},${c.commit_data|n},${c.overview_data|n});		
 
		</script>
 

	
 
    </div>
 
</div>    
 

	
 
<div class="box">    
 
    <div class="title">
 
        <div class="breadcrumbs">${h.link_to(_('Shortlog'),h.url('shortlog_home',repo_name=c.repo_name))}</div>
 
    </div>    
 
    <div class="table">
 
        <div id="shortlog_data">
 
            <%include file='../shortlog/shortlog_data.html'/>
 
        </div>
 
        ##%if c.repo_changesets:
 
        ##	${h.link_to(_('show more'),h.url('changelog_home',repo_name=c.repo_name))}
 
        ##%endif
 
    </div>
 
</div>
 

	
 
%if c.readme_data:
 
<div class="box" style="background-color: #FAFAFA">    
 
    <div class="title">
 
        <div class="breadcrumbs"><a href="${h.url('files_home',repo_name=c.repo_name,revision='tip',f_path=c.readme_file)}">${c.readme_file}</a></div>
 
    </div>    
 
    <div class="readme">
 
      <div class="readme_box">
 
        ${c.readme_data|n}
 
      </div>
 
    </div>
 
</div>
 
<div class="box">    
 
    <div class="title">
 
        <div class="breadcrumbs">${h.link_to(_('Tags'),h.url('tags_home',repo_name=c.repo_name))}</div>
 
    </div>    
 
    <div class="table">
 
        <%include file='../tags/tags_data.html'/>
 
        %if c.repo_changesets:
 
        	${h.link_to(_('show more'),h.url('tags_home',repo_name=c.repo_name))}
 
        %endif
 
    </div>
 
</div>
 
<div class="box">
 
    <div class="title">
 
        <div class="breadcrumbs">${h.link_to(_('Branches'),h.url('branches_home',repo_name=c.repo_name))}</div>
 
    </div>    
 
    <div class="table">
 
        <%include file='../branches/branches_data.html'/>
 
        %if c.repo_changesets:
 
        	${h.link_to(_('show more'),h.url('branches_home',repo_name=c.repo_name))}
 
        %endif
 
    </div>      
 
</div> 
 
%endif
 

	
 
<script type="text/javascript">
 
        YUE.onDOMReady(function(e){
 
            id = 'clone_url';
 
            YUE.on(id,'click',function(e){
 
                if(YUD.hasClass(id,'selected')){
 
                    return
 
                }
 
                else{
 
                    YUD.addClass(id,'selected');
 
                    YUD.get(id).select();                   
 
                }
 

	
 
            })
 
        })
 
        var data = ${c.trending_languages|n};
 
        var total = 0;
 
        var no_data = true;
 
        for (k in data){
 
            total += data[k].count;
 
            no_data = false;
 
        } 
 
        var tbl = document.createElement('table');
 
        tbl.setAttribute('class','trending_language_tbl');
 
        var cnt = 0;
 
        for (k in data){
 
            cnt += 1;
 
            var hide = cnt>2;
 
            var tr = document.createElement('tr');
 
            if (hide){
 
                tr.setAttribute('style','display:none');
 
                tr.setAttribute('class','stats_hidden');
 
            }
 
            var percentage = Math.round((data[k].count/total*100),2);
 
            var value = data[k].count;
 
            var td1 = document.createElement('td');
 
            td1.width = 150;
 
            var trending_language_label = document.createElement('div');
 
            trending_language_label.innerHTML = data[k].desc+" ("+k+")";
 
            td1.appendChild(trending_language_label);
 

	
 
            var td2 = document.createElement('td');
 
            td2.setAttribute('style','padding-right:14px !important');
 
            var trending_language = document.createElement('div');
 
            var nr_files = value+" ${_('files')}";
 
            
 
            trending_language.title = k+" "+nr_files;
 
            
 
            if (percentage>22){
 
                trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"% "+nr_files+ "</b>";   
 
            }
 
            else{
 
                trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"%</b>";
 
            }
 
            
 
            trending_language.setAttribute("class", 'trending_language top-right-rounded-corner bottom-right-rounded-corner');
 
            trending_language.style.width=percentage+"%";
 
            td2.appendChild(trending_language);
 
            
 
            tr.appendChild(td1);
 
            tr.appendChild(td2);
 
            tbl.appendChild(tr);
 
            if(cnt == 3){
 
                var show_more = document.createElement('tr');
 
                var td = document.createElement('td');
 
                lnk = document.createElement('a');
 
                
 
                lnk.href='#';
 
                lnk.innerHTML = "${_('show more')}";
 
                lnk.id='code_stats_show_more';
 
                td.appendChild(lnk);
 
                
 
                show_more.appendChild(td);
 
                show_more.appendChild(document.createElement('td'));
 
                tbl.appendChild(show_more);
 
            }
 
            
 
        }
 
        if(no_data){
 
            var tr = document.createElement('tr');
 
            var td1 = document.createElement('td');
 
            td1.innerHTML = "${c.no_data_msg}";
 
            tr.appendChild(td1);
 
            tbl.appendChild(tr);
 
        }
 
        YUD.get('lang_stats').appendChild(tbl);
 
        YUE.on('code_stats_show_more','click',function(){
 
            l = YUD.getElementsByClassName('stats_hidden')
 
            for (e in l){
 
                YUD.setStyle(l[e],'display','');
 
            };
 
            YUD.setStyle(YUD.get('code_stats_show_more'),
 
                    'display','none');
 
        })
 
    
 
             var tmpl_links = {}
 
              %for cnt,archive in enumerate(c.rhodecode_repo._get_archives()):
 
                tmpl_links['${archive['type']}'] = '${h.link_to(archive['type'],
 
                     h.url('files_archive_home',repo_name=c.dbrepo.repo_name,
 
                     fname='__CS__'+archive['extension'],subrepos='__SUB__'),class_="archive_icon")}';
 
              %endfor
 
              
 
             YUE.on(['download_options','archive_subrepos'],'change',function(e){
 
                 var sm = YUD.get('download_options');
 
                 var new_cs = sm.options[sm.selectedIndex];
 
                 
 
                 for(k in tmpl_links){
 
                     var s = YUD.get(k+'_link');
 
                     title_tmpl = "${_('Download %s as %s') % ('__CS_NAME__','__CS_EXT__')}";
 
                     s.title = title_tmpl.replace('__CS_NAME__',new_cs.text);
 
                     s.title = s.title.replace('__CS_EXT__',k);
 
                     var url = tmpl_links[k].replace('__CS__',new_cs.value);
 
                     var subrepos = YUD.get('archive_subrepos').checked
 
                     url = url.replace('__SUB__',subrepos);
 
                     s.innerHTML = url 
 
                 }
 
             });
 
    </script>   
 
<script type="text/javascript">
 
        /**
 
         * Plots summary graph
 
         *
 
         * @class SummaryPlot
 
         * @param {from} initial from for detailed graph
 
         * @param {to} initial to for detailed graph
 
         * @param {dataset}
 
         * @param {overview_dataset}
 
         */
 
        function SummaryPlot(from,to,dataset,overview_dataset) {
 
            var initial_ranges = {
 
                "xaxis":{
 
                    "from":from,
 
                    "to":to,
 
                },
 
            };
 
            var dataset = dataset;
 
            var overview_dataset = [overview_dataset];
 
            var choiceContainer = YUD.get("legend_choices");
 
            var choiceContainerTable = YUD.get("legend_choices_tables");
 
            var plotContainer = YUD.get('commit_history');
 
            var overviewContainer = YUD.get('overview');
 
            
 
            var plot_options = {
 
                bars: {show:true,align:'center',lineWidth:4},
 
                legend: {show:true, container:"legend_container"},
 
                points: {show:true,radius:0,fill:false},
 
                yaxis: {tickDecimals:0,},
 
                xaxis: {
 
                    mode: "time", 
 
                    timeformat: "%d/%m",
 
                    min:from,
 
                    max:to, 
 
                }, 
 
                grid: {
 
                    hoverable: true, 
 
                    clickable: true,
 
                    autoHighlight:true,
 
                    color: "#999"
 
                },
 
                //selection: {mode: "x"}
 
            };
 
            var overview_options = {
 
                legend:{show:false},
 
                bars: {show:true,barWidth: 2,},
 
                shadowSize: 0,
 
                xaxis: {mode: "time", timeformat: "%d/%m/%y",},
 
                yaxis: {ticks: 3, min: 0,tickDecimals:0,},
 
                grid: {color: "#999",},
 
                selection: {mode: "x"}
 
            };
 

	
 
            /**
 
            *get dummy data needed in few places
 
            */
 
            function getDummyData(label){
 
                return {"label":label,
 
                 "data":[{"time":0,
 
                     "commits":0,
 
                         "added":0,
 
                         "changed":0,
 
                         "removed":0,
 
                    }],
 
                    "schema":["commits"],
 
                    "color":'#ffffff',
 
                }
 
            }
 
            
 
            /**
 
             * generate checkboxes accordindly to data
 
             * @param keys
 
             * @returns
 
             */
 
            function generateCheckboxes(data) {
 
                //append checkboxes
 
                var i = 0;
 
                choiceContainerTable.innerHTML = '';
 
                for(var pos in data) {
 
                    
 
                    data[pos].color = i;
 
                    i++;
 
                    if(data[pos].label != ''){
 
                        choiceContainerTable.innerHTML += '<tr><td>'+
 
                        '<input type="checkbox" name="' + data[pos].label +'" checked="checked" />'
 
                        +data[pos].label+
 
                        '</td></tr>';
 
                    }
 
                }   
 
            }
 
            
 
            /**
 
             * ToolTip show
 
             */
 
            function showTooltip(x, y, contents) {
 
                var div=document.getElementById('tooltip');
 
                if(!div) {
 
                    div = document.createElement('div');
 
                    div.id="tooltip";
 
                    div.style.position="absolute";
 
                    div.style.border='1px solid #fdd';
 
                    div.style.padding='2px';
 
                    div.style.backgroundColor='#fee';
 
                    document.body.appendChild(div);
 
                }
 
                YUD.setStyle(div, 'opacity', 0);
 
                div.innerHTML = contents;
 
                div.style.top=(y + 5) + "px";
 
                div.style.left=(x + 5) + "px";
 

	
 
                var anim = new YAHOO.util.Anim(div, {opacity: {to: 0.8}}, 0.2);
 
                anim.animate();
 
            }
 
            
 
            /**
 
             * This function will detect if selected period has some changesets 
 
               for this user if it does this data is then pushed for displaying
 
               Additionally it will only display users that are selected by the checkbox
 
            */
 
            function getDataAccordingToRanges(ranges) {
 
                
 
                var data = [];
 
                var new_dataset = {};
 
                var keys = [];
 
                var max_commits = 0;
 
                for(var key in dataset){
 
                    
 
                    for(var ds in dataset[key].data){
 
                        commit_data = dataset[key].data[ds];
 
                        if (commit_data.time >= ranges.xaxis.from && commit_data.time <= ranges.xaxis.to){
 

	
 
                            if(new_dataset[key] === undefined){
 
                                new_dataset[key] = {data:[],schema:["commits"],label:key};  
 
                            }
 
                            new_dataset[key].data.push(commit_data);
 
                        }
 
                    }
 
                    if (new_dataset[key] !== undefined){
 
                        data.push(new_dataset[key]);    
 
                    }
 
                }
 

	
 
                if (data.length > 0){
 
                    return data;    
 
                }
 
                else{
 
                    //just return dummy data for graph to plot itself
 
                    return [getDummyData('')];  
 
                }
 
            }
 
            
 
            /**
 
            * redraw using new checkbox data
 
            */
 
            function plotchoiced(e,args){
 
                var cur_data = args[0];
 
                var cur_ranges = args[1];
 
                
 
                var new_data = [];
 
                var inputs = choiceContainer.getElementsByTagName("input");
 

	
 
                //show only checked labels
 
                for(var i=0; i<inputs.length; i++) {
 
                    var checkbox_key = inputs[i].name;
 
                    
 
                    if(inputs[i].checked){
 
                        for(var d in cur_data){
 
                            if(cur_data[d].label == checkbox_key){
 
                                new_data.push(cur_data[d]);
 
                            }
 
                        }                           
 
                    }
 
                    else{
 
                        //push dummy data to not hide the label
 
                        new_data.push(getDummyData(checkbox_key));
 
                    }
 
                }
 
                            
 
                var new_options = YAHOO.lang.merge(plot_options, {
 
                    xaxis: { 
 
                        min: cur_ranges.xaxis.from, 
 
                        max: cur_ranges.xaxis.to,
 
                        mode:"time",
 
                        timeformat: "%d/%m",
 
                    },
 
                });
 
                if (!new_data){
 
                    new_data = [[0,1]];
 
                }
 
                // do the zooming
 
               plot = YAHOO.widget.Flot(plotContainer, new_data, new_options);
 
               
 
               plot.subscribe("plotselected", plotselected);
 
    
 
               //resubscribe plothover
 
               plot.subscribe("plothover", plothover);
 
                
 
               // don't fire event on the overview to prevent eternal loop 
 
               overview.setSelection(cur_ranges, true);
 
    
 
            }
 
            
 
            /**
 
             * plot only selected items from overview
 
             * @param ranges
 
             * @returns
 
             */
 
            function plotselected(ranges,cur_data) {
 
                //updates the data for new plot
 
                var data = getDataAccordingToRanges(ranges);
 
                generateCheckboxes(data);
 
                
 
                var new_options = YAHOO.lang.merge(plot_options, {
 
                    xaxis: { 
 
                        min: ranges.xaxis.from, 
 
                        max: ranges.xaxis.to,
 
                        mode:"time",
 
                        timeformat: "%d/%m",
 
                    },
 
                });
 
                // do the zooming 
 
                plot = YAHOO.widget.Flot(plotContainer, data, new_options);
 

	
 
                plot.subscribe("plotselected", plotselected);
 

	
 
                //resubscribe plothover
 
                plot.subscribe("plothover", plothover);
 
                
 
                // don't fire event on the overview to prevent eternal loop
 
                overview.setSelection(ranges, true);
 

	
 
                //resubscribe choiced 
 
                YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, ranges]);
 
            }
 
            
 
            var previousPoint = null;
 

	
 
            function plothover(o) {
 
                var pos = o.pos;
 
                var item = o.item;
 
                
 
                //YUD.get("x").innerHTML = pos.x.toFixed(2);
 
                //YUD.get("y").innerHTML = pos.y.toFixed(2);
 
                if (item) {
 
                    if (previousPoint != item.datapoint) {
 
                        previousPoint = item.datapoint;
 
                        
 
                        var tooltip = YUD.get("tooltip");
 
                        if(tooltip) {
 
                              tooltip.parentNode.removeChild(tooltip);
 
                        }
 
                        var x = item.datapoint.x.toFixed(2);
 
                        var y = item.datapoint.y.toFixed(2);
 
                        
 
                        if (!item.series.label){
 
                            item.series.label = 'commits';
 
                        }
 
                        var d = new Date(x*1000);
 
                        var fd = d.toDateString()
 
                        var nr_commits = parseInt(y);
 
                        
 
                        var cur_data = dataset[item.series.label].data[item.dataIndex];
 
                        var added = cur_data.added;
 
                        var changed = cur_data.changed;
 
                        var removed = cur_data.removed;
 
                        
 
                        var nr_commits_suffix = " ${_('commits')} ";
 
                        var added_suffix = " ${_('files added')} ";
 
                        var changed_suffix = " ${_('files changed')} ";
 
                        var removed_suffix = " ${_('files removed')} ";
 

	
 
                        
 
                        if(nr_commits == 1){nr_commits_suffix = " ${_('commit')} ";}
 
                        if(added==1){added_suffix=" ${_('file added')} ";}
 
                        if(changed==1){changed_suffix=" ${_('file changed')} ";}
 
                        if(removed==1){removed_suffix=" ${_('file removed')} ";}
 
                                                        
 
                        showTooltip(item.pageX, item.pageY, item.series.label + " on " + fd
 
                                 +'<br/>'+
 
                                 nr_commits + nr_commits_suffix+'<br/>'+
 
                                 added + added_suffix +'<br/>'+
 
                                 changed + changed_suffix + '<br/>'+
 
                                 removed + removed_suffix + '<br/>');
 
                    }
 
                }
 
                else {
 
                      var tooltip = YUD.get("tooltip");
 
                      
 
                      if(tooltip) {
 
                            tooltip.parentNode.removeChild(tooltip);
 
                      }
 
                    previousPoint = null;
 
                }
 
            }
 
            
 
            /**
 
             * MAIN EXECUTION
 
             */
 
            
 
            var data = getDataAccordingToRanges(initial_ranges);    
 
            generateCheckboxes(data);
 
            
 
            //main plot 
 
            var plot = YAHOO.widget.Flot(plotContainer,data,plot_options);
 
            
 
            //overview 
 
            var overview = YAHOO.widget.Flot(overviewContainer, 
 
                    overview_dataset, overview_options);
 
            
 
            //show initial selection on overview 
 
            overview.setSelection(initial_ranges);    
 
            
 
            plot.subscribe("plotselected", plotselected);
 
            plot.subscribe("plothover", plothover)
 
            
 
            overview.subscribe("plotselected", function (ranges) {
 
                plot.setSelection(ranges);
 
            });     
 

	
 
            YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, initial_ranges]);
 
        }
 
            SummaryPlot(${c.ts_min},${c.ts_max},${c.commit_data|n},${c.overview_data|n});       
 
        </script>
 

	
 
</%def>    
rhodecode/templates/switch_to_list.html
Show inline comments
 
new file 100644
 
## -*- coding: utf-8 -*-                        
 
<li>
 
    ${h.link_to('%s (%s)' % (_('branches'),len(c.rhodecode_repo.branches.values()),),h.url('branches_home',repo_name=c.repo_name),class_='branches childs')}
 
    <ul>
 
    %if c.rhodecode_repo.branches.values():
 
        %for cnt,branch in enumerate(c.rhodecode_repo.branches.items()):
 
            <li>${h.link_to('%s - %s' % (branch[0],h.short_id(branch[1])),h.url('files_home',repo_name=c.repo_name,revision=branch[1]))}</li>
 
        %endfor
 
    %else:
 
        <li>${h.link_to(_('There are no branches yet'),'#')}</li>
 
    %endif
 
    </ul>                        
 
</li>
 
<li>
 
    ${h.link_to('%s (%s)' % (_('tags'),len(c.rhodecode_repo.tags.values()),),h.url('tags_home',repo_name=c.repo_name),class_='tags childs')}
 
    <ul>
 
    %if c.rhodecode_repo.tags.values():
 
        %for cnt,tag in enumerate(c.rhodecode_repo.tags.items()):
 
         <li>${h.link_to('%s - %s' % (tag[0],h.short_id(tag[1])),h.url('files_home',repo_name=c.repo_name,revision=tag[1]))}</li>
 
        %endfor
 
    %else:
 
        <li>${h.link_to(_('There are no tags yet'),'#')}</li>
 
    %endif
 
    </ul>                        
 
</li>  
 
\ No newline at end of file
setup.py
Show inline comments
 
import sys
 
from rhodecode import get_version
 
from rhodecode import __platform__
 
from rhodecode import __license__
 
from rhodecode import PLATFORM_OTHERS
 

	
 
py_version = sys.version_info
 

	
 
if py_version < (2, 5):
 
    raise Exception('RhodeCode requires python 2.5 or later')
 

	
 
requirements = [
 
        "Pylons==1.0.0",
 
        "Beaker==1.5.4",
 
        "WebHelpers>=1.2",
 
        "formencode==1.2.4",
 
        "SQLAlchemy==0.7.3",
 
        "Mako==0.5.0",
 
        "pygments>=1.4",
 
        "mercurial>=1.9.3,<2.0",
 
        "whoosh<1.8",
 
        "celery>=2.2.5,<2.3",
 
        "babel",
 
        "python-dateutil>=1.5.0,<2.0.0",
 
        "dulwich>=0.8.0,<0.9.0",
 
        "vcs>=0.2.3.dev",
 
        "webob==1.0.8"
 
        "webob==1.0.8",
 
        "markdown==2.0.3",
 
        "docutils==0.8.1",
 
    ]
 

	
 
dependency_links = [
 
    "https://secure.rhodecode.org/vcs/archive/default.zip#egg=vcs-0.2.3.dev",
 
    "https://bitbucket.org/marcinkuzminski/vcs/get/default.zip#egg=vcs-0.2.3.dev",
 
]
 

	
 
classifiers = ['Development Status :: 4 - Beta',
 
               'Environment :: Web Environment',
 
               'Framework :: Pylons',
 
               'Intended Audience :: Developers',
 
               'License :: OSI Approved :: GNU General Public License (GPL)',
 
               'Operating System :: OS Independent',
 
               'Programming Language :: Python',
 
               'Programming Language :: Python :: 2.5',
 
               'Programming Language :: Python :: 2.6',
 
               'Programming Language :: Python :: 2.7', ]
 

	
 
if py_version < (2, 6):
 
    requirements.append("simplejson")
 
    requirements.append("pysqlite")
 

	
 
if __platform__ in PLATFORM_OTHERS:
 
    requirements.append("py-bcrypt")
 

	
 

	
 
#additional files from project that goes somewhere in the filesystem
 
#relative to sys.prefix
 
data_files = []
 

	
 
#additional files that goes into package itself
 
package_data = {'rhodecode': ['i18n/*/LC_MESSAGES/*.mo', ], }
 

	
 
description = ('Mercurial repository browser/management with '
 
               'build in push/pull server and full text search')
 
keywords = ' '.join(['rhodecode', 'rhodiumcode', 'mercurial', 'git',
 
                      'repository management', 'hgweb replacement'
 
                      'hgwebdir', 'gitweb replacement', 'serving hgweb', ])
 
#long description
 
try:
 
    readme_file = 'README.rst'
 
    changelog_file = 'docs/changelog.rst'
 
    long_description = open(readme_file).read() + '\n\n' + \
 
        open(changelog_file).read()
 

	
 
except IOError, err:
 
    sys.stderr.write("[WARNING] Cannot find file specified as "
 
        "long_description (%s)\n or changelog (%s) skipping that file" \
 
            % (readme_file, changelog_file))
 
    long_description = description
 

	
 

	
 
try:
 
    from setuptools import setup, find_packages
 
except ImportError:
 
    from ez_setup import use_setuptools
 
    use_setuptools()
 
    from setuptools import setup, find_packages
 
#packages
 
packages = find_packages(exclude=['ez_setup'])
 

	
 
setup(
 
    name='RhodeCode',
 
    version=get_version(),
 
    description=description,
 
    long_description=long_description,
 
    keywords=keywords,
 
    license=__license__,
 
    author='Marcin Kuzminski',
 
    author_email='marcin@python-works.com',
 
    dependency_links=dependency_links,
 
    url='http://rhodecode.org',
 
    install_requires=requirements,
 
    classifiers=classifiers,
 
    setup_requires=["PasteScript>=1.6.3"],
 
    data_files=data_files,
 
    packages=packages,
 
    include_package_data=True,
 
    test_suite='nose.collector',
 
    package_data=package_data,
 
    message_extractors={'rhodecode': [
 
            ('**.py', 'python', None),
 
            ('templates/**.mako', 'mako', {'input_encoding': 'utf-8'}),
 
            ('templates/**.html', 'mako', {'input_encoding': 'utf-8'}),
 
            ('public/**', 'ignore', None)]},
 
    zip_safe=False,
 
    paster_plugins=['PasteScript', 'Pylons'],
 
    entry_points="""
 
    [paste.app_factory]
 
    main = rhodecode.config.middleware:make_app
 

	
 
    [paste.app_install]
 
    main = pylons.util:PylonsInstaller
 

	
 
    [paste.global_paster_command]
 
    make-index = rhodecode.lib.indexers:MakeIndex
 
    upgrade-db = rhodecode.lib.dbmigrate:UpgradeDb
 
    celeryd=rhodecode.lib.celerypylons.commands:CeleryDaemonCommand
 
    """,
 
)
test.ini
Show inline comments
 
################################################################################
 
################################################################################
 
# RhodeCode - Pylons environment configuration                                 #
 
#                                                                              # 
 
# The %(here)s variable will be replaced with the parent directory of this file#
 
################################################################################
 

	
 
[DEFAULT]
 
debug = true
 
pdebug = false
 
################################################################################
 
## Uncomment and replace with the address which should receive                ## 
 
## any error reports after application crash                                  ##
 
## Additionally those settings will be used by RhodeCode mailing system       ##
 
################################################################################
 
#email_to = admin@localhost
 
#error_email_from = paste_error@localhost
 
#app_email_from = rhodecode-noreply@localhost
 
#error_message =
 

	
 
#smtp_server = mail.server.com
 
#smtp_username = 
 
#smtp_password = 
 
#smtp_port = 
 
#smtp_use_tls = false
 
#smtp_use_ssl = true
 

	
 
[server:main]
 
##nr of threads to spawn
 
threadpool_workers = 5
 

	
 
##max request before thread respawn
 
threadpool_max_requests = 2
 

	
 
##option to use threads of process
 
use_threadpool = true
 

	
 
use = egg:Paste#http
 
host = 127.0.0.1
 
port = 5000
 

	
 
[app:main]
 
use = egg:rhodecode
 
full_stack = true
 
static_files = true
 
lang=en
 
cache_dir = /tmp/data
 
index_dir = /tmp/index
 
app_instance_uuid = develop-test
 
cut_off_limit = 256000
 
force_https = false
 
commit_parse_limit = 25
 
use_gravatar = true
 

	
 
####################################
 
###        CELERY CONFIG        ####
 
####################################
 
use_celery = false
 
broker.host = localhost
 
broker.vhost = rabbitmqhost
 
broker.port = 5672
 
broker.user = rabbitmq
 
broker.password = qweqwe
 

	
 
celery.imports = rhodecode.lib.celerylib.tasks
 

	
 
celery.result.backend = amqp
 
celery.result.dburi = amqp://
 
celery.result.serialier = json
 

	
 
#celery.send.task.error.emails = true
 
#celery.amqp.task.result.expires = 18000
 

	
 
celeryd.concurrency = 2
 
#celeryd.log.file = celeryd.log
 
celeryd.log.level = debug
 
celeryd.max.tasks.per.child = 1
 

	
 
#tasks will never be sent to the queue, but executed locally instead.
 
celery.always.eager = false
 

	
 
####################################
 
###         BEAKER CACHE        ####
 
####################################
 
beaker.cache.data_dir=/tmp/data/cache/data
 
beaker.cache.lock_dir=/tmp/data/cache/lock
 
beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
 

	
 
beaker.cache.super_short_term.type=memory
 
beaker.cache.super_short_term.expire=10
 
beaker.cache.super_short_term.key_length = 256
 

	
 
beaker.cache.short_term.type=memory
 
beaker.cache.short_term.expire=60
 
beaker.cache.short_term.key_length = 256
 

	
 
beaker.cache.long_term.type=memory
 
beaker.cache.long_term.expire=36000
 
beaker.cache.long_term.key_length = 256
 

	
 
beaker.cache.sql_cache_short.type=memory
 
beaker.cache.sql_cache_short.expire=10
 
beaker.cache.sql_cache_short.key_length = 256
 

	
 
beaker.cache.sql_cache_med.type=memory
 
beaker.cache.sql_cache_med.expire=360
 
beaker.cache.sql_cache_med.key_length = 256
 

	
 
beaker.cache.sql_cache_long.type=file
 
beaker.cache.sql_cache_long.expire=3600
 
beaker.cache.sql_cache_long.key_length = 256
 

	
 
####################################
 
###       BEAKER SESSION        ####
 
####################################
 
## Type of storage used for the session, current types are 
 
## dbm, file, memcached, database, and memory. 
 
## The storage uses the Container API 
 
##that is also used by the cache system.
 
beaker.session.type = file
 

	
 
beaker.session.key = rhodecode
 
beaker.session.secret = g654dcno0-9873jhgfreyu
 
beaker.session.timeout = 36000
 

	
 
##auto save the session to not to use .save()
 
beaker.session.auto = False
 

	
 
##true exire at browser close
 
#beaker.session.cookie_expires = 3600
 

	
 
    
 
################################################################################
 
## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*  ##
 
## Debug mode will enable the interactive debugging tool, allowing ANYONE to  ##
 
## execute malicious code after an exception is raised.                       ##
 
################################################################################
 
#set debug = false
 

	
 
##################################
 
###       LOGVIEW CONFIG       ###
 
##################################
 
logview.sqlalchemy = #faa
 
logview.pylons.templating = #bfb
 
logview.pylons.util = #eee
 

	
 
#########################################################
 
### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG    ###
 
#########################################################
 
sqlalchemy.db1.url = sqlite:///%(here)s/test.db
 
#sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode_tests
 
#sqlalchemy.db1.echo = False
 
#sqlalchemy.db1.echo = false
 
#sqlalchemy.db1.pool_recycle = 3600
 
sqlalchemy.convert_unicode = true
 

	
 
################################
 
### LOGGING CONFIGURATION   ####
 
################################
 
[loggers]
 
keys = root, routes, rhodecode, sqlalchemy, beaker, templates
 

	
 
[handlers]
 
keys = console
 

	
 
[formatters]
 
keys = generic, color_formatter
 

	
 
#############
 
## LOGGERS ##
 
#############
 
[logger_root]
 
level = ERROR
 
handlers = console
 

	
 
[logger_routes]
 
level = ERROR
 
handlers = 
 
qualname = routes.middleware
 
# "level = DEBUG" logs the route matched and routing variables.
 
propagate = 1
 

	
 
[logger_beaker]
 
level = DEBUG
 
handlers = 
 
qualname = beaker.container
 
propagate = 1
 

	
 
[logger_templates]
 
level = INFO
 
handlers = 
 
qualname = pylons.templating
 
propagate = 1
 

	
 
[logger_rhodecode]
 
level = ERROR
 
handlers = 
 
qualname = rhodecode
 
propagate = 1
 

	
 
[logger_sqlalchemy]
 
level = ERROR
 
handlers = console
 
qualname = sqlalchemy.engine
 
propagate = 0
 

	
 
##############
 
## HANDLERS ##
 
##############
 

	
 
[handler_console]
 
class = StreamHandler
 
args = (sys.stderr,)
 
level = NOTSET
 
formatter = generic
 

	
 
################
 
## FORMATTERS ##
 
################
 

	
 
[formatter_generic]
 
format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
 
datefmt = %Y-%m-%d %H:%M:%S
 

	
 
[formatter_color_formatter]
 
class=rhodecode.lib.colored_formatter.ColorFormatter
 
format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
 
datefmt = %Y-%m-%d %H:%M:%S
 
\ No newline at end of file
0 comments (0 inline, 0 general)