Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merged rev_1_8 changes 6905-7041. Will tag rev_1_8_merge_7041.

  • Loading branch information...
commit 7de2e1b5b9fcb514856858da361efc3fdac9d3e3 2 parents c8cc526 + 22360da
@theory theory authored
Showing with 929 additions and 532 deletions.
  1. +3 −3 Makefile
  2. +7 −1 comp/admin/control/publish/category.html
  3. +6 −16 comp/admin/profile/alert_type/dhandler
  4. +58 −39 comp/help/en_us/workflow/profile/media.html
  5. +1 −1  comp/help/en_us/workflow/trail/dhandler
  6. +1 −1  comp/widgets/container_prof/edit.html
  7. +17 −0 comp/widgets/container_prof/view.html
  8. +5 −1 comp/widgets/desk/desk.mc
  9. +26 −24 comp/widgets/desk/desk_top.html
  10. +5 −0 comp/widgets/help/debuggers.html
  11. +2 −0  comp/widgets/perm/display.html
  12. +13 −4 comp/widgets/story_prof/edit_meta.html
  13. +2 −2 comp/workflow/manager/dhandler
  14. +1 −1  conf/bricolage.conf
  15. +0 −5 data/burn/comp/oc_1/book_review.mc
  16. +7 −5 inst/upgrade.pl
  17. +1 −1  inst/upgrade/1.10.0/delete_old_stuff.pl
  18. +16 −0 inst/upgrade/1.10.0/rm_old_sort_prefs.pl
  19. +44 −0 inst/upgrade/1.8.7/fix_media.pl
  20. +29 −0 inst/upgrade/1.8.7/fix_media2.pl
  21. +3 −0  inst/upgrade/1.8.7/move_media.pl
  22. +3 −3 inst/upgrade/1.8.9/add_keyword_fks.pl
  23. +27 −0 inst/upgrade/1.8.9/fix_publish_status.pl
  24. +33 −0 inst/upgrade/1.8.9/update_publish_status_check.pl
  25. +2 −0  lib/Bric/Admin.pod
  26. +23 −9 lib/Bric/App/Callback/Publish.pm
  27. +3 −1 lib/Bric/Biz/Asset.pm
  28. +81 −2 lib/Bric/Biz/Asset/Business.pm
  29. +32 −39 lib/Bric/Biz/Asset/Business/Media.pm
  30. +1 −22 lib/Bric/Biz/Asset/Business/Story.pm
  31. +93 −81 lib/Bric/Biz/Asset/Template.pm
  32. +179 −5 lib/Bric/Changes.pod
  33. +10 −0 lib/Bric/License.pod
  34. +2 −0  lib/Bric/SOAP/Media.pm
  35. +2 −0  lib/Bric/SOAP/Story.pm
  36. +46 −35 lib/Bric/SOAP/Workflow.pm
  37. +10 −5 lib/Bric/Util/Burner.pm
  38. +14 −13 lib/Bric/Util/Burner/Mason.pm
  39. +14 −13 lib/Bric/Util/Burner/Template.pm
  40. +15 −13 lib/Bric/Util/Burner/TemplateToolkit.pm
  41. +2 −1  lib/Bric/Util/Language/de_de.pm
  42. +4 −2 lib/Bric/Util/Language/en_us.pm
  43. +4 −3 lib/Bric/Util/Language/it_it.pm
  44. +2 −1  lib/Bric/Util/Language/pt_pt.pm
  45. +2 −1  lib/Bric/Util/Language/ru_ru.pm
  46. +2 −0  lib/Bric/Util/Language/zh_cn.pm
  47. +2 −1  lib/Bric/Util/Language/zh_tw.pm
  48. +1 −1  sql/Pg/Bric/Biz/Asset/Business/Media.sql
  49. +1 −2  sql/Pg/Bric/Biz/Asset/Business/Story.sql
  50. +2 −9 sql/Pg/Bric/Util/Pref.val
  51. +0 −131 sql/Pg/Bric/Util/Priv.con
  52. +70 −35 t/Bric/Biz/Asset/Business/Media/DevTest.pm
View
6 Makefile
@@ -123,9 +123,9 @@ SQL_FILES := $(shell find lib -name '*.sql' -o -name '*.val' -o -name '*.con')
# Update this later to be database-independent.
inst/Pg.sql : $(SQL_FILES)
- env LC_ALL=C grep -vh '^--' `find sql/Pg -name '*.sql' | sort` > $@;
- env LC_ALL=C grep -vh '^--' `find sql/Pg -name '*.val' | sort` >> $@;
- env LC_ALL=C grep -vh '^--' `find sql/Pg -name '*.con' | sort` >> $@;
+ grep -vh '^--' `find sql/Pg -name '*.sql' | env LANG= LANGUAGE= LC_ALL=POSIX sort` > $@;
+ grep -vh '^--' `find sql/Pg -name '*.val' | env LANG= LANGUAGE= LC_ALL=POSIX sort` >> $@;
+ grep -vh '^--' `find sql/Pg -name '*.con' | env LANG= LANGUAGE= LC_ALL=POSIX sort` >> $@;
.PHONY : distclean inst/Pg.sql dist_dir rm_svn dist_tar check_dist
View
8 comp/admin/control/publish/category.html
@@ -11,7 +11,7 @@
<& '/widgets/listManager/listManager.mc',
object => 'category',
select => $select,
- fields => [qw(uri)],
+ fields => [(@$sites > 1 ? 'site' : () ), 'uri'],
addition => '',
profile => undef,
exclude => $exclude,
@@ -43,6 +43,12 @@
&& get_pref("Filter by Site Context")) {
@constrain = ( constrain => { site_id => $site_id } );
}
+
+my $sites = $c->get('__SITES__');
+unless ($sites) {
+ $sites = Bric::Biz::Site->list({ active => 1 });
+ $c->set('__SITES__', $sites);
+}
</%init>
<%once>
View
22 comp/admin/profile/alert_type/dhandler
@@ -1,4 +1,3 @@
-%#-- Begin HTML --#
<%perl>
$m->out(qq{<form method="post" name="alert_type_profile" action="} . $r->uri
. qq{" onsubmit="return confirmChanges(this)">\n});
@@ -69,27 +68,29 @@ if (defined $id) {
name => 'sub_sel',
useTable => 0,
options => $var_sel_vals,
- js => 'onChange="this.form.subject.value = this.form.subject.value '
+ js => 'onchange="this.form.subject.value = this.form.subject.value '
. '+ this.form.sub_sel[selectedIndex].text; '
. 'this.form.subject.focus();"'
&>
-% }
+% }
</div>
</div>
<%perl>
# Variables to put into Message.
$m->out(qq{<div class="alertTypeVars">});
+ my $len = $at->my_meths->{message}{len};
$m->comp('/widgets/profile/select.mc',
name => 'msg_sel',
width => 550,
options => $var_sel_vals,
- js => 'onChange="this.form.message.value = this.form.message.value '
+ js => 'onchange="this.form.message.value = this.form.message.value '
. '+ this.form.msg_sel[selectedIndex].text; '
+ . "textCount('message', $len); "
. 'this.form.message.focus();"'
) unless $no_edit;
$m->out(qq{</div>});
-
+
# Message
$m->comp('/widgets/profile/displayFormElement.mc',
objref => $at,
@@ -166,11 +167,7 @@ if (defined $id) {
}
</%perl>
</form>
-
<& '/widgets/wrappers/sharky/footer.mc', param => \%ARGS &>
-%#-- End HTML --#
-
-%#-- Once Section --#
<%once>;
my $widget = 'profile';
my $type = 'alert_type';
@@ -185,14 +182,10 @@ my $et_class = get_package_name('event_type');
my $fmt = get_pref('List Name Format');
my $hidden = 1;
</%shared>
-
-%#-- Args Section --#
<%args>
$id => undef
$class_id => undef
</%args>
-
-%#-- Init Section --#
<%init>;
do_queued_redirect();
$id ||= $ARGS{alert_type_id} unless defined $id;
@@ -243,7 +236,6 @@ if (defined $id) {
unshift @{ $meths->{attr}{props}{vals} }, ['', ''];
}
</%init>
-
<%def .contact>
<%args>
$c
@@ -284,7 +276,6 @@ $no_edit
</tr>
% undef $hidden;
</%def>
-
<%def .owner>
<%args>
$owner_id => get_user_id()
@@ -307,7 +298,6 @@ $no_edit => 0
);
</%perl>
</%def>
-
<%doc>
###############################################################################
View
97 comp/help/en_us/workflow/profile/media.html
@@ -1,51 +1,56 @@
<help page="Media Profile">
<p>Here you can upload the Media to the file, adjust its vital information and
-enter Contributors. Be sure to click "Save" at the bottom of the page to save
-the Media file to your Workspace.</p>
+enter Contributors. Be sure to click <q>Save</q> at the bottom of the page to
+save the Media file to your Workspace.</p>
<h3>1) Information</h3>
<p><dl>
<dt>Trail</dt>
-<dd>Lists what Desks the Media asset has been checked in to (None if it is a new
- Media asset).</dd>
+<dd>Lists what Desks the Media document has been checked in to (None if it is
+ a new Media document).</dd>
<dt>Notes</dt>
-<dd>Click this icon to attach editorial notes to the Media asset. The Notes will
- be viewable to other users when you check the Media in to a Desk but will
- not show up when you publish it. If the icon appears to have writing on it,
- then there are already notes associated with the media asset.</dd>
+<dd>Click this icon to attach editorial notes to the Media document. The Notes
+ will be viewable to other users when you check the Media in to a Desk but
+ will not show up when you publish it. If the icon appears to have writing
+ on it, then there are already notes associated with the media
+ document.</dd>
-<dt>ID</dt>
-<dd>The asset's identification number, given automatically.</dd>
+<dt>UUID</dt>
+<dd>The document's universally unique identifier, given automatically.</dd>
<dt>Media Type Element</dt>
-<dd>The type of Media of the file, such as Photograph or Illustration.</dd>
+<dd>The element type that defines the structure of the media document, such as
+Photograph or Illustration.</dd>
<dt>URI</dt>
-<dd>The address of the Media asset on your server, it includes the Category and
- Slug you selected on the previous page. If the URI is a link you can click
- it to preview the Media asset.</dd>
+<dd>The address of the Media document on your server, based on the URI format
+ for the primary output channel, and usually including the category URI the
+ media document file name. If the URI is a link you can click it to preview
+ the Media document.</dd>
<dt>Version</dt>
-<dd>Indicates how many times the Media asset has been revised.</dd>
+<dd>Indicates how many times the Media document has been revised.</dd>
<dt>Title</dt>
-<dd>The name of the Media asset. Required.</dd>
+<dd>The name of the Media document. Required.</dd>
<dt>Description</dt>
-<dd>A brief description of the Media asset.</dd>
+<dd>A brief description of the Media document.</dd>
<dt>Source</dt>
-<dd>The party that has provided the Media asset.</dd>
+<dd>The party that has provided the Media document.</dd>
<dt>Priority</dt>
-<dd>Tells users how urgent the Media is. Required.</dd>
+<dd>Tells users how urgently the Media document should be moved through
+workflow. Required.</dd>
<dt>Cover Date</dt>
-<dd>The date that will be posted with the media. (this is not necessarily the
- publish date, but what appears to viewers to be the publish date).</dd>
+<dd>The date that will be posted with the media. The cover date is not
+ necessarily the publish date, but what appears to viewers to be the
+ publish date. It is often used as a part of the URI, as well.</dd>
<dt>Expire Date</dt>
<dd>The date and time the Media will be taken offline.</dd>
@@ -54,27 +59,41 @@
<h3>2) Upload a File</h3>
<p><dl>
<dt>File Path</dt>
-<dd>Upload the Media. Click Browse, find the file on your computer or shared
- drive, and select it. Its path will display in the field. Click Upload to
- attach it to the Bricolage Media file. Only one Media can be attached to
- each Bricolage file; if you upload a second Media, it will replace the
- first.</dd>
+<dd>Upload the Media. Click <q>Browse,</q> find the file on your computer or
+ shared drive, and select it. Its path will display in the field. Click
+ <q>Upload</q> to attach it to the Bricolage media document. Only one file
+ can be attached to each media document; if you upload a second file, it
+ will replace the first.</dd>
<dt>Download</dt>
-<dd>Once a Media is uploaded, any user with access to the Media profile can
- download it. Click the hyperlink to open the file in a new window, then save
- it.</dd>
+<dd>Once a file has been uploaded, any user with access to the Media profile
+ can download it. Click the hyperlink to open the file in a new window,
+ then save it to your local drive if you wish to make changes.</dd>
</dl></p>
-<h3>3) Contributors</h3>
-
-<p>Enter the names of the item's producers, including any photographer or
-illustrator who was involved in the creation of the Media. Click Edit to get to
-the Contributor Association page. Under Choose Contributors, find the person's
-name and click Associate. On the next page, select his or her role and click
-Next. When done, click Save.</p>
-
-<p>Back on the Media Profile page, save the Media to your Workspace by clicking
-<i>Save.</i></p>
+<h3>3) Associations</h3>
+
+<dl>
+<dt>Keywords</dt>
+<dd>Enter any words or phrases relating to the media document's subject(s)
+ that will help tie it to other documents and also allow it to be found by
+ archive searches. Click <q>Edit</q> to get to the Edit Keywords page, then
+ type the keywords into the blank fields. You do not need to fill in all of
+ the keyword fields, but you can include as many additional fields as you
+ want by clicking <q>Add More.</q> When done, click <q>Save.</q></dd>
+
+<dt>Contributors</dt>
+<dd><p>Select the item's producers, including any photographer or illustrator
+ who was involved in the creation of the Media. Click <q>Edit</q> to get to
+ the Contributor Association page. Under <q>Choose Contributors,</q> find
+ the person's name and click <q>Associate.</q> On the next page, select his
+ or her role and click <q>Next.</q> When done, click <q>Save.</q></p></dd>
+</dl>
+
+<p>Back on the Media Profile page, save the Media document to your Workspace
+by clicking <q>Save.</q> Click <q>Save and Stay</q> to save the media document
+and continue editing it. Select a previous version and click <q>View</q> to
+see the previous version, or <q>Diff</q> to see a comparision of the previous
+version to the current version.</p>
</help>
View
2  comp/help/en_us/workflow/trail/dhandler
@@ -5,6 +5,6 @@
asset, except that only movements to different desks are shown.</p>
<p>For more details see the
- <a href="/help/workflow/events/">help on event logs</a>.</p>
+ <a href="../events/">help on event logs</a>.</p>
</help>
View
2  comp/widgets/container_prof/edit.html
@@ -58,7 +58,7 @@
# Find a suitable element to display
my($disp_buf, $value_buf);
foreach my $field ($dt->get_fields) {
- next if $field->get_widget_type !~ /^text/;
+# next if $field->get_widget_type !~ /^text/;
if (my $value = $field->get_value) {
$disp_buf = $field->get_name;
$value_buf = substr($value, 0, 64);
View
17 comp/widgets/container_prof/view.html
@@ -21,6 +21,23 @@
<td class="name"><% $dt->get_name %>:</td>
% if ($dt->is_container) {
<td>
+
+<%perl>
+# Find a suitable field of a tile to display
+my($disp_buf, $value_buf);
+foreach my $field ($dt->get_fields) {
+# next if $field->get_widget_type !~ /^text/;
+ if (my $value = $field->get_value) {
+ $disp_buf = $field->get_name;
+ $value_buf = substr($value, 0, 64);
+ last;
+ }
+}
+</%perl>
+% if ($value_buf) {
+<% $disp_buf %>: <% escape_html($value_buf) %><br />
+% }
+
<&
'/widgets/profile/imageSubmit.mc',
formName => 'theForm',
View
6 comp/widgets/desk/desk.mc
@@ -102,7 +102,11 @@ my $cached_assets = sub {
# Figure out what all we've got. We'll use this for displaying
# relative links.
- foreach (keys %$pkgs) { $others->{$_} = 1 if defined $objs->{$_} }
+ $others = {
+ map { $_ => 1 }
+ grep { $objs->{$_} && @{ $objs->{$_} } }
+ keys %$pkgs
+ };
# Return them.
return $objs->{$ckey};
View
50 comp/widgets/desk/desk_top.html
@@ -32,6 +32,7 @@
</%args>
<%init>;
$caption ||= $pl_names->{$class};
+$sort_by_val = get_pref('Default Asset Sort') unless defined $sort_by_val;
my ($link1, $link2, $lab1, $lab2, $img1, $img2);
if ($class eq 'story') {
($link1, $lab1, $img1) = ('media', $pl_names->{media}, 'media') if $others->{media};
@@ -44,10 +45,11 @@
} else {
($link1, $lab1, $img1) = ('story', $pl_names->{story}, 'stories') if $others->{story};
($link2, $lab2, $img2) = ('media', $pl_names->{media}, 'media') if $others->{media};
+ $sort_by_val = $sort_by_val eq 'cover_date' ? 'deploy_date'
+ : $sort_by_val eq 'element' ? 'output_channel'
+ : $sort_by_val;
}
-$sort_by_val = get_pref('Default Asset Sort') unless defined $sort_by_val;
-
my $sites = $c->get('__SITES__');
unless ($sites) {
@@ -62,28 +64,28 @@
}
</%init>
<%once>;
-my $sort_by = { story => [ [ name => 'Title' ],
- [ uri => 'Primary URI' ],
- [ cover_date => 'Cover Date' ],
- [ element => 'Story Type' ],
- [ priority => 'Priority' ],
- [ site_id => 'Site' ],
- ],
- media => [ [ name => 'Title' ],
- [ uri => 'Primary URI' ],
- [ cover_date => 'Cover Date' ],
- [ element => 'Media Type' ],
- [ priority => 'Priority' ],
- [ site_id => 'Site' ],
- ],
- template => [ [ name => 'File Name' ],
- [ deploy_date => 'Deployed Date' ],
- [ output_channel => 'Output Channel' ],
- [ priority => 'Priority' ],
- [ element_type => 'Asset Type' ],
- [ site_id => 'Site' ],
- ]
- };
+my $sort_by = {
+ story => [
+ [ name => 'Title' ],
+ [ uri => 'Primary URI' ],
+ [ cover_date => 'Cover Date' ],
+ [ element => 'Story Type' ],
+ [ priority => 'Priority' ],
+ ],
+ media => [
+ [ name => 'Title' ],
+ [ uri => 'Primary URI' ],
+ [ cover_date => 'Cover Date' ],
+ [ element => 'Media Type' ],
+ [ priority => 'Priority' ],
+ ],
+ template => [
+ [ name => 'File Name' ],
+ [ deploy_date => 'Deployed Date' ],
+ [ output_channel => 'Output Channel' ],
+ [ priority => 'Priority' ],
+ ]
+};
my $pl_names = {
story => get_class_info('story')->get_plural_name,
View
5 comp/widgets/help/debuggers.html
@@ -55,6 +55,11 @@
<li>Jos&eacute; Castro</li>
<li>Alexandra Gershman</li>
<li>Phillip Smith</li>
+ <li>Jerry Franz</li>
+ <li>Alexey Sheynuk</li>
+ <li>Paul Hyland</li>
+ <li>Frank Febbraro</li>
+ <li>Li Li</li>
<li>Guido Bülskämper</li>
<li>Wayne Slavin</li>
</ul>
View
2  comp/widgets/perm/display.html
@@ -98,6 +98,8 @@
$m->comp($head_comp, $lang->maketext('Grant "[_1]" members permission to'
." access assets in these workflows.", $name));
foreach my $wf ($wf_pkg->list) {
+ # Skip workflows from deleted sites.
+ my $site = $sites{$wf->get_site_id} or next;
my $gid = $wf->get_asset_grp_id;
my $grp = $asset_grp_pkg->lookup({ id => $gid });
# XXX We say it isn't an asset group because no higher than EDIT is
View
17 comp/widgets/story_prof/edit_meta.html
@@ -101,10 +101,19 @@
id => 'slug',
key => 'slug',
&>
-<& '/widgets/profile/displayFormElement.mc',
- objref => $story,
- key => 'cover_date',
-&>
+<%perl>;
+TZ: {
+ # XXX Yes, ugly hack, but it's the best way to prevent the
+ # user's preferences from affecting the time zone.
+ local $HTML::Mason::Commands::session{_bric_user}->{object} = undef;
+ print STDERR Bric::App::Session::get_user_object(), $/;
+ $m->comp(
+ '/widgets/profile/displayFormElement.mc',
+ objref => $story,
+ key => 'cover_date',
+ );
+}
+</%perl>
<& '/widgets/profile/displayFormElement.mc',
objref => $story,
key => 'expire_date',
View
4 comp/workflow/manager/dhandler
@@ -105,8 +105,8 @@ my $fields = { template => [qw(file_name version output_channel_name publish_sta
};
my $sort_by = { template => 'file_name',
- story => 'title',
- media => 'title' };
+ story => get_pref('Default Asset Sort') || 'title',
+ media => get_pref('Default Asset Sort') || 'title' };
unshift @{$fields->{'media'}}, 'thumb' if USE_THUMBNAILS;
View
2  conf/bricolage.conf
@@ -180,7 +180,7 @@ PASSWD_LENGTH = 5
# used.
#
# QUEUE_PUBLISH_JOBS tells Bricolage to drop all jobs into the Distribution
-# queue on save, rather than trying to run them immediately, which is the
+# queue on publish, rather than trying to run them immediately, which is the
# default.
#
# FTP_UNLINK_BEFORE_MOVE must be set to Yes for some FTP servers (e.g.
View
5 data/burn/comp/oc_1/book_review.mc
@@ -13,8 +13,3 @@
<br>
Page <% $burner->get_page + 1 %>
<!-- End "Book Review" -->
-<%publish>
-if (my $media = $element->get_related_media) {
- $burner->publish_another($media);
-}
-</%publish>
View
12 inst/upgrade.pl
@@ -35,6 +35,7 @@ =head1 SEE ALSO
use Bric::Inst qw(:all);
use File::Spec::Functions qw(:ALL);
use Data::Dumper;
+use lib './lib'; # To get local version number.
# make sure we're root, otherwise uninformative errors result
unless ($> == 0) {
@@ -47,11 +48,6 @@ =head1 SEE ALSO
'/usr/local/bricolage' );
our $INSTALL;
-# determine version being installed
-use lib './lib';
-require Bric;
-our $VERSION = $Bric::VERSION;
-
print q{
##########################################################################
@@ -90,6 +86,7 @@ sub get_bricolage_root {
hard_fail("The Bricolage Installation found in $UPGRADE{BRICOLAGE_ROOT}\n",
"was installed manually and cannot be automatically upgraded.")
unless -e catfile($UPGRADE{BRICOLAGE_ROOT}, "conf", "install.db");
+ $ENV{BRICOLAGE_ROOT} = $UPGRADE{BRICOLAGE_ROOT};
}
# read the install.db file from the chosen bricolage root
@@ -106,6 +103,11 @@ sub read_install_db {
sub check_version {
my @todo;
+ # determine version being installed (Only after BRICOLAGE_ROOT has been
+ # set up so that bricolage.conf is properly read-in.
+ require Bric;
+ my $VERSION = Bric->VERSION;
+
# make sure we're not trying to install the same version twice
if ($INSTALL->{VERSION} eq $VERSION) {
print <<END;
View
2  inst/upgrade/1.10.0/delete_old_stuff.pl
@@ -17,7 +17,7 @@
media/images/%s/D_red.gif
media/images/%s/P_green.gif
media/images/%s/P_red.gif
- comp/widgets/summary/formatting_meta.html
+ widgets/summary/formatting_meta.html
);
# Delete defunct language-specific UI components.
View
16 inst/upgrade/1.10.0/rm_old_sort_prefs.pl
@@ -0,0 +1,16 @@
+#!/usr/bin/perl -w
+
+use strict;
+use File::Spec::Functions qw(catdir updir);
+use FindBin;
+use lib catdir $FindBin::Bin, updir, 'lib';
+use Bric::Config qw(MASON_COMP_ROOT);
+use Bric::Util::Trans::FS;
+
+do_sql
+ q{DELETE from pref_opt WHERE value in ('id', 'category_name')},
+ q{UPDATE pref_opt SET description = 'Cover Date/Deploy Date'
+ WHERE value = 'cover_date'},
+ q{UPDATE pref_opt SET description = 'Document Type/Output Channel'
+ WHERE value = 'element'},
+
View
44 inst/upgrade/1.8.7/fix_media.pl
@@ -0,0 +1,44 @@
+#!/usr/bin/perl -w
+
+use strict;
+use FindBin;
+use File::Spec::Functions qw(catdir updir tmpdir);
+use lib catdir $FindBin::Bin, updir, 'lib';
+use bric_upgrade qw(:all);
+use Bric::Util::DBI qw(:all);
+use Bric::Util::Trans::FS;
+use Bric::Config qw(MEDIA_FILE_ROOT);
+
+my $fs = Bric::Util::Trans::FS->new;
+my $zero_dir = $fs->cat_dir('', '0', '');
+
+my $sel = prepare(qq{
+ SELECT id, media__id, version, file_name, location
+ FROM media_instance
+ WHERE location LIKE '$zero_dir%'
+});
+
+my $upd = prepare(q{
+ UPDATE media_instance
+ SET location = ?
+ WHERE id = ?
+});
+
+execute($sel);
+bind_columns($sel, \my ($id, $mid, $version, $fn, $loc));
+my $list_file = $fs->cat_file(tmpdir, 'fix_media.txt');
+open my $file, '>', $list_file or die "Cannot open '$list_file': $!\n";
+
+while (fetch($sel)) {
+ my $new_path = Bric::Util::Trans::FS->cat_dir('/', $mid, $version);
+ my $new_loc = Bric::Util::Trans::FS->cat_dir($new_path, $fn);
+ # Save date for fix_media2.pl.
+ print $file "$loc\t$new_path\n";
+ execute($upd, $new_loc, $id);
+}
+
+close $file;
+
+
+__END__
+
View
29 inst/upgrade/1.8.7/fix_media2.pl
@@ -0,0 +1,29 @@
+#!/usr/bin/perl -w
+
+use strict;
+use FindBin;
+use File::Spec::Functions qw(catdir updir tmpdir);
+use lib catdir $FindBin::Bin, updir, 'lib';
+use Bric;
+use Bric::Util::Trans::FS;
+use Bric::Config qw(MEDIA_FILE_ROOT);
+use File::Copy qw(mv);
+
+my $fs = Bric::Util::Trans::FS->new;
+my $list_file = $fs->cat_file(tmpdir, 'fix_media.txt');
+open my $file, '<', $list_file or die "Cannot open '$list_file': $!\n";
+while (<$file>) {
+ chomp;
+ my ($file, $new_dir) = split /\t/;
+ $file = $fs->cat_dir(MEDIA_FILE_ROOT, $file);
+ $new_dir = $fs->cat_dir(MEDIA_FILE_ROOT, $new_dir);
+ $fs->mk_path($new_dir);
+ mv $file, $new_dir;
+}
+
+close $file;
+$fs->del($list_file);
+$fs->del($fs->cat_dir(MEDIA_FILE_ROOT, '0'));
+
+__END__
+
View
3  inst/upgrade/1.8.7/move_media.pl
@@ -12,6 +12,9 @@
my $orig_dir = $fs->cat_dir(MASON_COMP_ROOT->[0][1], qw(data media));
my $temp_dir = $fs->cat_dir(MASON_COMP_ROOT->[0][1], qw(data temp));
+# Just exit if there is no media directory.
+exit unless -e $orig_dir;
+
# Check the media directory to see if upgrade script has already run.
opendir my $check_dir, $orig_dir or die "Cannot open $orig_dir: $!\n";
while (my $check_file = readdir $check_dir) {
View
6 inst/upgrade/1.8.9/add_keyword_fks.pl
@@ -13,9 +13,9 @@
qq{ DELETE from $thing\_keyword
WHERE $thing\_id IN (
SELECT kc.$thing\_id
- FROM $thing\_keyword kc LEFT JOIN $thing\ c
- ON kc.$thing\_id = c.id
- WHERE c.id IS NULL
+ FROM $thing\_keyword kc LEFT JOIN $thing c
+ ON kc.$thing\_id = c.id
+ WHERE c.id IS NULL
)
},
View
27 inst/upgrade/1.8.9/fix_publish_status.pl
@@ -0,0 +1,27 @@
+#!/usr/bin/perl -w
+
+use strict;
+use File::Spec::Functions qw(catdir updir);
+use FindBin;
+use lib catdir $FindBin::Bin, updir, 'lib';
+use bric_upgrade qw(:all);
+
+for my $thing (qw(story media)) {
+ do_sql
+ qq{UPDATE $thing
+ SET publish_status = '1'
+ WHERE published_version IS NOT NULL
+ AND publish_status = '0'
+ },
+
+ # We have no idea what version was actually published, so
+ # current_version is the best we can do. :-(
+ qq{UPDATE $thing
+ SET published_version = current_version
+ WHERE published_version IS NULL
+ AND publish_status = '1'
+ },
+ ;
+}
+
+__END__
View
33 inst/upgrade/1.8.9/update_publish_status_check.pl
@@ -0,0 +1,33 @@
+#!/usr/bin/perl -w
+
+use strict;
+use File::Spec::Functions qw(catdir updir);
+use FindBin;
+use lib catdir $FindBin::Bin, updir, 'lib';
+use bric_upgrade qw(:all);
+
+for my $thing (qw(story media)) {
+ do_sql
+ qq{ALTER TABLE $thing DROP CONSTRAINT ck_$thing\__publish_status},
+
+ qq{ALTER TABLE $thing
+ ADD CONSTRAINT ck_$thing\__publish_status CHECK (
+ publish_status IN (0,1)
+ AND (
+ (
+ publish_status = 0
+ AND publish_date IS NULL
+ AND first_publish_date IS NULL
+ )
+ OR (
+ publish_status = 1
+ AND publish_date IS NOT NULL
+ AND first_publish_date IS NOT NULL
+ )
+ )
+ )
+ },
+ ;
+}
+
+__END__
View
2  lib/Bric/Admin.pod
@@ -199,6 +199,8 @@ START MODULE LIST
=item Text::WordDiff
+=item URI::Escape
+
=item HTML::Template (optional)
=item HTML::Template::Expr (optional)
View
32 lib/Bric/App/Callback/Publish.pm
@@ -11,7 +11,7 @@ use Bric::Biz::Asset::Business::Media;
use Bric::Biz::Asset::Business::Story;
use Bric::Biz::OutputChannel;
use Bric::Dist::ServerType;
-use Bric::Config qw(:prev);
+use Bric::Config qw(:prev :time);
use Bric::Util::Burner;
use Bric::Util::DBI qw(:junction);
use Bric::Util::Job::Pub;
@@ -161,9 +161,13 @@ sub publish : Callback {
my $media = mk_aref($media_pub_ids);
# Iterate through each story and media object to be published.
- for my $spec ( [story => $stories], [ media => $media] ) {
- my ($key, $doc_ids) = @$spec;
+ for my $spec (
+ [ 'story', 'stories', $stories ],
+ [ 'media', 'media', $media ],
+ ) {
+ my ($key, $plural, $doc_ids) = @$spec;
my $count = @$doc_ids or next;
+ my $exp_count = 0;
my $pkg = get_package_name($key);
my $disp = get_disp_name($key);
for my $doc ($pkg->list({ version_id => ANY(@$doc_ids) })) {
@@ -179,12 +183,18 @@ sub publish : Callback {
$job->save;
log_event('job_new', $job);
- # Report publishing if the job was executed on save, otherwise
- # report scheduling
- my $saved = $job->get_comp_time
- ? 'published'
- : 'scheduled for publication';
- add_msg(qq{$disp "[_1]" $saved.}, $doc->get_title) if $count <= 3;
+ my $exp_date = $doc->get_expire_date(ISO_8601_FORMAT);
+ my $expired = $exp_date
+ && $exp_date lt $job->get_sched_time(ISO_8601_FORMAT);
+ if ($count <= 3) {
+ my $saved = $expired
+ ? $job->get_comp_time ? 'expired' : 'scheduled for expiration'
+ : $job->get_comp_time ? 'published' : 'scheduled for publication';
+ add_msg(qq{$disp "[_1]" $saved.}, $doc->get_title);
+ } else {
+ $exp_count++ if $expired;
+ }
+
# Remove it from the desk it's on.
if (my $d = $doc->get_current_desk) {
$d->remove_asset($doc);
@@ -204,6 +214,10 @@ sub publish : Callback {
}
$doc->save;
}
+ add_msg("[quant,_1,$key,$plural] published.", $count - $exp_count)
+ if $count > 3;
+ add_msg("[quant,_1,$key,$plural] expired.", $exp_count)
+ if $exp_count;
}
unless (exists($param->{instant}) && $param->{instant}) {
View
4 lib/Bric/Biz/Asset.pm
@@ -1083,7 +1083,9 @@ NONE
sub needs_publish {
my $self = shift;
- return $self->get_current_version == $self->get_published_version ? 0 : 1;
+ # Version 0 is never published. Neither is undef, of course.
+ my $pub_version = $self->get_published_version or return 1;
+ return $self->get_current_version == $pub_version ? 0 : 1;
}
################################################################################
View
83 lib/Bric/Biz/Asset/Business.pm
@@ -436,7 +436,8 @@ sub my_meths {
push @ord, $meth->{name};
push (@ord, 'title') if $meth->{name} eq 'name';
}
- push @ord, qw(source_id source first_publish_date publish_date), pop @ord;
+ push @ord, qw(source_id source first_publish_date publish_date category
+ category_name), pop @ord;
$meths->{uuid} = {
name => 'uuid',
@@ -499,6 +500,36 @@ sub my_meths {
len => 10,
type => 'short',
};
+ $meths->{category} = {
+ get_meth => sub { shift->get_primary_category(@_) },
+ get_args => [],
+ set_meth => sub { shift->set_primary_category(@_) },
+ set_args => [],
+ name => 'category',
+ disp => 'Category',
+ len => 64,
+ req => 1,
+ type => 'short',
+ };
+
+ $meths->{category_name} = {
+ get_meth => sub { shift->get_primary_category(@_)->get_name },
+ get_args => [],
+ name => 'category_name',
+ disp => 'Category Name',
+ len => 64,
+ req => 1,
+ type => 'short',
+ };
+ $meths->{category_uri} = {
+ get_meth => sub { shift->get_primary_category(@_)->get_uri },
+ get_args => [],
+ name => 'category_uri',
+ disp => 'Category URI',
+ len => 64,
+ req => 1,
+ type => 'short',
+ };
# Copy the data for the title from name.
$meths->{title} = { %{ $meths->{name} } };
$meths->{title}{name} = 'title';
@@ -1368,7 +1399,7 @@ B<Side Effects:>
NONE
-B<Notes:>
+B<Notes:>
NONE
@@ -1460,6 +1491,52 @@ sub set_publish_date {
# First publish. Set both dates.
$self->_set([qw(publish_date first_publish_date)], [$date, $date]);
}
+ return $self;
+}
+
+################################################################################
+
+=item $self = $story->set_publish_status($bool)
+
+Sets the publish status to a true or false value.
+
+B<Throws:> NONE.
+
+B<Side Effects:> Also sets the first C<published_version> to the value stored
+in the C<version> attribute if it hasn't been set before.
+
+B<Notes:> NONE.
+
+=cut
+
+sub set_publish_status {
+ my ($self, $val) = @_;
+ my ($pubv, $curv) = $self->_get(qw(published_version version));
+ return $self->_set([qw(publish_status published_version)] => [$val, $curv])
+ if $val && !$pubv;
+ return $self->_set(['publish_status'] => [$val]);
+}
+
+################################################################################
+
+=item $self = $story->set_published_version($version)
+
+Sets the published version of the document.
+
+B<Throws:> NONE.
+
+B<Side Effects:> Also sets the first C<publishstatus> if it's set to a false
+value.
+
+B<Notes:> NONE.
+
+=cut
+
+sub set_published_version {
+ my ($self, $version) = @_;
+ return $self->_set([qw(publish_status published_version)] => [ 1, $version])
+ if $version;
+ return $self->_set([qw(published_version)] => [$version]);
}
################################################################################
@@ -2427,7 +2504,9 @@ sub _construct_uri {
}
}
+ Bric::Util::Pref->use_user_prefs(0);
my $path = $self->get_cover_date($fmt) or return;
+ Bric::Util::Pref->use_user_prefs(1);
my @path = split( '/', $path );
# Return the URI with the case adjusted as necessary.
View
71 lib/Bric/Biz/Asset/Business/Media.pm
@@ -50,6 +50,7 @@ use File::Temp qw( tempfile );
use Bric::Config qw(:media :thumb MASON_COMP_ROOT PREVIEW_ROOT);
use Bric::Util::Fault qw(:all);
use Bric::Util::MediaType;
+use URI::Escape ();
#==============================================================================#
# Inheritance #
@@ -396,6 +397,7 @@ BEGIN {
_category_obj => Bric::FIELD_NONE,
_file => Bric::FIELD_NONE,
_media_type_obj => Bric::FIELD_NONE,
+ _upload_data => Bric::FIELD_NONE,
});
}
@@ -1097,7 +1099,7 @@ sub my_meths {
push @ord, $meth->{name};
}
- push @ord, qw(file_name category category_name), pop @ord;
+ push @ord, qw(file_name), pop @ord;
$meths->{file_name} = {
get_meth => sub { shift->get_file_name(@_) },
get_args => [],
@@ -1111,25 +1113,6 @@ sub my_meths {
maxlength => 256
}
};
- $meths->{category} = {
- get_meth => sub { shift->get_category_object(@_) },
- get_args => [],
- name => 'category',
- disp => 'Category',
- len => 64,
- req => 1,
- type => 'short',
- };
-
- $meths->{category_name} = {
- get_meth => sub { shift->get_category_object(@_)->get_name },
- get_args => [],
- name => 'category_name',
- disp => 'Category Name',
- len => 64,
- req => 1,
- type => 'short',
- };
# Copy the data for the title from name.
$meths->{title} = { %{ $meths->{name} } };
@@ -1431,8 +1414,10 @@ B<Notes:> NONE.
sub get_local_uri {
my $self = shift;
my $loc = $self->get_location || return;
- return Bric::Util::Trans::FS->cat_uri(MEDIA_URI_ROOT,
- Bric::Util::Trans::FS->dir_to_uri($loc) );
+ return Bric::Util::Trans::FS->cat_uri(
+ MEDIA_URI_ROOT,
+ Bric::Util::Trans::FS->dir_to_uri($loc),
+ );
}
=item $uri = $media->get_path()
@@ -1504,10 +1489,17 @@ B<Notes:> NONE.
=cut
sub upload_file {
- my ($self, $fh, $name, $type, $size) = @_;
+ my $self = shift;
+
+ my ($id, $v, $old_fn) = $self->_get(qw(id version file_name));
+
+ unless ($id) {
+ # If there is no ID, we're not ready to create a file name, yet.
+ $self->_set(['_upload_data'] => [\@_]);
+ return $self;
+ }
- my ($id, $v, $old_fn, $loc, $uri) =
- $self->_get(qw(id version file_name location uri));
+ my ($fh, $name, $type, $size) = @_;
my @id_dirs = $id =~ /(\d\d?)/g;
my $dir = Bric::Util::Trans::FS->cat_dir(MEDIA_FILE_ROOT, @id_dirs, "v.$v");
Bric::Util::Trans::FS->mk_path($dir);
@@ -1540,8 +1532,8 @@ sub upload_file {
$name = $prefix . $ext;
}
- open FILE, ">$path"
- or throw_gen(error => "Unable to open '$path': $!");
+ local *FILE;
+ open FILE, ">$path" or throw_gen "Unable to open '$path': $!";
my $buffer;
while (read($fh, $buffer, 10240)) { print FILE $buffer }
close $fh;
@@ -1570,20 +1562,14 @@ sub upload_file {
my $oc_obj = $self->get_primary_oc;
my $new_loc = Bric::Util::Trans::FS->cat_dir('/', @id_dirs, "v.$v", $name);
-
# Set the location, name, and URI.
- if (not defined $old_fn
- or not defined $uri
- or $old_fn ne $name
- or $loc ne $new_loc) {
- $self->_set(['file_name'], [$name]);
- $uri = Bric::Util::Trans::FS->cat_uri
- ($self->_construct_uri($self->get_category_object, $oc_obj),
- $oc_obj->get_filename($self));
+ $self->_set(['file_name'], [$name]);
+ my $uri = Bric::Util::Trans::FS->cat_uri(
+ $self->_construct_uri($self->get_category_object, $oc_obj),
+ URI::Escape::uri_escape($oc_obj->get_filename($self))
+ );
- $self->_set([qw(location uri _update_uri)] =>
- [ $new_loc, $uri, 1]);
- }
+ $self->_set( [qw(location uri _update_uri)] => [ $new_loc, $uri, 1 ] );
if (my $auto_fields = $self->_get_auto_fields) {
# We need to autopopulate data field values. Get the top level element
@@ -1860,6 +1846,13 @@ sub save {
} else {
$self->_insert_media();
$self->_insert_instance();
+ if (my $upload_data = $self->_get('_upload_data')) {
+ # Ah, we need to handle a file upload.
+ $self->upload_file(@$upload_data);
+ $self->_set(['_upload_data'] => [undef]);
+ # Update to save the file location data.
+ $self->_update_instance;
+ }
}
}
View
23 lib/Bric/Biz/Asset/Business/Story.pm
@@ -1170,7 +1170,7 @@ sub my_meths {
$meths->{$meth->{name}} = $meth;
push @ord, $meth->{name};
}
- push @ord, qw(slug category category_name), pop @ord;
+ push @ord, qw(slug), pop @ord;
$meths->{slug} = {
get_meth => sub { shift->get_slug(@_) },
get_args => [],
@@ -1186,27 +1186,6 @@ sub my_meths {
maxlength => 64
}
};
- $meths->{category} = {
- get_meth => sub { shift->get_primary_category(@_) },
- get_args => [],
- set_meth => sub { shift->set_primary_category(@_) },
- set_args => [],
- name => 'category',
- disp => 'Category',
- len => 64,
- req => 1,
- type => 'short',
- };
-
- $meths->{category_name} = {
- get_meth => sub { shift->get_primary_category(@_)->get_name },
- get_args => [],
- name => 'category_name',
- disp => 'Category Name',
- len => 64,
- req => 1,
- type => 'short',
- };
# Rename element type, too.
$meths->{element_type} = { %{ $meths->{element_type} } };
View
174 lib/Bric/Biz/Asset/Template.pm
@@ -1130,94 +1130,106 @@ sub my_meths {
category_name), pop @ord;
$meths->{file_name} = {
- name => 'file_name',
- get_meth => sub { shift->get_file_name(@_) },
- get_args => [],
- set_meth => sub { shift->set_file_name(@_) },
- set_args => [],
- disp => 'File Name',
- len => 256,
- req => 0,
- type => 'short',
- props => { type => 'text',
- length => 32,
- maxlength => 256
- }
- };
+ name => 'file_name',
+ get_meth => sub { shift->get_file_name(@_) },
+ get_args => [],
+ set_meth => sub { shift->set_file_name(@_) },
+ set_args => [],
+ disp => 'File Name',
+ len => 256,
+ req => 0,
+ type => 'short',
+ props => {
+ type => 'text',
+ length => 32,
+ maxlength => 256
+ }
+ };
+
$meths->{deploy_date} = {
- name => 'deploy_date',
- get_meth => sub { shift->get_deploy_date(@_) },
- get_args => [],
- set_meth => sub { shift->set_deploy_date(@_) },
- set_args => [],
- disp => 'Deploy Date',
- len => 64,
- req => 0,
- type => 'short',
- props => { type => 'date' }
- };
- $meths->{output_channel} = {
- name => 'output_channel',
- get_meth => sub { shift->get_output_channel(@_) },
- get_args => [],
- set_meth => sub { shift->set_output_channel(@_) },
- set_args => [],
- disp => 'Output Channel',
- len => 64,
- req => 0,
- type => 'short',
- };
-
- $meths->{tplate_type} = {
- name => 'tplate_type',
- get_meth => sub { shift->get_tplate_type(@_) },
- get_args => [],
- disp => 'Template Type',
- len => 1,
- req => 1,
- type => 'short',
- props => { type => 'select',
- vals => [[ &ELEMENT_TEMPLATE =>
- 'Element'],
- [ &CATEGORY_TEMPLATE =>
- 'Category'],
- [ &UTILITY_TEMPLATE =>
- 'Utility'],
- ]
- }
- };
+ name => 'deploy_date',
+ get_meth => sub { shift->get_deploy_date(@_) },
+ get_args => [],
+ set_meth => sub { shift->set_deploy_date(@_) },
+ set_args => [],
+ disp => 'Deploy Date',
+ len => 64,
+ req => 0,
+ type => 'short',
+ props => { type => 'date' }
+ };
+
+ $meths->{output_channel} = {
+ name => 'output_channel',
+ get_meth => sub { shift->get_output_channel(@_) },
+ get_args => [],
+ set_meth => sub { shift->set_output_channel(@_) },
+ set_args => [],
+ disp => 'Output Channel',
+ len => 64,
+ req => 0,
+ type => 'short',
+ };
+
+ $meths->{tplate_type} = {
+ name => 'tplate_type',
+ get_meth => sub { shift->get_tplate_type(@_) },
+ get_args => [],
+ disp => 'Template Type',
+ len => 1,
+ req => 1,
+ type => 'short',
+ props => {
+ type => 'select',
+ vals => [
+ [ &ELEMENT_TEMPLATE => 'Element' ],
+ [ &CATEGORY_TEMPLATE => 'Category' ],
+ [ &UTILITY_TEMPLATE => 'Utility' ],
+ ]
+ }
+ };
$meths->{output_channel_name} = {
- get_meth => sub { shift->get_output_channel_name(@_) },
- get_args => [],
- name => 'output_channel_name',
- disp => 'Output Channel',
- len => 64,
- req => 1,
- type => 'short',
- };
+ get_meth => sub { shift->get_output_channel_name(@_) },
+ get_args => [],
+ name => 'output_channel_name',
+ disp => 'Output Channel',
+ len => 64,
+ req => 1,
+ type => 'short',
+ };
$meths->{category} = {
- get_meth => sub { shift->get_category(@_) },
- get_args => [],
- set_meth => sub { shift->set_category(@_) },
- set_args => [],
- name => 'category',
- disp => 'Category',
- len => 64,
- req => 1,
- type => 'short',
- };
+ get_meth => sub { shift->get_category(@_) },
+ get_args => [],
+ set_meth => sub { shift->set_category(@_) },
+ set_args => [],
+ name => 'category',
+ disp => 'Category',
+ len => 64,
+ req => 1,
+ type => 'short',
+ };
$meths->{category_name} = {
- get_meth => sub { shift->get_category(@_)->get_name },
- get_args => [],
- name => 'category_name',
- disp => 'Category Name',
- len => 64,
- req => 1,
- type => 'short',
- };
+ get_meth => sub { shift->get_category(@_)->get_name },
+ get_args => [],
+ name => 'category_name',
+ disp => 'Category Name',
+ len => 64,
+ req => 1,
+ type => 'short',
+ };
+
+ $meths->{category_uri} = {
+ get_meth => sub { shift->get_category(@_)->get_uri },
+ get_args => [],
+ name => 'category_uri',
+ disp => 'Category URI',
+ len => 64,
+ req => 1,
+ type => 'short',
+ };
return !$ord ? $meths : wantarray ? @{$meths}{@ord} : [@{$meths}{@ord}];
}
View
184 lib/Bric/Changes.pod
@@ -92,6 +92,10 @@ Added F<republish_by_uri> contrib script. [David and Mark]
Field types can now have their widgets changed via the UI as well as via SOAP.
So you can change a "text" widget to "textarea", for example. [David]
+=item *
+
+Fixed the options in the "Default Asset Sort" to be more up-to-date. [David]
+
=back
=cut
@@ -1104,6 +1108,37 @@ C<story_keyword>, C<media_keyword>, C<element_member>, and
C<media_contributor> tables. This should make keyword lookups, at least, much
faster. [David]
+=item *
+
+When a story or media document is published with an expiration date earlier
+than the publish date, the UI will now properly report that the document has
+been "expired", rather than "published". Thanks to Simon Wilcox for the spot.
+[David]
+
+=item *
+
+The Bulk Publish interface in the UI now displays the name of the site
+alongside the category if there is more than one site, so as to disambiguate
+the list of categories. Reported by Marshall Roch. [David]
+
+=item *
+
+Added constraints to the story and media tables in the database to prevent the
+publish status from becoming out of sync with the publish date and first
+publish date. [David]
+
+=item *
+
+Changed code to show the first displayable data field of a subelement when
+viewing or editing an asset as opposed to only text fields. [Paul Orrock]
+
+=item *
+
+L<Bric::SOAP::Workflow|Bric::SOAP::Workflow>'s publish method now schedules a
+publish job instead of immediately publishing, thus allowing the
+C<publish_date> parameter to actually work, and ensuring that the proper
+version is published. [David]
+
=back
=head2 Bug Fixes
@@ -1112,8 +1147,147 @@ faster. [David]
=item *
-Fixed misnamed keywords on the C<category_keyword>, C<story_keyword>, and
-C<media_keyword> tables. [David]
+Fixed misnamed and/or missing keyword foreign keys on the C<category_keyword>,
+C<story_keyword>, and C<media_keyword> tables. [David]
+
+=item *
+
+Documents created or updated via SOAP will now set the publish date to the
+same value as the first publish date if the latter is set and the former is
+not. [David]
+
+=item *
+
+The Burner C<publish()> method now sets the publish date to the current date
+and time if it was not specified via an argument. This will hopefully fix
+instances of stories and media in the database with the C<first_publish_date>
+set but not the C<publish_date>. [David]
+
+=item *
+
+The version 1.8.8 upgrade script that moves media files around no longer fails
+when the media directory doesn't exist (because no media documents have been
+created). Reported by Wayne Slavin. [David]
+
+=item *
+
+Upgrades no longer fail if $BRICOLAGE_ROOT is not set and the instance of
+Bricolage to be upgraded is somewhere other than F</usr/local/bricolage>.
+Reported by Nate Perry-Thistle. [David]
+
+=item *
+
+Backported database upgrade permissions changes from Bricolage 1.10 so that
+the permissions are set for the super user for upgrade scripts such as
+F<inst/upgrade/1.8.7/move_media.pl> and as the PostgreSQL user only when an
+upgrade script loads F<inst/upgrade/lib/bric_upgrade.pm>. Thanks to Nate
+Perry-Thistle for reporting the permissions bug with the 1.8.7 upgrade script.
+[David]
+
+=item *
+
+Fixed file names for files uploaded by MSIE on Windows. Again. Reported by
+Wayne Slavin. [David]
+
+=item *
+
+Modified the C<set_publish_status()> and C<set_published_version()> methods of
+L<Bric::Biz::Asset::Business|Bric::Biz::Asset::Business> so that they each
+make sure that the other is set. This will hopefully prevent only one from
+being set. [David]
+
+=item *
+
+A media document that has a file uploaded to it before it is ever saved will
+no longer cause it to store the media file in a directory without an ID
+mapping it to the media document. This only affected installations where media
+were created by some method other than the Bricolage UI or SOAP. Reported by
+Rod Taylor. [David]
+
+=item *
+
+Story and Media on the search result page are now correctly sorted by the
+"Default Asset Sort" preference, or title if the preference is not set. [Paul
+Orrock]
+
+=item *
+
+Removed commented-out SQL that was appearing at the end of F<inst/Pg.sql>. The
+comment style, C</* */>, caused problems with PostgreSQL 7.3 and earlier.
+Reported by Jerry Franz, with the underlying problem identified by "aander07".
+[David]
+
+=item *
+
+Media file names are now URI-escaped for inclusion in the URIs returned by
+C<get_uri()> and C<get_primary_uri()>. Reported by Alexey Sheynuk. [David]
+
+=item *
+
+The burner now looks up existing resources (files) by both file system path
+and URI, instead of just the file system path, since the combination of the
+path and the URI are globally unique, not just the path. Reported by Paul
+Hyland. [David]
+
+=item *
+
+Publishing a document with a related document, where the related document is
+still at version 0 (because it has never been checked in), now properly
+displays a message indicating that the related document cannot be published
+because it is checked out. [David]
+
+=item *
+
+Removed testing code from the default F<book_review.mc> template on the file
+system (not present in the template in the database) that was put in place
+before the release of 1.8.6. [David]
+
+=item *
+
+Eliminated an error in the permissions screen when a site with workflows has
+been deleted. Reported by Frank Febbraro. [David]
+
+=item *
+
+Fixed the "help on event logs" link in the Trail help page. Reported by Scott.
+[David]
+
+=item *
+
+If a desk or My Workspace does not have assets of a particular type (stories,
+media, or templates) on it, it will no longer display buttons for them.
+Reported by Scott. [David]
+
+=item *
+
+Fixed the sorting menus for templates on desks. Also fixed them for all assets
+on desks so that sorting on categories sorts by URIs (which are displayed)
+rather than names. Template sorting issues reported by Scott. [David]
+
+=item *
+
+Adding a variable to the message in an alert type now properly triggers the
+update of the message character count. Reported by Scott. [David]
+
+=item *
+
+Changed the media type for the files in the JavaScript directory from
+"application/x-javascript", which Safari 2.03 didn't seem to like, to
+"text/javascipt", which is what it should have been all along, anyway. [David]
+
+=item *
+
+Fixed sorting of SQL files for concatenation into F<inst/Pg.sql> so that it
+should now always be in the right order, regardless of the local system's
+locale settings. This issue only applied to those running C<make dist> or
+C<make inst/Pg.sql>, since distributions already have F<inst/Pg.sql>. [David]
+
+=item *
+
+URIs are now always constructed with the cover date reflecting the global Time
+Zone preference, rather than the setting from a user's overriding Time Zone
+preference. This prevents URI conflicts and makes searches for URIs with dates
+in them consistent. Reported by Li Li. [David]
=back
@@ -1175,9 +1349,9 @@ are checked out. [David]
=item *
-If a story passed to the C<burn_another()> or C<preview_another()> burner
+If a story passed to the C<publish_another()> or C<preview_another()> burner
methods is the same as the story currently being burned, it will no longer be
-published or previewed again by C<burn_another()> or C<preview_another()>,
+published or previewed again by C<publish_another()> or C<preview_another()>,
thus mitigating the possibility of infinite loops. [David]
=item *
@@ -2045,7 +2219,7 @@ and makes the operation of Bric::Dist::Handler more efficient. [David]
=item *
-A call to C<< $burner->burn_another >> in a template that passes in a
+A call to C<< $burner->publish_another >> in a template that passes in a
date/time string in the future now causes a publish job to be scheduled for
that time, rather than immediate burning the document and then scheduling the
distribution to take place in the future. Reported by Ashlee Caul. [David]
View
10 lib/Bric/License.pod
@@ -320,6 +320,16 @@ Friends who have spotted bugs include:
=item Wayne Slavin
+=item Jerry Franz
+
+=item Alexey Sheynuk
+
+=item Paul Hyland
+
+=item Frank Febbraro
+
+=item Li Li
+
=back
Bricolage's translation team:
View
2  lib/Bric/SOAP/Media.pm
@@ -700,6 +700,8 @@ sub load_asset {
$init{name} = $mdata->{name};
# mix in dates
+ $mdata->{publish_date} ||= $mdata->{first_publish_date}
+ if $mdata->{first_publish_date};
for my $name qw(cover_date expire_date publish_date first_publish_date) {
my $date = $mdata->{$name};
next unless $date; # skip missing date
View
2  lib/Bric/SOAP/Story.pm
@@ -919,6 +919,8 @@ sub load_asset {
$story->set_publish_status($sdata->{publish_status}) if $update;
# assign dates
+ $sdata->{publish_date} ||= $sdata->{first_publish_date}
+ if $sdata->{first_publish_date};
for my $name qw(cover_date expire_date publish_date first_publish_date) {
my $date = $sdata->{$name};
next unless $date; # skip missing date
View
81 lib/Bric/SOAP/Workflow.pm
@@ -747,57 +747,63 @@ sub move {
# find destination workflow if defined
my $to_workflow;
if (exists $args->{workflow}) {
- ($to_workflow) = Bric::Biz::Workflow->list(
- { name => $args->{workflow} });
- throw_ap(error => __PACKAGE__ . "::move : no workflow found matching " .
- "(workflow => \"$args->{workflow}\")")
- unless defined $to_workflow;
+ ($to_workflow) = Bric::Biz::Workflow->list({
+ name => $args->{workflow},
+ });
+ throw_ap(error => __PACKAGE__ . "::move : no workflow found matching " .
+ "(workflow => \"$args->{workflow}\")")
+ unless defined $to_workflow;
}
# find destination desk
- my ($to_desk) = Bric::Biz::Workflow::Parts::Desk->list(
- { name => $args->{desk} });
+ my ($to_desk) = Bric::Biz::Workflow::Parts::Desk->list({
+ name => $args->{desk},
+ });
throw_ap(error => __PACKAGE__ . "::move : no desk found matching " .
- "(desk => \"$args->{desk}\")")
+ "(desk => \"$args->{desk}\")")
unless $to_desk;
- my @ids = _collect_ids("move_ids",
- [ "story_id", "media_id", "template_id" ],
- $env);
+ my @ids = _collect_ids(
+ "move_ids",
+ [ "story_id", "media_id", "template_id" ],
+ $env
+ );
foreach my $id (@ids) {
my $obj;
my $type;
if ($id->name eq 'story_id') {
$type = 'story';
- $obj = Bric::Biz::Asset::Business::Story->lookup(
- { id => $id->value });
+ $obj = Bric::Biz::Asset::Business::Story->lookup({
+ id => $id->value,
+ });
throw_ap(error => "Unable to find story for story_id \"".$id->value."\".")
unless $obj;
} elsif ($id->name eq 'media_id') {
$type = 'media';
- $obj = Bric::Biz::Asset::Business::Media->lookup(
- { id => $id->value });
+ $obj = Bric::Biz::Asset::Business::Media->lookup({
+ id => $id->value,
+ });
throw_ap(error => "Unable to find media object for media_id \"".$id->value."\".")
unless $obj;
} elsif ($id->name eq 'template_id') {
$type = 'template';
- $obj = Bric::Biz::Asset::Template->lookup(
- { id => $id->value });
- throw_ap(error => "Unable to find template object for template_id \"".$id->value."\".")
+ $obj = Bric::Biz::Asset::Template->lookup({ id => $id->value });
+ throw_ap 'Unable to find template object for template_id "'
+ . $id->value .'".'
unless $obj;
} else {
throw_ap(error => "Unknown element found in move_ids list.");
}
# check check check
- throw_ap(error => "Cannot move checked-out $types{$type}: \"".$id->value."\".")
+ throw_ap(error => "Cannot move checked-out $types{$type}: \""
+ . $id->value."\".")
if $obj->get_checked_out;
# Check for EDIT permission
- throw_ap(error => "Access denied.")
- unless chk_authz($obj, EDIT, 1);
+ throw_ap(error => "Access denied.") unless chk_authz($obj, EDIT, 1);
# are we moving to a new workflow?
if ($to_workflow) {
@@ -811,49 +817,54 @@ sub move {
$ok = 1 if $to_workflow->get_type == TEMPLATE_WORKFLOW;
}
throw_ap(error => __PACKAGE__ . "::move : cannot move $types{$type} \""
- . $id->value . "\" to "
- . "workflow \"$args->{workflow}\" : type mismatch.")
+ . $id->value . "\" to "
+ . "workflow \"$args->{workflow}\" : type mismatch.")
unless $ok;
# move to new workflow
$obj->set_workflow_id($to_workflow->get_id);
- log_event("${type}_add_workflow", $obj,
- { Workflow => $to_workflow->get_name });
+ log_event("${type}_add_workflow", $obj, {
+ Workflow => $to_workflow->get_name
+ });
} else {
# might need to assign a workflow here, if this item was just
# published, for example.
unless ($obj->get_workflow_id) {
- my $workflow = (Bric::Biz::Workflow->list
- ({ type => $wf_types{$type} }))[0];
+ my $workflow = (Bric::Biz::Workflow->list({
+ type => $wf_types{$type},
+ }))[0];
$obj->set_workflow_id($workflow->get_id);
- log_event("${type}_add_workflow", $obj,
- { Workflow => $workflow->get_name });
+ log_event("${type}_add_workflow", $obj, {
+ Workflow => $workflow->get_name,
+ });
my $desk = $workflow->get_start_desk;
- $desk->accept({'asset' => $obj});
+ $desk->accept({asset => $obj});
$desk->save;
- log_event("${type}_moved", $obj, { Desk => $desk->get_name });
+ log_event("$type\_moved", $obj, { Desk => $desk->get_name });
}
}
# get origin desk
my $from_desk = $obj->get_current_desk;
throw_ap(error => "Cannot move $types{$type} without a current desk: \""
- . $id->value . "\".)")
+ . $id->value . "\".)")
unless $from_desk;
# don't move if we're already here
unless ($from_desk->get_id == $to_desk->get_id) {
- $from_desk->transfer({asset => $obj,
- to => $to_desk});
+ $from_desk->transfer({
+ asset => $obj,
+ to => $to_desk,
+ });
$from_desk->save;
$to_desk->save;
}
$obj->save;
# log the move
- log_event("${type}_moved", $obj, {Desk => $to_desk->get_name});
+ log_event("$type\_moved", $obj, { Desk => $to_desk->get_name });
}
View
15 lib/Bric/Util/Burner.pm
@@ -1190,6 +1190,7 @@ sub publish {
my ($ats, $oc_sts) = ({}, {});
my ($ba, $key, $user_id, $publish_date, $die_err) = @_;
my $published = 0;
+ $publish_date ||= strfdate;
$ba->set_publish_date($publish_date);
my $baid = $ba->get_id;
@@ -1325,8 +1326,8 @@ sub publish {
$ba->set_publish_status(1);
# Set published version if we've reverted
# (i.e. unless we're republishing published_version)
- my $pubversion = $ba->get_published_version || 0;
- if ($ba->get_version > $pubversion) {
+ my $pubversion = $ba->get_published_version;
+ unless (defined $pubversion && $ba->get_version <= $pubversion) {
$ba->set_published_version($ba->get_version);
}
# Now log that we've published and get it out of workflow.
@@ -1404,7 +1405,8 @@ sub publish_another {
# Figure out the publish time. Default to the same time as the story
# that's currently being burned.
- $pub_time ||= $self->get_story->get_publish_date(ISO_8601_FORMAT);
+ $pub_time ||= $self->get_story->get_publish_date(ISO_8601_FORMAT)
+ || strfdate;
if ($pub_time gt strfdate) {
# Schedule it to be published later.
@@ -1428,13 +1430,16 @@ sub publish_another {
=item @resources = $burner->burn_one($ba, $oc, $cat);
-Publishes an asset. Returns a list of resources burned. Parameters are:
+Burn an asset in a given output channel and category, this is usually called by
+the preview or publish method. Returns a list of resources burned.
+
+Parameters are:
=over 4
=item C<$ba>
-A business asset object to publish.
+A business asset object to burn.
=item C<$oc>
View
27 lib/Bric/Util/Burner/Mason.pm
@@ -25,7 +25,7 @@ $LastChangedDate$
my $mason_burner = Bric::Util::Burner::Mason->new($burner);
# burn an asset, get back a list of resources
- my $resources = $mason_burner->burn_one($ba, $oc, $cat);
+ my $resources = $mason_burner->burn_one($ba, $oc, $cat, $at);
=head1 DESCRIPTION
@@ -155,29 +155,30 @@ sub new {
#------------------------------------------------------------------------------#
-=item $resources = $b->burn_one($ba, $oc, $cat);
+=item $resources = $b->burn_one($ba, $oc, $cat, $at);
-Publishes an asset. Returns a list of resources burned. Parameters are:
+Burn an asset in a given output channel and category, this is usually called
+by the preview or publish method. Returns a list of resources burned.
+
+Parameters are:
=over 4
-=item *
+=item C<$ba>
-$ba
+A business asset object to burn.
-A business asset object to publish.
+=item C<$oc>
-=item *
+The output channel to which to burn the asset.
-$oc
+=item C<$cat>
-An output channel object to use for the publish
-
-=item *
+A category in which to burn the asset.
-cat
+=item C<$at>
-A category in which to publish.
+A asset type object for $ba . Note that this is not currently used by Mason.
=back
View
27 lib/Bric/Util/Burner/Template.pm
@@ -25,7 +25,7 @@ $LastChangedDate$
my $template_burner = Bric::Util::Burner::Template->new($burner);
# burn an asset, get back a list of resources
- my $resources = $template_burner->burn_one($ba, $oc, $cat);
+ my $resources = $template_burner->burn_one($ba, $oc, $cat, $at);
=head1 DESCRIPTION
@@ -142,29 +142,30 @@ sub new {
=over 4
-=item $resources = $template_burner->burn_one($ba, $oc, $cat);
+=item $resources = $template_burner->burn_one($ba, $oc, $cat, $at);
-Publishes an asset. Returns a list of resources burned. Parameters are:
+Burn an asset in a given output channel and category, this is usually called
+by the preview or publish method. Returns a list of resources burned.
+
+Parameters are:
=over 4
-=item *
+=item C<$ba>
-$ba
+A business asset object to burn.
-A business asset object to publish.
+=item C<$oc>
-=item *
+The output channel to which to burn the asset.
-$oc
+=item C<$cat>
-An output channel object to use for the publish
-
-=item *
+A category in which to burn the asset.
-$category
+=item C<$at>
-A category in which to publish.
+A asset type object for $ba
=back
View
28 lib/Bric/Util/Burner/TemplateToolkit.pm
@@ -25,7 +25,7 @@ $LastChangedDate$
my $tt_burner = Bric::Util::Burner::TemplateToolkit->new($burner);
# Burn an asset, get back a list of resources
- my $resources = $tt_burner->burn_one($ba, $oc, $cat);
+ my $resources = $tt_burner->burn_one($ba, $oc, $cat, $at);
=head1 DESCRIPTION
@@ -168,29 +168,31 @@ sub new {
#------------------------------------------------------------------------------#
-=item $resources = $b->burn_one($ba, $oc, $cat);
+=item $resources = $b->burn_one($ba, $oc, $cat, $at);
-Publishes an asset. Returns a list of resources burned. Parameters are:
+Burn an asset in a given output channel and category, this is usually called
+by the preview or publish method. Returns a list of resources burned.
+
+Parameters are:
=over 4
-=item *
+=item C<$ba>
-$ba
+A business asset object to burn.
-A business asset object to publish.
+=item C<$oc>
-=item *
+The output channel to which to burn the asset.
-$oc
+=item C<$cat>
-An output channel object to use for the publish
-
-=item *
+A category in which to burn the asset.
-cat
+=item C<$at>
-A category in which to publish.
+A asset type object for $ba. Note that this is not currently used by the TT
+burner
=back
View
3  lib/Bric/Util/Language/de_de.pm
@@ -744,7 +744,8 @@ To Translate:
'Invalid codeselect code (didn't return an array ref of even size)' => 'Invalid codeselect code (didn't return an array ref of even size)',
'The error message is available below. No further execution attempts will be made on this job unless you check the "Reset this Job" checkbox below.' => 'The error message is available below. No further execution attempts will be made on this job unless you check the "Reset this Job" checkbox below.',
'Job "[_1]" has been reset.' => 'Job "[_1]" has been reset.',
-
+ '[quant,_1,story,stories] expired.' => '[quant,_1,story,stories] expired.',
+ '[quant,_1,media,media] expired.' => '[quant,_1,media,media] expired.',
'No context for content beginning at line [_1].' => 'No context for content beginning at line [_1].',
'No such field "[_1]" at line [_2]. Did you mean "[_3]"?' => 'No such field "[_1]" at line [_2]. Did you mean "[_3]"?',
'No such subelement "[_1]" at line [_2]. Did you mean "[_3]"?' => 'No such subelement "[_1]" at line [_2]. Did you mean "[_3]"?',
View
6 lib/Bric/Util/Language/en_us.pm
@@ -41,8 +41,10 @@ our %Lexicon = (
'[quant,_1,Alert] acknowledged.' => '[quant,_1,Alert,Alerts] acknowledged.',
'[quant,_1,Contributor] "[_2]" associated.' => '[quant,_1,Contributor,Contributors] "[_2]" assocuated.',
'[quant,_1,Template] deployed.' => '[quant,_1,Template,Templates] deployed.',
- '[quant,_1,media,media] published.' => '[quant,_1,media,media] published',
- '[quant,_1,story,stories] published.' => '[quant,_1,story,stories] published',
+ '[quant,_1,media,media] published.' => '[quant,_1,media,media] published.',
+ '[quant,_1,media,media] expired.' => '[quant,_1,media,media] expired.',
+ '[quant,_1,story,stories] published.' => '[quant,_1,story,stories] published.',
+ '[quant,_1,story,stories] expired.' => '[quant,_1,story,stories] expired.',
'D [for Deployed]' => 'D',
'P [for Published]' => 'P',
_AUTO => 1
View
7 lib/Bric/Util/Language/it_it.pm
@@ -482,8 +482,6 @@ To translate:
'Associate'
'Preview in'
'Parent cannot choose itself or its child as its parent. Try a different parent.'
- '[quant,_1,story,stories] published.'
- '[quant,_1,media,media] published.'
'Category URI'