changeset 3920:985db7f7b9b2 beta

Added flag to controll option for changing the repos path location from web interface
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 30 May 2013 16:08:14 +0200
parents b367b016ee39
children 932c84e8fa92
files development.ini production.ini rhodecode/config/deployment.ini_tmpl rhodecode/controllers/admin/settings.py rhodecode/lib/base.py rhodecode/templates/admin/settings/settings.html
diffstat 6 files changed, 16 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/development.ini	Thu May 30 14:12:32 2013 +0200
+++ b/development.ini	Thu May 30 16:08:14 2013 +0200
@@ -212,6 +212,7 @@
 ## codes don't break the transactions while 4XX codes do
 lock_ret_code = 423
 
+allow_repo_location_change = True
 
 ####################################
 ###        CELERY CONFIG        ####
--- a/production.ini	Thu May 30 14:12:32 2013 +0200
+++ b/production.ini	Thu May 30 16:08:14 2013 +0200
@@ -212,6 +212,7 @@
 ## codes don't break the transactions while 4XX codes do
 lock_ret_code = 423
 
+allow_repo_location_change = True
 
 ####################################
 ###        CELERY CONFIG        ####
--- a/rhodecode/config/deployment.ini_tmpl	Thu May 30 14:12:32 2013 +0200
+++ b/rhodecode/config/deployment.ini_tmpl	Thu May 30 16:08:14 2013 +0200
@@ -212,6 +212,7 @@
 ## codes don't break the transactions while 4XX codes do
 lock_ret_code = 423
 
+allow_repo_location_change = True
 
 ####################################
 ###        CELERY CONFIG        ####
--- a/rhodecode/controllers/admin/settings.py	Thu May 30 14:12:32 2013 +0200
+++ b/rhodecode/controllers/admin/settings.py	Thu May 30 16:08:14 2013 +0200
@@ -242,10 +242,10 @@
                 sett = RhodeCodeUi.get_by_key('push_ssl')
                 sett.ui_value = form_result['web_push_ssl']
                 Session().add(sett)
-
-                sett = RhodeCodeUi.get_by_key('/')
-                sett.ui_value = form_result['paths_root_path']
-                Session().add(sett)
+                if c.visual.allow_repo_location_change:
+                    sett = RhodeCodeUi.get_by_key('/')
+                    sett.ui_value = form_result['paths_root_path']
+                    Session().add(sett)
 
                 #HOOKS
                 sett = RhodeCodeUi.get_by_key(RhodeCodeUi.HOOK_UPDATE)
--- a/rhodecode/lib/base.py	Thu May 30 14:12:32 2013 +0200
+++ b/rhodecode/lib/base.py	Thu May 30 16:08:14 2013 +0200
@@ -277,6 +277,7 @@
 
         ## 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.repo_name = get_repo_slug(request)  # can be empty
         c.backends = BACKENDS.keys()
--- a/rhodecode/templates/admin/settings/settings.html	Thu May 30 14:12:32 2013 +0200
+++ b/rhodecode/templates/admin/settings/settings.html	Thu May 30 16:08:14 2013 +0200
@@ -268,20 +268,21 @@
                     ##<span class="help-block">${_('Requires hg-git library installed. Allows cloning from git remote locations')}</span>
                 </div>
             </div>
+            %if c.visual.allow_repo_location_change:
             <div class="field">
                 <div class="label">
                     <label for="paths_root_path">${_('Repositories location')}:</label>
                 </div>
                 <div class="input">
-                    ${h.text('paths_root_path',size=30,readonly="readonly")}
-                    <span id="path_unlock" class="tooltip"
-                            title="${h.tooltip(_('This a crucial application setting. If you are really sure you need to change this, you must restart application in order to make this setting take effect. Click this label to unlock.'))}">
+                    ${h.text('paths_root_path',size=30,readonly="readonly", class_="disabled")}
+                    <span id="path_unlock" class="tooltip" style="cursor: pointer"
+                            title="${h.tooltip(_('Click to unlock. You must restart RhodeCode in order to make this setting take effect.'))}">
                         ${_('Unlock')}
                     </span>
                     <span class="help-block">${_('Location where repositories are stored. After changing this value a restart, and rescan is required')}</span>
                 </div>
             </div>
-
+            %endif
             <div class="buttons">
                 ${h.submit('save',_('Save settings'),class_="ui-btn large")}
                 ${h.reset('reset',_('Reset'),class_="ui-btn large")}
@@ -292,8 +293,9 @@
 
     <script type="text/javascript">
         YAHOO.util.Event.onDOMReady(function(){
-            YAHOO.util.Event.addListener('path_unlock','click',function(){
-                YAHOO.util.Dom.get('paths_root_path').removeAttribute('readonly');
+            YUE.on('path_unlock','click',function(){
+                YUD.get('paths_root_path').removeAttribute('readonly');
+                YUD.removeClass('paths_root_path', 'disabled')
             });
         });
     </script>