Changeset - 36f7562a5919
[Not reviewed]
beta
0 6 0
Marcin Kuzminski - 12 years ago 2013-05-28 23:12:31
marcin@python-works.com
Implements #842 RhodeCode version disclosure.

- it's now implemented as visual option in settings
6 files changed with 20 insertions and 1 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/admin/settings.py
Show inline comments
 
@@ -200,24 +200,29 @@ class SettingsController(BaseController)
 
                Session().add(sett3)
 

	
 
                sett4 = RhodeCodeSetting.get_by_name_or_create('repository_fields')
 
                sett4.app_settings_value = \
 
                    form_result['rhodecode_repository_fields']
 
                Session().add(sett4)
 

	
 
                sett5 = RhodeCodeSetting.get_by_name_or_create('dashboard_items')
 
                sett5.app_settings_value = \
 
                    form_result['rhodecode_dashboard_items']
 
                Session().add(sett5)
 

	
 
                sett6 = RhodeCodeSetting.get_by_name_or_create('show_version')
 
                sett6.app_settings_value = \
 
                    form_result['rhodecode_show_version']
 
                Session().add(sett6)
 

	
 
                Session().commit()
 
                set_rhodecode_config(config)
 
                h.flash(_('Updated visualisation settings'),
 
                        category='success')
 

	
 
            except Exception:
 
                log.error(traceback.format_exc())
 
                h.flash(_('Error occurred during updating '
 
                          'visualisation settings'),
 
                        category='error')
 

	
 
        if setting_id == 'vcs':
rhodecode/lib/base.py
Show inline comments
 
@@ -264,24 +264,26 @@ class BaseController(WSGIController):
 
        c.rhodecode_name = config.get('rhodecode_title')
 
        c.use_gravatar = str2bool(config.get('use_gravatar'))
 
        c.ga_code = config.get('rhodecode_ga_code')
 
        # Visual options
 
        c.visual = AttributeDict({})
 
        rc_config = RhodeCodeSetting.get_app_settings()
 
        ## DB stored
 
        c.visual.show_public_icon = str2bool(rc_config.get('rhodecode_show_public_icon'))
 
        c.visual.show_private_icon = str2bool(rc_config.get('rhodecode_show_private_icon'))
 
        c.visual.stylify_metatags = str2bool(rc_config.get('rhodecode_stylify_metatags'))
 
        c.visual.dashboard_items = safe_int(rc_config.get('rhodecode_dashboard_items', 100))
 
        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.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
 
        self.scm_model = ScmModel(self.sa)
 

	
 
    def __call__(self, environ, start_response):
 
        """Invoke the Controller"""
rhodecode/lib/db_manage.py
Show inline comments
 
@@ -650,24 +650,25 @@ class DbManage(object):
 
            setattr(ui_conf, 'ui_section', section)
 
            setattr(ui_conf, 'ui_key', key)
 
            setattr(ui_conf, 'ui_value', value)
 

	
 
        settings = [
 
            ('realm', 'RhodeCode authentication', unicode),
 
            ('title', 'RhodeCode', unicode),
 
            ('ga_code', '', unicode),
 
            ('show_public_icon', True, bool),
 
            ('show_private_icon', True, bool),
 
            ('stylify_metatags', False, bool),
 
            ('dashboard_items', 100, int),
 
            ('show_version', True, bool)
 
        ]
 
        for key, val, type_ in settings:
 
            sett = RhodeCodeSetting(key, val)
 
            self.sa.add(sett)
 

	
 
        self.create_ldap_options()
 
        self.create_default_options()
 

	
 
        log.info('created ui config')
 

	
 
    def create_user(self, username, password, email='', admin=False):
 
        log.info('creating user %s' % username)
rhodecode/model/forms.py
Show inline comments
 
@@ -277,24 +277,25 @@ def ApplicationSettingsForm():
 

	
 
def ApplicationVisualisationForm():
 
    class _ApplicationVisualisationForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = False
 
        rhodecode_show_public_icon = v.StringBoolean(if_missing=False)
 
        rhodecode_show_private_icon = v.StringBoolean(if_missing=False)
 
        rhodecode_stylify_metatags = v.StringBoolean(if_missing=False)
 

	
 
        rhodecode_repository_fields = v.StringBoolean(if_missing=False)
 
        rhodecode_lightweight_journal = v.StringBoolean(if_missing=False)
 
        rhodecode_dashboard_items = v.UnicodeString()
 
        rhodecode_show_version = v.StringBoolean(if_missing=False)
 

	
 
    return _ApplicationVisualisationForm
 

	
 

	
 
def ApplicationUiSettingsForm():
 
    class _ApplicationUiSettingsForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = False
 
        web_push_ssl = v.StringBoolean(if_missing=False)
 
        paths_root_path = All(
 
            v.ValidPath(),
 
            v.UnicodeString(strip=True, min=1, not_empty=True)
rhodecode/templates/admin/settings/settings.html
Show inline comments
 
@@ -125,24 +125,29 @@
 

	
 
        <div class="fields">
 
             <div class="field">
 
                <div class="label label-checkbox">
 
                    <label>${_('General')}:</label>
 
                </div>
 
                <div class="checkboxes">
 
                    <div class="checkbox">
 
                        ${h.checkbox('rhodecode_repository_fields','True')}
 
                        <label for="rhodecode_repository_fields">${_('Use repository extra fields')}</label>
 
                    </div>
 
                    <span class="help-block">${_('Allows storing additional customized fields per repository.')}</span>
 
                    <div class="checkbox">
 
                        ${h.checkbox('rhodecode_show_version','True')}
 
                        <label for="rhodecode_show_version">${_('Show RhodeCode version')}</label>
 
                    </div>
 
                    <span class="help-block">${_('Shows or hides displayed version of RhodeCode in the footer')}</span>
 
                </div>
 
             </div>
 
            <div class="field">
 
                <div class="label">
 
                    <label for="rhodecode_realm">${_('Dashboard items')}:</label>
 
                </div>
 
                <div class="input">
 
                    ${h.text('rhodecode_dashboard_items',size=5)}
 
                    <span class="help-block">${_('Number of items displayed in lightweight dashboard before pagination is shown.')}</span>
 
                </div>
 
            </div>
 
             <div class="field">
rhodecode/templates/base/base.html
Show inline comments
 
@@ -33,25 +33,30 @@
 
    </div>
 
</div>
 
<!-- END CONTENT -->
 

	
 
<!-- FOOTER -->
 
<div id="footer">
 
   <div id="footer-inner" class="title">
 
       <div>
 
           <p class="footer-link">
 
               ${_('Server instance: %s') % c.rhodecode_instanceid if c.rhodecode_instanceid else ''}
 
           </p>
 
           <p class="footer-link-right">
 
               <a href="${h.url('rhodecode_official')}">RhodeCode ${c.rhodecode_version}</a>
 
               <a href="${h.url('rhodecode_official')}">
 
               RhodeCode
 
               %if c.visual.show_version:
 
                   ${c.rhodecode_version}
 
               %endif
 
               </a>
 
               &copy; 2010-${h.datetime.today().year} by Marcin Kuzminski and others
 
               &ndash; <a href="${h.url('bugtracker')}">${_('Report a bug')}</a>
 
           </p>
 
       </div>
 
   </div>
 
</div>
 

	
 
<!-- END FOOTER -->
 

	
 
### MAKO DEFS ###
 
<%def name="breadcrumbs()">
 
    <div class="breadcrumbs">
0 comments (0 inline, 0 general)