Changeset - 9b4ba12ef8c3
[Not reviewed]
default
0 7 0
Marcin Kuzminski - 12 years ago 2013-06-27 00:47:15
marcin@python-works.com
Add ini option to controll custom advanced hooks settings
7 files changed with 24 insertions and 3 deletions:
0 comments (0 inline, 0 general)
development.ini
Show inline comments
 
@@ -168,13 +168,13 @@ default_encoding = utf8
 
## pass - password 
 
## netloc - network location
 
## path - usually repo_name
 

	
 
#clone_uri = {scheme}://{user}{pass}{netloc}{path}
 

	
 
## issue tracker RhodeCode (leave blank to disable, absent for default)
 
## issue tracker for RhodeCode (leave blank to disable, absent for default)
 
#bugtracker = http://bitbucket.org/marcinkuzminski/rhodecode/issues
 

	
 
## issue tracking mapping for commits messages
 
## comment out issue_pat, issue_server, issue_prefix to enable
 

	
 
## pattern to get the issues from commit messages
 
@@ -216,14 +216,19 @@ instance_id =
 
auth_ret_code =
 

	
 
## locking return code. When repository is locked return this HTTP code. 2XX
 
## codes don't break the transactions while 4XX codes do
 
lock_ret_code = 423
 

	
 
## allows to change the repository location in settings page
 
allow_repo_location_change = True
 

	
 
## allows to setup custom hooks in settings page
 
allow_custom_hooks_settings = True
 

	
 

	
 
####################################
 
###        CELERY CONFIG        ####
 
####################################
 
use_celery = false
 
broker.host = localhost
 
broker.vhost = rabbitmqhost
production.ini
Show inline comments
 
@@ -216,14 +216,19 @@ instance_id =
 
auth_ret_code =
 

	
 
## locking return code. When repository is locked return this HTTP code. 2XX
 
## codes don't break the transactions while 4XX codes do
 
lock_ret_code = 423
 

	
 
## allows to change the repository location in settings page
 
allow_repo_location_change = True
 

	
 
## allows to setup custom hooks in settings page
 
allow_custom_hooks_settings = True
 

	
 

	
 
####################################
 
###        CELERY CONFIG        ####
 
####################################
 
use_celery = false
 
broker.host = localhost
 
broker.vhost = rabbitmqhost
rhodecode/bin/template.ini.mako
Show inline comments
 
@@ -224,15 +224,18 @@ instance_id =
 
auth_ret_code =
 

	
 
<%text>## locking return code. When repository is locked return this HTTP code. 2XX</%text>
 
<%text>## codes don't break the transactions while 4XX codes do</%text>
 
lock_ret_code = 423
 

	
 
<%text>## allow chaning the repository store location from web interface</%text>
 
<%text>## allows to change the repository location in settings page</%text>
 
allow_repo_location_change = True
 

	
 
<%text>## allows to setup custom hooks in settings page</%text>
 
allow_custom_hooks_settings = True
 

	
 
<%text>
 
####################################
 
###        CELERY CONFIG        ####
 
####################################
 
</%text>
 
use_celery = false
rhodecode/config/deployment.ini_tmpl
Show inline comments
 
@@ -216,14 +216,19 @@ instance_id =
 
auth_ret_code =
 

	
 
## locking return code. When repository is locked return this HTTP code. 2XX
 
## codes don't break the transactions while 4XX codes do
 
lock_ret_code = 423
 

	
 
## allows to change the repository location in settings page
 
allow_repo_location_change = True
 

	
 
## allows to setup custom hooks in settings page
 
allow_custom_hooks_settings = True
 

	
 

	
 
####################################
 
###        CELERY CONFIG        ####
 
####################################
 
use_celery = false
 
broker.host = localhost
 
broker.vhost = rabbitmqhost
rhodecode/controllers/admin/settings.py
Show inline comments
 
@@ -306,12 +306,13 @@ class SettingsController(BaseController)
 
            except Exception:
 
                log.error(traceback.format_exc())
 
                h.flash(_('Error occurred during updating '
 
                          'application settings'), category='error')
 

	
 
        if setting_id == 'hooks':
 
            if c.visual.allow_custom_hooks_settings:
 
            ui_key = request.POST.get('new_hook_ui_key')
 
            ui_value = request.POST.get('new_hook_ui_value')
 
            try:
 

	
 
                if ui_value and ui_key:
 
                    RhodeCodeUi.create_or_update_hook(ui_key, ui_value)
rhodecode/lib/base.py
Show inline comments
 
@@ -276,12 +276,13 @@ class BaseController(WSGIController):
 
        c.visual.repository_fields = str2bool(rc_config.get('rhodecode_repository_fields'))
 
        c.visual.show_version = str2bool(rc_config.get('rhodecode_show_version'))
 

	
 
        ## INI stored
 
        self.cut_off_limit = int(config.get('cut_off_limit'))
 
        c.visual.allow_repo_location_change = str2bool(config.get('allow_repo_location_change', True))
 
        c.visual.allow_custom_hooks_settings = str2bool(config.get('allow_custom_hooks_settings', True))
 

	
 
        c.repo_name = get_repo_slug(request)  # can be empty
 
        c.backends = BACKENDS.keys()
 
        c.unread_notifications = NotificationModel()\
 
                        .get_unread_cnt_for_user(c.rhodecode_user.user_id)
 
        self.sa = meta.Session
rhodecode/templates/admin/settings/hooks.html
Show inline comments
 
@@ -33,13 +33,13 @@
 
                  ${h.text(hook.ui_key,hook.ui_value,size=60,readonly="readonly")}
 
                </div>
 
            </div>
 
          % endfor
 
        </div>
 
    </div>
 

	
 
    % if c.visual.allow_custom_hooks_settings:
 
    <h3>${_('Custom hooks')}</h3>
 
    ${h.form(url('admin_setting', setting_id='hooks'),method='put')}
 
    <div class="form">
 
        <div class="fields">
 

	
 
          % for hook in c.custom_hooks:
 
@@ -72,12 +72,13 @@
 
          <div class="buttons" style="margin-left:280px">
 
             ${h.submit('save',_('Save'),class_="ui-btn large")}
 
          </div>
 
        </div>
 
    </div>
 
    ${h.end_form()}
 
    % endif
 
</div>
 
<script type="text/javascript">
 
function ajaxActionHook(hook_id,field_id) {
 
    var sUrl = "${h.url('admin_setting', setting_id='hooks')}";
 
    var callback = {
 
        success: function (o) {
0 comments (0 inline, 0 general)