From 30941fd8ba1b357e9ec4a4f42813e7dcc50f0444 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Tue, 23 Aug 2016 19:58:14 -0700 Subject: [PATCH] Projects: enable gui editing of hooks.reverseorder field Signed-off-by: Kyle J. McKay --- Girocco/Config.pm | 6 +++--- Girocco/Project.pm | 11 +++++++++++ cgi/regproj.cgi | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Girocco/Config.pm b/Girocco/Config.pm index ce7d0bd..c8b4f04 100644 --- a/Girocco/Config.pm +++ b/Girocco/Config.pm @@ -210,11 +210,11 @@ our $project_passwords = 1; # the site operates only as mirror of purely local-filesystem repositories. our $project_owners = 'email'; -# Which project fields to make editable, out of 'shortdesc', 'homepage', -# 'README', 'notifymail', 'summaryonly', 'notifytag' and 'notifyjson' +# Which project fields to make editable, out of 'shortdesc', 'homepage', 'README', +# 'notifymail', 'reverseorder', 'summaryonly', 'notifytag' and 'notifyjson' # 'notifycia' was used by the now defunct CIA service and while allowing it to # be edited does work and the value is saved, the value is totally ignored by Girocco -our @project_fields = qw(homepage shortdesc README notifymail summaryonly notifytag notifyjson); +our @project_fields = qw(homepage shortdesc README notifymail reverseorder summaryonly notifytag notifyjson); # Minimal number of seconds to pass between two updates of a project. our $min_mirror_interval = 3600; # 1 hour diff --git a/Girocco/Project.pm b/Girocco/Project.pm index d77cff0..fbb7b74 100644 --- a/Girocco/Project.pm +++ b/Girocco/Project.pm @@ -42,6 +42,8 @@ our $metadata_fields = { 'to completely suppress any README'], notifymail => ['Commit notify – mail to', 'notifymail', 'text', 'comma separated address list'], + reverseorder => ['Show oldest first', 'reverseorder', 'checkbox', + 'show new revisions in oldest to newest order instead of the default newest to oldest older'], summaryonly => ['Summaries only', 'summaryonly', 'checkbox', 'suppress patch/diff output in “Commit notify” email when showing new revisions'], notifytag => ['Tag notify – mail to', 'notifytag', 'text', @@ -246,6 +248,7 @@ sub _properties_load { $self->_readlocalconfigfile unless ref($self->{configfilehash}) eq 'HASH'; $self->{statusupdates} = _boolval($self->{configfilehash}->{'gitweb.statusupdates'}, 1); + $self->{reverseorder} = _boolval($self->{configfilehash}->{'hooks.reverseorder'}, 0); $self->{summaryonly} = _boolval($self->{configfilehash}->{'hooks.summaryonly'}, 0); delete $self->{auth}; my $val = $self->{configfilehash}->{'gitweb.repoauth'}; @@ -272,6 +275,10 @@ sub _properties_save { unless defined($self->{statusupdates}) && $self->{statusupdates} =~ /^\d+$/; system($Girocco::Config::git_bin, '--git-dir='.$self->{path}, 'config', '--bool', "gitweb.statusupdates", $self->{statusupdates}); + $self->{reverseorder} = 0 + unless defined($self->{reverseorder}) && $self->{reverseorder} =~ /^\d+$/; + system($Girocco::Config::git_bin, '--git-dir='.$self->{path}, 'config', '--bool', + "hooks.reverseorder", $self->{reverseorder}); $self->{summaryonly} = 0 unless defined($self->{summaryonly}) && $self->{summaryonly} =~ /^\d+$/; system($Girocco::Config::git_bin, '--git-dir='.$self->{path}, 'config', '--bool', @@ -669,6 +676,9 @@ sub cgi_fill { (valid_email_multi($self->{notifymail}) and length($self->{notifymail}) <= 512) or $gcgi->err("Invalid notify e-mail address. Use mail,mail to specify multiple addresses; total length must not exceed 512 characters, however."); } + if ($field_enabled->('reverseorder')) { + $self->{reverseorder} = $gcgi->wparam('reverseorder') || 0; + } if ($field_enabled->('summaryonly')) { $self->{summaryonly} = $gcgi->wparam('summaryonly') || 0; } @@ -717,6 +727,7 @@ sub form_defaults { hp => $self->{hp}, users => $self->{users}, notifymail => html_esc($self->{notifymail}), + reverseorder => html_esc($self->{reverseorder}), summaryonly => html_esc($self->{summaryonly}), notifytag => html_esc($self->{notifytag}), notifyjson => html_esc($self->{notifyjson}), diff --git a/cgi/regproj.cgi b/cgi/regproj.cgi index 8dd9984..38ef164 100755 --- a/cgi/regproj.cgi +++ b/cgi/regproj.cgi @@ -34,6 +34,7 @@ my %values = ( hp => '', mirror => $mirror_mode_set, notifymail => '', + reverseorder => '', summaryonly => '', notifytag => '', notifyjson => '', -- 2.11.4.GIT