From e8fcddfbda58957453b0126cca9a63b61be4ff76 Mon Sep 17 00:00:00 2001 From: vfilippov Date: Tue, 18 Aug 2009 12:08:16 +0000 Subject: [PATCH] Bug 40933 wiki_url in products and components git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@257 6955db30-a419-402b-8a0d-67ecbb4d7f56 --- Bugzilla/Component.pm | 2 ++ Bugzilla/DB/Schema.pm | 4 +-- Bugzilla/Product.pm | 33 +++++++++++-------- editcomponents.cgi | 2 ++ editproducts.cgi | 1 + extensions/bugzilla-2-to-3-db-fix.sql | 5 +++ extensions/custis/code/install-update_db.pl | 14 +++++++- .../default/admin/components/create.html.tmpl | 9 +++++ .../default/admin/components/edit.html.tmpl | 9 +++++ .../admin/products/edit-common.html.tmpl | 9 +++++ .../default/admin/products/updated.html.tmpl | 8 +++++ template/en/default/bug/edit.html.tmpl | 4 +-- template/en/default/global/messages.html.tmpl | 3 ++ 13 files changed, 84 insertions(+), 19 deletions(-) diff --git a/Bugzilla/Component.pm b/Bugzilla/Component.pm index 56dc5e757..0143db733 100644 --- a/Bugzilla/Component.pm +++ b/Bugzilla/Component.pm @@ -58,6 +58,7 @@ use constant UPDATE_COLUMNS => qw( initialowner initialqacontact description + wiki_url ); use constant VALIDATORS => { @@ -301,6 +302,7 @@ sub _create_series { } } +sub set_wiki_url { $_[0]->set('wiki_url', $_[1]); } sub set_name { $_[0]->set('name', $_[1]); } sub set_description { $_[0]->set('description', $_[1]); } sub set_default_assignee { diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm index a1580536a..91396203f 100644 --- a/Bugzilla/DB/Schema.pm +++ b/Bugzilla/DB/Schema.pm @@ -1,4 +1,3 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- # # The contents of this file are subject to the Mozilla Public # License Version 1.1 (the "License"); you may not use this file @@ -1181,6 +1180,7 @@ use constant ABSTRACT_SCHEMA => { DEFAULT => 0}, defaultmilestone => {TYPE => 'varchar(20)', NOTNULL => 1, DEFAULT => "'---'"}, + wiki_url => {TYPE => 'varchar(255)', NOTNULL => 1, DEFAULT => "''"}, ], INDEXES => [ products_name_idx => {FIELDS => ['name'], @@ -1205,7 +1205,7 @@ use constant ABSTRACT_SCHEMA => { COLUMN => 'userid', DELETE => 'SET NULL'}}, description => {TYPE => 'MEDIUMTEXT', NOTNULL => 1}, - wiki_url => {TYPE => 'TINYTEXT', NOTNULL => 1}, + wiki_url => {TYPE => 'varchar(255)', NOTNULL => 1, DEFAULT => "''"}, ], INDEXES => [ components_product_id_idx => {FIELDS => [qw(product_id name)], diff --git a/Bugzilla/Product.pm b/Bugzilla/Product.pm index de2d96708..ec7267c3e 100644 --- a/Bugzilla/Product.pm +++ b/Bugzilla/Product.pm @@ -48,16 +48,17 @@ use constant NAME_FIELD => 'name'; use constant LIST_ORDER => 'name'; use constant DB_COLUMNS => qw( - id - name - classification_id - description - milestoneurl - disallownew - votesperuser - maxvotesperbug - votestoconfirm - defaultmilestone + id + name + classification_id + description + milestoneurl + disallownew + votesperuser + maxvotesperbug + votestoconfirm + defaultmilestone + wiki_url ); use constant REQUIRED_CREATE_FIELDS => qw( @@ -75,6 +76,7 @@ use constant UPDATE_COLUMNS => qw( votesperuser maxvotesperbug votestoconfirm + wiki_url ); use constant VALIDATORS => { @@ -605,6 +607,7 @@ sub set_disallow_new { $_[0]->set('disallownew', $_[1]); } sub set_votes_per_user { $_[0]->set('votesperuser', $_[1]); } sub set_votes_per_bug { $_[0]->set('maxvotesperbug', $_[1]); } sub set_votes_to_confirm { $_[0]->set('votestoconfirm', $_[1]); } +sub set_wiki_url { $_[0]->set('wiki_url', $_[1]); } sub set_group_controls { my ($self, $group, $settings) = @_; @@ -864,6 +867,7 @@ sub max_votes_per_bug { return $_[0]->{'maxvotesperbug'}; } sub votes_to_confirm { return $_[0]->{'votestoconfirm'}; } sub default_milestone { return $_[0]->{'defaultmilestone'}; } sub classification_id { return $_[0]->{'classification_id'}; } +sub wiki_url { return $_[0]->{'wiki_url'}; } ############################### #### Subroutines ###### @@ -911,10 +915,11 @@ Bugzilla::Product - Bugzilla product class. my $name = $product->name; my $description = $product->description; my $milestoneurl = $product->milestone_url; - my disallownew = $product->disallow_new; - my votesperuser = $product->votes_per_user; - my maxvotesperbug = $product->max_votes_per_bug; - my votestoconfirm = $product->votes_to_confirm; + my $disallownew = $product->disallow_new; + my $votesperuser = $product->votes_per_user; + my $maxvotesperbug = $product->max_votes_per_bug; + my $votestoconfirm = $product->votes_to_confirm; + my $wiki_url = $product->wiki_url; my $defaultmilestone = $product->default_milestone; my $classificationid = $product->classification_id; diff --git a/editcomponents.cgi b/editcomponents.cgi index 7623be591..67b482707 100755 --- a/editcomponents.cgi +++ b/editcomponents.cgi @@ -225,6 +225,7 @@ if ($action eq 'update') { my $default_assignee = trim($cgi->param('initialowner') || ''); my $default_qa_contact = trim($cgi->param('initialqacontact') || ''); my $description = trim($cgi->param('description') || ''); + my $wiki_url = trim($cgi->param('wiki_url') || ''); my @initial_cc = $cgi->param('initialcc'); my $component = @@ -234,6 +235,7 @@ if ($action eq 'update') { $component->set_description($description); $component->set_default_assignee($default_assignee); $component->set_default_qa_contact($default_qa_contact); + $component->set_wiki_url($wiki_url); $component->set_cc_list(\@initial_cc); my $changes = $component->update(); diff --git a/editproducts.cgi b/editproducts.cgi index 4d305c313..72d38e382 100755 --- a/editproducts.cgi +++ b/editproducts.cgi @@ -291,6 +291,7 @@ if ($action eq 'update') { $product->set_votes_per_user(scalar $cgi->param('votesperuser')); $product->set_votes_per_bug(scalar $cgi->param('maxvotesperbug')); $product->set_votes_to_confirm(scalar $cgi->param('votestoconfirm')); + $product->set_wiki_url(scalar $cgi->param('wiki_url')); my $changes = $product->update(); diff --git a/extensions/bugzilla-2-to-3-db-fix.sql b/extensions/bugzilla-2-to-3-db-fix.sql index b34008a58..121b78e3f 100644 --- a/extensions/bugzilla-2-to-3-db-fix.sql +++ b/extensions/bugzilla-2-to-3-db-fix.sql @@ -1,6 +1,11 @@ -- SQL скрипт изменений требуемых в нашей боевой базе багзиллы при обновлении с 2.x до 3.х -- Возможно, добавятся ещё новые кривости, но пока так. set names utf8; +-- ДО ./checksetup.pl: +alter table components change wiki_url wiki_url1 varchar(255) not null; +-- ПОСЛЕ ./checksetup.pl: +alter table components drop wiki_url; +alter table components change wiki_url1 wiki_url varchar(255) not null; -- Убираем кривые значения из базы delete from profiles_activity where userid=83; delete from bugs_activity where attach_id=13529; diff --git a/extensions/custis/code/install-update_db.pl b/extensions/custis/code/install-update_db.pl index 99081317e..fb9db6589 100644 --- a/extensions/custis/code/install-update_db.pl +++ b/extensions/custis/code/install-update_db.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -# Перекодировка параметров сохранённых поисков из CP-1251 в UTF-8 +# ./checksetup'овые обновления базы use strict; use utf8; @@ -18,6 +18,7 @@ sub sure_utf8 return $s; } +# Перекодировка параметров сохранённых поисков из CP-1251 в UTF-8 print "Making sure saved queries are in UTF-8...\n"; my $dbh = Bugzilla->dbh; my $nq = $dbh->selectall_arrayref("SELECT * FROM namedqueries WHERE query LIKE '%\\%%'", {Slice=>{}}); @@ -31,3 +32,14 @@ if ($nq) $dbh->do("UPDATE namedqueries SET query=? WHERE id=?", undef, $q, $_->{id}) if $q ne $_->{query}; } } + +# Добавляем колонку wiki_url в продукты и компоненты +if (!$dbh->bz_column_info('products', 'buglist')) +{ + $dbh->bz_add_column('products', 'wiki_url', {TYPE => 'varchar(255)', NOTNULL => 1, DEFAULT => "''"}); +} + +if (!$dbh->bz_column_info('components', 'buglist')) +{ + $dbh->bz_add_column('components', 'wiki_url', {TYPE => 'varchar(255)', NOTNULL => 1, DEFAULT => "''"}); +} diff --git a/template/en/default/admin/components/create.html.tmpl b/template/en/default/admin/components/create.html.tmpl index 86411adad..5cf90df6e 100644 --- a/template/en/default/admin/components/create.html.tmpl +++ b/template/en/default/admin/components/create.html.tmpl @@ -90,6 +90,15 @@ [% END %] + + + + + + +
Or use product setting when empty. + +
diff --git a/template/en/default/admin/components/edit.html.tmpl b/template/en/default/admin/components/edit.html.tmpl index 9ddb8ca3e..8859a9153 100644 --- a/template/en/default/admin/components/edit.html.tmpl +++ b/template/en/default/admin/components/edit.html.tmpl @@ -100,6 +100,15 @@ [% END %] + + + + + + +
Or use product setting when empty. + + [% terms.Bugs %]: diff --git a/template/en/default/admin/products/edit-common.html.tmpl b/template/en/default/admin/products/edit-common.html.tmpl index c05a87877..df0839c92 100644 --- a/template/en/default/admin/products/edit-common.html.tmpl +++ b/template/en/default/admin/products/edit-common.html.tmpl @@ -76,6 +76,15 @@ checked="checked"[% END %]> + + + + + + +
Or use default setting when empty. + + [% IF !Param('usevotes') %] diff --git a/template/en/default/admin/products/updated.html.tmpl b/template/en/default/admin/products/updated.html.tmpl index 1d11416e1..4671632cc 100644 --- a/template/en/default/admin/products/updated.html.tmpl +++ b/template/en/default/admin/products/updated.html.tmpl @@ -118,6 +118,14 @@ [% checkvotes = 1 %] [% END %] +[% IF changes.wiki_url.defined %] +

+ Updated Wiki URL from + [%+ changes.wiki_url.0 FILTER html %] to + [%+ product.wiki_url FILTER html %]. +

+[% END %] + [% IF !changes.keys.size %]

Nothing changed for product '[% product.name FILTER html %]'.

[% END %] diff --git a/template/en/default/bug/edit.html.tmpl b/template/en/default/bug/edit.html.tmpl index cd53581cc..f05c62728 100644 --- a/template/en/default/bug/edit.html.tmpl +++ b/template/en/default/bug/edit.html.tmpl @@ -1217,13 +1217,13 @@
Look for [% terms.Bug %] in: CVS&SVN / - Wiki + Wiki [% ELSE %]
CVS&SVN / - Wiki + Wiki [% IF bug.user.canmove %] diff --git a/template/en/default/global/messages.html.tmpl b/template/en/default/global/messages.html.tmpl index c2a23d88b..2072c1e3e 100644 --- a/template/en/default/global/messages.html.tmpl +++ b/template/en/default/global/messages.html.tmpl @@ -242,6 +242,9 @@
  • Default CC list deleted
  • [% END %] [% END %] + [% IF changes.wiki_url.defined %] +
  • Wiki URL updated to '[% comp.wiki_url FILTER html %]'
  • + [% END %] [% ELSE %] No changes made to [% comp.name FILTER html %]. [% END %]