fix: Dashboard content positioning field problem
This commit is contained in:
parent
7ab7b97c5e
commit
f715c29c67
3 changed files with 61 additions and 18 deletions
|
|
@ -5,6 +5,7 @@
|
|||
- fix: purging old asset revisions on large sites never completes
|
||||
- fix: Can't add assets when not using preload.perl.
|
||||
- fix: wiki recent
|
||||
- fix: Dashboard content positioning field problem
|
||||
- fix: graphing doesn't work with GraphicsMagick
|
||||
- fix: Calendar generated iCal for last 30 days instead of next 30 days
|
||||
- fix: hover help doesn't appear for matrix fields
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use lib "../../lib";
|
|||
use strict;
|
||||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
|
||||
use WebGUI::ProfileField;
|
||||
|
||||
my $toVersion = "7.4.9"; # make this match what version you're going to
|
||||
my $quiet; # this line required
|
||||
|
|
@ -21,10 +21,12 @@ my $quiet; # this line required
|
|||
my $session = start(); # this line required
|
||||
|
||||
removeOrphanedGroupings($session); # upgrade functions go here
|
||||
fixDashboardContentPositions($session);
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------
|
||||
sub removeOrphanedGroupings {
|
||||
my $session = shift;
|
||||
|
|
@ -34,12 +36,33 @@ sub removeOrphanedGroupings {
|
|||
}
|
||||
|
||||
|
||||
##-------------------------------------------------
|
||||
#sub exampleFunction {
|
||||
# my $session = shift;
|
||||
# print "\tWe're doing some stuff here that you should know about.\n" unless ($quiet);
|
||||
# # and here's our code
|
||||
#}
|
||||
#-------------------------------------------------
|
||||
sub fixDashboardContentPositions {
|
||||
my $session = shift;
|
||||
my $db = $session->db;
|
||||
print "\tFixing broken dashboard content positions.\n" unless ($quiet);
|
||||
foreach my $dashboardId ($db->quickArray("select assetId from asset where className='WebGUI::Asset::Wobject::Dashboard'")) {
|
||||
my $newContentPositionId = "contentPositions".$dashboardId;
|
||||
$newContentPositionId =~ s/-/_/g;
|
||||
my $newField = WebGUI::ProfileField->create($session, $newContentPositionId, {
|
||||
label=>'\'Dashboard User Preference - Content Positions\'',
|
||||
visible=>0,
|
||||
protected=>1,
|
||||
editable=>0,
|
||||
required=>0,
|
||||
fieldType=>'textarea'
|
||||
});
|
||||
my $oldContentPositionId = $dashboardId."contentPositions";
|
||||
my $userPositioning = $db->read("select userId, `".$oldContentPositionId."` from userProfileData");
|
||||
while (my ($userId, $positions) = $userPositioning->array) {
|
||||
$db->write("update userProfileData set $newContentPositionId = ? where userId=?", [$positions, $userId]);
|
||||
}
|
||||
my $oldField = WebGUI::ProfileField->new($session, $oldContentPositionId);
|
||||
if (defined $oldField) {
|
||||
$oldField->delete;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue