merged with SVN to get friends stuff
This commit is contained in:
commit
7e12c6c2f0
73 changed files with 3262 additions and 424 deletions
|
|
@ -1,8 +1,43 @@
|
|||
7.5.0
|
||||
- Added link to return to inbox from message in inbox message template (Diona Kidd, Knowmad Technologies)
|
||||
- fix: Cannot delete private message (Diona Kidd, Knowmad Technologies)
|
||||
- fix: Delete this entry link in data form header broken
|
||||
- fix: Image uploads fail when not using preload.perl
|
||||
- fix: Workflow activities don't pick up new default values
|
||||
- safely allow sorting by more fields in collaboration systems
|
||||
- fix: iCal link on calendar doesn't work
|
||||
- add: Friends Network
|
||||
|
||||
7.4.10
|
||||
- fix: Graphs aren't sized properly using GraphicsMagick
|
||||
- fix: Navigation with pedigree on site with multiple roots (Yung Han Khoe, United Knowledge)
|
||||
- fix: user selected CS sorting should be cleared after last update
|
||||
|
||||
7.4.9
|
||||
- fix: Bug that did not allow Calendar Update Feeds workflow activity to
|
||||
complete
|
||||
- Clean up orphaned grouping
|
||||
- fix: purging old asset revisions on large sites never completes
|
||||
- fix: Can't add assets when not using preload.perl.
|
||||
- Colors in bar graph now cycle through the palette like pie chart.
|
||||
- fix: Graphing with Graphics Magick Bungled
|
||||
- fix: wiki recent
|
||||
- fix: Dashboard content positioning field problem
|
||||
- fix: graphing doesn't work with GraphicsMagick
|
||||
- fix: Last Reply and Replies columns not updating
|
||||
- fix: Calendar generated iCal for last 30 days instead of next 30 days
|
||||
- fix: hover help doesn't appear for matrix fields
|
||||
- Collaboration systems should always tell browser there is new content
|
||||
- fix: Good Bad fields not properly localized
|
||||
- fix: File user profile fields didn't link to the file
|
||||
- fix: SQL Reports only work on MySQL databases
|
||||
- More complete error messages from spectre
|
||||
- fix: Wiki uploads didn't obey image and thumbnail size
|
||||
- fix: Doesn't copy LDAP link to user on create, also wrong search base
|
||||
- fix: Unable to view running workflows if spectre not running
|
||||
- protect Wiki pages from malformed html content
|
||||
- work around broken linking function in tinyMCE on Safari
|
||||
- fix: Searching in Calendars finds multiple of same event
|
||||
|
||||
7.4.8
|
||||
- fix: Syndicated Content doesn't display all items with multiple feeds in interleaved mode
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
237
docs/upgrades/installPhotoGallery.pl
Normal file
237
docs/upgrades/installPhotoGallery.pl
Normal file
|
|
@ -0,0 +1,237 @@
|
|||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use lib "../../lib";
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
|
||||
|
||||
my $toVersion = "photogallery"; # make this match what version you're going to
|
||||
my $quiet; # this line required
|
||||
|
||||
|
||||
my $session = start(); # this line required
|
||||
|
||||
# upgrade functions go here
|
||||
installGalleryAsset($session);
|
||||
installGalleryAlbumAsset($session);
|
||||
installPhotoAsset($session);
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
||||
##-------------------------------------------------
|
||||
#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
|
||||
#}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Install the Gallery asset
|
||||
sub installGalleryAsset {
|
||||
my $session = shift;
|
||||
print "\tInstalling Gallery asset..." unless $quiet;
|
||||
|
||||
$session->db->write(<<'ENDSQL');
|
||||
CREATE TABLE IF NOT EXISTS Gallery (
|
||||
assetId VARCHAR(22) BINARY NOT NULL,
|
||||
revisionDate BIGINT NOT NULL,
|
||||
groupIdAddComment VARCHAR(22) BINARY,
|
||||
groupIdAddFile VARCHAR(22) BINARY,
|
||||
groupIdModerator VARCHAR(22) BINARY,
|
||||
imageResolutions TEXT,
|
||||
imageViewSize INT,
|
||||
imageViewCompression INT,
|
||||
imageThumbnailSize INT,
|
||||
maxSpacePerUser VARCHAR(20),
|
||||
richEditIdFileComment VARCHAR(22) BINARY,
|
||||
templateIdAddArchive VARCHAR(22) BINARY,
|
||||
templateIdDeleteAlbum VARCHAR(22) BINARY,
|
||||
templateIdDeleteFile VARCHAR(22) BINARY,
|
||||
templateIdEditFile VARCHAR(22) BINARY,
|
||||
templateIdListAlbums VARCHAR(22) BINARY,
|
||||
templateIdListAlbumsRss VARCHAR(22) BINARY,
|
||||
templateIdListUserFiles VARCHAR(22) BINARY,
|
||||
templateIdListUserFilesRss VARCHAR(22) BINARY,
|
||||
templateIdMakeShortcut VARCHAR(22) BINARY,
|
||||
templateIdSearch VARCHAR(22) BINARY,
|
||||
templateIdSlideshow VARCHAR(22) BINARY,
|
||||
templateIdThumbnails VARCHAR(22) BINARY,
|
||||
templateIdViewAlbum VARCHAR(22) BINARY,
|
||||
templateIdViewAlbumRss VARCHAR(22) BINARY,
|
||||
templateIdViewFile VARCHAR(22) BINARY,
|
||||
workflowIdCommit VARCHAR(22) BINARY,
|
||||
PRIMARY KEY (assetId, revisionDate)
|
||||
)
|
||||
ENDSQL
|
||||
|
||||
|
||||
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Install the GalleryAlbum asset
|
||||
sub installGalleryAlbumAsset {
|
||||
my $session = shift;
|
||||
print "\tInstalling GalleryAlbum asset..." unless $quiet;
|
||||
|
||||
$session->db->write(<<'ENDSQL');
|
||||
CREATE TABLE IF NOT EXISTS GalleryAlbum (
|
||||
assetId VARCHAR(22) BINARY NOT NULL,
|
||||
revisionDate BIGINT NOT NULL,
|
||||
othersCanAdd INT,
|
||||
allowComments INT,
|
||||
PRIMARY KEY (assetId, revisionDate)
|
||||
)
|
||||
ENDSQL
|
||||
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Install the photo asset
|
||||
sub installPhotoAsset {
|
||||
my $session = shift;
|
||||
print "\tInstalling Photo asset..." unless $quiet;
|
||||
|
||||
# Photo Asset
|
||||
$session->db->write(<<'ENDSQL');
|
||||
CREATE TABLE IF NOT EXISTS Photo (
|
||||
assetId VARCHAR(22) BINARY NOT NULL,
|
||||
revisionDate BIGINT NOT NULL,
|
||||
friendsOnly INT,
|
||||
rating INT,
|
||||
storageIdPhoto VARCHAR(22) BINARY,
|
||||
userDefined1 TEXT,
|
||||
userDefined2 TEXT,
|
||||
userDefined3 TEXT,
|
||||
userDefined4 TEXT,
|
||||
userDefined5 TEXT,
|
||||
PRIMARY KEY (assetId, revisionDate)
|
||||
)
|
||||
ENDSQL
|
||||
|
||||
$session->db->write(<<'ENDSQL');
|
||||
CREATE TABLE IF NOT EXISTS Photo_comment (
|
||||
assetId VARCHAR(22) BINARY NOT NULL,
|
||||
commentId VARCHAR(22) BINARY NOT NULL,
|
||||
userId VARCHAR(22) BINARY,
|
||||
visitorIp VARCHAR(255),
|
||||
creationDate DATETIME,
|
||||
bodyText LONGTEXT,
|
||||
INDEX (commentId),
|
||||
PRIMARY KEY (assetId, commentId)
|
||||
)
|
||||
ENDSQL
|
||||
|
||||
$session->db->write(<<'ENDSQL');
|
||||
CREATE TABLE IF NOT EXISTS Photo_rating (
|
||||
assetId VARCHAR(22) BINARY NOT NULL,
|
||||
userId VARCHAR(22) BINARY,
|
||||
visitorIp VARCHAR(255),
|
||||
rating INT,
|
||||
INDEX (assetId)
|
||||
)
|
||||
ENDSQL
|
||||
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
# ---- DO NOT EDIT BELOW THIS LINE ----
|
||||
|
||||
#-------------------------------------------------
|
||||
sub start {
|
||||
my $configFile;
|
||||
$|=1; #disable output buffering
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile,
|
||||
'quiet'=>\$quiet
|
||||
);
|
||||
my $session = WebGUI::Session->open("../..",$configFile);
|
||||
$session->user({userId=>3});
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Upgrade to ".$toVersion});
|
||||
updateTemplates($session);
|
||||
return $session;
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub finish {
|
||||
my $session = shift;
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->commit;
|
||||
$session->close();
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub updateTemplates {
|
||||
my $session = shift;
|
||||
return undef unless (-d "templates-".$toVersion);
|
||||
print "\tUpdating templates.\n" unless ($quiet);
|
||||
opendir(DIR,"templates-".$toVersion);
|
||||
my @files = readdir(DIR);
|
||||
closedir(DIR);
|
||||
my $importNode = WebGUI::Asset->getImportNode($session);
|
||||
my $newFolder = undef;
|
||||
foreach my $file (@files) {
|
||||
next unless ($file =~ /\.tmpl$/);
|
||||
open(FILE,"<templates-".$toVersion."/".$file);
|
||||
my $first = 1;
|
||||
my $create = 0;
|
||||
my $head = 0;
|
||||
my %properties = (className=>"WebGUI::Asset::Template");
|
||||
while (my $line = <FILE>) {
|
||||
if ($first) {
|
||||
$line =~ m/^\#(.*)$/;
|
||||
$properties{id} = $1;
|
||||
$first = 0;
|
||||
} elsif ($line =~ m/^\#create$/) {
|
||||
$create = 1;
|
||||
} elsif ($line =~ m/^\#(.*):(.*)$/) {
|
||||
$properties{$1} = $2;
|
||||
} elsif ($line =~ m/^~~~$/) {
|
||||
$head = 1;
|
||||
} elsif ($head) {
|
||||
$properties{headBlock} .= $line;
|
||||
} else {
|
||||
$properties{template} .= $line;
|
||||
}
|
||||
}
|
||||
close(FILE);
|
||||
if ($create) {
|
||||
$newFolder = createNewTemplatesFolder($importNode) unless (defined $newFolder);
|
||||
my $template = $newFolder->addChild(\%properties, $properties{id});
|
||||
} else {
|
||||
my $template = WebGUI::Asset->new($session,$properties{id}, "WebGUI::Asset::Template");
|
||||
if (defined $template) {
|
||||
my $newRevision = $template->addRevision(\%properties);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub createNewTemplatesFolder {
|
||||
my $importNode = shift;
|
||||
my $newFolder = $importNode->addChild({
|
||||
className=>"WebGUI::Asset::Wobject::Folder",
|
||||
title => $toVersion." New Templates",
|
||||
menuTitle => $toVersion." New Templates",
|
||||
url=> $toVersion."_new_templates",
|
||||
groupIdView=>"12"
|
||||
});
|
||||
return $newFolder;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
#PBtmpl0000000000000205
|
||||
<div class="PM_wrapper">
|
||||
<a href="?op=viewInbox" title="Return to Inbox">Return to Inbox</a>
|
||||
<table cellpadding="2" cellspacing="2" width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
|
|
|
|||
80
docs/upgrades/templates-7.4.9/MatrixDefaultCompare.tmpl
Normal file
80
docs/upgrades/templates-7.4.9/MatrixDefaultCompare.tmpl
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
#matrixtmpl000000000002
|
||||
<h2>Comparison</h2>
|
||||
<table cellpadding="0" cellspacing="0" border="0" style="font-size: 11px; font-family: helvetica, arial, sans-serif;">
|
||||
|
||||
<tr>
|
||||
<td valign="top"><tmpl_var compare.form></td>
|
||||
<td style="width:10px;"> </td>
|
||||
<td style="width:3px;background-color:silver;"> </td>
|
||||
<td style="width:10px;"> </td>
|
||||
<td valign="top">
|
||||
|
||||
<tmpl_if isTooMany>
|
||||
You tried to compare too many listings. Please choose <tmpl_var maxCompares> or less at a time.
|
||||
</tmpl_if>
|
||||
|
||||
<tmpl_if isTooFew>
|
||||
You must choose at least two products to compare. Less than two isn't much of a comparison.
|
||||
</tmpl_if>
|
||||
|
||||
|
||||
<tmpl_unless isTooFew><tmpl_unless isTooMany>
|
||||
|
||||
|
||||
<table style="font-size: 11px; font-family: helvetica, arial, sans-serif;" cellpadding="2" cellspacing="2" border="0">
|
||||
<tr>
|
||||
<td style="border-bottom:solid gray 1px;font-weight:bold;font-size:13px;">Product</td>
|
||||
<tmpl_loop product_loop>
|
||||
<td style="border-bottom:solid gray 1px;"><a href="<tmpl_var url>"><tmpl_var name> <tmpl_var version></a></td>
|
||||
</tmpl_loop>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="lastUpdated">Last Updated</td>
|
||||
<tmpl_loop lastupdated_loop>
|
||||
<td class="lastUpdated" style="text-align:center;"><tmpl_var lastupdated></td>
|
||||
</tmpl_loop>
|
||||
</tr>
|
||||
|
||||
<tmpl_loop category_loop>
|
||||
<tr><td class="category"><b><tmpl_var category></b></td>
|
||||
<tmpl_loop product_loop>
|
||||
<td align="center"><tmpl_var name></td>
|
||||
</tmpl_loop>
|
||||
|
||||
|
||||
</tr>
|
||||
<tmpl_loop row_loop>
|
||||
<tr
|
||||
<tmpl_if __ODD__>
|
||||
class="odd"
|
||||
<tmpl_else>
|
||||
class="even"
|
||||
</tmpl_if>
|
||||
>
|
||||
<tmpl_loop column_loop>
|
||||
<td class="<tmpl_var class>">
|
||||
<tmpl_var value>
|
||||
<tmpl_if description>
|
||||
<div class="wg-hoverhelp"><tmpl_var description></div>
|
||||
</tmpl_if>
|
||||
</td>
|
||||
</tmpl_loop>
|
||||
</tr>
|
||||
</tmpl_loop>
|
||||
</tmpl_loop>
|
||||
</table>
|
||||
|
||||
|
||||
</tmpl_unless></tmpl_unless>
|
||||
|
||||
</td></tr></table>
|
||||
~~~
|
||||
<style type="text/css">
|
||||
.lastUpdated {
|
||||
background-color:#F0F0F0;
|
||||
}
|
||||
.category {
|
||||
font-size:13px;
|
||||
}
|
||||
</style>
|
||||
|
||||
103
docs/upgrades/templates-7.4.9/MatrixDefaultDetailedListing.tmpl
Normal file
103
docs/upgrades/templates-7.4.9/MatrixDefaultDetailedListing.tmpl
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
#matrixtmpl000000000003
|
||||
<h2><tmpl_var productName></h2>
|
||||
|
||||
|
||||
<table class="content" border="0" cellspacing="5">
|
||||
<tr><td valign="top">
|
||||
<table class="content">
|
||||
<tr><td><b>Web Site</b></td><td><a onclick="window.open('<tmpl_var productUrl.click>')" href="#"><tmpl_var productUrl></a></td></tr>
|
||||
<tr><td><b>Version Number</b></td><td><tmpl_var versionNumber></td></tr>
|
||||
<tr><td><b>Manufacturer</b></td><td><a onclick="window.open('<tmpl_var manufacturerUrl.click>')" href="#"><tmpl_var manufacturerName></a></td></tr>
|
||||
<tr><td><b>Last Updated</b></td><td><tmpl_var lastUpdated.date></td></tr>
|
||||
<tr><td><b>Clicks</b></td><td><tmpl_var clicks></td></tr>
|
||||
<tr><td><b>Views</b></td><td><tmpl_var views></td></tr>
|
||||
<tr><td><b>Compares</b></td><td><tmpl_var compares></td></tr>
|
||||
<tr><td><b>Screenshot</b></td><td><a href="<tmpl_var screenshot>"><img src="<tmpl_var thumbnail>" alt="Screenshot"`></a></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<td valign="top" style="background-color:silver;"> </td>
|
||||
<td valign="top">
|
||||
<tmpl_if description>
|
||||
<b>Description</b><br />
|
||||
<tmpl_var description><br /><br />
|
||||
</tmpl_if>
|
||||
|
||||
<b>Contact Maintainer</b><br />
|
||||
<tmpl_if email.wasSent>
|
||||
<div style="color: green;">Message sent.<br /></div>
|
||||
</tmpl_if>
|
||||
<tmpl_var email.form>
|
||||
</td>
|
||||
<td valign="top" style="background-color:silver;"> </td>
|
||||
<td valign="top">
|
||||
<tmpl_var ratings>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p />
|
||||
|
||||
<table width="100%" class="content">
|
||||
<tr>
|
||||
<td valign="top" style="width:50%">
|
||||
<span class="category">Features</span>
|
||||
<table class="content" width="180">
|
||||
|
||||
<tmpl_loop features_loop>
|
||||
<tr<tmpl_if __ODD__> class="odd"<tmpl_else> class="even"</tmpl_if>>
|
||||
<td><tmpl_var label><div class="wg-hoverhelp"><tmpl_var description></div></td>
|
||||
<td><tmpl_var value></td>
|
||||
</tr>
|
||||
</tmpl_loop>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p />
|
||||
</td>
|
||||
<td valign="top" style="width:50%;">
|
||||
<span class="category">Benefits</span>
|
||||
<table class="content" width="180">
|
||||
|
||||
<tmpl_loop benefits_loop>
|
||||
<tr<tmpl_if __ODD__> class="odd"<tmpl_else> class="even"</tmpl_if>>
|
||||
<td><tmpl_var label><div class="wg-hoverhelp"><tmpl_var description></div></td>
|
||||
<td class="<tmpl_var class>"><tmpl_var value></td>
|
||||
</tr>
|
||||
</tmpl_loop>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p />
|
||||
|
||||
<tmpl_var discussion>
|
||||
|
||||
<tmpl_if user.canEdit>
|
||||
<br /> <hr /><a href="<tmpl_var edit.url>">Edit this listing.</a> <br />
|
||||
</tmpl_if>
|
||||
<tmpl_if user.canApprove>
|
||||
<tmpl_if isPending>
|
||||
<a href="<tmpl_var approve.url>">Approve this listing.</a><br />
|
||||
</tmpl_if>
|
||||
<a href="<tmpl_var delete.url>">Delete this listing.</a><br />
|
||||
|
||||
</tmpl_if>
|
||||
|
||||
~~~
|
||||
<style type="text/css">
|
||||
.ratingForm {
|
||||
font-size: 9px;
|
||||
}
|
||||
.statBox {
|
||||
width:100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
102
docs/upgrades/templates-7.4.9/MatrixDefaultSearch.tmpl
Normal file
102
docs/upgrades/templates-7.4.9/MatrixDefaultSearch.tmpl
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
#matrixtmpl000000000005
|
||||
<h2>Search The Matrix</h2>
|
||||
|
||||
<tmpl_if isTooFew>
|
||||
<p class="fontSettings">Your search returned no results. Try specifying a few less criteria.</p>
|
||||
</tmpl_if>
|
||||
|
||||
<tmpl_if isTooMany>
|
||||
<p class="fontSettings">
|
||||
Your search returned too many results. Either select up to <tmpl_var maxCompares> products from the list below, or specify more critera.
|
||||
</p>
|
||||
</tmpl_if>
|
||||
|
||||
|
||||
<table width="100%" class="matrixSearch" border="0">
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<tmpl_var compare.form>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<tmpl_var form.header>
|
||||
<tmpl_var form.submit>
|
||||
<table width="100%" class="content">
|
||||
<tr>
|
||||
<td valign="top" style="width:50%;">
|
||||
<span class="category">Features</span>
|
||||
<table class="content" width="180">
|
||||
<tmpl_if features>
|
||||
<tmpl_loop features_loop>
|
||||
<tr<tmpl_if __ODD__> class="odd"<tmpl_else> class="even"</tmpl_if>>
|
||||
<td><tmpl_var label><div class="wg-tooltip"><tmpl_var description></div></td>
|
||||
<td><tmpl_var form></td>
|
||||
</tr>
|
||||
</tmpl_loop>
|
||||
<tmpl_else>
|
||||
<tr><td> </td></tr>
|
||||
</tmpl_if>
|
||||
</table>
|
||||
</td>
|
||||
<td valign="top" style="width:50%;">
|
||||
<span class="category">Benefits</span>
|
||||
<table class="content">
|
||||
<tmpl_if features>
|
||||
<tmpl_loop benefits_loop>
|
||||
<tr<tmpl_if __ODD__> class="odd"<tmpl_else> class="even"</tmpl_if>>
|
||||
<td><tmpl_var label><div class="wg-hoverhelp"><tmpl_var description></div></td>
|
||||
<td><tmpl_var form></td>
|
||||
</tr>
|
||||
</tmpl_loop>
|
||||
<tmpl_else>
|
||||
<tr><td> </td></tr>
|
||||
</tmpl_if>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<tmpl_var form.submit>
|
||||
</div>
|
||||
<tmpl_var form.footer>
|
||||
|
||||
|
||||
</td></tr></table>
|
||||
~~~
|
||||
<style type="text/css">
|
||||
h2 {
|
||||
font-family:arial;
|
||||
}
|
||||
.fontSettings {
|
||||
font-size:9pt;
|
||||
font-family:arial;
|
||||
}
|
||||
.matrixSearch td {
|
||||
font-size:9pt;
|
||||
font-family:arial;
|
||||
}
|
||||
.matrixSearch .leftColumn {
|
||||
width:48%;
|
||||
}
|
||||
.matrixSearch .grayBox {
|
||||
background-color:#DADADA;
|
||||
padding:3px;
|
||||
-moz-box-sizing:border-box;
|
||||
border-bottom:solid gray 2px;
|
||||
}
|
||||
.matrixSearch .stats .columnOne{
|
||||
width:30%;
|
||||
}
|
||||
.matrixSearch .stats .columnTwo{
|
||||
width:20%;
|
||||
}
|
||||
.matrixSearch .stats .columnThree{
|
||||
width:50%;
|
||||
}
|
||||
.hrStyle {
|
||||
border-bottom:solid black 1px;
|
||||
height:1px;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
94
docs/upgrades/templates-7.4.9/wikipage.tmpl
Normal file
94
docs/upgrades/templates-7.4.9/wikipage.tmpl
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
#WikiPageTmpl0000000001
|
||||
<tmpl_if session.var.adminOn><p><tmpl_var controls></p></tmpl_if>
|
||||
<h2><tmpl_var title></h2>
|
||||
|
||||
<div id="wikipage" class="yui-navset">
|
||||
<ul class="yui-nav">
|
||||
<li class="selected"><a href="#wikipagecontent"><em><tmpl_var viewLabel></em></a></li>
|
||||
<li><a href="#wikipageedit"><em><tmpl_var editLabel></em></a></li>
|
||||
</ul>
|
||||
<div class="yui-content">
|
||||
<div id="wikipagecontent">
|
||||
<tmpl_var content>
|
||||
<p>^International("keywords","Asset");: <tmpl_loop keywordsLoop><a href="<tmpl_var url>"><tmpl_var
|
||||
keyword></a> </tmpl_loop></p>
|
||||
</div><div id="wikipageedit">
|
||||
<tmpl_var editContent>
|
||||
</div></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
( function() {
|
||||
var tabView = new YAHOO.widget.TabView('wikipage');
|
||||
tabView.on('contentReady', function() {
|
||||
tabView.addTab(new YAHOO.widget.Tab({
|
||||
label: '<tmpl_var historyLabel>',
|
||||
dataSrc: '<tmpl_var historyUrl>',
|
||||
cacheData: true
|
||||
}));
|
||||
});
|
||||
|
||||
|
||||
})();
|
||||
</script>
|
||||
<div style="padding: 8px;"><a href="<tmpl_var searchUrl>"><tmpl_var searchLabel></a> | <a href="<tmpl_var
|
||||
mostPopularUrl>"><tmpl_var mostPopularLabel></a> | <a href="<tmpl_var recentChangesUrl>"><tmpl_var
|
||||
recentChangesLabel></a> | <a href="<tmpl_var wikiHomeUrl>"><tmpl_var wikiHomeLabel></a></div>
|
||||
~~~
|
||||
<link rel="stylesheet" type="text/css" href="^Extras(yui/build/tabview/assets/tabview.css);" />
|
||||
<script type="text/javascript" src="^Extras(yui/build/yahoo/yahoo-min.js);"></script>
|
||||
<script type="text/javascript" src="^Extras(yui/build/event/event-min.js);"></script>
|
||||
<script type="text/javascript" src="^Extras(yui/build/dom/dom-min.js);"></script>
|
||||
<script type="text/javascript" src="^Extras(yui/build/connection/connection-min.js);"></script>
|
||||
<script type="text/javascript" src="^Extras(yui/build/element/element-beta-min.js);"></script>
|
||||
<script type="text/javascript" src="^Extras(yui/build/tabview/tabview-min.js);"></script>
|
||||
|
||||
<style type="text/css">
|
||||
#wikipage.yui-navset .yui-nav li a {
|
||||
border:1px solid #000; /* label and content borders */
|
||||
}
|
||||
|
||||
#wikipage.yui-navset .yui-content {
|
||||
border-top: 1px solid #000;
|
||||
border-bottom: 1px solid #000;
|
||||
}
|
||||
|
||||
#wikipage.yui-navset .yui-nav .selected a, #wikipage.yui-navset .yui-nav a:hover {
|
||||
background-color:#f6f7ee; /* active tab, tab hover, and content bgcolor */
|
||||
}
|
||||
|
||||
#wikipage.yui-navset .yui-nav li em { padding:.5em; } /* tab padding */
|
||||
|
||||
|
||||
#wikipage.yui-navset .yui-nav .selected a {
|
||||
background-color:black; /* active tab, tab hover, and content bgcolor */
|
||||
color: white;
|
||||
border-bottom-width:0; /* no bottom border for active tab */
|
||||
padding-bottom:1px; /* to match height of other tabs */
|
||||
}
|
||||
|
||||
#wikipage.yui-navset-top .yui-nav .selected a {
|
||||
border-bottom:0; /* no bottom border for active tab */
|
||||
padding-bottom:1px; /* to match height of other tabs */
|
||||
}
|
||||
|
||||
#wikipage.yui-navset-top .yui-content {
|
||||
margin-top:-1px; /* for active tab overlap */
|
||||
}
|
||||
|
||||
#wikipage .yui-content {
|
||||
padding-top:1em;
|
||||
padding-bottom:1em;
|
||||
}
|
||||
#wikipage .loading {
|
||||
background-image:url(^Extras(yui/examples/tabview/img/loading.gif););
|
||||
background-position:center center;
|
||||
background-repeat:no-repeat;
|
||||
}
|
||||
|
||||
#wikipage .loading * {
|
||||
display:none;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
61
docs/upgrades/templates-7.5.0/managefriends.tmpl
Executable file
61
docs/upgrades/templates-7.5.0/managefriends.tmpl
Executable file
|
|
@ -0,0 +1,61 @@
|
|||
#managefriends_________
|
||||
#url: managefriendstemplate
|
||||
#title: Manage Friends (default)
|
||||
#menuTitle: Manage Friends
|
||||
#namespace:friends/manage
|
||||
#create
|
||||
<h1>^International("my friends","Friends");</h1>
|
||||
<tmpl_var formHeader>
|
||||
<table>
|
||||
<tr style="background-color: #cccccc;">
|
||||
<td><input type="checkbox" onclick="toggleUserSelectAll(this.form);" value="1" name="checkAllUserIds"></td>
|
||||
<th>^International("name","Friends");</th>
|
||||
<th>^International("status","Friends");</th>
|
||||
</tr>
|
||||
<tmpl_loop friends>
|
||||
<tr>
|
||||
<td><tmpl_var checkboxForm></td>
|
||||
<td><a href="<tmpl_var profileUrl>"><tmpl_var name></a></td>
|
||||
<td><tmpl_var status></td>
|
||||
</tr>
|
||||
</tmpl_loop>
|
||||
</table>
|
||||
<tmpl_var removeFriendButton>
|
||||
<p>^International("send friend email instructions","Friends");</p>
|
||||
<table>
|
||||
<tr>
|
||||
<td><label for="subject_formId">^International("subject","Friends");</label></td>
|
||||
<td><tmpl_var subjectForm><tmpl_var sendMessageButton></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="message_formId">^International("message","Friends");</label></td>
|
||||
<td><tmpl_var messageForm></td>
|
||||
</tr>
|
||||
</table>
|
||||
<tmpl_var formFooter>
|
||||
|
||||
<div class="accountOptions">
|
||||
<ul>
|
||||
<tmpl_loop account.options>
|
||||
<li><tmpl_var options.display></li>
|
||||
</tmpl_loop>
|
||||
</ul>
|
||||
</div>
|
||||
~~~
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
var userSelectAllToggle = false;
|
||||
function toggleUserSelectAll(form){
|
||||
userSelectAllToggle = userSelectAllToggle ? false : true;
|
||||
for(var i = 0; i < form.userId.length; i++)
|
||||
form.userId[i].checked = userSelectAllToggle;
|
||||
}
|
||||
function confirmRemovalOfFriends (form) {
|
||||
if (confirm('^International("confirm remove friends","Friends");')) {
|
||||
form.op.value = 'removeFriends';
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
311
docs/upgrades/templates-7.5.0/time-tracking-user-view.tmpl
Normal file
311
docs/upgrades/templates-7.5.0/time-tracking-user-view.tmpl
Normal file
|
|
@ -0,0 +1,311 @@
|
|||
#TimeTrackingTMPL000001
|
||||
<tmpl_if session.var.adminOn>
|
||||
<p><tmpl_var controls></p>
|
||||
</tmpl_if>
|
||||
|
||||
<tmpl_if displayTitle>
|
||||
<h2><tmpl_var title></h2>
|
||||
</tmpl_if>
|
||||
|
||||
<tmpl_if description>
|
||||
<div class="fontSettings">
|
||||
<tmpl_var description>
|
||||
</div>
|
||||
</tmpl_if>
|
||||
|
||||
<script language="JavaScript">
|
||||
var nextRowNum = <tmpl_var time.report.rows.total>;
|
||||
var projectTasks = <tmpl_var project.task.array> //Do not put a semi colon at the end of this. The app does it
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
function changeOptions(proj,task) {
|
||||
var projId = proj.value;
|
||||
//Remove all options from task list except first one
|
||||
var optLen = task.options.length;
|
||||
while (task.options.length > 1) {
|
||||
var elem = task.options[1];
|
||||
task.removeChild(elem);
|
||||
}
|
||||
|
||||
if(projId != "") {
|
||||
//Add new options
|
||||
var array = projectTasks[projId];
|
||||
for (var word in array) {
|
||||
var opt = document.createElement("option");
|
||||
opt.setAttribute("value",word);
|
||||
opt.appendChild(document.createTextNode(array[word]));
|
||||
task.appendChild(opt);
|
||||
}
|
||||
}
|
||||
|
||||
//Fix IE Bug which causes dymamic repopulation to fail
|
||||
var newtask = task;
|
||||
var col = task.parentNode;
|
||||
col.removeChild(task);
|
||||
col.appendChild(newtask);
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
function recalcHours() {
|
||||
var newHours = 0;
|
||||
var rows = document.getElementById("ttbody");
|
||||
var rowLen = rows.childNodes.length;
|
||||
|
||||
for(var i = 0; i <= rowLen; i++) {
|
||||
var row = rows.childNodes[i];
|
||||
if(row && row.id && row.id.indexOf("row") > -1) {
|
||||
var rowId = row.id;
|
||||
var idPart = rowId.split("_");
|
||||
var rowNum = idPart[1];
|
||||
var hourElem = document.getElementById("hours_"+rowNum+"_formId");
|
||||
if (hourElem) {
|
||||
newHours += parseFloat(hourElem.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
document.getElementById('totalHours').innerHTML = newHours;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
function getTarget(e) {
|
||||
var targ;
|
||||
if (!e) e = window.event || window.Event;
|
||||
if (e.target) targ = e.target;
|
||||
else if (e.srcElement) targ = e.srcElement;
|
||||
if (targ.nodeType == 3) // defeat Safari bug
|
||||
targ = targ.parentNode;
|
||||
return targ
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
function removeRow(e) {
|
||||
if(!e) e = window.event || window.Event;
|
||||
var eleId = e;
|
||||
if(typeof(e) == "object") {
|
||||
var targ = getTarget(e);
|
||||
eleId = targ.parentNode.parentNode.id;
|
||||
}
|
||||
var row = document.getElementById(eleId);
|
||||
var ttbody = document.getElementById("ttbody");
|
||||
var timeRowCount = getTimeRowCount();
|
||||
if(timeRowCount > 1) {
|
||||
ttbody.removeChild(row);
|
||||
recalcHours();
|
||||
return;
|
||||
}
|
||||
alert("<tmpl_var js.alert.removeRow.error>");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
function getTimeRowCount() {
|
||||
var rows = document.getElementById("ttbody");
|
||||
var rowLen = rows.childNodes.length;
|
||||
var count = 0;
|
||||
|
||||
for(var i = 0; i <= rowLen; i++) {
|
||||
var row = rows.childNodes[i];
|
||||
//Skip Text and Attribute Nodes
|
||||
if(row && row.id && row.id.indexOf("row") > -1) count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
function countRows(ttbody) {
|
||||
var tbLen = ttbody.childNodes.length;
|
||||
var rowCount = 0;
|
||||
for (var i = (tbLen - 1); i >= 0; i--) {
|
||||
if(ttbody.childNodes[i].nodeType != 1) continue;
|
||||
rowCount++;
|
||||
}
|
||||
return rowCount;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
function addRow() {
|
||||
var rowx = document.getElementById('row_x');
|
||||
|
||||
var ttbody = document.getElementById('ttbody');
|
||||
//Insert row into the right place
|
||||
var rowCount = countRows(ttbody); //Count actual rows for firefox b/c it's stupid
|
||||
var row = ttbody.insertRow((rowCount-2));
|
||||
|
||||
row.id='row_'+nextRowNum;
|
||||
//Task Entry Id
|
||||
var rowLen = rowx.childNodes.length;
|
||||
|
||||
for ( var i = 0; i < rowLen; i++) {
|
||||
if(rowx.childNodes[i].nodeType != 1) continue;
|
||||
// create the cell
|
||||
var clonetd = rowx.childNodes[i].cloneNode(true);
|
||||
|
||||
var td = row.appendChild(clonetd);
|
||||
var colLen = td.childNodes.length;
|
||||
for ( var j = 0; j < colLen; j++) {
|
||||
var node = td.childNodes[j];
|
||||
// alert(node + " " + node.nodeType);
|
||||
//Skip Text and Attirbute Node Types
|
||||
if(node.nodeType != 1) continue;
|
||||
//alert(node + " " + node.tagName);
|
||||
var nodeName = node.name;
|
||||
|
||||
//Handle Image Node
|
||||
if(node.tagName == "IMG") {
|
||||
var newImg = document.createElement('img');
|
||||
newImg.setAttribute("style","cursor:pointer");
|
||||
newImg.src = "<tmpl_var extras>/delete.gif";
|
||||
newImg.onclick = removeRow;
|
||||
|
||||
childLen = node.childNodes.length;
|
||||
// alert("removing this node");
|
||||
td.removeChild(node);
|
||||
|
||||
// alert("appending new node: " + newImg);
|
||||
td.appendChild(newImg);
|
||||
continue;
|
||||
}
|
||||
|
||||
//Skip Nodes that have no names
|
||||
if(nodeName == "") continue;
|
||||
var nameParts = nodeName.split("_");
|
||||
var colName = nameParts[0];
|
||||
//Set New Node Name
|
||||
node.name = colName + "_" + nextRowNum;
|
||||
//Set New Node ID
|
||||
node.id = colName + "_" + nextRowNum + "_formId";
|
||||
|
||||
if(colName == "projectId") {
|
||||
node.onchange = new Function('changeOptions(this,document.getElementById("taskId_'+nextRowNum+'_formId"));');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
nextRowNum++;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
function validateForm(form) {
|
||||
//Set Row Total
|
||||
form.rowTotal.value = (nextRowNum - 1);
|
||||
if(parseFloat(document.getElementById('totalHours').innerHTML) > 168) {
|
||||
alert("<tmpl_var js.alert.validate.hours.error>");
|
||||
return false;
|
||||
}
|
||||
|
||||
var rows = document.getElementById("ttbody");
|
||||
var rowLen = rows.childNodes.length;
|
||||
var isValid = true;
|
||||
|
||||
for(var i = 0; i <= rowLen; i++) {
|
||||
var row = rows.childNodes[i];
|
||||
if(row && row.id && row.id.indexOf("row") > -1) {
|
||||
var rowId = row.id;
|
||||
var idPart = rowId.split("_");
|
||||
var rowNum = idPart[1];
|
||||
var taskDateElem = document.getElementById("taskDate_"+rowNum+"_formId");
|
||||
taskDateElem.style.background='#FFFFFF';
|
||||
var projectElem = document.getElementById("projectId_"+rowNum+"_formId");
|
||||
projectElem.style.background='#FFFFFF';
|
||||
var taskElem = document.getElementById("taskId_"+rowNum+"_formId");
|
||||
taskElem.style.background='#FFFFFF';
|
||||
var hourElem = document.getElementById("hours_"+rowNum+"_formId");
|
||||
hourElem.style.background='#FFFFFF';
|
||||
//Uncomment below if you wish comments to be required
|
||||
//var comments = document.getElementById("hours_"+rowNum+"_formId");
|
||||
//comments.style.background='#FFFFFF';
|
||||
|
||||
//Uncomment below if you wish comments to be required
|
||||
//if(taskDateElem.value != "" || projectElem.value != "" || taskElem.value != "" || hourElem.value != "" || comments.value != "" ) {
|
||||
//Comment below if you wish comments to be required
|
||||
if(taskDateElem.value != "" || projectElem.value != "" || taskElem.value != "" || (hourElem.value != "" && hourElem.value != "0")) {
|
||||
if(taskDateElem.value == "") {
|
||||
taskDateElem.style.background='#FFFF99';
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
if(projectElem.value == "") {
|
||||
projectElem.style.background='#FFFF99';
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
if(taskElem.value == "") {
|
||||
taskElem.style.background='#FFFF99';
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
if(hourElem.value == "" || hourElem.value == 0) {
|
||||
hourElem.style.background='#FFFF99';
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
//Uncomment below if you wish comments to be required
|
||||
/*if(comments.value == "") {
|
||||
commnts.style.background='#FFFF99';
|
||||
isValid = false;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!isValid) {
|
||||
alert("<tmpl_var js.alert.validate.incomplete.error>");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<p><tmpl_if project.manage.url><a href="<tmpl_var project.manage.url>"><tmpl_var project.manage.label></a></tmpl_if></p>
|
||||
<tmpl_var form.header>
|
||||
<tmpl_var form.timetracker>
|
||||
<tmpl_var form.footer>
|
||||
|
||||
~~~
|
||||
|
||||
<style type="text/css">
|
||||
.timeTracking02 {
|
||||
width:850px;
|
||||
}
|
||||
.timeTracking02 td {
|
||||
border:solid silver 1px;
|
||||
border-bottom:solid gray 1px;
|
||||
font-size:9pt;
|
||||
font-family:arial;
|
||||
}
|
||||
tr.tt_title td {
|
||||
font-weight:bold;
|
||||
background-color:#F0F0F0;
|
||||
border-style:none;
|
||||
font-size:11pt;
|
||||
}
|
||||
tr.tt_header td {
|
||||
font-weight:bold;
|
||||
text-align:center;
|
||||
}
|
||||
tr.tt_empty td {
|
||||
border-style:none;
|
||||
}
|
||||
|
||||
a.PM_blueLink {
|
||||
color:#29587E;
|
||||
text-decoration:none;
|
||||
font-weight:bold;
|
||||
}
|
||||
a.PM_blueLink:hover {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
.pt-select {
|
||||
font-weight: normal;
|
||||
color: black;
|
||||
width: 175px;
|
||||
}
|
||||
.date-select {
|
||||
font-weight: normal;
|
||||
color: black;
|
||||
width: 110px;
|
||||
}
|
||||
</style>
|
||||
191
docs/upgrades/upgrade_7.4.10-7.5.0.pl
Normal file
191
docs/upgrades/upgrade_7.4.10-7.5.0.pl
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use lib "../../lib";
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
|
||||
|
||||
my $toVersion = "7.5.0"; # make this match what version you're going to
|
||||
my $quiet; # this line required
|
||||
|
||||
|
||||
my $session = start(); # this line required
|
||||
|
||||
# upgrade functions go here
|
||||
addFriendsNetwork($session);
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
||||
##-------------------------------------------------
|
||||
#sub exampleFunction {
|
||||
# my $session = shift;
|
||||
# print "\tWe're doing some stuff here that you should know about..." unless $quiet;
|
||||
# # and here's our code
|
||||
# print "DONE!\n" unless $quiet;
|
||||
#}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub addFriendsNetwork {
|
||||
my $session = shift;
|
||||
print "\tInstall the Friend's Network.\n" unless ($quiet);
|
||||
print "\t\tInstall new Network User Profile Field for not wanting to be friendly.\n" unless ($quiet);
|
||||
my $field = WebGUI::ProfileField->create(
|
||||
$session,
|
||||
'ableToBeFriend',
|
||||
{
|
||||
'label' => WebGUI::International->new($session)->get('user profile field friend availability', 'WebGUI'),
|
||||
'visible' => 0,
|
||||
'required' => 0,
|
||||
'protected' => 1,
|
||||
'editable' => 1,
|
||||
'fieldType' => 'yesNo',
|
||||
'dataDefault' => 1,
|
||||
},
|
||||
);
|
||||
|
||||
print "\t\tUpdating Private Messaging Profile Field.\n" unless ($quiet);
|
||||
my $pmField = WebGUI::ProfileField->new($session,"allowPrivateMessages");
|
||||
my %data = (
|
||||
label => 'WebGUI::International::get("allow private messages label","WebGUI")',
|
||||
visible => 1,
|
||||
possibleValues =>'{ all=>WebGUI::International::get("user profile field private message allow label","WebGUI"), friends=>WebGUI::International::get("user profile field private message friends only label","WebGUI"), none=>WebGUI::International::get("user profile field private message allow none label","WebGUI"),}',
|
||||
dataDefault =>'["all"]',
|
||||
fieldType =>'RadioList',
|
||||
required => 0,
|
||||
protected => 1,
|
||||
editable => 1,
|
||||
);
|
||||
$pmField->set(\%data);
|
||||
$session->db->write("update userProfileData set allowPrivateMessages='all' where allowPrivateMessages='1'");
|
||||
$session->db->write("update userProfileData set allowPrivateMessages='none' where allowPrivateMessages='0'");
|
||||
|
||||
|
||||
print "\t\tInstall the table to keep track of friend network invitations.\n" unless ($quiet);
|
||||
my $db = $session->db;
|
||||
$session->db->write(<<EOSQL);
|
||||
|
||||
CREATE TABLE friendInvitations (
|
||||
inviteId VARCHAR(22) BINARY NOT NULL,
|
||||
inviterId VARCHAR(22) BINARY NOT NULL,
|
||||
friendId VARCHAR(22) BINARY NOT NULL,
|
||||
dateSent datetime not null,
|
||||
comments VARCHAR(255) NOT NULL,
|
||||
messageId varchar(22) binary not null,
|
||||
PRIMARY KEY (inviteId)
|
||||
)
|
||||
EOSQL
|
||||
|
||||
print "\t\tAdding friend cleanup workflow activity.\n" unless ($quiet);
|
||||
my $workflow = WebGUI::Workflow->new($session, "pbworkflow000000000001");
|
||||
my $activity = $workflow->addActivity("WebGUI::Workflow::Activity::DenyUnansweredFriends", "unansweredfriends_____");
|
||||
$activity->set("timeout", 60 * 60 * 24 * 30);
|
||||
$activity->set("title", "Deny Friend Requests Older Than A Month");
|
||||
|
||||
print "\t\tAdding friends related settings.\n" unless ($quiet);
|
||||
$session->setting->add("manageFriendsTemplateId", "managefriends_________");
|
||||
|
||||
print "\t\tAdd a new column to the users table to keep track of the groupId for friends." unless ($quiet);
|
||||
$db->write("alter table users add column friendsGroup varchar(22) binary not null default ''");
|
||||
print "OK\n" unless $quiet;
|
||||
}
|
||||
|
||||
|
||||
# ---- DO NOT EDIT BELOW THIS LINE ----
|
||||
|
||||
#-------------------------------------------------
|
||||
sub start {
|
||||
my $configFile;
|
||||
$|=1; #disable output buffering
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile,
|
||||
'quiet'=>\$quiet
|
||||
);
|
||||
my $session = WebGUI::Session->open("../..",$configFile);
|
||||
$session->user({userId=>3});
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Upgrade to ".$toVersion});
|
||||
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
|
||||
updateTemplates($session);
|
||||
return $session;
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub finish {
|
||||
my $session = shift;
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->commit;
|
||||
$session->close();
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub updateTemplates {
|
||||
my $session = shift;
|
||||
return undef unless (-d "templates-".$toVersion);
|
||||
print "\tUpdating templates.\n" unless ($quiet);
|
||||
opendir(DIR,"templates-".$toVersion);
|
||||
my @files = readdir(DIR);
|
||||
closedir(DIR);
|
||||
my $importNode = WebGUI::Asset->getImportNode($session);
|
||||
my $newFolder = undef;
|
||||
foreach my $file (@files) {
|
||||
next unless ($file =~ /\.tmpl$/);
|
||||
open(FILE,"<templates-".$toVersion."/".$file);
|
||||
my $first = 1;
|
||||
my $create = 0;
|
||||
my $head = 0;
|
||||
my %properties = (className=>"WebGUI::Asset::Template");
|
||||
while (my $line = <FILE>) {
|
||||
if ($first) {
|
||||
$line =~ m/^\#(.*)$/;
|
||||
$properties{id} = $1;
|
||||
$first = 0;
|
||||
} elsif ($line =~ m/^\#create$/) {
|
||||
$create = 1;
|
||||
} elsif ($line =~ m/^\#(.*):(.*)$/) {
|
||||
$properties{$1} = $2;
|
||||
} elsif ($line =~ m/^~~~$/) {
|
||||
$head = 1;
|
||||
} elsif ($head) {
|
||||
$properties{headBlock} .= $line;
|
||||
} else {
|
||||
$properties{template} .= $line;
|
||||
}
|
||||
}
|
||||
close(FILE);
|
||||
if ($create) {
|
||||
$newFolder = createNewTemplatesFolder($importNode) unless (defined $newFolder);
|
||||
my $template = $newFolder->addChild(\%properties, $properties{id});
|
||||
} else {
|
||||
my $template = WebGUI::Asset->new($session,$properties{id}, "WebGUI::Asset::Template");
|
||||
if (defined $template) {
|
||||
my $newRevision = $template->addRevision(\%properties);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub createNewTemplatesFolder {
|
||||
my $importNode = shift;
|
||||
my $newFolder = $importNode->addChild({
|
||||
className=>"WebGUI::Asset::Wobject::Folder",
|
||||
title => $toVersion." New Templates",
|
||||
menuTitle => $toVersion." New Templates",
|
||||
url=> $toVersion."_new_templates",
|
||||
groupIdView=>"12"
|
||||
});
|
||||
return $newFolder;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -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,13 @@ my $quiet; # this line required
|
|||
my $session = start(); # this line required
|
||||
|
||||
removeOrphanedGroupings($session); # upgrade functions go here
|
||||
fixDashboardContentPositions($session);
|
||||
fixPosts($session);
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------
|
||||
sub removeOrphanedGroupings {
|
||||
my $session = shift;
|
||||
|
|
@ -34,12 +37,44 @@ 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 fixPosts {
|
||||
my $session = shift;
|
||||
my $db = $session->db;
|
||||
print "\tRemoving unneeded fields from Posts.\n" unless ($quiet);
|
||||
$db->write("alter table Post drop column dateSubmitted");
|
||||
$db->write("alter table Post drop column dateUpdated");
|
||||
$db->write("update Collaboration set sortBy='assetData.revisionDate' where sortBy='dateUpdated'");
|
||||
$db->write("update Collaboration set sortBy='creationDate' where sortBy='dateSubmitted'");
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
128
docs/upgrades/upgrade_7.4.9-7.4.10.pl
Normal file
128
docs/upgrades/upgrade_7.4.9-7.4.10.pl
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use lib "../../lib";
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
|
||||
|
||||
my $toVersion = "7.4.10"; # make this match what version you're going to
|
||||
my $quiet; # this line required
|
||||
|
||||
|
||||
my $session = start(); # this line required
|
||||
|
||||
fixPost($session);
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
||||
#-------------------------------------------------
|
||||
sub fixPost {
|
||||
my $session = shift;
|
||||
print "\tFixing post problems from previous release.\n" unless ($quiet);
|
||||
my $db = $session->db;
|
||||
$db->write("delete from userSessionScratch where value='dateSubmitted'");
|
||||
$db->write("delete from userSessionScratch where value='dateUpdated'");
|
||||
$db->write("alter table Collaboration change sortBy sortBy varchar(35) not null default 'assetData.revisionDate'");
|
||||
}
|
||||
|
||||
|
||||
|
||||
# ---- DO NOT EDIT BELOW THIS LINE ----
|
||||
|
||||
#-------------------------------------------------
|
||||
sub start {
|
||||
my $configFile;
|
||||
$|=1; #disable output buffering
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile,
|
||||
'quiet'=>\$quiet
|
||||
);
|
||||
my $session = WebGUI::Session->open("../..",$configFile);
|
||||
$session->user({userId=>3});
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Upgrade to ".$toVersion});
|
||||
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
|
||||
updateTemplates($session);
|
||||
return $session;
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub finish {
|
||||
my $session = shift;
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->commit;
|
||||
$session->close();
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub updateTemplates {
|
||||
my $session = shift;
|
||||
return undef unless (-d "templates-".$toVersion);
|
||||
print "\tUpdating templates.\n" unless ($quiet);
|
||||
opendir(DIR,"templates-".$toVersion);
|
||||
my @files = readdir(DIR);
|
||||
closedir(DIR);
|
||||
my $importNode = WebGUI::Asset->getImportNode($session);
|
||||
my $newFolder = undef;
|
||||
foreach my $file (@files) {
|
||||
next unless ($file =~ /\.tmpl$/);
|
||||
open(FILE,"<templates-".$toVersion."/".$file);
|
||||
my $first = 1;
|
||||
my $create = 0;
|
||||
my $head = 0;
|
||||
my %properties = (className=>"WebGUI::Asset::Template");
|
||||
while (my $line = <FILE>) {
|
||||
if ($first) {
|
||||
$line =~ m/^\#(.*)$/;
|
||||
$properties{id} = $1;
|
||||
$first = 0;
|
||||
} elsif ($line =~ m/^\#create$/) {
|
||||
$create = 1;
|
||||
} elsif ($line =~ m/^\#(.*):(.*)$/) {
|
||||
$properties{$1} = $2;
|
||||
} elsif ($line =~ m/^~~~$/) {
|
||||
$head = 1;
|
||||
} elsif ($head) {
|
||||
$properties{headBlock} .= $line;
|
||||
} else {
|
||||
$properties{template} .= $line;
|
||||
}
|
||||
}
|
||||
close(FILE);
|
||||
if ($create) {
|
||||
$newFolder = createNewTemplatesFolder($importNode) unless (defined $newFolder);
|
||||
my $template = $newFolder->addChild(\%properties, $properties{id});
|
||||
} else {
|
||||
my $template = WebGUI::Asset->new($session,$properties{id}, "WebGUI::Asset::Template");
|
||||
if (defined $template) {
|
||||
my $newRevision = $template->addRevision(\%properties);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub createNewTemplatesFolder {
|
||||
my $importNode = shift;
|
||||
my $newFolder = $importNode->addChild({
|
||||
className=>"WebGUI::Asset::Wobject::Folder",
|
||||
title => $toVersion." New Templates",
|
||||
menuTitle => $toVersion." New Templates",
|
||||
url=> $toVersion."_new_templates",
|
||||
groupIdView=>"12"
|
||||
});
|
||||
return $newFolder;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -585,17 +585,17 @@ sub workerResponse {
|
|||
$self->debug("Got an error response for $instanceId.");
|
||||
$kernel->yield("suspendInstance",$instance);
|
||||
} else {
|
||||
$self->error("Something bad happened on the return of $instanceId. ".$response->error_as_HTML);
|
||||
$self->error("Something bad happened on the return of $instance->{sitename} - $instanceId. ".$response->error_as_HTML);
|
||||
$kernel->yield("suspendInstance",$instance);
|
||||
}
|
||||
} elsif ($response->is_redirect) {
|
||||
$self->error("Response for $instanceId was redirected. This should never happen if configured properly!!!");
|
||||
$self->error("Response for $instance->{sitename} - $instanceId was redirected. This should never happen if configured properly!!!");
|
||||
$instance->{lastState} = "redirect";
|
||||
$instance->{lastRunTime} = localtime(time());
|
||||
} elsif ($response->is_error) {
|
||||
$instance->{lastState} = "comm error";
|
||||
$instance->{lastRunTime} = localtime(time());
|
||||
$self->error("Response for $instanceId had a communications error. ".$response->error_as_HTML);
|
||||
$self->error("Response for $instance->{sitename} - $instanceId had a communications error. ".$response->error_as_HTML);
|
||||
$kernel->yield("suspendInstance",$instance)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package WebGUI;
|
||||
|
||||
our $VERSION = "7.4.9";
|
||||
our $STATUS = "stable";
|
||||
our $VERSION = "7.5.0";
|
||||
our $STATUS = "beta";
|
||||
|
||||
|
||||
=head1 LEGAL
|
||||
|
|
|
|||
|
|
@ -1326,6 +1326,23 @@ sub indexContent {
|
|||
return $indexer;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 loadModule ( $session, $className )
|
||||
|
||||
Loads an asset module if it's not already in memory. This is a class method. Returns undef on failure to load, otherwise returns the classname.
|
||||
|
||||
=cut
|
||||
|
||||
sub loadModule {
|
||||
my ($class, $session, $className) = @_;
|
||||
(my $module = $className . '.pm') =~ s{::|'}{/}g;
|
||||
if (eval { require $module; 1 }) {
|
||||
return $className;
|
||||
}
|
||||
$session->errorHandler->error("Couldn't compile asset package: ".$className.". Root cause: ".$@);
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -1687,14 +1704,9 @@ sub new {
|
|||
}
|
||||
}
|
||||
|
||||
if ($className) {
|
||||
my $cmd = "use ".$className;
|
||||
eval ($cmd);
|
||||
if ($@) {
|
||||
$session->errorHandler->error("Couldn't compile asset package: ".$className.". Root cause: ".$@);
|
||||
return undef;
|
||||
}
|
||||
$class = $className;
|
||||
if ($className) {
|
||||
$class = $class->loadModule($session, $className);
|
||||
return undef unless (defined $class);
|
||||
}
|
||||
|
||||
my $cache = WebGUI::Cache->new($session, ["asset",$assetId,$revisionDate]);
|
||||
|
|
@ -1777,13 +1789,8 @@ sub newByPropertyHashRef {
|
|||
my $properties = shift;
|
||||
return undef unless defined $properties;
|
||||
return undef unless exists $properties->{className};
|
||||
my $className = $properties->{className};
|
||||
my $cmd = "use ".$className;
|
||||
eval ($cmd);
|
||||
if ($@) {
|
||||
$session->errorHandler->warn("Couldn't compile asset package: ".$className.". Root cause: ".$@);
|
||||
return undef;
|
||||
}
|
||||
my $className = $class->loadModule($session, $properties->{className});
|
||||
return undef unless (defined $className);
|
||||
bless {_session=>$session, _properties => $properties}, $className;
|
||||
}
|
||||
|
||||
|
|
@ -2206,7 +2213,8 @@ Adds a new Asset based upon the class of the current form. Returns the Asset cal
|
|||
sub www_add {
|
||||
my $self = shift;
|
||||
my %prototypeProperties;
|
||||
my $class = $self->session->form->process("class","className");
|
||||
my $class = $self->loadModule($self->session, $self->session->form->process("class","className"));
|
||||
return undef unless (defined $class);
|
||||
return $self->session->privilege->insufficient() unless ($class->canAdd($self->session));
|
||||
if ($self->session->form->process('prototype')) {
|
||||
my $prototype = WebGUI::Asset->new($self->session, $self->session->form->process("prototype"),$class);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use base 'WebGUI::Asset::File';
|
|||
use WebGUI::Storage::Image;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::Utility;
|
||||
|
||||
use WebGUI::Form::Image;
|
||||
|
||||
|
||||
=head1 NAME
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ sub definition {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 appendTemplateVarsForCommentForm ( vars )
|
||||
=head2 appendTemplateVarsForCommentForm ( var )
|
||||
|
||||
Add the template variables necessary for the comment form to the given hash
|
||||
reference. Returns the hash reference for convenience.
|
||||
|
|
@ -100,11 +100,11 @@ reference. Returns the hash reference for convenience.
|
|||
|
||||
sub appendTemplateVarsForCommentForm {
|
||||
my $self = shift;
|
||||
my $vars = shift;
|
||||
my $var = shift;
|
||||
|
||||
# ...
|
||||
|
||||
return $vars;
|
||||
return $var;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -151,9 +151,27 @@ sub canEdit {
|
|||
Returns true if the user can view this asset. C<userId> is a WebGUI user ID.
|
||||
If no user is passed, checks the current user.
|
||||
|
||||
Users can view this photo if they can view the parent asset. If this is a
|
||||
C<friendsOnly> photo, then they must also be in the owners friends list.
|
||||
|
||||
=cut
|
||||
|
||||
# Inherited from superclass
|
||||
sub canView {
|
||||
my $self = shift;
|
||||
my $userId = shift || $self->session->user->userId;
|
||||
|
||||
my $album = $self->getParent;
|
||||
return 0 unless $album->canView($userId);
|
||||
|
||||
if ($self->isFriendsOnly) {
|
||||
|
||||
# ...
|
||||
|
||||
}
|
||||
|
||||
# Passed all checks
|
||||
return 1;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -321,6 +339,19 @@ sub i18n {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 isFriendsOnly ( )
|
||||
|
||||
Returns true if this Photo is friends only. Returns false otherwise.
|
||||
|
||||
=cut
|
||||
|
||||
sub isFriendsOnly {
|
||||
my $self = shift;
|
||||
return $self->get("friendsOnly");
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 makeResolutions ( [resolutions] )
|
||||
|
||||
Create the specified resolutions for this Photo. If resolutions is not
|
||||
|
|
|
|||
|
|
@ -72,16 +72,12 @@ sub addRevision {
|
|||
my $now = time();
|
||||
if ($threadId eq "") { # new post
|
||||
if ($newSelf->getParent->isa("WebGUI::Asset::Wobject::Collaboration")) {
|
||||
$newSelf->update({threadId=>$newSelf->getId, dateSubmitted=>$now});
|
||||
$newSelf->update({threadId=>$newSelf->getId});
|
||||
} else {
|
||||
$newSelf->update({threadId=>$newSelf->getParent->get("threadId"), dateSubmitted=>$now});
|
||||
$newSelf->update({threadId=>$newSelf->getParent->get("threadId")});
|
||||
}
|
||||
delete $newSelf->{_thread};
|
||||
}
|
||||
$newSelf->update({
|
||||
dateUpdated=>$now,
|
||||
});
|
||||
|
||||
$newSelf->getThread->unmarkRead;
|
||||
|
||||
return $newSelf;
|
||||
|
|
@ -99,7 +95,7 @@ sub canEdit {
|
|||
my $self = shift;
|
||||
return (($self->session->form->process("func") eq "add" || ($self->session->form->process("assetId") eq "new" && $self->session->form->process("func") eq "editSave" && $self->session->form->process("class","className") eq "WebGUI::Asset::Post")) && $self->getThread->getParent->canPost) || # account for new posts
|
||||
|
||||
($self->isPoster && $self->getThread->getParent->get("editTimeout") > ($self->session->datetime->time() - $self->get("dateUpdated"))) ||
|
||||
($self->isPoster && $self->getThread->getParent->get("editTimeout") > ($self->session->datetime->time() - $self->get("revisionDate"))) ||
|
||||
$self->getThread->getParent->canEdit;
|
||||
|
||||
}
|
||||
|
|
@ -150,7 +146,7 @@ sub commit {
|
|||
my $u = WebGUI::User->new($self->session, $self->get("ownerUserId"));
|
||||
$u->karma($self->getThread->getParent->get("karmaPerPost"), $self->getId, "Collaboration post");
|
||||
}
|
||||
$self->getThread->incrementReplies($self->get("dateUpdated"),$self->getId) if ($self->isReply);
|
||||
$self->getThread->incrementReplies($self->get("revisionDate"),$self->getId) if ($self->isReply);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -176,15 +172,6 @@ sub definition {
|
|||
fieldType=>"hidden",
|
||||
defaultValue=>undef
|
||||
},
|
||||
dateSubmitted => {
|
||||
noFormPost=>1,
|
||||
fieldType=>"hidden",
|
||||
defaultValue=>$session->datetime->time()
|
||||
},
|
||||
dateUpdated => {
|
||||
fieldType=>"hidden",
|
||||
defaultValue=>$session->datetime->time()
|
||||
},
|
||||
username => {
|
||||
fieldType=>"hidden",
|
||||
defaultValue=>$session->form->process("visitorUsername") || $session->user->profileField("alias") || $session->user->username
|
||||
|
|
@ -311,6 +298,12 @@ sub formatContent {
|
|||
return $msg;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# Too slow to try to find out children, just always assume new data
|
||||
sub getContentLastModified {
|
||||
return time();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getAutoCommitWorkflowId {
|
||||
my $self = shift;
|
||||
|
|
@ -511,8 +504,8 @@ sub getTemplateVars {
|
|||
$var{"user.isPoster"} = $self->isPoster;
|
||||
$var{"avatar.url"} = $self->getAvatarUrl;
|
||||
$var{"userProfile.url"} = $self->getUrl("op=viewProfile;uid=".$self->get("ownerUserId"));
|
||||
$var{"dateSubmitted.human"} =$self->session->datetime->epochToHuman($self->get("dateSubmitted"));
|
||||
$var{"dateUpdated.human"} =$self->session->datetime->epochToHuman($self->get("dateUpdated"));
|
||||
$var{"dateSubmitted.human"} =$self->session->datetime->epochToHuman($self->get("creationDate"));
|
||||
$var{"dateUpdated.human"} =$self->session->datetime->epochToHuman($self->get("revisionDate"));
|
||||
$var{'title.short'} = $self->chopTitle;
|
||||
$var{content} = $self->formatContent if ($self->getThread);
|
||||
$var{'user.canEdit'} = $self->canEdit if ($self->getThread);
|
||||
|
|
@ -689,7 +682,7 @@ Returns a boolean indicating whether this post is new (not an edit).
|
|||
|
||||
sub isNew {
|
||||
my $self = shift;
|
||||
return $self->get("dateSubmitted") eq $self->get("dateUpdated");
|
||||
return $self->get("creationDate") == $self->get("revisionDate");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -1021,19 +1014,23 @@ Moves post to the trash and updates reply counter on thread.
|
|||
=cut
|
||||
|
||||
sub trash {
|
||||
my $self = shift;
|
||||
$self->SUPER::trash;
|
||||
$self->getThread->sumReplies if ($self->isReply);
|
||||
if ($self->getThread->get("lastPostId") eq $self->getId) {
|
||||
my $threadLineage = $self->getThread->get("lineage");
|
||||
my ($id, $date) = $self->session->db->quickArray("select Post.assetId, Post.dateSubmitted from Post, asset where asset.lineage like ".$self->session->db->quote($threadLineage.'%')." and Post.assetId<>".$self->session->db->quote($self->getId)." and asset.assetId=Post.assetId and asset.state='published' order by Post.dateSubmitted desc");
|
||||
$self->getThread->update({lastPostId=>$id, lastPostDate=>$date});
|
||||
}
|
||||
if ($self->getThread->getParent->get("lastPostId") eq $self->getId) {
|
||||
my $forumLineage = $self->getThread->getParent->get("lineage");
|
||||
my ($id, $date) = $self->session->db->quickArray("select Post.assetId, Post.dateSubmitted from Post, asset where asset.lineage like ".$self->session->db->quote($forumLineage.'%')." and Post.assetId<>".$self->session->db->quote($self->getId)." and asset.assetId=Post.assetId and asset.state='published' order by Post.dateSubmitted desc");
|
||||
$self->getThread->getParent->update({lastPostId=>$id, lastPostDate=>$date});
|
||||
}
|
||||
my $self = shift;
|
||||
$self->SUPER::trash;
|
||||
$self->getThread->sumReplies if ($self->isReply);
|
||||
if ($self->getThread->get("lastPostId") eq $self->getId) {
|
||||
my $threadLineage = $self->getThread->get("lineage");
|
||||
my ($id, $date) = $self->session->db->quickArray("select assetId, creationDate from asset where
|
||||
lineage like ? and assetId<>? and asset.state='published' and className like 'WebGUI::Asset::Post%'
|
||||
order by creationDate desc",[$threadLineage.'%', $self->getId]);
|
||||
$self->getThread->update({lastPostId=>$id, lastPostDate=>$date});
|
||||
}
|
||||
if ($self->getThread->getParent->get("lastPostId") eq $self->getId) {
|
||||
my $forumLineage = $self->getThread->getParent->get("lineage");
|
||||
my ($id, $date) = $self->session->db->quickArray("select assetId, creationDate from asset where
|
||||
lineage like ? and assetId<>? and asset.state='published' and className like 'WebGUI::Asset::Post%'
|
||||
order by creationDate desc",[$forumLineage.'%', $self->getId]);
|
||||
$self->getThread->getParent->update({lastPostId=>$id, lastPostDate=>$date});
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ sub commit {
|
|||
my $self = shift;
|
||||
$self->SUPER::commit;
|
||||
if ($self->isNew) {
|
||||
$self->getParent->incrementThreads($self->get("dateUpdated"),$self->getId);
|
||||
$self->getParent->incrementThreads($self->get("revisionDate"),$self->getId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -623,6 +623,7 @@ sub setLastPost {
|
|||
$self->getParent->setLastPost($id,$date);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub normalizeLastPost {
|
||||
my $self = shift;
|
||||
# Hmm. Is this right?
|
||||
|
|
@ -704,14 +705,21 @@ Moves thread to the trash and updates reply counter on thread.
|
|||
=cut
|
||||
|
||||
sub trash {
|
||||
my $self = shift;
|
||||
$self->SUPER::trash;
|
||||
$self->getParent->sumReplies;
|
||||
if ($self->getParent->get("lastPostId") eq $self->getId) {
|
||||
my $parentLineage = $self->getThread->get("lineage");
|
||||
my ($id, $date) = $self->session->db->quickArray("select Post.assetId, Post.dateSubmitted from Post, asset where asset.lineage like ".$self->session->db->quote($parentLineage.'%')." and Post.assetId<>".$self->session->db->quote($self->getId)." and Post.assetId=asset.assetId and asset.state='published' order by Post.dateSubmitted desc");
|
||||
$self->getParent->setLastPost('','') ? $self->getParent->setLastPost($id,$date) : $id;
|
||||
my $self = shift;
|
||||
$self->SUPER::trash;
|
||||
$self->getParent->sumReplies;
|
||||
if ($self->getParent->get("lastPostId") eq $self->getId) {
|
||||
my $parentLineage = $self->getThread->get("lineage");
|
||||
my ($id, $date) = $self->session->db->quickArray("select assetId, creationDate from asset where
|
||||
lineage like ? and assetId<>? and asset.state='published' and className like 'WebGUI::Asset::Post%'
|
||||
order by creationDate desc",[$parentLineage.'%', $self->getId]);
|
||||
if (defined $id) {
|
||||
$self->getParent->setLastPost($id,$date);
|
||||
}
|
||||
else {
|
||||
$self->getParent->setLastPost('','');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -884,10 +892,9 @@ sub view {
|
|||
my $p = WebGUI::Paginator->new($self->session,$self->getUrl,$self->getParent->get("postsPerPage"));
|
||||
my $sql = "select asset.assetId, asset.className, assetData.revisionDate as revisionDate, assetData.url as url from asset
|
||||
left join assetData on assetData.assetId=asset.assetId
|
||||
left join Post on Post.assetId=assetData.assetId and assetData.revisionDate=Post.revisionDate
|
||||
where asset.lineage like ".$self->session->db->quote($self->get("lineage").'%')
|
||||
." and asset.state='published'
|
||||
and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId
|
||||
and assetData.revisionDate=(SELECT max(assetData.revisionDate) from assetData where assetData.assetId=asset.assetId
|
||||
and (
|
||||
assetData.status in ('approved','archived')
|
||||
or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag"));
|
||||
|
|
@ -898,7 +905,7 @@ sub view {
|
|||
order by ";
|
||||
|
||||
if ($layout eq "flat") {
|
||||
$sql .= "Post.dateSubmitted";
|
||||
$sql .= "asset.creationDate";
|
||||
} else {
|
||||
$sql .= "asset.lineage";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ sub www_view {
|
|||
$subvar = {};
|
||||
@$subvar{'title', 'link', 'description'} = $self->_tlsOfAsset($item);
|
||||
$subvar->{guid} = $subvar->{link};
|
||||
$subvar->{pubDate} = _escapeXml($self->session->datetime->epochToMail($item->get('dateUpdated')));
|
||||
$subvar->{pubDate} = _escapeXml($self->session->datetime->epochToMail($item->get('revisionDate')));
|
||||
} elsif (ref $item eq 'HASH') {
|
||||
foreach my $key (keys %$item) {
|
||||
$subvar->{$key} = _escapeXml($item->{$key});
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ sub getEditForm {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getList ( session, namespace )
|
||||
=head2 getList ( session, namespace [,clause] )
|
||||
|
||||
Returns a hash reference containing template ids and template names of all the templates in the specified namespace.
|
||||
|
||||
|
|
@ -203,7 +203,12 @@ A reference to the current session.
|
|||
|
||||
=head3 namespace
|
||||
|
||||
Specify the namespace to build the list for.
|
||||
Specify the namespace to build the list for. If no namespace is specified,
|
||||
then an empty hash reference will be returned.
|
||||
|
||||
=head3 clause
|
||||
|
||||
An extra clause that can be used to further limit the list, such as "assetData.status='approved'
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -211,8 +216,15 @@ sub getList {
|
|||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $namespace = shift;
|
||||
my $sql = "select asset.assetId, assetData.revisionDate from template left join asset on asset.assetId=template.assetId left join assetData on assetData.revisionDate=template.revisionDate and assetData.assetId=template.assetId where template.namespace=".$session->db->quote($namespace)." and template.showInForms=1 and asset.state='published' and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId and (assetData.status='approved' or assetData.tagId=".$session->db->quote($session->scratch->get("versionTag")).")) order by assetData.title";
|
||||
my $sth = $session->dbSlave->read($sql);
|
||||
my $clause = shift;
|
||||
if ($clause) {
|
||||
$clause = ' and ' . $clause;
|
||||
}
|
||||
else {
|
||||
$clause = '';
|
||||
}
|
||||
my $sql = "select asset.assetId, assetData.revisionDate from template left join asset on asset.assetId=template.assetId left join assetData on assetData.revisionDate=template.revisionDate and assetData.assetId=template.assetId where template.namespace=? and template.showInForms=1 and asset.state='published' and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId and (assetData.status='approved' or assetData.tagId=?)) $clause order by assetData.title";
|
||||
my $sth = $session->dbSlave->read($sql, [$namespace, $session->scratch->get("versionTag")]);
|
||||
my %templates;
|
||||
tie %templates, 'Tie::IxHash';
|
||||
while (my ($id, $version) = $sth->array) {
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ sub addRevision {
|
|||
my $now = time();
|
||||
$newSelf->update({
|
||||
isHidden => 1,
|
||||
dateUpdated=>$now,
|
||||
});
|
||||
return $newSelf;
|
||||
}
|
||||
|
|
@ -227,17 +226,21 @@ sub processPropertiesFromFormPost {
|
|||
my $self = shift;
|
||||
$self->SUPER::processPropertiesFromFormPost(@_);
|
||||
my $actionTaken = ($self->session->form->process("assetId") eq "new") ? "Created" : "Edited";
|
||||
|
||||
$self->update({ groupIdView => $self->getWiki->get('groupIdView'),
|
||||
groupIdEdit => $self->getWiki->get('groupToAdminister'),
|
||||
my $wiki = $self->getWiki;
|
||||
$self->update({ groupIdView => $wiki->get('groupIdView'),
|
||||
groupIdEdit => $wiki->get('groupToAdminister'),
|
||||
actionTakenBy => $self->session->user->userId,
|
||||
actionTaken => $actionTaken,
|
||||
});
|
||||
|
||||
if ($self->getWiki->canAdminister) {
|
||||
if ($wiki->canAdminister) {
|
||||
$self->update({isProtected => $self->session->form("isProtected")});
|
||||
}
|
||||
|
||||
my $options = {
|
||||
maxImageSize => $wiki->get('maxImageSize'),
|
||||
thumbnailSize => $wiki->get('thumbnailSize'),
|
||||
};
|
||||
# deal with attachments from the attachments form control
|
||||
my @attachments = $self->session->form->param("attachments");
|
||||
my @tags = ();
|
||||
|
|
@ -252,6 +255,7 @@ sub processPropertiesFromFormPost {
|
|||
groupIdView => $self->get("groupIdView"),
|
||||
});
|
||||
}
|
||||
$asset->applyConstraints($options);
|
||||
push(@tags, $asset->get("tagId"));
|
||||
$asset->setVersionTag($self->get("tagId"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -975,7 +975,7 @@ sub view {
|
|||
$var->{"urlSearch"} = $self->getSearchUrl;
|
||||
$var->{"urlPrint"} = $self->getUrl("type=".$params->{type}.";start=".$params->{start}.";print=1");
|
||||
$var->{"urlIcal"} = $self->getUrl(
|
||||
sprintf "func=ical;type=%s;start=%d",
|
||||
sprintf "func=ical;type=%s;start=%s",
|
||||
$params->{type},
|
||||
$params->{start},
|
||||
);
|
||||
|
|
@ -1510,7 +1510,7 @@ sub www_ical {
|
|||
#}
|
||||
#else
|
||||
#{
|
||||
$dt_start = WebGUI::DateTime->new($self->session, time-60*60*24*30)->set_time_zone($session->user->profileField("timeZone"));
|
||||
$dt_start = WebGUI::DateTime->new($self->session, time)->set_time_zone($session->user->profileField("timeZone"));
|
||||
#}
|
||||
}
|
||||
else {
|
||||
|
|
@ -1667,7 +1667,7 @@ sub www_search {
|
|||
keywords => $keywords,
|
||||
classes => ['WebGUI::Asset::Event'],
|
||||
lineage => [$self->get("lineage")],
|
||||
join => "join Event on assetIndex.assetId=Event.assetId",
|
||||
join => "join Event on assetIndex.assetId=Event.assetId and assetIndex.revisionDate=Event.revisionDate",
|
||||
columns => ['Event.startDate','Event.startTime'],
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -93,15 +93,17 @@ sub appendPostListTemplateVars {
|
|||
my $p = shift;
|
||||
my $page = $p->getPageData;
|
||||
my $i = 0;
|
||||
my ($icon, $datetime) = $self->session->quick(qw(icon datetime));
|
||||
foreach my $row (@$page) {
|
||||
my $post = WebGUI::Asset->new($self->session,$row->{assetId}, $row->{className}, $row->{revisionDate});
|
||||
$post->{_parent} = $self; # caching parent for efficiency
|
||||
my $controls = $self->session->icon->delete('func=delete',$post->get("url"),"Delete").$self->session->icon->edit('func=edit',$post->get("url"));
|
||||
my $controls = $icon->delete('func=delete',$post->get("url"),"Delete") . $icon->edit('func=edit',$post->get("url"));
|
||||
if ($self->get("sortBy") eq "lineage") {
|
||||
if ($self->get("sortOrder") eq "desc") {
|
||||
$controls .= $self->session->icon->moveUp('func=demote',$post->get("url")).$self->session->icon->moveDown('func=promote',$post->get("url"));
|
||||
} else {
|
||||
$controls .= $self->session->icon->moveUp('func=promote',$post->get("url")).$self->session->icon->moveDown('func=demote',$post->get("url"));
|
||||
$controls .= $icon->moveUp('func=demote',$post->get("url")).$icon->moveDown('func=promote',$post->get("url"));
|
||||
}
|
||||
else {
|
||||
$controls .= $icon->moveUp('func=promote',$post->get("url")).$icon->moveDown('func=demote',$post->get("url"));
|
||||
}
|
||||
}
|
||||
my @rating_loop;
|
||||
|
|
@ -114,13 +116,13 @@ sub appendPostListTemplateVars {
|
|||
if ($self->get("displayLastReply")) {
|
||||
my $lastPost = $post->getLastPost();
|
||||
%lastReply = (
|
||||
"lastReply.url"=>$lastPost->getUrl.'#'.$lastPost->getId,
|
||||
"lastReply.title"=>$lastPost->get("title"),
|
||||
"lastReply.user.isVisitor"=>$lastPost->get("ownerUserId") eq "1",
|
||||
"lastReply.username"=>$lastPost->get("username"),
|
||||
"lastReply.userProfile.url"=>$lastPost->WebGUI::Asset::Post::getPosterProfileUrl(),
|
||||
"lastReply.dateSubmitted.human"=>$self->session->datetime->epochToHuman($lastPost->get("dateSubmitted"),"%z"),
|
||||
"lastReply.timeSubmitted.human"=>$self->session->datetime->epochToHuman($lastPost->get("dateSubmitted"),"%Z")
|
||||
"lastReply.url" => $lastPost->getUrl.'#'.$lastPost->getId,
|
||||
"lastReply.title" => $lastPost->get("title"),
|
||||
"lastReply.user.isVisitor" => $lastPost->get("ownerUserId") eq "1",
|
||||
"lastReply.username" => $lastPost->get("username"),
|
||||
"lastReply.userProfile.url" => $lastPost->getPosterProfileUrl(),
|
||||
"lastReply.dateSubmitted.human" => $datetime->epochToHuman($lastPost->get("creationDate"),"%z"),
|
||||
"lastReply.timeSubmitted.human" => $datetime->epochToHuman($lastPost->get("creationDate"),"%Z"),
|
||||
);
|
||||
}
|
||||
$hasRead = $post->isMarkedRead;
|
||||
|
|
@ -133,32 +135,32 @@ sub appendPostListTemplateVars {
|
|||
}
|
||||
my %postVars = (
|
||||
%{$post->get},
|
||||
"id"=>$post->getId,
|
||||
"url"=>$url,
|
||||
rating_loop=>\@rating_loop,
|
||||
"content"=>$post->formatContent,
|
||||
"status"=>$post->getStatus,
|
||||
"thumbnail"=>$post->getThumbnailUrl,
|
||||
"image.url"=>$post->getImageUrl,
|
||||
"dateSubmitted.human"=>$self->session->datetime->epochToHuman($post->get("dateSubmitted"),"%z"),
|
||||
"dateUpdated.human"=>$self->session->datetime->epochToHuman($post->get("dateUpdated"),"%z"),
|
||||
"timeSubmitted.human"=>$self->session->datetime->epochToHuman($post->get("dateSubmitted"),"%Z"),
|
||||
"timeUpdated.human"=>$self->session->datetime->epochToHuman($post->get("dateUpdated"),"%Z"),
|
||||
"userProfile.url"=>$post->getPosterProfileUrl,
|
||||
"user.isVisitor"=>$post->get("ownerUserId") eq "1",
|
||||
"edit.url"=>$post->getEditUrl,
|
||||
'controls'=>$controls,
|
||||
"isSecond"=>(($i+1)%2==0),
|
||||
"isThird"=>(($i+1)%3==0),
|
||||
"isFourth"=>(($i+1)%4==0),
|
||||
"isFifth"=>(($i+1)%5==0),
|
||||
"user.hasRead" => $hasRead,
|
||||
"user.isPoster"=>$post->isPoster,
|
||||
"avatar.url"=>$post->getAvatarUrl,
|
||||
"id" => $post->getId,
|
||||
"url" => $url,
|
||||
rating_loop => \@rating_loop,
|
||||
"content" => $post->formatContent,
|
||||
"status" => $post->getStatus,
|
||||
"thumbnail" => $post->getThumbnailUrl,
|
||||
"image.url" => $post->getImageUrl,
|
||||
"dateSubmitted.human" => $datetime->epochToHuman($post->get("creationDate"),"%z"),
|
||||
"dateUpdated.human" => $datetime->epochToHuman($post->get("revisionDate"),"%z"),
|
||||
"timeSubmitted.human" => $datetime->epochToHuman($post->get("creationDate"),"%Z"),
|
||||
"timeUpdated.human" => $datetime->epochToHuman($post->get("revisionDate"),"%Z"),
|
||||
"userProfile.url" => $post->getPosterProfileUrl,
|
||||
"user.isVisitor" => $post->get("ownerUserId") eq "1",
|
||||
"edit.url" => $post->getEditUrl,
|
||||
'controls' => $controls,
|
||||
"isSecond" => (($i+1)%2==0),
|
||||
"isThird" => (($i+1)%3==0),
|
||||
"isFourth" => (($i+1)%4==0),
|
||||
"isFifth" => (($i+1)%5==0),
|
||||
"user.hasRead" => $hasRead,
|
||||
"user.isPoster" => $post->isPoster,
|
||||
"avatar.url" => $post->getAvatarUrl,
|
||||
%lastReply
|
||||
);
|
||||
$post->getTemplateMetadataVars(\%postVars);
|
||||
if ($row->{className} eq 'WebGUI::Asset::Post::Thread') {
|
||||
if ($row->{className} =~ m/^WebGUI::Asset::Post::Thread/) {
|
||||
$postVars{'rating'} = $post->get('threadRating');
|
||||
}
|
||||
push(@{$var->{post_loop}}, \%postVars );
|
||||
|
|
@ -363,8 +365,8 @@ sub definition {
|
|||
my %sortByOptions;
|
||||
tie %sortByOptions, 'Tie::IxHash';
|
||||
%sortByOptions = (lineage=>$i18n->get('sequence'),
|
||||
dateUpdated=>$i18n->get('date updated'),
|
||||
dateSubmitted=>$i18n->get('date submitted'),
|
||||
"assetData.revisionDate"=>$i18n->get('date updated'),
|
||||
creationDate=>$i18n->get('date submitted'),
|
||||
title=>$i18n->get('title'),
|
||||
userDefined1=>$i18n->get('user defined 1'),
|
||||
userDefined2=>$i18n->get('user defined 2'),
|
||||
|
|
@ -611,7 +613,7 @@ sub definition {
|
|||
},
|
||||
sortBy =>{
|
||||
fieldType=>"selectBox",
|
||||
defaultValue=>'dateUpdated',
|
||||
defaultValue=>'assetData.revisionDate',
|
||||
tab=>'display',
|
||||
options=>\%sortByOptions,
|
||||
label=>$i18n->get('sort by'),
|
||||
|
|
@ -753,6 +755,12 @@ sub duplicate {
|
|||
return $newAsset;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# Too slow to try to find out children, just always assume new data
|
||||
sub getContentLastModified {
|
||||
return time();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getEditTabs {
|
||||
my $self = shift;
|
||||
|
|
@ -781,7 +789,8 @@ sub getRssItems {
|
|||
# XXX copied and reformatted this query from www_viewRSS, but why is it constructed like this?
|
||||
# And it's duplicated inside view, too! Eeeagh! And it uses the versionTag scratch var...
|
||||
my ($sortBy, $sortOrder) = ($self->getValue('sortBy'), $self->getValue('sortOrder'));
|
||||
my @postIds = $self->session->db->buildArray(<<"SQL", [$self->getId, $self->session->scratch->get('versionTag')]);
|
||||
|
||||
my @postIds = $self->session->db->buildArray(<<"SQL", [$self->getId, $self->session->scratch->get('versionTag')]);
|
||||
SELECT asset.assetId
|
||||
FROM Thread
|
||||
LEFT JOIN asset ON Thread.assetId = asset.assetId
|
||||
|
|
@ -823,7 +832,7 @@ SQL
|
|||
'link' => $postUrl,
|
||||
guid => $postUrl,
|
||||
description => $post->get('synopsis'),
|
||||
pubDate => $datetime->epochToMail($post->get('dateUpdated')),
|
||||
pubDate => $datetime->epochToMail($post->get('revisionDate')),
|
||||
attachmentLoop => $attachmentLoop,
|
||||
userDefined1 => $post->get("userDefined1"),
|
||||
userDefined2 => $post->get("userDefined2"),
|
||||
|
|
@ -925,7 +934,7 @@ sub getThreadsPaginator {
|
|||
my $scratchSortBy = $self->getId."_sortBy";
|
||||
my $scratchSortOrder = $self->getId."_sortDir";
|
||||
my $sortBy = $self->session->form->process("sortBy") || $self->session->scratch->get($scratchSortBy) || $self->get("sortBy");
|
||||
my $sortOrder = $self->session->scratch->get($scratchSortOrder) || $self->get("sortOrder");
|
||||
my $sortOrder = $self->session->scratch->get($scratchSortOrder) || $self->get("sortOrder");
|
||||
if ($sortBy ne $self->session->scratch->get($scratchSortBy) && $self->session->form->process("func") ne "editSave") {
|
||||
$self->session->scratch->set($scratchSortBy,$self->session->form->process("sortBy"));
|
||||
} elsif ($self->session->form->process("sortBy") && $self->session->form->process("func") ne "editSave") {
|
||||
|
|
@ -936,13 +945,13 @@ sub getThreadsPaginator {
|
|||
}
|
||||
$self->session->scratch->set($scratchSortOrder, $sortOrder);
|
||||
}
|
||||
$sortBy ||= "dateUpdated";
|
||||
$sortBy ||= "assetData.revisionDate";
|
||||
$sortOrder ||= "desc";
|
||||
# Sort by the thread rating instead of the post rating. other places don't care about threads.
|
||||
if ($sortBy eq 'rating') {
|
||||
$sortBy = 'threadRating';
|
||||
}
|
||||
|
||||
$sortBy = $self->session->db->dbh->quote_identifier($sortBy);
|
||||
my $sql = "
|
||||
select
|
||||
asset.assetId,
|
||||
|
|
@ -1007,7 +1016,7 @@ sub getViewTemplateVars {
|
|||
$var{'sortby.username.url'} = $self->getSortByUrl("username");
|
||||
$var{'karmaIsEnabled'} = $self->session->setting->get("useKarma");
|
||||
$var{'sortby.karmaRank.url'} = $self->getSortByUrl("karmaRank");
|
||||
$var{'sortby.date.url'} = $self->getSortByUrl("dateSubmitted");
|
||||
$var{'sortby.date.url'} = $self->getSortByUrl("creationDate");
|
||||
$var{'sortby.lastreply.url'} = $self->getSortByUrl("lastPostDate");
|
||||
$var{'sortby.views.url'} = $self->getSortByUrl("views");
|
||||
$var{'sortby.replies.url'} = $self->getSortByUrl("replies");
|
||||
|
|
|
|||
|
|
@ -95,15 +95,29 @@ sub definition {
|
|||
return $class->SUPER::definition($session, $definition);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub discernUserId {
|
||||
my $self = shift;
|
||||
return ($self->canManage && $self->session->var->isAdminOn) ? '1' : $self->session->user->userId;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getContentPositions {
|
||||
my $self = shift;
|
||||
my $dummy = $self->initialize unless $self->get("isInitialized");
|
||||
my $u = WebGUI::User->new($self->session, $self->discernUserId);
|
||||
return $u->profileField($self->getId.'contentPositions')
|
||||
return $u->profileField($self->getContentPositionsId)
|
||||
|| $self->getContentPositionsDefault;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getContentPositionsId {
|
||||
my $self = shift;
|
||||
my $id = "contentPositions".$self->getId;
|
||||
$id =~ s/-/_/g;
|
||||
return $id;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getContentPositionsDefault ( )
|
||||
|
|
@ -117,13 +131,7 @@ sub getContentPositionsDefault {
|
|||
my $dummy = $self->initialize unless $self->get("isInitialized");
|
||||
# The default positions are saved under the "Visitor" user
|
||||
my $u = WebGUI::User->new($self->session, 1);
|
||||
return $u->profileField($self->getId.'contentPositions');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub discernUserId {
|
||||
my $self = shift;
|
||||
return ($self->canManage && $self->session->var->isAdminOn) ? '1' : $self->session->user->userId;
|
||||
return $u->profileField($self->getContentPositionsId);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -154,13 +162,13 @@ sub getEditForm {
|
|||
#-------------------------------------------------------------------
|
||||
sub initialize {
|
||||
my $self = shift;
|
||||
my $userPrefField = WebGUI::ProfileField->create($self->session,$self->getId.'contentPositions',{
|
||||
my $userPrefField = WebGUI::ProfileField->create($self->session,$self->getContentPositionsId,{
|
||||
label=>'\'Dashboard User Preference - Content Positions\'',
|
||||
visible=>0,
|
||||
protected=>1,
|
||||
editable=>0,
|
||||
required=>0,
|
||||
fieldType=>'text'
|
||||
fieldType=>'textarea'
|
||||
});
|
||||
$self->update({isInitialized=>1});
|
||||
}
|
||||
|
|
@ -201,6 +209,17 @@ sub processPropertiesFromFormPost {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
my $self = shift;
|
||||
my $userPrefField = WebGUI::ProfileField->new($self->session,$self->getContentPositionsId);
|
||||
if (defined $userPrefField) {
|
||||
$userPrefField->delete;
|
||||
}
|
||||
$self->SUPER::purge(@_);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub view {
|
||||
my $self = shift;
|
||||
|
|
@ -309,7 +328,7 @@ sub www_setContentPositions {
|
|||
return 'empty' unless $self->get("isInitialized");
|
||||
my $dummy = $self->initialize unless $self->get("isInitialized");
|
||||
my $u = WebGUI::User->new($self->session, $self->discernUserId);
|
||||
my $success = $u->profileField($self->getId.'contentPositions',$self->session->form->process("map")) eq $self->session->form->process("map");
|
||||
my $success = $u->profileField($self->getContentPositionsId,$self->session->form->process("map")) eq $self->session->form->process("map");
|
||||
return "Map set: ".$self->session->form->process("map") if $success;
|
||||
return "Map failed to set.";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -503,6 +503,8 @@ sub getRecordTemplateVars {
|
|||
$where .= " and b.DataForm_entryId=".$self->session->db->quote($var->{entryId});
|
||||
$join = "left join DataForm_entryData as b on a.DataForm_fieldId=b.DataForm_fieldId";
|
||||
$select .= ", b.value";
|
||||
$var->{"delete.url"} = $self->getUrl('func=deleteEntry;entryId='.$var->{entryId});
|
||||
$var->{"delete.label"} = $i18n->get(90);
|
||||
}
|
||||
my %data;
|
||||
tie %data, 'Tie::CPHash';
|
||||
|
|
@ -628,8 +630,6 @@ sub getTemplateVars {
|
|||
$var->{"entryList.label"} = $i18n->get(86);
|
||||
$var->{"export.tab.url"} = $self->getUrl('func=exportTab');
|
||||
$var->{"export.tab.label"} = $i18n->get(84);
|
||||
$var->{"delete.url"} = $self->getUrl('func=deleteEntry;entryId='.$var->{entryId});
|
||||
$var->{"delete.label"} = $i18n->get(90);
|
||||
$var->{"addField.url"} = $self->getUrl('func=editField');
|
||||
$var->{"addField.label"} = $i18n->get(76);
|
||||
$var->{"deleteAllEntries.url"} = $self->getUrl("func=deleteAllEntriesConfirm");
|
||||
|
|
@ -816,7 +816,7 @@ sub sendEmail {
|
|||
sentBy => $self->session->user->userId,
|
||||
subject=>$subject,
|
||||
message=>$message,
|
||||
status=>'complete'
|
||||
status=>'unread'
|
||||
});
|
||||
if ($cc) {
|
||||
my $mail = WebGUI::Mail::Send->create($self->session,{to=>$cc, replyTo=>$from, subject=>$subject, from=>$from});
|
||||
|
|
|
|||
|
|
@ -281,6 +281,14 @@ sub www_compare {
|
|||
unless (scalar(@cmsList)) {
|
||||
@cmsList = $self->session->form->checkList("listingId");
|
||||
}
|
||||
my ($style, $url) = ($self->session->style, $self->session->url);
|
||||
$style->setLink($url->extras('/yui/build/container/assets/container.css'),{ type=>'text/css', rel=>"stylesheet" });
|
||||
$style->setLink($url->extras('/hoverhelp.css'),{ type=>'text/css', rel=>"stylesheet" });
|
||||
$style->setScript($url->extras('/yui/build/yahoo/yahoo-min.js'),{ type=>'text/javascript' });
|
||||
$style->setScript($url->extras('/yui/build/dom/dom-min.js'),{ type=>'text/javascript' });
|
||||
$style->setScript($url->extras('/yui/build/event/event-min.js'),{ type=>'text/javascript' });
|
||||
$style->setScript($url->extras('/yui/build/container/container-min.js'),{ type=>'text/javascript' });
|
||||
$style->setScript($url->extras('/hoverhelp.js'),{ type=>'text/javascript' });
|
||||
my ( %var, @prodcol, @datecol);
|
||||
my $max = $self->session->user->isInGroup($self->get("privilegedGroup")) ? $self->get("maxComparisonsPrivileged") : $self->get("maxComparisons");
|
||||
$var{isTooMany} = (scalar(@cmsList)>$max);
|
||||
|
|
@ -303,12 +311,20 @@ sub www_compare {
|
|||
lastUpdated=>$self->session->datetime->epochToHuman($data->{lastUpdated},"%z")
|
||||
});
|
||||
}
|
||||
my $i18n = WebGUI::International->new($self->session,'Asset_Matrix');
|
||||
my %goodBad = (
|
||||
"No" => $i18n->get("no"),
|
||||
"Yes" => $i18n->get("yes"),
|
||||
"Free Add On" => $i18n->get("free"),
|
||||
"Costs Extra" => $i18n->get("extra"),
|
||||
"Limited" => $i18n->get("limited"),
|
||||
);
|
||||
$var{product_loop} = \@prodcol;
|
||||
$var{lastupdated_loop} = \@datecol;
|
||||
my @categoryloop;
|
||||
foreach my $category ($self->getCategories()) {
|
||||
my @rowloop;
|
||||
my $select = "select a.label, a.description";
|
||||
my $select = "select a.fieldType, a.label, a.description";
|
||||
my $from = "from Matrix_field a";
|
||||
my $tableCount = "b";
|
||||
foreach my $cms (@cmsList) {
|
||||
|
|
@ -321,17 +337,17 @@ sub www_compare {
|
|||
while (my @row = $sth->array) {
|
||||
my @columnloop;
|
||||
my $first = 1;
|
||||
my $type = shift @row;
|
||||
foreach my $value (@row) {
|
||||
my $desc = "";
|
||||
if ($first) {
|
||||
$desc = $row[1];
|
||||
shift(@row);
|
||||
$desc =~ s/\n//g;
|
||||
$desc =~ s/\r//g;
|
||||
$desc =~ s/'/\\\'/g;
|
||||
$desc =~ s/"/\"/g;
|
||||
$first = 0;
|
||||
}
|
||||
elsif ($type eq 'goodBad') {
|
||||
$value = $goodBad{$value};
|
||||
}
|
||||
my $class = lc($value);
|
||||
$class =~ s/\s/_/g;
|
||||
$class =~ s/\W//g;
|
||||
|
|
@ -729,7 +745,7 @@ sub www_editListingSave {
|
|||
addEditStampToPosts => 0,
|
||||
usePreview => 1,
|
||||
sortOrder => 'desc',
|
||||
sortBy => 'dateUpdated',
|
||||
sortBy => 'assetData.revisionDate',
|
||||
rssTemplateId=>'PBtmpl0000000000000142',
|
||||
notificationTemplateId=>'PBtmpl0000000000000027',
|
||||
searchTemplateId=>'PBtmpl0000000000000031',
|
||||
|
|
@ -972,10 +988,6 @@ sub www_search {
|
|||
my $sth = $self->session->db->read("select name, fieldType, label, description from Matrix_field where category = ".$self->session->db->quote($category)." order by label");
|
||||
my @loop;
|
||||
while (my $data = $sth->hashRef) {
|
||||
$data->{description} =~ s/\n//g;
|
||||
$data->{description} =~ s/\r//g;
|
||||
$data->{description} =~ s/'/\\\'/g;
|
||||
$data->{description} =~ s/"/\"/g;
|
||||
if ($data->{fieldType} ne "goodBad") {
|
||||
$data->{form} = WebGUI::Form::text($self->session,{
|
||||
name=>$data->{name},
|
||||
|
|
@ -1214,16 +1226,22 @@ sub www_viewDetail {
|
|||
$var{views} = $listing->{views};
|
||||
$var{compares} = $listing->{compares};
|
||||
$var{clicks} = $listing->{clicks};
|
||||
my $sth = $self->session->db->read("select a.value, b.name, b.label, b.description, category from Matrix_listingData a left join
|
||||
my $sth = $self->session->db->read("select a.value, b.name, b.label, b.description, category, fieldType from Matrix_listingData a left join
|
||||
Matrix_field b on a.fieldId=b.fieldId and b.assetId=? where listingId=? order by b.label",[$self->getId, $listingId]);
|
||||
while (my $data = $sth->hashRef) {
|
||||
$data->{description} =~ s/\n//g;
|
||||
$data->{description} =~ s/\r//g;
|
||||
$data->{description} =~ s/'/\\\'/g;
|
||||
$data->{description} =~ s/"/\"/g;
|
||||
$data->{class} = lc($data->{value});
|
||||
my %goodBad = (
|
||||
"No" => $i18n->get("no"),
|
||||
"Yes" => $i18n->get("yes"),
|
||||
"Free Add On" => $i18n->get("free"),
|
||||
"Costs Extra" => $i18n->get("extra"),
|
||||
"Limited" => $i18n->get("limited"),
|
||||
);
|
||||
while (my $data = $sth->hashRef) {
|
||||
$data->{class} = lc($data->{value});
|
||||
$data->{class} =~ s/\s/_/g;
|
||||
$data->{class} =~ s/\W//g;
|
||||
if ($data->{fieldType} eq 'goodBad') {
|
||||
$data->{value} = $goodBad{$data->{value}};
|
||||
}
|
||||
my $cat = $self->session->url->urlize($data->{category})."_loop";
|
||||
push(@{$var{$cat}},$data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,9 +119,9 @@ sub view {
|
|||
if (defined $lastPost) {
|
||||
%lastPostVars = (
|
||||
'forum.lastPost.url' => $lastPost->getUrl,
|
||||
'forum.lastPost.date' => $self->session->datetime->epochToHuman($lastPost->get("dateSubmitted"),"%z"),
|
||||
'forum.lastPost.time' => $self->session->datetime->epochToHuman($lastPost->get("dateSubmitted"),"%Z"),
|
||||
'forum.lastPost.epoch' => $lastPost->get("dateSubmitted"),
|
||||
'forum.lastPost.date' => $self->session->datetime->epochToHuman($lastPost->get("creationDate"),"%z"),
|
||||
'forum.lastPost.time' => $self->session->datetime->epochToHuman($lastPost->get("creationDate"),"%Z"),
|
||||
'forum.lastPost.epoch' => $lastPost->get("creationDate"),
|
||||
'forum.lastPost.subject' => $lastPost->get("title"),
|
||||
'forum.lastPost.user.hasRead' => $lastPost->getThread->isMarkedRead,
|
||||
'forum.lastPost.user.id' => $lastPost->get("ownerUserId"),
|
||||
|
|
|
|||
|
|
@ -1055,14 +1055,14 @@ sub www_editProject {
|
|||
|
||||
my $hpdLabel = $i18n->get('hours per day label');
|
||||
my $hpdHoverHelp = $i18n->get('hours per day hoverhelp');
|
||||
$hpdHoverHelp =~ s/'/\\'/g;
|
||||
my $hpdValue = $form->get("hoursPerDay") || $project->{hoursPerDay} || "8.0";
|
||||
my $hpdStyle = ($dunitValue eq "days"?"display:none":"");
|
||||
|
||||
my $html = qq|
|
||||
<tr id="hoursper" style="$hpdStyle">
|
||||
<td class="formDescription" onmouseover="return escape('$hpdHoverHelp')" valign="top" style="width: 180px;">
|
||||
<label for="hoursPerDay_formId">$hpdLabel</label>
|
||||
<td class="formDescription" valign="top" style="width: 180px;">
|
||||
<div class="wg-hoverhelp">$hpdHoverHelp</div>
|
||||
<label for="hoursPerDay_formId">$hpdLabel</label>
|
||||
</td>
|
||||
<td valign="top" class="tableData" style="width: *;">
|
||||
<input id="hoursPerDay_formId" type="text" name="hoursPerDay" value="$hpdValue" size="11" maxlength="14" />
|
||||
|
|
|
|||
|
|
@ -40,12 +40,16 @@ sub appendRecentChanges {
|
|||
my $self = shift;
|
||||
my $var = shift;
|
||||
my $limit = shift || $self->get("recentChangesCount") || 50;
|
||||
foreach my $asset (@{$self->getLineage(["children"], {
|
||||
returnObjects => 1,
|
||||
limit => $limit,
|
||||
includeOnlyClasses =>["WebGUI::Asset::WikiPage"],
|
||||
orderByClause => "assetData.revisionDate desc"
|
||||
})}) {
|
||||
my $revisions = $self->session->db->read("select asset.assetId, assetData.revisionDate, asset.className
|
||||
from asset left join assetData using (assetId) where asset.parentId=? and asset.className
|
||||
like ? order by assetData.revisionDate desc limit ?", [$self->getId,
|
||||
"WebGUI::Asset::WikiPage%", $limit]);
|
||||
while (my ($id, $version, $class) = $revisions->array) {
|
||||
my $asset = WebGUI::Asset->new($self->session, $id, $class, $version);
|
||||
unless (defined $asset) {
|
||||
$self->session->errorHandler->error("Asset $id $class $version could not be instanciated.");
|
||||
next;
|
||||
}
|
||||
my $user = WebGUI::User->new($self->session, $asset->get("actionTakenBy"));
|
||||
my $specialAction = '';
|
||||
my $isAvailable = 1;
|
||||
|
|
|
|||
|
|
@ -363,16 +363,18 @@ sub getLineage {
|
|||
}
|
||||
# now lets add in all of the siblings in every level between ourself and the asset we wish to pedigree
|
||||
if (isIn("pedigree",@{$relatives}) && exists $rules->{assetToPedigree}) {
|
||||
my @mods;
|
||||
my $lineage = $rules->{assetToPedigree}->get("lineage");
|
||||
my $length = $rules->{assetToPedigree}->getLineageLength;
|
||||
for (my $i = $length; $i > 0; $i--) {
|
||||
my $line = substr($lineage,0,$i*6);
|
||||
push(@mods,"( asset.lineage like ".$self->session->db->quote($line.'%')." and length(asset.lineage)=".(($i+1)*6).")");
|
||||
last if ($self->getLineageLength == $i);
|
||||
}
|
||||
push(@whereModifiers, "(".join(" or ",@mods).")") if (scalar(@mods));
|
||||
}
|
||||
my $pedigreeLineage = $rules->{assetToPedigree}->get("lineage");
|
||||
if (substr($pedigreeLineage,0,length($lineage)) eq $lineage) {
|
||||
my @mods;
|
||||
my $length = $rules->{assetToPedigree}->getLineageLength;
|
||||
for (my $i = $length; $i > 0; $i--) {
|
||||
my $line = substr($pedigreeLineage,0,$i*6);
|
||||
push(@mods,"( asset.lineage like ".$self->session->db->quote($line.'%')." and length(asset.lineage)=".(($i+1)*6).")");
|
||||
last if ($self->getLineageLength == $i);
|
||||
}
|
||||
push(@whereModifiers, "(".join(" or ",@mods).")") if (scalar(@mods));
|
||||
}
|
||||
}
|
||||
# deal with custom joined tables if we must
|
||||
my $tables = "asset left join assetData on asset.assetId=assetData.assetId ";
|
||||
if (exists $rules->{joinClass}) {
|
||||
|
|
@ -422,7 +424,10 @@ sub getLineage {
|
|||
$where .= ' and (asset.className in ('.$self->session->db->quoteAndJoin($rules->{includeOnlyClasses}).'))';
|
||||
}
|
||||
## finish up our where clause
|
||||
$where .= ' and ('.join(" or ",@whereModifiers).')' if (scalar(@whereModifiers));
|
||||
if (!scalar(@whereModifiers)) {
|
||||
return [];
|
||||
}
|
||||
$where .= ' and ('.join(" or ",@whereModifiers).')';
|
||||
if (exists $rules->{whereClause} && $rules->{whereClause}) {
|
||||
$where .= ' and ('.$rules->{whereClause}.')';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -300,7 +300,8 @@ sub createAccountSave {
|
|||
my $properties;
|
||||
$properties->{connectDN} = $connectDN;
|
||||
$properties->{ldapUrl} = $connection->{ldapUrl};
|
||||
|
||||
$properties->{ldapConnection} = $connection->{ldapLinkId};
|
||||
|
||||
return $self->SUPER::createAccountSave($username,$properties,$password,$profile);
|
||||
}
|
||||
|
||||
|
|
@ -503,7 +504,8 @@ sub login {
|
|||
if ($self->validUsername($username)) {
|
||||
$self->SUPER::createAccountSave($username, {
|
||||
connectDN => $self->getConnectDN,
|
||||
ldapUrl => $self->getLDAPConnection->{ldapUrl}
|
||||
ldapUrl => $self->getLDAPConnection->{ldapUrl},
|
||||
ldapConnection => $self->getLDAPConnection->{ldapLinkId},
|
||||
},$identifier);
|
||||
$hasAuthenticated = 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -257,10 +257,10 @@ sub displayFormWithWrapper {
|
|||
my $self = shift;
|
||||
if ($self->passUiLevelCheck) {
|
||||
my ($fieldClass, $rowClass, $labelClass, $hoverHelp, $subtext) = $self->prepareWrapper;
|
||||
my $hoverCode = $self->getHoverCode($hoverHelp, $self->get('id') . '_wrapper');
|
||||
$hoverHelp &&= '<div class="wg-hoverhelp">' . $hoverHelp . '</div>';
|
||||
return '<tr'.$rowClass.'>
|
||||
<td'.$labelClass.' valign="top" style="width: 25%;">'.$self->get("label").'</td>
|
||||
<td valign="top"'.$fieldClass.' style="width: 75%;">'.$self->displayForm().$subtext.$hoverCode."</td>
|
||||
<td'.$labelClass.' valign="top" style="width: 25%;">'.$self->get("label") . $hoverHelp . '</td>
|
||||
<td valign="top"'.$fieldClass.' style="width: 75%;">'.$self->displayForm().$subtext."</td>
|
||||
</tr>\n";
|
||||
} else {
|
||||
return $self->toHtmlAsHidden;
|
||||
|
|
@ -542,8 +542,9 @@ sub prepareWrapper {
|
|||
$labelClass = qq| class="$labelClass" | if($self->get("labelClass"));
|
||||
my $fieldClass = $self->get("fieldClass");
|
||||
$fieldClass = qq| class="$fieldClass" | if($self->get("fieldClass"));
|
||||
my $hoverHelp = $self->get("hoverHelp");
|
||||
my $subtext = $self->get("subtext");
|
||||
my $hoverHelp = $self->get("hoverHelp") || '';
|
||||
$hoverHelp =~ s/^\s+//;
|
||||
my $subtext = $self->get("subtext");
|
||||
$subtext = qq| <span class="formSubtext">$subtext</span>| if ($subtext);
|
||||
return ($fieldClass, $rowClass, $labelClass, $hoverHelp, $subtext);
|
||||
}
|
||||
|
|
@ -625,10 +626,10 @@ sub toHtmlWithWrapper {
|
|||
if ($self->passUiLevelCheck) {
|
||||
my $rawField = $self->toHtml(); # has to be called before prepareWrapper for some controls, namely captcha.
|
||||
my ($fieldClass, $rowClass, $labelClass, $hoverHelp, $subtext) = $self->prepareWrapper;
|
||||
my $hoverCode = $self->getHoverCode($hoverHelp, $self->get('id') . '_description');
|
||||
$hoverHelp &&= '<div class="wg-hoverhelp">' . $hoverHelp . '</div>';
|
||||
return '<tr'.$rowClass.' id="'.$self->get("id").'_row">
|
||||
<td'.$labelClass.' id="' . $self->get('id') . '_description" valign="top" style="width: 180px;"><label for="'.$self->get("id").'">'.$self->get("label").'</label></td>
|
||||
<td valign="top"'.$fieldClass.'>'.$rawField . $subtext . $hoverCode . "</td>
|
||||
<td'.$labelClass.' valign="top" style="width: 180px;"><label for="'.$self->get("id").'">'.$self->get("label").'</label>' . $hoverHelp . '</td>
|
||||
<td valign="top"'.$fieldClass.'>'.$rawField . $subtext . "</td>
|
||||
</tr>\n";
|
||||
} else {
|
||||
return $self->toHtmlAsHidden;
|
||||
|
|
@ -637,43 +638,6 @@ sub toHtmlWithWrapper {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getHoverCode ( hoverHelp, attachId )
|
||||
|
||||
Generated the code to add hover help to html elements.
|
||||
|
||||
=head3 hoverHelp
|
||||
|
||||
The text in include in the hover help.
|
||||
|
||||
=head3 attachId
|
||||
|
||||
The id of the HTML element to attach the hover help to.
|
||||
|
||||
=cut
|
||||
|
||||
sub getHoverCode {
|
||||
my $self = shift;
|
||||
my $style = $self->session->style;
|
||||
my $url = $self->session->url;
|
||||
my $hoverHelp = shift;
|
||||
my $attachId = shift;
|
||||
$hoverHelp =~ s/\r/ /g;
|
||||
$hoverHelp =~ s/\n/ /g;
|
||||
$hoverHelp =~ s/'/\\'/g;
|
||||
$hoverHelp =~ s/^\s+//;
|
||||
return ''
|
||||
unless $hoverHelp;
|
||||
my $hover = '<script type="text/javascript">var tooltip = new YAHOO.widget.Tooltip("' . $attachId . '_tooltip", { context: "' . $attachId . '", text: \'' . $hoverHelp . '\', autodismissdelay: 100000, width: "300px"});</script>';
|
||||
$style->setLink($url->extras('/hoverhelp.css'),{ type=>'text/css', rel=>"stylesheet" });
|
||||
$style->setScript($url->extras('/yui/build/yahoo/yahoo-min.js'),{ type=>'text/javascript' });
|
||||
$style->setScript($url->extras('/yui/build/dom/dom-min.js'),{ type=>'text/javascript' });
|
||||
$style->setScript($url->extras('/yui/build/event/event-min.js'),{ type=>'text/javascript' });
|
||||
$style->setScript($url->extras('/yui/build/container/container-min.js'),{ type=>'text/javascript' });
|
||||
return $hover;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 passUiLevelCheck ( )
|
||||
|
||||
Renders the form field to HTML as a table row complete with labels, subtext, hoverhelp, etc.
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ sub displayValue {
|
|||
return '' unless $self->get("value");
|
||||
my $location = WebGUI::Storage->get($self->session,$self->get("value"));
|
||||
my $file = shift @{ $location->getFiles };
|
||||
my $fileValue = sprintf qq|<img src="%s" /> %s|, $location->getFileIconUrl($file), $file;
|
||||
my $fileValue = sprintf qq|<img src="%s" /> <a href="%s">%s</a>|, $location->getFileIconUrl($file), $location->getUrl($file), $file;
|
||||
return $fileValue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,10 @@ The namespace for the list of templates to return. If this is omitted, all templ
|
|||
|
||||
A text label that will be displayed if toHtmlWithWrapper() is called. Defaults to getName().
|
||||
|
||||
=head4 onlyCommitted
|
||||
|
||||
If true, this will limit the list of template to only include templates that are committed.
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -79,6 +83,9 @@ sub definition {
|
|||
namespace=>{
|
||||
defaultValue=>undef
|
||||
},
|
||||
onlyCommitted=>{
|
||||
defaultValue=>''
|
||||
},
|
||||
dbDataType => {
|
||||
defaultValue => "VARCHAR(22) BINARY",
|
||||
},
|
||||
|
|
@ -96,14 +103,15 @@ Renders a template picker control.
|
|||
|
||||
sub toHtml {
|
||||
my $self = shift;
|
||||
my $templateList = WebGUI::Asset::Template->getList($self->session, $self->get("namespace"));
|
||||
#Remove entries from template list that the user does not have permission to view.
|
||||
for my $assetId ( keys %{$templateList} ) {
|
||||
my $asset = WebGUI::Asset::Template->new($self->session, $assetId);
|
||||
if (!$asset->canView($self->session->user->userId)) {
|
||||
delete $templateList->{$assetId};
|
||||
}
|
||||
my $onlyCommitted = $self->get('onlyCommitted') ? "assetData.status='approved'" : $self->get('onlyCommitted');
|
||||
my $templateList = WebGUI::Asset::Template->getList($self->session, $self->get("namespace"), $onlyCommitted);
|
||||
#Remove entries from template list that the user does not have permission to view.
|
||||
for my $assetId ( keys %{$templateList} ) {
|
||||
my $asset = WebGUI::Asset::Template->new($self->session, $assetId);
|
||||
if (!$asset->canView($self->session->user->userId)) {
|
||||
delete $templateList->{$assetId};
|
||||
}
|
||||
}
|
||||
$self->set("options", $templateList);
|
||||
return $self->SUPER::toHtml();
|
||||
}
|
||||
|
|
|
|||
318
lib/WebGUI/Friends.pm
Normal file
318
lib/WebGUI/Friends.pm
Normal file
|
|
@ -0,0 +1,318 @@
|
|||
package WebGUI::Friends;
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
WebGUI is Copyright 2001-2007 Plain Black Corporation.
|
||||
-------------------------------------------------------------------
|
||||
Please read the legal notices (docs/legal.txt) and the license
|
||||
(docs/license.txt) that came with this distribution before using
|
||||
this software.
|
||||
-------------------------------------------------------------------
|
||||
http://www.plainblack.com info@plainblack.com
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use Class::InsideOut qw(id register public readonly);
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::HTML;
|
||||
use WebGUI::Inbox;
|
||||
use WebGUI::International;
|
||||
use WebGUI::User;
|
||||
use WebGUI::Utility;
|
||||
|
||||
readonly session => my %session;
|
||||
readonly user => my %user;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
WebGUI::Friends
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
my $friends = WebGUI::Friends->new($session, $user);
|
||||
|
||||
$friends->add(\@userIds);
|
||||
$friends->remove(\@userIds);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
A user relationship management system.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 add ( \@userIds )
|
||||
|
||||
Add friends. Also adds the reciprocal relationship.
|
||||
|
||||
=head3 userIds
|
||||
|
||||
An array reference of userIds to add as friends.
|
||||
|
||||
=cut
|
||||
|
||||
sub add {
|
||||
my $self = shift;
|
||||
my $userIds = shift;
|
||||
my $me = $self->user;
|
||||
$me->friends->addUsers($userIds);
|
||||
foreach my $userId (@{$userIds}) {
|
||||
my $friend = WebGUI::User->new($self->session, $userId);
|
||||
$friend->friends->addUsers([$me->userId]);
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 approveAddRequest ( inviteId )
|
||||
|
||||
Sends an approval, sets up the relationship, and deletes the invitation.
|
||||
|
||||
=head3 inviteId
|
||||
|
||||
The unique idenitifer for this invitation.
|
||||
|
||||
=cut
|
||||
|
||||
sub approveAddRequest {
|
||||
my $self = shift;
|
||||
my $inviteId = shift;
|
||||
my $db = $self->session->db;
|
||||
my $invite = $self->getAddRequest($inviteId);
|
||||
$self->add([$invite->{inviterId}]);
|
||||
my $i18n = WebGUI::International->new($self->session, "Friends");
|
||||
my $inbox = WebGUI::Inbox->new($self->session);
|
||||
$inbox->addMessage({
|
||||
message => sprintf($i18n->get("invitation accepted by user"), $self->user->getWholeName),
|
||||
subject => $i18n->get('friends invitation accepted'),
|
||||
userId => $invite->{inviterId},
|
||||
status => 'unread',
|
||||
sentBy => $self->user->userId,
|
||||
});
|
||||
$inbox->getMessage($invite->{messageId})->setStatus('completed');
|
||||
$db->deleteRow("friendInvitations", "inviteId", $inviteId);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 delete ( \@userIds )
|
||||
|
||||
Remove friends.
|
||||
|
||||
=head3 userIds
|
||||
|
||||
An array reference of userIds to remove from friends list.
|
||||
|
||||
=cut
|
||||
|
||||
sub delete {
|
||||
my $self = shift;
|
||||
my $userIds = shift;
|
||||
$self->user->friends->deleteUsers($userIds);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getAddRequest ( inviteId )
|
||||
|
||||
Returns the invitation data as a hash reference.
|
||||
|
||||
=cut
|
||||
|
||||
sub getAddRequest {
|
||||
my $self = shift;
|
||||
my $inviteId = shift;
|
||||
my $invite = $self->session->db->getRow('friendInvitations', 'inviteId', $inviteId);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head getAllPendingAddRequests ( session )
|
||||
|
||||
Class method. Returns a WebGUI::SQL::ResultSet object with all the unanswered add requests.
|
||||
|
||||
=cut
|
||||
|
||||
sub getAllPendingAddRequests {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
return $session->db->read("select * from friendInvitations order by dateSent");
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isFriend ( userId )
|
||||
|
||||
Returns a booelean indicating whether the userId is already a friend of this user.
|
||||
|
||||
=head3 userId
|
||||
|
||||
The userId to check against this user.
|
||||
|
||||
=cut
|
||||
|
||||
sub isFriend {
|
||||
my $self = shift;
|
||||
my $userId = shift;
|
||||
return isIn($userId, @{$self->user->friends->getUsers});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 new ( session, user )
|
||||
|
||||
Constructor.
|
||||
|
||||
=head3 session
|
||||
|
||||
A reference to the current WebGUI::Session object.
|
||||
|
||||
=head3 user
|
||||
|
||||
A reference to a WebGUI::User object that we're going to manage the friends of. Defaults to the current user
|
||||
attached to the session.
|
||||
|
||||
=cut
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $user = shift || $session->user;
|
||||
my $self = register($class);
|
||||
$session{id $self} = $session;
|
||||
$user{id $self} = $user;
|
||||
return $self;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 rejectAddRequest ( inviteId )
|
||||
|
||||
Sends a rejection notice, and deletes the invitation.
|
||||
|
||||
=head3 inviteId
|
||||
|
||||
The id of an invitation.
|
||||
|
||||
=cut
|
||||
|
||||
sub rejectAddRequest {
|
||||
my $self = shift;
|
||||
my $inviteId = shift;
|
||||
my $db = $self->session->db;
|
||||
my $invite = $self->getAddRequest($inviteId);
|
||||
my $i18n = WebGUI::International->new($self->session, "Friends");
|
||||
my $inbox = WebGUI::Inbox->new($self->session);
|
||||
$inbox->addMessage({
|
||||
message => sprintf($i18n->get("friends invitation not accepted by user"), $self->user->getWholeName),
|
||||
subject => $i18n->get('friends invitation not accepted'),
|
||||
userId => $invite->{inviterId},
|
||||
status => 'unread',
|
||||
});
|
||||
$inbox->getMessage($invite->{messageId})->setStatus('completed');
|
||||
$self->session->db->deleteRow("friendInvitations", "inviteId", $inviteId);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 sendAddRequest ( userId, message )
|
||||
|
||||
Sends a request to another user to be added to this user's friends list. Returns an invitationId.
|
||||
|
||||
=head3 userId
|
||||
|
||||
The user to invite to be a friend.
|
||||
|
||||
=head3 message
|
||||
|
||||
The message to lure them to accept.
|
||||
|
||||
=cut
|
||||
|
||||
sub sendAddRequest {
|
||||
my $self = shift;
|
||||
my $userId = shift;
|
||||
my $comments = shift;
|
||||
my $i18n = WebGUI::International->new($self->session, "Friends");
|
||||
|
||||
# No sneaky attack paths...
|
||||
$comments = WebGUI::HTML::filter($comments);
|
||||
|
||||
# Create the invitation url.
|
||||
my $inviteId = $self->session->id->generate();
|
||||
my $inviteUrl = $self->session->url->append($self->session->url->getSiteURL, 'op=friendRequest;inviteId='.$inviteId);
|
||||
# Build the message
|
||||
my $messageText = sprintf $i18n->get("invitation approval email"), $self->user->getWholeName, $self->session->url->getSiteURL, $comments, $inviteUrl;
|
||||
|
||||
# send message
|
||||
my $message = WebGUI::Inbox->new($self->session)->addMessage({
|
||||
message => $messageText,
|
||||
subject => $i18n->get("friends network invitation"),
|
||||
userId => $userId,
|
||||
status => 'pending',
|
||||
sentBy => $self->user->userId,
|
||||
});
|
||||
|
||||
# Create the invitation record.
|
||||
$self->session->db->setRow(
|
||||
'friendInvitations',
|
||||
'inviteId',
|
||||
{
|
||||
inviterId => $self->user->userId,
|
||||
friendId => $userId,
|
||||
dateSent => WebGUI::DateTime->new($self->session, time)->toMysql,
|
||||
comments => $comments,
|
||||
messageId => $message->getId,
|
||||
},
|
||||
$inviteId,
|
||||
);
|
||||
return $inviteId;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 sendMessage ( subject, message, [ userIds ] )
|
||||
|
||||
=head3 subject
|
||||
|
||||
The subject of the message.
|
||||
|
||||
=head3 message
|
||||
|
||||
The message itself.
|
||||
|
||||
=head3 userIds
|
||||
|
||||
An array reference of userIds to send the message to. Defaults to all friends.
|
||||
|
||||
=cut
|
||||
|
||||
sub sendMessage {
|
||||
my $self = shift;
|
||||
my $subject = shift || "Untitled";
|
||||
my $message = shift;
|
||||
my $userIds = shift || $self->user->friends->getUsers;
|
||||
my $inbox = WebGUI::Inbox->new($self->session);
|
||||
my $myId = $self->user->userId;
|
||||
foreach my $userId (@{$userIds}) {
|
||||
$inbox->addPrivateMessage({
|
||||
message => $message,
|
||||
subject => $subject,
|
||||
userId => $userId,
|
||||
sentBy => $myId,
|
||||
status => 'unread',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
@ -215,6 +215,15 @@ Returns the HTML for this form object.
|
|||
|
||||
sub print {
|
||||
my $self = shift;
|
||||
my $style = $self->session->style;
|
||||
my $url = $self->session->url;
|
||||
$style->setLink($url->extras('/yui/build/container/assets/container.css'),{ type=>'text/css', rel=>"stylesheet" });
|
||||
$style->setLink($url->extras('/hoverhelp.css'),{ type=>'text/css', rel=>"stylesheet" });
|
||||
$style->setScript($url->extras('/yui/build/yahoo/yahoo-min.js'),{ type=>'text/javascript' });
|
||||
$style->setScript($url->extras('/yui/build/dom/dom-min.js'),{ type=>'text/javascript' });
|
||||
$style->setScript($url->extras('/yui/build/event/event-min.js'),{ type=>'text/javascript' });
|
||||
$style->setScript($url->extras('/yui/build/container/container-min.js'),{ type=>'text/javascript' });
|
||||
$style->setScript($url->extras('/hoverhelp.js'),{ type=>'text/javascript' });
|
||||
return $self->{_header}.$self->{_data}.$self->{_footer};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use strict;
|
|||
use WebGUI::Image::Palette;
|
||||
use Carp qw(croak);
|
||||
|
||||
my $graphicsPackage;
|
||||
our $graphicsPackage;
|
||||
BEGIN {
|
||||
if (eval { require Graphics::Magick; 1 }) {
|
||||
$graphicsPackage = 'Graphics::Magick';
|
||||
|
|
@ -264,8 +264,12 @@ sub setImageHeight {
|
|||
my $self = shift;
|
||||
my $height = shift;
|
||||
|
||||
#$self->image->set(size => $self->getImageWidth.'x'.$height);
|
||||
$self->image->Extent(height => $height);
|
||||
if ($graphicsPackage eq 'Graphics::Magick') {
|
||||
$self->image->Resize(height => $height);
|
||||
}
|
||||
else {
|
||||
$self->image->Extent(height => $height);
|
||||
}
|
||||
$self->image->Colorize(fill => $self->getBackgroundColor);
|
||||
$self->{_properties}->{height} = $height;
|
||||
}
|
||||
|
|
@ -285,9 +289,12 @@ Teh width of the image in pixels.
|
|||
sub setImageWidth {
|
||||
my $self = shift;
|
||||
my $width = shift;
|
||||
|
||||
#$self->image->set(size => $width.'x'.$self->getImageHeight);
|
||||
$self->image->Extent(width => $width);
|
||||
if ($graphicsPackage eq 'Graphics::Magick') {
|
||||
$self->image->Resize(width => $width);
|
||||
}
|
||||
else {
|
||||
$self->image->Extent(width => $width);
|
||||
}
|
||||
$self->image->Colorize(fill => $self->getBackgroundColor);
|
||||
$self->{_properties}->{width} = $width;
|
||||
}
|
||||
|
|
@ -410,8 +417,13 @@ sub text {
|
|||
my $anchorX = $properties{x};
|
||||
my $anchorY = $properties{y};
|
||||
|
||||
|
||||
my ($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_advance) = $self->image->QueryMultilineFontMetrics(%properties);
|
||||
my %testProperties = %properties;
|
||||
delete $testProperties{align};
|
||||
delete $testProperties{style};
|
||||
delete $testProperties{fill};
|
||||
delete $testProperties{alignHorizontal};
|
||||
delete $testProperties{alignVertical};
|
||||
my ($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_advance) = $self->image->QueryFontMetrics(%testProperties);
|
||||
|
||||
# Process horizontal alignment
|
||||
if ($properties{alignHorizontal} eq 'center') {
|
||||
|
|
|
|||
|
|
@ -422,8 +422,8 @@ sub getLabelDimensions {
|
|||
my ($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_advance) = $self->image->QueryFontMetrics(
|
||||
font => $self->getLabelFont->getFile,
|
||||
# stroke => $self->getLabelColor,
|
||||
fill => $self->getLabelColor,
|
||||
style => 'Normal',
|
||||
# fill => $self->getLabelColor,
|
||||
# style => 'Normal',
|
||||
pointsize => $self->getLabelFontSize,
|
||||
%$properties,
|
||||
text => $text,
|
||||
|
|
|
|||
|
|
@ -172,33 +172,31 @@ sub drawLabels {
|
|||
my $self = shift;
|
||||
my $location = shift;
|
||||
|
||||
my %anchorPoint = %{$self->getFirstAnchorLocation};# %$location;
|
||||
my %anchorPoint = %{$self->getFirstAnchorLocation};
|
||||
|
||||
# Draw x-axis labels
|
||||
foreach (@{$self->getLabel}) {
|
||||
my $text = $self->wrapLabelToWidth($_, $self->getAnchorSpacing->{x});
|
||||
foreach my $text (@{$self->getLabel}) {
|
||||
$self->drawLabel($text, (
|
||||
alignHorizontal => 'center',
|
||||
alignVertical => 'top',
|
||||
align => 'Center',
|
||||
align => 'left',
|
||||
rotate => 90,
|
||||
x => $anchorPoint{x},
|
||||
y => $anchorPoint{y},
|
||||
));
|
||||
|
||||
$anchorPoint{x} += $self->getAnchorSpacing->{x}; #$groupWidth + $self->getGroupSpacing;
|
||||
$anchorPoint{x} += $self->getAnchorSpacing->{x};
|
||||
$anchorPoint{y} += $self->getAnchorSpacing->{y};
|
||||
}
|
||||
|
||||
# Draw y-axis labels
|
||||
$anchorPoint{x} = $self->getChartOffset->{x} - $self->getLabelOffset;
|
||||
$anchorPoint{y} = $self->getChartOffset->{y} + $self->getChartHeight;
|
||||
# for (1 .. $self->getYRange / $self->getYGranularity) {
|
||||
foreach (@{$self->getYLabels}) {
|
||||
$self->drawLabel($_, (
|
||||
alignHorizontal => 'right',
|
||||
alignVertical => 'center',
|
||||
x => $anchorPoint{x}, #$self->getChartOffset->{x} - $self->getLabelOffset,
|
||||
y => $anchorPoint{y}, #$self->getChartOffset->{y} + $self->getChartHeight - $self->getPixelsPerUnit * $_*$self->getYGranularity,
|
||||
x => $anchorPoint{x},
|
||||
y => $anchorPoint{y},
|
||||
));
|
||||
$anchorPoint{y} -= $self->getPixelsPerUnit * $self->getYGranularity
|
||||
}
|
||||
|
|
@ -244,6 +242,19 @@ sub formNamespace {
|
|||
return $self->SUPER::formNamespace.'_XYGraph';
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getAnchorSpacing ()
|
||||
|
||||
This method MUST be overridden by all sub classes.
|
||||
|
||||
=cut
|
||||
|
||||
sub getAnchorSpacing {
|
||||
die "You were supposed to override this method in the sub class.";
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getAxisColor ( )
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use strict;
|
|||
use WebGUI::Image::Graph::XYGraph;
|
||||
use List::Util;
|
||||
use POSIX;
|
||||
use WebGUI::Utility;
|
||||
|
||||
our @ISA = qw(WebGUI::Image::Graph::XYGraph);
|
||||
|
||||
|
|
@ -250,7 +251,7 @@ sub getAnchorSpacing {
|
|||
|
||||
my $numberOfGroups = List::Util::max(map {scalar @$_} @{$self->getDataset});
|
||||
|
||||
my $spacing = ($self->getChartWidth - ($numberOfGroups-1) * $self->getGroupSpacing) / $numberOfGroups + $self->getGroupSpacing;
|
||||
my $spacing = round(($self->getChartWidth - ($numberOfGroups-1) * $self->getGroupSpacing) / $numberOfGroups + $self->getGroupSpacing);
|
||||
|
||||
return {
|
||||
x => $spacing,
|
||||
|
|
@ -319,7 +320,7 @@ sub getFirstAnchorLocation {
|
|||
my $self = shift;
|
||||
|
||||
return {
|
||||
x => $self->getChartOffset->{x} + ($self->getAnchorSpacing->{x} - $self->getGroupSpacing) / 2,
|
||||
x => round($self->getChartOffset->{x} + ($self->getAnchorSpacing->{x} - $self->getGroupSpacing) / 2),
|
||||
y => $self->getChartOffset->{y} + $self->getChartHeight
|
||||
}
|
||||
}
|
||||
|
|
@ -344,10 +345,14 @@ sub processDataSet {
|
|||
for my $currentElement (0 .. $maxElements-1) {
|
||||
my @thisSet = ();
|
||||
for my $currentDataset (0 .. $numberOfDatasets - 1) {
|
||||
my $color = $palette->getColor($currentDataset);
|
||||
if ($numberOfDatasets == 1) {
|
||||
$color = $palette->getNextColor;
|
||||
}
|
||||
push(@thisSet, {
|
||||
height => $self->{_datasets}->[$currentDataset]->[$currentElement] || 0,
|
||||
fillColor => $palette->getColor($currentDataset)->getFillColor,
|
||||
strokeColor => $palette->getColor($currentDataset)->getStrokeColor,
|
||||
fillColor => $color->getFillColor,
|
||||
strokeColor => $color->getStrokeColor,
|
||||
});
|
||||
}
|
||||
push(@{$self->{_bars}}, [ @thisSet ]);
|
||||
|
|
|
|||
|
|
@ -55,6 +55,33 @@ sub addMessage {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 addPrivateMessage ( properties[, userToSend] )
|
||||
|
||||
Adds a new private message to the inbox if the user accepts private messages.
|
||||
|
||||
=head3 properties
|
||||
|
||||
See WebGUI::Inbox::Message::addMessage() for details.
|
||||
|
||||
=cut
|
||||
|
||||
sub addPrivateMessage {
|
||||
my $self = shift;
|
||||
my $messageData = shift;
|
||||
my $isReply = shift;
|
||||
|
||||
my $userId = $messageData->{userId};
|
||||
my $sentBy = $messageData->{sentBy} || $self->session->user->userId;
|
||||
return undef unless $userId;
|
||||
|
||||
my $u = WebGUI::User->new($self->session,$userId);
|
||||
return undef unless ($isReply || $u->acceptsPrivateMessages($sentBy));
|
||||
|
||||
return $self->addMessage($messageData);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 DESTROY ( )
|
||||
|
||||
Deconstructor.
|
||||
|
|
|
|||
|
|
@ -72,6 +72,10 @@ A userId of a user attached to this message.
|
|||
|
||||
A groupId of a group attached to this message.
|
||||
|
||||
=head4 sentBy
|
||||
|
||||
A userId that created this message. Defaults to '3' (Admin).
|
||||
|
||||
=cut
|
||||
|
||||
sub create {
|
||||
|
|
|
|||
|
|
@ -236,8 +236,10 @@ sub parseParts {
|
|||
my $body = $message->bodyhandle;
|
||||
if (defined $body) {
|
||||
my $disposition = $message->head->get("Content-Disposition");
|
||||
$disposition =~ m/filename=\"(.*)\"/;
|
||||
my $filename = $1;
|
||||
my $filename = "";
|
||||
if($disposition =~ m/filename=\"(.*)\"/) {
|
||||
$filename = $1;
|
||||
}
|
||||
return [{content => $body->as_string, type=>$type, filename=>$filename}];
|
||||
}
|
||||
my @parts = ();
|
||||
|
|
|
|||
|
|
@ -165,11 +165,20 @@ sub getOperations {
|
|||
'viewInboxMessage' => 'WebGUI::Operation::Inbox',
|
||||
'sendPrivateMessage' => 'WebGUI::Operation::Inbox',
|
||||
'sendPrivateMessageSave' => 'WebGUI::Operation::Inbox',
|
||||
'deletePrivateMessage' => 'WebGUI::Operation::Inbox',
|
||||
|
||||
'inviteUser' => 'WebGUI::Operation::Invite',
|
||||
'inviteUserSave' => 'WebGUI::Operation::Invite',
|
||||
'acceptInvite' => 'WebGUI::Operation::Invite',
|
||||
|
||||
'addFriend' => 'WebGUI::Operation::Friends',
|
||||
'addFriendSave' => 'WebGUI::Operation::Friends',
|
||||
'friendRequest' => 'WebGUI::Operation::Friends',
|
||||
'friendRequestSave' => 'WebGUI::Operation::Friends',
|
||||
'manageFriends' => 'WebGUI::Operation::Friends',
|
||||
'removeFriends' => 'WebGUI::Operation::Friends',
|
||||
'sendMessageToFriends' => 'WebGUI::Operation::Friends',
|
||||
|
||||
'copyLDAPLink' => 'WebGUI::Operation::LDAPLink',
|
||||
'deleteLDAPLink' => 'WebGUI::Operation::LDAPLink',
|
||||
'editLDAPLink' => 'WebGUI::Operation::LDAPLink',
|
||||
|
|
|
|||
376
lib/WebGUI/Operation/Friends.pm
Normal file
376
lib/WebGUI/Operation/Friends.pm
Normal file
|
|
@ -0,0 +1,376 @@
|
|||
package WebGUI::Operation::Friends;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2007 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::Friends;
|
||||
use WebGUI::User;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Operation::Shared;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Operation::Friends
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Operation handler for handling the friends network.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_addFriend ( )
|
||||
|
||||
Form for inviting a user to become your friend.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_addFriend {
|
||||
my $session = shift;
|
||||
return $session->privilege->insufficient() unless ($session->user->isInGroup(2));
|
||||
my $friendId = $session->form->get('userId');
|
||||
my $protoFriend = WebGUI::User->new($session, $friendId);
|
||||
|
||||
my $i18n = WebGUI::International->new($session, 'Friends');
|
||||
|
||||
# Check for non-existant user id.
|
||||
if ((!$protoFriend->username) || (!$protoFriend->profileField('ableToBeFriend'))) {
|
||||
my $output = sprintf qq!<h1>%s</h1>\n<p>%s</p><a href="%s">%s</a>!,
|
||||
$i18n->get('add to friends'),
|
||||
$i18n->get('does not want to be a friend'),
|
||||
$session->url->getBackToSiteURL(),
|
||||
$i18n->get('493', 'WebGUI');
|
||||
return $session->style->userStyle($output);
|
||||
}
|
||||
|
||||
my $output = join '',
|
||||
sprintf("<h1>%s</h1>\n", $i18n->get('add to friends')),
|
||||
'<p>',
|
||||
sprintf($i18n->get('add to friends description'),
|
||||
$protoFriend->getWholeName),
|
||||
'</p>',
|
||||
WebGUI::Form::formHeader($session),
|
||||
WebGUI::Form::hidden($session,
|
||||
{
|
||||
name => 'op',
|
||||
value => 'addFriendSave',
|
||||
}
|
||||
),
|
||||
WebGUI::Form::hidden($session,
|
||||
{
|
||||
name => 'friendId',
|
||||
value => $friendId,
|
||||
}
|
||||
),
|
||||
WebGUI::Form::textarea($session,
|
||||
{
|
||||
name => 'comments',
|
||||
value => sprintf($i18n->get('default friend comments'), $protoFriend->getFirstName, $session->user->getFirstName),
|
||||
}
|
||||
),
|
||||
WebGUI::Form::Submit($session,
|
||||
{
|
||||
value => $i18n->get('add')
|
||||
}
|
||||
),
|
||||
WebGUI::Form::Button($session,
|
||||
{
|
||||
value => $i18n->get('cancel', 'WebGUI'),
|
||||
extras => q|onclick="history.go(-1);" class="backwardButton"|,
|
||||
}
|
||||
),
|
||||
WebGUI::Form::formFooter($session),
|
||||
;
|
||||
return $session->style->userStyle($output);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_addFriendSave ( )
|
||||
|
||||
Post process the form, check for required fields, handle inviting users who are already
|
||||
members (determined by email address) and send the email.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_addFriendSave {
|
||||
my $session = shift;
|
||||
return $session->privilege->insufficient() unless ($session->user->isInGroup(2));
|
||||
|
||||
my $friendId = $session->form->get('friendId');
|
||||
my $protoFriend = WebGUI::User->new($session, $friendId);
|
||||
my $i18n = WebGUI::International->new($session, 'Friends');
|
||||
|
||||
# Check for non-existant user id.
|
||||
if ((!$protoFriend->username) || (!$protoFriend->profileField('ableToBeFriend'))) {
|
||||
my $output = sprintf qq!<h1>%s</h1>\n<p>%s</p><a href="%s">%s</a>!,
|
||||
$i18n->get('add to friends'),
|
||||
$i18n->get('does not want to be a friend'),
|
||||
$session->url->getBackToSiteURL(),
|
||||
$i18n->get('493', 'WebGUI');
|
||||
return $session->style->userStyle($output);
|
||||
}
|
||||
|
||||
my $friends = WebGUI::Friends->new($session);
|
||||
$friends->sendAddRequest($friendId, $session->form->get('comments'));
|
||||
|
||||
# display result
|
||||
my $output = sprintf(
|
||||
q!<h1>%s</h1><p>%s</p><p><a href="%s">%s</a></p><p><a href="%s">%s</a></p>!,
|
||||
$i18n->get('add to friends'),
|
||||
sprintf($i18n->get('add to friends confirmation'), $protoFriend->getWholeName),
|
||||
$session->url->append($session->url->getRequestedUrl, 'op=viewProfile;uid='.$friendId),
|
||||
sprintf($i18n->get('add to friends profile'), $protoFriend->getFirstName),
|
||||
$session->url->getBackToSiteURL(),
|
||||
$i18n->get('493', 'WebGUI'),
|
||||
);
|
||||
return $session->style->userStyle($output);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_friendRequest ( )
|
||||
|
||||
Form for the friend to accept or deny the request.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_friendRequest {
|
||||
my $session = shift;
|
||||
return $session->privilege->insufficient() unless ($session->user->isInGroup(2));
|
||||
|
||||
my $i18n = WebGUI::International->new($session, 'Friends');
|
||||
|
||||
my $inviteId = $session->form->get('inviteId');
|
||||
my $friends = WebGUI::Friends->new($session);
|
||||
|
||||
my $invitation = $friends->getAddRequest($inviteId);
|
||||
|
||||
##Invalid invite ID
|
||||
unless (exists $invitation->{friendId}) { ##No userId corresponds to the inviteId
|
||||
my $output = sprintf qq!<h1>%s</h1>\n<p>%s</p><a href="%s">%s</a>!,
|
||||
$i18n->get('invalid invite code'),
|
||||
$i18n->get('invalid invite code message'),
|
||||
$session->url->page("op=viewInbox"),
|
||||
$i18n->get('354', 'WebGUI');
|
||||
return $session->style->userStyle($output);
|
||||
}
|
||||
|
||||
##Already a friend (check friendId already in the group)
|
||||
if ($friends->isFriend($invitation->{inviterId})) {
|
||||
my $output = sprintf qq!<h1>%s</h1>\n<p>%s</p><a href="%s">%s</a>!,
|
||||
$i18n->get('invalid invite code'),
|
||||
$i18n->get('already a friend'),
|
||||
$session->url->page("op=viewInbox"),
|
||||
$i18n->get('354', 'WebGUI');
|
||||
return $session->style->userStyle($output);
|
||||
}
|
||||
|
||||
##Someone else's invite (check friendId vs current userId).
|
||||
if ($session->user->userId ne $invitation->{friendId}) { ##This isn't your invitation, dude.
|
||||
my $output = sprintf qq!<h1>%s</h1>\n<p>%s</p><a href="%s">%s</a>!,
|
||||
$i18n->get('invalid invite code'),
|
||||
$i18n->get('not the right user'),
|
||||
$session->url->page("op=viewInbox"),
|
||||
$i18n->get('354', 'WebGUI');
|
||||
return $session->style->userStyle($output);
|
||||
}
|
||||
|
||||
##Everything looks good. Make the form!
|
||||
my $inviter = WebGUI::User->new($session, $invitation->{inviterId});
|
||||
my $output = join '',
|
||||
sprintf("<h1>%s</h1>\n", $i18n->get('friend request')),
|
||||
'<p>',
|
||||
sprintf($i18n->get('friend request description'),
|
||||
$inviter->getWholeName),
|
||||
'</p>',
|
||||
WebGUI::Form::formHeader($session),
|
||||
WebGUI::Form::hidden($session,
|
||||
{
|
||||
name => 'op',
|
||||
value => 'friendRequestSave',
|
||||
}
|
||||
),
|
||||
WebGUI::Form::hidden($session,
|
||||
{
|
||||
name => 'inviteId',
|
||||
value => $inviteId,
|
||||
}
|
||||
),
|
||||
WebGUI::Form::textarea($session,
|
||||
{
|
||||
name => 'comments',
|
||||
value => $invitation->{comments},
|
||||
extras => 'disabled=disabled',
|
||||
}
|
||||
),
|
||||
WebGUI::Form::Submit($session, ##Approve
|
||||
{
|
||||
name => 'doWhat',
|
||||
value => $i18n->get('572', 'WebGUI'),
|
||||
}
|
||||
),
|
||||
WebGUI::Form::Submit($session, ##Deny
|
||||
{
|
||||
name => 'doWhat',
|
||||
value => $i18n->get('574', 'WebGUI'),
|
||||
}
|
||||
),
|
||||
WebGUI::Form::formFooter($session),
|
||||
;
|
||||
return $session->style->userStyle($output);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_friendRequestSave ( )
|
||||
|
||||
Handle form data from the friend's response to the invitation
|
||||
|
||||
=cut
|
||||
|
||||
sub www_friendRequestSave {
|
||||
my $session = shift;
|
||||
return $session->privilege->insufficient() unless ($session->user->isInGroup(2));
|
||||
|
||||
my $i18n = WebGUI::International->new($session, 'Friends');
|
||||
my $doWhat = $session->form->get('doWhat');
|
||||
my $inviteId = $session->form->get('inviteId');
|
||||
my $friends = WebGUI::Friends->new($session);
|
||||
my $invite = $friends->getAddRequest($inviteId);
|
||||
my $inviter = WebGUI::User->new($session, $invite->{inviterId});
|
||||
##Invalid invite ID
|
||||
if (!$invite->{inviterId}) { ##No userId corresponds to the inviteId
|
||||
my $output = sprintf qq!<h1>%s</h1>\n<p>%s</p><a href="%s">%s</a>!,
|
||||
$i18n->get('invalid invite code'),
|
||||
$i18n->get('invalid invite code message'),
|
||||
$session->url->page("op=viewInbox"),
|
||||
$i18n->get('354', 'WebGUI');
|
||||
return $session->style->userStyle($output);
|
||||
}
|
||||
|
||||
##If deny, change the status of the request to denied.
|
||||
if ($doWhat ne $i18n->get('572', 'WebGUI')) { ##request denied
|
||||
$friends->rejectAddRequest($inviteId);
|
||||
##Return screen that says they denied the request.
|
||||
my $output = sprintf qq!<h1>%s</h1>\n<p>%s</p><a href="%s">%s</a>!,
|
||||
$i18n->get('friend request'),
|
||||
sprintf($i18n->get('you have not been added'), $inviter->getWholeName),
|
||||
$session->url->page("op=viewInbox"),
|
||||
$i18n->get('354', 'WebGUI');
|
||||
return $session->style->userStyle($output);
|
||||
}
|
||||
|
||||
##If accepted,
|
||||
# set the status to accepted.
|
||||
$friends->approveAddRequest($inviteId);
|
||||
|
||||
# Return screen that says they accepted the request.
|
||||
my $output = sprintf qq!<h1>%s</h1>\n<p>%s</p><a href="%s">%s</a>!,
|
||||
$i18n->get('friend request'),
|
||||
sprintf($i18n->get('you have been added'), $inviter->getWholeName),
|
||||
$session->url->page("op=viewInbox"),
|
||||
$i18n->get('354', 'WebGUI');
|
||||
return $session->style->userStyle($output);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_manageFriends ( )
|
||||
|
||||
Display the list of friends and allow the user to remove friends or
|
||||
send private messages to a subset of them.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_manageFriends {
|
||||
my $session = shift;
|
||||
my ($user, $url, $style) = $session->quick(qw(user url style));
|
||||
return $session->privilege->insufficient() unless ($user->isInGroup(2));
|
||||
my $i18n = WebGUI::International->new($session, 'Friends');
|
||||
|
||||
##You have no friends!
|
||||
my $friends = $user->friends->getUsers;
|
||||
unless (scalar(@{$friends})) {
|
||||
my $output = sprintf qq!<h1>%s</h1>\n<p>%s</p><a href="%s">%s</a>!,
|
||||
$i18n->get('my friends'),
|
||||
$i18n->get('no friends'),
|
||||
$url->getBackToSiteURL(),
|
||||
$i18n->get('493', 'WebGUI');
|
||||
return $style->userStyle($output);
|
||||
}
|
||||
|
||||
# show the friend manager
|
||||
my %var = (
|
||||
"account.options" => WebGUI::Operation::Shared::accountOptions($session),
|
||||
formHeader => WebGUI::Form::formHeader($session)
|
||||
. WebGUI::Form::hidden($session, { name => 'op', value => 'sendMessageToFriends', }),
|
||||
removeFriendButton => WebGUI::Form::button($session, { value => $i18n->get('remove'), extras => q|onclick="confirmRemovalOfFriends(form);"|, }),
|
||||
subjectForm => WebGUI::Form::text($session, { name=>"subject" }),
|
||||
sendMessageButton => WebGUI::Form::Submit($session, { value => $i18n->get('send message'), }),
|
||||
messageForm => WebGUI::Form::textarea($session, { name=>"message" }),
|
||||
formFooter => WebGUI::Form::formFooter($session),
|
||||
);
|
||||
foreach my $userId (@{ $friends}) {
|
||||
my $friend = WebGUI::User->new($session, $userId);
|
||||
push(@{$var{friends}}, {
|
||||
name => $friend->getWholeName,
|
||||
profileUrl => $url->append($url->getRequestedUrl, 'op=viewProfile;uid='.$userId),
|
||||
status => ($friend->isOnline ? $i18n->get('online') : $i18n->get('offline')),
|
||||
checkboxForm => WebGUI::Form::checkbox($session, { name => 'userId', value => $userId, }),
|
||||
});
|
||||
}
|
||||
my $template = WebGUI::Asset->new(
|
||||
$session,
|
||||
$session->setting->get("manageFriendsTemplateId"),
|
||||
"WebGUI::Asset::Template",
|
||||
);
|
||||
return $style->userStyle($template->process(\%var));
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_removeFriends ()
|
||||
|
||||
Removes friends from the current user's friends list.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_removeFriends {
|
||||
my $session = shift;
|
||||
return $session->privilege->insufficient() unless ($session->user->isInGroup(2));
|
||||
my @users = $session->form->param("userId");
|
||||
WebGUI::Friends->new($session)->delete(\@users);
|
||||
return www_manageFriends($session);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_sendMessageToFriends ()
|
||||
|
||||
Sends a message to selected friends.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_sendMessageToFriends {
|
||||
my $session = shift;
|
||||
return $session->privilege->insufficient() unless ($session->user->isInGroup(2));
|
||||
my @users = $session->form->param("userId");
|
||||
my $friends = WebGUI::Friends->new($session);
|
||||
$friends->sendMessage($session->form->process("subject", "text"), $session->form->process("message","textarea"), \@users);
|
||||
return www_manageFriends($session);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
@ -153,7 +153,7 @@ sub www_sendPrivateMessage {
|
|||
return $style->userStyle(WebGUI::Asset::Template->new($session,$templateId)->process($vars));
|
||||
}
|
||||
|
||||
unless($userTo->profileField("allowPrivateMessages")) {
|
||||
unless($userTo->acceptsPrivateMessages($user->userId)) {
|
||||
$vars->{'error_msg'} = $i18n->get('private message blocked error');
|
||||
return $style->userStyle(WebGUI::Asset::Template->new($session,$templateId)->process($vars));
|
||||
}
|
||||
|
|
@ -213,7 +213,15 @@ sub www_sendPrivateMessageSave {
|
|||
}
|
||||
}
|
||||
|
||||
unless($isReply || $userTo->profileField("allowPrivateMessages")) {
|
||||
my $message = WebGUI::Inbox->new($session)->addPrivateMessage({
|
||||
message => $form->get("message"),
|
||||
subject => $form->get("subject"),
|
||||
userId => $uid,
|
||||
status => 'unread',
|
||||
sentBy => $user->userId
|
||||
},$isReply);
|
||||
|
||||
unless(defined $message) {
|
||||
my $output = sprintf qq|<h1>%s</h1>\n<p>%s</p><a href="%s">%s</a>|,
|
||||
$i18n->get('private message error'),
|
||||
$i18n->get('private message blocked error'),
|
||||
|
|
@ -222,15 +230,6 @@ sub www_sendPrivateMessageSave {
|
|||
return $style->userStyle($output);
|
||||
}
|
||||
|
||||
|
||||
WebGUI::Inbox->new($session)->addMessage({
|
||||
message => $form->get("message"),
|
||||
subject => $form->get("subject"),
|
||||
userId => $uid,
|
||||
status => 'unread',
|
||||
sentBy => $user->userId
|
||||
});
|
||||
|
||||
|
||||
my $output = sprintf qq!<p>%s</p><a href="%s">%s</a>!,
|
||||
$i18n->get('private message sent'),
|
||||
|
|
@ -270,7 +269,7 @@ sub www_viewInbox {
|
|||
|
||||
#Cache the base url
|
||||
my $inboxUrl = $session->url->page('op=viewInbox');
|
||||
|
||||
|
||||
$vars->{ title } = $i18n->get(159);
|
||||
$vars->{'subject_label' } = $i18n->get(351);
|
||||
$vars->{'subject_url' } = $inboxUrl.$pn_url.";sortBy=subject";
|
||||
|
|
@ -287,6 +286,8 @@ sub www_viewInbox {
|
|||
my $adminUser = WebGUI::User->new($session,3)->username;
|
||||
my $messages = WebGUI::Inbox->new($session)->getMessagesForUser($session->user,$rpp,$pn,$sortBy);
|
||||
foreach my $message (@$messages) {
|
||||
next if($message->get('status') eq 'deleted');
|
||||
|
||||
my $hash = {};
|
||||
$hash->{ message_url } = $session->url->page('op=viewInboxMessage;messageId='.$message->getId);
|
||||
$hash->{ subject } = $message->get("subject");
|
||||
|
|
@ -332,6 +333,27 @@ sub www_viewInbox {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_deletePrivateMessage ( )
|
||||
|
||||
Mark a private message in the inbox as deleted.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_deletePrivateMessage {
|
||||
my $session = shift;
|
||||
return $session->privilege->insufficient() unless ($session->user->isInGroup(2));
|
||||
|
||||
#Get the message
|
||||
my $message = WebGUI::Inbox->new($session)->getMessage($session->form->param("messageId"));
|
||||
if(defined $message) {
|
||||
# set the message status to 'deleted'
|
||||
$message->setStatus("deleted");
|
||||
}
|
||||
return www_viewInbox($session);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_viewInboxMessage ( )
|
||||
|
||||
Templated display of a single message for the user.
|
||||
|
|
@ -367,6 +389,8 @@ sub www_viewInboxMessage {
|
|||
$vars->{'dateStamp'} =$session->datetime->epochToHuman($message->get("dateStamp"));
|
||||
$vars->{'status' } = _status($session)->{$message->get("status")};
|
||||
$vars->{ message } = $message->get("message");
|
||||
$vars->{ delete_text } = $i18n->get("private message delete text");
|
||||
$vars->{ delete_url } = '?op=deletePrivateMessage;messageId=' . $message->getId;
|
||||
unless ($vars->{message} =~ /\<a/ig) {
|
||||
$vars->{message} =~ s/(http\S*)/\<a href=\"$1\"\>$1\<\/a\>/g;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ use WebGUI::Utility;
|
|||
use WebGUI::ProfileField;
|
||||
use WebGUI::ProfileCategory;
|
||||
use WebGUI::Operation::Shared;
|
||||
use WebGUI::Operation::Friends;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -280,39 +281,45 @@ A reference to the current session.
|
|||
=cut
|
||||
|
||||
sub www_viewProfile {
|
||||
my $session = shift;
|
||||
my $u = WebGUI::User->new($session,$session->form->process("uid"));
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
my $vars = {};
|
||||
$vars->{displayTitle} = $i18n->get(347).' '.$u->username;
|
||||
my $session = shift;
|
||||
my $u = WebGUI::User->new($session,$session->form->process("uid"));
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
my $vars = {};
|
||||
$vars->{displayTitle} = $i18n->get(347).' '.$u->username;
|
||||
|
||||
return $session->privilege->notMember() if($u->username eq "");
|
||||
return $session->privilege->notMember() if($u->username eq "");
|
||||
|
||||
return $session->style->userStyle($vars->{displayTitle}.'. '.$i18n->get(862)) if($u->profileField("publicProfile") < 1 && ($session->user->userId ne $session->form->process("uid") || $session->user->isInGroup(3)));
|
||||
return $session->privilege->insufficient() if(!$session->user->isInGroup(2));
|
||||
return $session->style->userStyle($vars->{displayTitle}.'. '.$i18n->get(862)) if($u->profileField("publicProfile") < 1 && ($session->user->userId ne $session->form->process("uid") || $session->user->isInGroup(3)));
|
||||
return $session->privilege->insufficient() if(!$session->user->isInGroup(2));
|
||||
|
||||
my @array = ();
|
||||
foreach my $category (@{WebGUI::ProfileCategory->getCategories($session)}) {
|
||||
next unless ($category->get("visible"));
|
||||
push(@array, {'profile.category' => $category->getLabel});
|
||||
foreach my $field (@{$category->getFields}) {
|
||||
next unless ($field->get("visible"));
|
||||
next if ($field->get("fieldName") eq "email" && !$u->profileField("publicEmail"));
|
||||
push(@array, {
|
||||
'profile.label' => $field->getLabel,
|
||||
'profile.value' => $field->formField(undef,2,$u)
|
||||
});
|
||||
}
|
||||
}
|
||||
$vars->{'profile.elements'} = \@array;
|
||||
if ($session->user->userId eq $session->form->process("uid")) {
|
||||
$vars->{'profile.accountOptions'} = WebGUI::Operation::Shared::accountOptions($session);
|
||||
}
|
||||
my @array = ();
|
||||
foreach my $category (@{WebGUI::ProfileCategory->getCategories($session)}) {
|
||||
next unless ($category->get("visible"));
|
||||
push(@array, {'profile.category' => $category->getLabel});
|
||||
foreach my $field (@{$category->getFields}) {
|
||||
next unless ($field->get("visible"));
|
||||
next if ($field->get("fieldName") eq "email" && !$u->profileField("publicEmail"));
|
||||
push @array, {
|
||||
'profile.label' => $field->getLabel,
|
||||
'profile.value' => $field->formField(undef,2,$u),
|
||||
};
|
||||
}
|
||||
}
|
||||
$vars->{'profile.elements'} = \@array;
|
||||
|
||||
if ($session->user->userId eq $session->form->process("uid")) {
|
||||
$vars->{'profile.accountOptions'} = WebGUI::Operation::Shared::accountOptions($session);
|
||||
}
|
||||
else {
|
||||
push(@{$vars->{'profile.accountOptions'}}, {'options.display' => '<a href="'.$session->url->page('op=sendPrivateMessage;uid='.$session->form->process("uid")).'">'.$i18n->get('send private message').'</a>'});
|
||||
## TODO: Make this more legible code, maybe refactor into a method
|
||||
push @{$vars->{'profile.accountOptions'}}, {
|
||||
'options.display' => '<a href="'.$session->url->page("op=addFriend;userId=".$u->userId).'">'.$i18n->get('add to friends list', 'Friends').'</a>',
|
||||
}, {
|
||||
'options.display' => '<a href="'.$session->url->page('op=sendPrivateMessage;uid='.$session->form->process("uid")).'">'.$i18n->get('send private message').'</a>',
|
||||
};
|
||||
}
|
||||
|
||||
return $session->style->userStyle(WebGUI::Asset::Template->new($session,"PBtmpl0000000000000052")->process($vars));
|
||||
return $session->style->userStyle(WebGUI::Asset::Template->new($session,"PBtmpl0000000000000052")->process($vars));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -441,6 +441,15 @@ sub definition {
|
|||
namespace=>"userInvite/Email",
|
||||
defaultValue=>$setting->get("userInvitationsEmailTemplateId"),
|
||||
});
|
||||
push(@fields, {
|
||||
tab => "user",
|
||||
fieldType => "template",
|
||||
defaultValue => "managefriends_________",
|
||||
namespace => "friends/manage",
|
||||
name => "manageFriendsTemplateId",
|
||||
label => $i18n->get("manage friends template", "Friends"),
|
||||
hoverHelp => $i18n->get("manage friends template help", "Friends"),
|
||||
});
|
||||
# auth settings
|
||||
my $options;
|
||||
foreach (@{$session->config->get("authMethods")}) {
|
||||
|
|
|
|||
|
|
@ -73,6 +73,11 @@ TODO: DOCUMENT ME
|
|||
push @array, {
|
||||
'options.display' => sprintf('<a href=%s>%s</a>', $session->url->page('op=inviteUser'), $i18n->get('invite a friend')),
|
||||
};
|
||||
}
|
||||
unless ($op eq "manageFriends") {
|
||||
push @array, {
|
||||
'options.display' => sprintf('<a href=%s>%s</a>', $session->url->page('op=manageFriends'), $i18n->get('see my friends', 'Friends')),
|
||||
};
|
||||
}
|
||||
my %logout;
|
||||
$logout{'options.display'} = '<a href="'.$session->url->page('op=auth;method=logout').'">'.$i18n->get(64).'</a>';
|
||||
|
|
|
|||
|
|
@ -578,66 +578,87 @@ ENDCODE
|
|||
name=>rand(100000),
|
||||
timeout=>10
|
||||
);
|
||||
if (! $remote) {
|
||||
my $output = $i18n->get('spectre not running error');
|
||||
return $ac->render($output, $i18n->get('show running workflows'));
|
||||
}
|
||||
|
||||
my $sitename = $session->config()->get('sitename')->[0];
|
||||
my $workflowResult = $remote->post_respond('workflow/getJsonStatus',$sitename);
|
||||
if (! defined $workflowResult) {
|
||||
$remote->disconnect();
|
||||
my $output = $i18n->get('spectre no info error');
|
||||
return $ac->render($output, $i18n->get('show running workflows'));
|
||||
my $workflowResult;
|
||||
if ($remote) {
|
||||
$workflowResult = $remote->post_respond('workflow/getJsonStatus',$sitename);
|
||||
if (!defined $workflowResult) {
|
||||
$remote->disconnect();
|
||||
$output = $i18n->get('spectre no info error');
|
||||
}
|
||||
}
|
||||
else {
|
||||
$output = $i18n->get('spectre not running error')
|
||||
}
|
||||
|
||||
my $workflowsHref = jsonToObj($workflowResult);
|
||||
if (defined $workflowResult) {
|
||||
my $workflowsHref = jsonToObj($workflowResult);
|
||||
|
||||
my $workflowTitleFor = $session->db->buildHashRef(<<"");
|
||||
SELECT wi.instanceId, w.title
|
||||
FROM WorkflowInstance wi
|
||||
JOIN Workflow w USING (workflowId)
|
||||
my $workflowTitleFor = $session->db->buildHashRef(<<"");
|
||||
SELECT wi.instanceId, w.title
|
||||
FROM WorkflowInstance wi
|
||||
JOIN Workflow w USING (workflowId)
|
||||
|
||||
my $lastActivityFor = $session->db->buildHashRef(<<"");
|
||||
SELECT wi.instanceId, wa.title
|
||||
FROM WorkflowInstance wi
|
||||
JOIN WorkflowActivity wa ON wi.currentActivityId = wa.activityId
|
||||
my $lastActivityFor = $session->db->buildHashRef(<<"");
|
||||
SELECT wi.instanceId, wa.title
|
||||
FROM WorkflowInstance wi
|
||||
JOIN WorkflowActivity wa ON wi.currentActivityId = wa.activityId
|
||||
|
||||
for my $workflowType (qw( Suspended Waiting Running )) {
|
||||
my $workflowsAref = $workflowsHref->{$workflowType};
|
||||
my $workflowCount = @$workflowsAref;
|
||||
for my $workflowType (qw( Suspended Waiting Running )) {
|
||||
my $workflowsAref = $workflowsHref->{$workflowType};
|
||||
my $workflowCount = @$workflowsAref;
|
||||
|
||||
my $titleHeader = $i18n->get('title header');
|
||||
my $priorityHeader = $i18n->get('priority header');
|
||||
my $activityHeader = $i18n->get('activity header');
|
||||
my $lastStateHeader = $i18n->get('last state header');
|
||||
my $lastRunTimeHeader = $i18n->get('last run time header');
|
||||
$output .= sprintf $i18n->get('workflow type count'), $workflowCount, $workflowType;
|
||||
$output .= '<table style="width: 100%;">';
|
||||
$output .= "<tr><th>$titleHeader</th><th>$priorityHeader</th><th>$activityHeader</th>";
|
||||
$output .= "<th>$lastStateHeader</th><th>$lastRunTimeHeader</th></tr>";
|
||||
my $titleHeader = $i18n->get('title header');
|
||||
my $priorityHeader = $i18n->get('priority header');
|
||||
my $activityHeader = $i18n->get('activity header');
|
||||
my $lastStateHeader = $i18n->get('last state header');
|
||||
my $lastRunTimeHeader = $i18n->get('last run time header');
|
||||
$output .= sprintf $i18n->get('workflow type count'), $workflowCount, $workflowType;
|
||||
$output .= '<table style="width: 100%;">';
|
||||
$output .= "<tr><th>$titleHeader</th><th>$priorityHeader</th><th>$activityHeader</th>";
|
||||
$output .= "<th>$lastStateHeader</th><th>$lastRunTimeHeader</th></tr>";
|
||||
|
||||
for my $workflow (@$workflowsAref) {
|
||||
my($priority, $id, $instance) = @$workflow;
|
||||
for my $workflow (@$workflowsAref) {
|
||||
my($priority, $id, $instance) = @$workflow;
|
||||
|
||||
my $originalPriority = ($instance->{priority} - 1) * 10;
|
||||
my $instanceId = $instance->{instanceId};
|
||||
my $title = $workflowTitleFor->{$instanceId} || '(no title)';
|
||||
my $lastActivity = $lastActivityFor->{$instanceId} || '(none)';
|
||||
my $lastRunTime = $instance->{lastRunTime} || '(never)';
|
||||
my $originalPriority = ($instance->{priority} - 1) * 10;
|
||||
my $instanceId = $instance->{instanceId};
|
||||
my $title = $workflowTitleFor->{$instanceId} || '(no title)';
|
||||
my $lastActivity = $lastActivityFor->{$instanceId} || '(none)';
|
||||
my $lastRunTime = $instance->{lastRunTime} || '(never)';
|
||||
|
||||
$output .= '<tr>';
|
||||
$output .= "<td>$title</td>";
|
||||
$output .= qq[<td><a id="priority-$instanceId" href="javascript:void(0);" title="Edit Priority" onclick="showEditPriorityForm('$instanceId')">$priority</a>/$originalPriority</td>];
|
||||
$output .= "<td>$lastActivity</td>";
|
||||
$output .= "<td>$instance->{lastState}</td>";
|
||||
$output .= "<td>$lastRunTime</td>";
|
||||
$output .= '<tr>';
|
||||
$output .= "<td>$title</td>";
|
||||
$output .= qq[<td><a id="priority-$instanceId" href="javascript:void(0);" title="Edit Priority" onclick="showEditPriorityForm('$instanceId')">$priority</a>/$originalPriority</td>];
|
||||
$output .= "<td>$lastActivity</td>";
|
||||
$output .= "<td>$instance->{lastState}</td>";
|
||||
$output .= "<td>$lastRunTime</td>";
|
||||
|
||||
if ($isAdmin) {
|
||||
my $run = $i18n->get('run');
|
||||
my $href = $session->url->page(qq[op=runWorkflow;instanceId=$instanceId]);
|
||||
$output .= qq[<td><a href="$href">$run</a></td>];
|
||||
if ($isAdmin) {
|
||||
my $run = $i18n->get('run');
|
||||
my $href = $session->url->page(qq[op=runWorkflow;instanceId=$instanceId]);
|
||||
$output .= qq[<td><a href="$href">$run</a></td>];
|
||||
}
|
||||
$output .= "</tr>\n";
|
||||
}
|
||||
$output .= '</table>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$output .= '<table width="100%">';
|
||||
my $rs = $session->db->read("select Workflow.title, WorkflowInstance.lastStatus, WorkflowInstance.runningSince, WorkflowInstance.lastUpdate, WorkflowInstance.instanceId from WorkflowInstance left join Workflow on WorkflowInstance.workflowId=Workflow.workflowId order by WorkflowInstance.runningSince desc");
|
||||
while (my ($title, $status, $runningSince, $lastUpdate, $id) = $rs->array) {
|
||||
my $class = $status || "complete";
|
||||
$output .= '<tr class="'.$class.'">'
|
||||
.'<td>'.$title.'</td>'
|
||||
.'<td>'.$session->datetime->epochToHuman($runningSince).'</td>';
|
||||
if ($status) {
|
||||
$output .= '<td>'
|
||||
.$status.' / '.$session->datetime->epochToHuman($lastUpdate)
|
||||
.'</td>';
|
||||
}
|
||||
$output .= '<td><a href="'.$session->url->page("op=runWorkflow;instanceId=".$id).'">'.$i18n->get("run").'</a></td>'
|
||||
if ($isAdmin);
|
||||
$output .= "</tr>\n";
|
||||
}
|
||||
$output .= '</table>';
|
||||
|
|
|
|||
|
|
@ -680,12 +680,12 @@ sub setDataByQuery {
|
|||
my $pageNumber = $self->getPageNumber;
|
||||
my $rowsPerPage = $self->{_rpp};
|
||||
|
||||
#Handle dynamicPageNumber requests or custom limts the old way as it winds up being most efficient
|
||||
if ((defined $dynamicPageNumberKey && $pageNumber == 1) || $sql =~ m/limit/i) {
|
||||
$dbh ||= $self->session->dbSlave;
|
||||
|
||||
#Handle dynamicPageNumber requests or custom limits, or non-mysql the old way as it winds up being most efficient
|
||||
if ($dbh->getDriver ne 'mysql' || (defined $dynamicPageNumberKey && $pageNumber == 1) || $sql =~ m/limit/i) {
|
||||
return $self->_setDataByQuery(@_);
|
||||
}
|
||||
|
||||
$dbh ||= $self->session->dbSlave;
|
||||
|
||||
#Calculate where to start
|
||||
my $start = ( ($pageNumber - 1) * $rowsPerPage );
|
||||
|
|
|
|||
|
|
@ -459,6 +459,19 @@ sub getNextId {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getDriver ( )
|
||||
|
||||
Returns the DBI driver used by this database link
|
||||
|
||||
=cut
|
||||
|
||||
sub getDriver {
|
||||
my $self = shift;
|
||||
return $self->{_dbh}->{Driver}->{Name};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getRow ( table, key, keyValue )
|
||||
|
||||
Returns a row of data as a hash reference from the specified table.
|
||||
|
|
|
|||
|
|
@ -226,8 +226,17 @@ Returns an HTML string with all the necessary components to draw the tab form.
|
|||
|
||||
sub print {
|
||||
my $self = shift;
|
||||
$self->session->style->setScript($self->session->url->extras('tabs/tabs.js'),{type=>"text/javascript"});
|
||||
$self->session->style->setLink($self->{_css},{rel=>"stylesheet", rev=>"stylesheet",type=>"text/css"});
|
||||
my $style = $self->session->style;
|
||||
my $url = $self->session->url;
|
||||
$style->setScript($url->extras('tabs/tabs.js'),{type=>"text/javascript"});
|
||||
$style->setLink($self->{_css},{rel=>"stylesheet", rev=>"stylesheet",type=>"text/css"});
|
||||
$style->setLink($url->extras('/yui/build/container/assets/container.css'),{ type=>'text/css', rel=>"stylesheet" });
|
||||
$style->setLink($url->extras('/hoverhelp.css'),{ type=>'text/css', rel=>"stylesheet" });
|
||||
$style->setScript($url->extras('/yui/build/yahoo/yahoo-min.js'),{ type=>'text/javascript' });
|
||||
$style->setScript($url->extras('/yui/build/dom/dom-min.js'),{ type=>'text/javascript' });
|
||||
$style->setScript($url->extras('/yui/build/event/event-min.js'),{ type=>'text/javascript' });
|
||||
$style->setScript($url->extras('/yui/build/container/container-min.js'),{ type=>'text/javascript' });
|
||||
$style->setScript($url->extras('/hoverhelp.js'),{ type=>'text/javascript' });
|
||||
my $output = $self->{_form};
|
||||
$output .= $self->{_hidden};
|
||||
my $i = 1;
|
||||
|
|
|
|||
|
|
@ -97,6 +97,37 @@ sub addToGroups {
|
|||
$self->session->stow->delete("gotGroupsForUser");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 acceptsPrivateMessages ( userId )
|
||||
|
||||
Returns a boolean of whether or not the user can receive private messages from the user passed in
|
||||
|
||||
=head3 userId
|
||||
|
||||
userId to determine if the user accepts private messages from
|
||||
|
||||
=cut
|
||||
|
||||
sub acceptsPrivateMessages {
|
||||
my $self = shift;
|
||||
my $userId = shift;
|
||||
|
||||
my $pmSetting = $self->profileField('allowPrivateMessages');
|
||||
|
||||
return 0 if ($pmSetting eq "none");
|
||||
return 1 if ($pmSetting eq "all");
|
||||
|
||||
if($pmSetting eq "friends") {
|
||||
my $friendsGroup = $self->friends;
|
||||
my $sentBy = WebGUI::User->new($self->session,$userId);
|
||||
#$self->session->errorHandler->warn($self->isInGroup($friendsGroup->getId));
|
||||
return $sentBy->isInGroup($friendsGroup->getId);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 authMethod ( [ value ] )
|
||||
|
|
@ -163,22 +194,24 @@ Deletes this user.
|
|||
=cut
|
||||
|
||||
sub delete {
|
||||
my $self = shift;
|
||||
my $self = shift;
|
||||
$self->uncache;
|
||||
my $db = $self->session->db;
|
||||
foreach my $groupId (@{$self->getGroups($self->userId)}) {
|
||||
WebGUI::Group->new($self->session,$groupId)->deleteUsers([$self->userId]);
|
||||
}
|
||||
$self->session->db->write("delete from inbox where userId=? and (groupId is null or groupId='')",[$self->{_userId}]);
|
||||
$self->friends->delete if ($self->{_user}{"friendsGroup"} ne "");
|
||||
$db->write("delete from inbox where userId=? and (groupId is null or groupId='')",[$self->{_userId}]);
|
||||
require WebGUI::Operation::Auth;
|
||||
my $authMethod = WebGUI::Operation::Auth::getInstance($self->session,$self->authMethod,$self->{_userId});
|
||||
$authMethod->deleteParams($self->{_userId});
|
||||
my $rs = $self->session->db->read("select sessionId from userSession where userId=?",[$self->{_userId}]);
|
||||
my $rs = $db->read("select sessionId from userSession where userId=?",[$self->{_userId}]);
|
||||
while (my ($id) = $rs->array) {
|
||||
$self->session->db->write("delete from userSessionScratch where sessionId=?",[$id]);
|
||||
$db->write("delete from userSessionScratch where sessionId=?",[$id]);
|
||||
}
|
||||
$self->session->db->write("delete from userSession where userId=?",[$self->{_userId}]);
|
||||
$self->session->db->write("delete from userProfileData where userId=?",[$self->{_userId}]);
|
||||
$self->session->db->write("delete from users where userId=?",[$self->{_userId}]);
|
||||
$db->write("delete from userSession where userId=?",[$self->{_userId}]);
|
||||
$db->write("delete from userProfileData where userId=?",[$self->{_userId}]);
|
||||
$db->write("delete from users where userId=?",[$self->{_userId}]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -213,10 +246,57 @@ Deconstructor.
|
|||
|
||||
sub DESTROY {
|
||||
my $self = shift;
|
||||
if (exists $self->{_friendsGroup}) {
|
||||
$self->{_friendsGroup}->DESTROY;
|
||||
}
|
||||
undef $self;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 friends ( )
|
||||
|
||||
Returns the WebGUI::Group for this user's Friend's Group.
|
||||
|
||||
=cut
|
||||
|
||||
sub friends {
|
||||
my $self = shift;
|
||||
if ($self->{_user}{"friendsGroup"} eq "") {
|
||||
my $myFriends = WebGUI::Group->new($self->session, "new");
|
||||
$myFriends->name($self->username." Friends");
|
||||
$myFriends->description("Friends of user ".$self->userId);
|
||||
$myFriends->expireOffset(60*60*24*365*60);
|
||||
$myFriends->showInForms(0);
|
||||
$myFriends->isEditable(0);
|
||||
$myFriends->deleteUsers(['3']);
|
||||
$self->uncache;
|
||||
$self->{_user}{"friendsGroup"} = $myFriends->getId;
|
||||
$self->{_user}{"lastUpdated"} = $self->session->datetime->time();
|
||||
$self->session->db->write("update users set friendsGroup=?, lastUpdated=? where userId=?",
|
||||
[$myFriends->getId, $self->session->datetime->time(), $self->userId]);
|
||||
return $myFriends;
|
||||
}
|
||||
elsif (exists $self->{_friendsGroup}) {
|
||||
return $self->{_friendsGroup};
|
||||
}
|
||||
return WebGUI::Group->new($self->session, $self->{_user}{"friendsGroup"});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getFirstName ( )
|
||||
|
||||
Returns first name, or alias, or username depeneding upon what exists.
|
||||
|
||||
=cut
|
||||
|
||||
sub getFirstName {
|
||||
my $self = shift;
|
||||
return $self->profileField('firstName') || $self->profileField('alias') || $self->username;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getGroups ( [ withoutExpired ] )
|
||||
|
|
@ -252,6 +332,23 @@ sub getGroups {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getWholeName ( )
|
||||
|
||||
Attempts to build the user's whole name from profile fields, and ultimately their alias and username if all else
|
||||
fails.
|
||||
|
||||
=cut
|
||||
|
||||
sub getWholeName {
|
||||
my $self = shift;
|
||||
if ($self->profileField('firstName') and $self->profileField('lastName')) {
|
||||
return join ' ', $self->profileField('firstName'), $self->profileField('lastName');
|
||||
}
|
||||
return $self->profileField("alias") || $self->username;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# This method is depricated and is provided only for reverse compatibility. See WebGUI::Auth instead.
|
||||
sub identifier {
|
||||
|
|
@ -314,6 +411,22 @@ sub isInGroup {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isOnline ()
|
||||
|
||||
Returns a boolean indicating whether this user is logged in and actively viewing pages in the site.
|
||||
|
||||
=cut
|
||||
|
||||
sub isOnline {
|
||||
my $self = shift;
|
||||
my ($flag) = $self->session->db->quickArray('select count(*) from userSession where userId=? and lastPageView=?',
|
||||
[$self->userId, time() - 60*10]);
|
||||
return $flag;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 karma ( [ amount, source, description ] )
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ This package provides miscellaneous but useful utilities to the WebGUI programme
|
|||
use WebGUI::Utility;
|
||||
$string = commify($integer);
|
||||
$size = formatBytes($integer);
|
||||
$boolean = isBetween($value, $first, $second);
|
||||
$boolean = isIn($value, @array);
|
||||
$boolean = isInSubnet($ip, \@subnets);
|
||||
makeArrayCommaSafe(\@array);
|
||||
|
|
@ -48,6 +49,7 @@ This package provides miscellaneous but useful utilities to the WebGUI programme
|
|||
$string = makeTabSafe($string);
|
||||
$integer = randint($low,$high);
|
||||
$hashRef = randomizeHash(\%hash);
|
||||
$rounded = round($number, $digits);
|
||||
%hash = sortHash(%hash);
|
||||
%hash = sortHashDescending(%hash);
|
||||
|
||||
|
|
|
|||
|
|
@ -297,15 +297,21 @@ sub new {
|
|||
my $main = $session->db->getRow("WorkflowActivity","activityId", $activityId);
|
||||
return undef unless $main->{activityId};
|
||||
$class = $main->{className};
|
||||
my $cmd = "use ".$class;
|
||||
eval ($cmd);
|
||||
if ($@) {
|
||||
$session->errorHandler->error("Couldn't compile workflow activity package: ".$class.". Root cause: ".$@);
|
||||
return undef;
|
||||
}
|
||||
(my $module = "$class.pm") =~ s{'|::}{/}g;
|
||||
unless (eval { require $module; 1 }) {
|
||||
$session->errorHandler->error("Couldn't compile workflow activity package: ".$class.". Root cause: ".$@);
|
||||
return undef;
|
||||
}
|
||||
my $sub = $session->db->buildHashRef("select name,value from WorkflowActivityData where activityId=?",[$activityId]);
|
||||
my %data = (%{$main}, %{$sub});
|
||||
bless {_session=>$session, _id=>$activityId, _data=>\%data}, $class;
|
||||
for my $definition (reverse @{$class->definition($session)}) {
|
||||
for my $property (keys %{$definition->{properties}}) {
|
||||
if(!defined $data{$property} || $data{$property} eq '' && $definition->{properties}{$property}{defaultValue}) {
|
||||
$data{$property} = $definition->{properties}{$property}{defaultValue};
|
||||
}
|
||||
}
|
||||
}
|
||||
bless {_session=>$session, _id=>$activityId, _data=>\%data}, $class;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -77,14 +77,14 @@ sub execute {
|
|||
my $archiveDate = $epoch - $cs->get("archiveAfter");
|
||||
my $sql = "select asset.assetId, assetData.revisionDate from Post left join asset on asset.assetId=Post.assetId
|
||||
left join assetData on Post.assetId=assetData.assetId and Post.revisionDate=assetData.revisionDate
|
||||
where Post.dateUpdated<? and assetData.status='approved' and asset.state='published'
|
||||
where Post.revisionDate<? and assetData.status='approved' and asset.state='published'
|
||||
and Post.threadId=Post.assetId and asset.lineage like ?";
|
||||
my $b = $self->session->db->read($sql,[$archiveDate, $cs->get("lineage").'%']);
|
||||
while (my ($id, $version) = $b->array) {
|
||||
my $thread = WebGUI::Asset->new($self->session, $id, "WebGUI::Asset::Post::Thread", $version);
|
||||
my $archiveIt = 1;
|
||||
foreach my $post (@{$thread->getPosts}) {
|
||||
$archiveIt = 0 if (defined $post && $post->get("dateUpdated") > $archiveDate);
|
||||
$archiveIt = 0 if (defined $post && $post->get("revisionDate") > $archiveDate);
|
||||
}
|
||||
$thread->archive if ($archiveIt);
|
||||
}
|
||||
|
|
|
|||
103
lib/WebGUI/Workflow/Activity/DenyUnansweredFriends.pm
Normal file
103
lib/WebGUI/Workflow/Activity/DenyUnansweredFriends.pm
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
package WebGUI::Workflow::Activity::DenyUnansweredFriends;
|
||||
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
WebGUI is Copyright 2001-2007 Plain Black Corporation.
|
||||
-------------------------------------------------------------------
|
||||
Please read the legal notices (docs/legal.txt) and the license
|
||||
(docs/license.txt) that came with this distribution before using
|
||||
this software.
|
||||
-------------------------------------------------------------------
|
||||
http://www.plainblack.com info@plainblack.com
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use base 'WebGUI::Workflow::Activity';
|
||||
use WebGUI::DateTime;
|
||||
use DateTime::Duration;
|
||||
use WebGUI::Friends;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Workflow::Activity::DenyUnansweredFriends
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This activity denies unanswered "Add a friend" requests after a set period of time.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
See WebGUI::Workflow::Activity for details on how to use any activity.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
These methods are available from this class:
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( session, definition )
|
||||
|
||||
See WebGUI::Workflow::Activity::defintion() for details.
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift;
|
||||
my $i18n = WebGUI::International->new($session, "Friends");
|
||||
push(@{$definition}, {
|
||||
name => $i18n->get("deny unanswered friends"),
|
||||
properties => {
|
||||
timeout => {
|
||||
fieldType => "interval",
|
||||
label => $i18n->get("timeout"),
|
||||
defaultValue => 0,
|
||||
hoverHelp => $i18n->get("timeout help"),
|
||||
},
|
||||
}
|
||||
});
|
||||
return $class->SUPER::definition($session,$definition);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 execute ( [ object ] )
|
||||
|
||||
See WebGUI::Workflow::Activity::execute() for details.
|
||||
|
||||
=cut
|
||||
|
||||
sub execute {
|
||||
my $self = shift;
|
||||
my $start = time();
|
||||
my $session = $self->session;
|
||||
my $now = WebGUI::DateTime->new($session, $start);
|
||||
my $outdated = DateTime::Duration->new(seconds => $self->get("timeout"));
|
||||
my $pending = WebGUI::Friends->getAllPendingAddRequests($session);
|
||||
while (my $invite = $pending->hashRef) {
|
||||
my $sentOn = WebGUI::DateTime->new($session, $invite->{dateSent});
|
||||
if (DateTime::Duration->compare($now - $sentOn, $outdated) == 1) {
|
||||
WebGUI::Friends->new($session, WebGUI::User->new($session, $invite->{friendId}))->rejectAddRequest($invite->{inviteId});
|
||||
}
|
||||
if (time() - $start > 55) {
|
||||
$pending->finish;
|
||||
return $self->WAITING;
|
||||
}
|
||||
}
|
||||
return $self->COMPLETE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
@ -115,8 +115,8 @@ sub addPost {
|
|||
content=>$content,
|
||||
ownerUserId=>$user->userId,
|
||||
username=>$user->profileField("alias") || $user->username,
|
||||
originalEmail=>join("",@{$message->{rawMessage}})
|
||||
});
|
||||
originalEmail=>join("",@{$message->{rawMessage}}),
|
||||
});
|
||||
if (scalar(@attachments)) {
|
||||
my $storage = $post->getStorageLocation;
|
||||
foreach my $file (@attachments) {
|
||||
|
|
@ -176,14 +176,14 @@ sub execute {
|
|||
return $self->COMPLETE unless (defined $mail);
|
||||
my $i18n = WebGUI::International->new($self->session, "Asset_Collaboration");
|
||||
my $postGroup = $cs->get("postGroupId"); #group that's allowed to post to the CS
|
||||
|
||||
|
||||
while (my $message = $mail->getNextMessage) {
|
||||
next unless (scalar(@{$message->{parts}})); # no content, skip it
|
||||
my $from = $message->{from};
|
||||
$from =~ /<(\S+\@\S+)>/;
|
||||
$from = $1 || $from;
|
||||
$from =~ /(\S+\@\S+)/;
|
||||
my $user = WebGUI::User->newByEmail($self->session, $from); #instantiate the user by email
|
||||
if ($from =~ /<(\S+\@\S+)>/) {
|
||||
$from = $1;
|
||||
}
|
||||
my $user = WebGUI::User->newByEmail($self->session, $from); #instantiate the user by email
|
||||
|
||||
unless (defined $user) { #if no user
|
||||
unless ($postGroup eq 1 || $postGroup eq 7) { #reject mail if no registered email, unless post group is Visitors (1) or Everyone (7)
|
||||
|
|
@ -209,9 +209,8 @@ sub execute {
|
|||
}
|
||||
|
||||
my $post = undef;
|
||||
if ($message->{inReplyTo}) {
|
||||
$message->{inReplyTo} =~ m/cs\-([\w_-]{22})\@/;
|
||||
my $id = $1;
|
||||
if ($message->{inReplyTo} && $message->{inReplyTo} =~ m/cs\-([\w_-]{22})\@/) {
|
||||
my $id = $1;
|
||||
$post = WebGUI::Asset->newByDynamicClass($self->session, $id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ sub execute {
|
|||
if($ldap) {
|
||||
my $uri = $ldapLink->getURI();
|
||||
my $search = $ldap->search(
|
||||
base =>$ldapLink->getValue("ldapUserRDN"),
|
||||
base => $uri->dn,
|
||||
scope =>"sub",
|
||||
filter =>$ldapLink->getValue("ldapIdentity").'='.$userObject->username
|
||||
);
|
||||
|
|
|
|||
|
|
@ -75,8 +75,15 @@ See WebGUI::Workflow::Activity::execute() for details.
|
|||
|
||||
sub execute {
|
||||
my $self = shift;
|
||||
# do some work here, whatever this activity is supposed to do
|
||||
return $self->COMPLETE;
|
||||
my $object = shift;
|
||||
my $instance = shift;
|
||||
# do some work here, whatever this activity is supposed to do
|
||||
# Workflow is finished
|
||||
return $self->COMPLETE;
|
||||
# Or needs to be run again to finish processing
|
||||
#return $self->WAITING;
|
||||
# Or encountered an error and cannot finish
|
||||
#return $self->ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
217
lib/WebGUI/i18n/English/Friends.pm
Normal file
217
lib/WebGUI/i18n/English/Friends.pm
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
package WebGUI::i18n::English::Friends;
|
||||
|
||||
our $I18N = {
|
||||
|
||||
'invitation accepted by user' => {
|
||||
message => q{Your invitation has been accepted by %s.},
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'friends invitation accepted' => {
|
||||
message => q{Friends Invitation Accepted},
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'friends invitation not accepted by user' => {
|
||||
message => q{Your invitation has not been accepted by %s.},
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'friends invitation not accepted' => {
|
||||
message => q{Friends Invitation Not Accepted},
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'invitation approval email' => {
|
||||
message => q{%s has requested that you join their friend network on this site %s.
|
||||
|
||||
%s
|
||||
|
||||
Please visit the following url to accept or deny the request:
|
||||
|
||||
%s},
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'friends network invitation' => {
|
||||
message => q{Friends Network Invitation},
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'send friend email instructions' => {
|
||||
message => q{Check the friends you'd like to send a message to and then fill in the message below.},
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'confirm remove friends' => {
|
||||
message => q{Are you certain you wish to remove the selected friends from your list?},
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'already a friend' => {
|
||||
message => q{You can't add a friend twice.},
|
||||
lastUpdated => 1186028432,
|
||||
},
|
||||
|
||||
'add to friends list' => {
|
||||
message => q{Add this person to my friends list.},
|
||||
lastUpdated => 1186028432,
|
||||
},
|
||||
|
||||
'add to friends' => {
|
||||
message => q{Add to Friends},
|
||||
lastUpdated => 1186030775,
|
||||
},
|
||||
|
||||
'add to friends description' => {
|
||||
message => q{Do you really want to add %s as a friend?},
|
||||
lastUpdated => 1186030776,
|
||||
},
|
||||
|
||||
'add to friends confirmation' => {
|
||||
message => q{An email has been sent to %s for your request to be added to your friends network.},
|
||||
lastUpdated => 1186030776,
|
||||
},
|
||||
|
||||
'add to friends profile' => {
|
||||
message => q{Return to %s's Profile},
|
||||
lastUpdated => 1186030776,
|
||||
},
|
||||
|
||||
'does not want to be a friend' => {
|
||||
message => q{This user prefers not to be added as a friend.},
|
||||
lastUpdated => 1186264488,
|
||||
},
|
||||
|
||||
'manage friends template' => {
|
||||
message => q{Manage Friends Template},
|
||||
lastUpdated => 1186264488,
|
||||
context => "setting",
|
||||
},
|
||||
|
||||
'manage friends template help' => {
|
||||
message => q{Which template would you like to use for the "See my friends." screen in the user account?},
|
||||
lastUpdated => 1186264488,
|
||||
context => "setting",
|
||||
},
|
||||
|
||||
'deny unanswered friends' => {
|
||||
message => q{Deny Unanswered Friends},
|
||||
lastUpdated => 1186264488,
|
||||
context => "workflow activity",
|
||||
},
|
||||
|
||||
'timeout' => {
|
||||
message => q{Timeout},
|
||||
lastUpdated => 1186264488,
|
||||
context => "workflow activity",
|
||||
},
|
||||
|
||||
'timeout help' => {
|
||||
message => q{How long should invitations to a friends network go unanswered before we automatically deny the request?},
|
||||
lastUpdated => 1186264488,
|
||||
context => "workflow activity",
|
||||
},
|
||||
|
||||
'add' => {
|
||||
message => q{Add},
|
||||
lastUpdated => 1186264488,
|
||||
},
|
||||
|
||||
'default friend comments' => {
|
||||
message => q{%s,
|
||||
I'd like you to be a part of my friends network.
|
||||
|
||||
Thanks,
|
||||
%s},
|
||||
lastUpdated => 1186277362,
|
||||
},
|
||||
|
||||
'friend request' => {
|
||||
message => q{Friend Request},
|
||||
lastUpdated => 1186277362,
|
||||
},
|
||||
|
||||
'friend request description' => {
|
||||
message => q{%s has requested you be added to their friends list with the following comments:},
|
||||
lastUpdated => 1186277362,
|
||||
},
|
||||
|
||||
'invalid invite code' => {
|
||||
message => q|Invalid invitation code|,
|
||||
lastUpdated => 1186718713,
|
||||
},
|
||||
|
||||
'invalid invite code message' => {
|
||||
message => q|The invitation code in your URL is invalid.|,
|
||||
lastUpdated => 1186718715,
|
||||
},
|
||||
|
||||
'not the right user' => {
|
||||
message => q|The invitation code you are trying to use is not for you.|,
|
||||
lastUpdated => 1186718715,
|
||||
},
|
||||
|
||||
'you have not been added' => {
|
||||
message => q|You have denied %s's request.|,
|
||||
lastUpdated => 1186718715,
|
||||
},
|
||||
|
||||
'you have been added' => {
|
||||
message => q|You have been added to %s's Friends List.|,
|
||||
lastUpdated => 1186718715,
|
||||
},
|
||||
|
||||
'manage friends' => {
|
||||
message => q|Manage Friends or send them private messages.|,
|
||||
lastUpdated => 1186975937,
|
||||
},
|
||||
|
||||
'no friends' => {
|
||||
message => q|You haven't signed up any friends.|,
|
||||
lastUpdated => 1186976178,
|
||||
},
|
||||
|
||||
'my friends' => {
|
||||
message => q|My Friends|,
|
||||
lastUpdated => 1186976178,
|
||||
},
|
||||
|
||||
'name' => {
|
||||
message => q|Name|,
|
||||
lastUpdated => 1186976178,
|
||||
},
|
||||
|
||||
'status' => {
|
||||
message => q|Status|,
|
||||
lastUpdated => 1186976178,
|
||||
},
|
||||
|
||||
'online' => {
|
||||
message => q|Online|,
|
||||
lastUpdated => 1186976178,
|
||||
},
|
||||
|
||||
'offline' => {
|
||||
message => q|Offline|,
|
||||
lastUpdated => 1186976178,
|
||||
},
|
||||
|
||||
'send message' => {
|
||||
message => q|Send Message|,
|
||||
lastUpdated => 1186976178,
|
||||
},
|
||||
|
||||
'remove' => {
|
||||
message => q|Remove|,
|
||||
lastUpdated => 1186976178,
|
||||
},
|
||||
|
||||
'see my friends' => {
|
||||
message => q|See my friends.|,
|
||||
lastUpdated => 1187066104,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
@ -3138,8 +3138,8 @@ and tracked by WebGUI.|,
|
|||
},
|
||||
|
||||
'user function style description' => {
|
||||
message => q|Defines which style to be used to style WebGUI operations (profile editing, message log, etc.) when they are available to a user.|,
|
||||
lastUpdated => 1120239343,
|
||||
message => q|Defines which style to be used to style WebGUI operations (profile editing, message log, etc.) when they are available to a user. Only templates which have been committed are allowed.|,
|
||||
lastUpdated => 1192735786,
|
||||
},
|
||||
|
||||
'admin console template description' => {
|
||||
|
|
@ -3546,7 +3546,22 @@ LongTruncOk=1</p>
|
|||
},
|
||||
|
||||
'allow private messages label' => {
|
||||
message => q|Allow Private Messages|,
|
||||
message => q|Private Message Options|,
|
||||
lastUpdated => 1181019679,
|
||||
},
|
||||
|
||||
'user profile field private message allow label' => {
|
||||
message => q|Allow All|,
|
||||
lastUpdated => 1181019679,
|
||||
},
|
||||
|
||||
'user profile field private message friends only label' => {
|
||||
message => q|Allow From My Friends Only|,
|
||||
lastUpdated => 1181019679,
|
||||
},
|
||||
|
||||
'user profile field private message allow none label' => {
|
||||
message => q|Allow None|,
|
||||
lastUpdated => 1181019679,
|
||||
},
|
||||
|
||||
|
|
@ -3570,6 +3585,11 @@ LongTruncOk=1</p>
|
|||
lastUpdated => 1181019679,
|
||||
},
|
||||
|
||||
'private message delete text' => {
|
||||
message => q|delete|,
|
||||
lastUpdated => 1181019679,
|
||||
},
|
||||
|
||||
'view inbox template' => {
|
||||
message => q|Inbox Template|,
|
||||
lastUpdated => 1181019679,
|
||||
|
|
@ -3870,6 +3890,11 @@ LongTruncOk=1</p>
|
|||
lastUpdated => 1185162267,
|
||||
},
|
||||
|
||||
'user profile field friend availability' => {
|
||||
message => q{Are you available to be added as a Friend?},
|
||||
lastUpdated => 1185856549,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -179,13 +179,13 @@ our $I18N = {
|
|||
},
|
||||
|
||||
'spectre not running error' => {
|
||||
message => q|Spectre <b>is not running</b>.<br/>Unable to get workflow information.|,
|
||||
message => q|Spectre <b>is not running</b>.<br />Unable to get detailed workflow information.<br />|,
|
||||
context => q||,
|
||||
lastUpdated => 0,
|
||||
lastUpdated => 1192031332,
|
||||
},
|
||||
|
||||
'spectre no info error' => {
|
||||
message => q|Spectre <b>is running</b>, but I was not able to get workflow information.|,
|
||||
message => q|Spectre <b>is running</b>, but I was not able to get detailed workflow information.<br />|,
|
||||
context => q||,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -14,7 +14,10 @@ use lib "$FindBin::Bin/../../lib";
|
|||
|
||||
use Test::MockObject;
|
||||
my $mocker = Test::MockObject->new();
|
||||
$mocker->fake_module('WebGUI::Form::Image');
|
||||
#$mocker->fake_module('WebGUI::Form::Image', fake_method => sub {return 1;});
|
||||
# XXX
|
||||
# Hack to make this test run. This exact same code works fine for File.t above
|
||||
$mocker->fake_module('WebGUI::Form::Image', fake_method => sub {return 1;});
|
||||
$mocker->fake_new('WebGUI::Form::Image');
|
||||
|
||||
use WebGUI::Test;
|
||||
|
|
|
|||
|
|
@ -15,12 +15,14 @@ use lib "$FindBin::Bin/../lib";
|
|||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Asset::Template;
|
||||
use Test::More tests => 8; # increment this value for each test you create
|
||||
use Test::More tests => 10; # increment this value for each test you create
|
||||
use Test::Deep;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $list = WebGUI::Asset::Template->getList($session);
|
||||
ok(defined $list, "getList()");
|
||||
cmp_deeply($list, {}, 'getList with no classname returns an empty hashref');
|
||||
|
||||
my $template = " <tmpl_var variable> <tmpl_if conditional>true</tmpl_if> <tmpl_loop loop>XY</tmpl_loop> ";
|
||||
my %var = (
|
||||
variable=>"AAAAA",
|
||||
|
|
@ -31,11 +33,22 @@ my $output = WebGUI::Asset::Template->processRaw($session,$template,\%var);
|
|||
ok($output =~ m/\bAAAAA\b/, "processRaw() - variables");
|
||||
ok($output =~ m/true/, "processRaw() - conditionals");
|
||||
ok($output =~ m/\s(?:XY){5}\s/, "processRaw() - loops");
|
||||
|
||||
my $importNode = WebGUI::Asset::Template->getImportNode($session);
|
||||
my $template = $importNode->addChild({className=>"WebGUI::Asset::Template", title=>"test", url=>"testingtemplates", template=>$template});
|
||||
ok(defined $template, "creating a template");
|
||||
my $template = $importNode->addChild({className=>"WebGUI::Asset::Template", title=>"test", url=>"testingtemplates", template=>$template, namespace=>'WebGUI Test Template'});
|
||||
isa_ok($template, 'WebGUI::Asset::Template', "creating a template");
|
||||
|
||||
$var{variable} = "BBBBB";
|
||||
$output = $template->process(\%var);
|
||||
ok($output =~ m/\bAAAAA\b/, "process() - variables");
|
||||
ok($output =~ m/\bBBBBB\b/, "process() - variables");
|
||||
ok($output =~ m/true/, "process() - conditionals");
|
||||
ok($output =~ m/\s(?:XY){5}\s/, "process() - loops");
|
||||
|
||||
my $newList = WebGUI::Asset::Template->getList($session, 'WebGUI Test Template');
|
||||
ok(exists $newList->{$template->getId}, 'Uncommitted template exists returned from getList');
|
||||
|
||||
my $newList2 = WebGUI::Asset::Template->getList($session, 'WebGUI Test Template', "assetData.status='approved'");
|
||||
ok(!exists $newList2->{$template->getId}, 'extra clause to getList prevents uncommitted template from being displayed');
|
||||
|
||||
$template->purge;
|
||||
|
||||
|
|
|
|||
10
t/User.t
10
t/User.t
|
|
@ -20,7 +20,7 @@ use WebGUI::Cache;
|
|||
use WebGUI::User;
|
||||
use WebGUI::ProfileField;
|
||||
|
||||
use Test::More tests => 101; # increment this value for each test you create
|
||||
use Test::More tests => 103; # increment this value for each test you create
|
||||
use Test::Deep;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
|
@ -177,6 +177,11 @@ $user = WebGUI::User->new($session);
|
|||
is($user->userId, '1', 'new() -- returns visitor with no args');
|
||||
$user = "";
|
||||
|
||||
#Let's test new to retrieve a non-existing user
|
||||
$user = WebGUI::User->new($session, 'xxYYxxYYxxYYxxYYxxYYxx');
|
||||
isa_ok($user, 'WebGUI::User', 'non-existant ID returns valid user object');
|
||||
$user = "";
|
||||
|
||||
$user = WebGUI::User->new($session, "new", "ROYSUNIQUEUSERID000002");
|
||||
is($user->userId, "ROYSUNIQUEUSERID000002", 'new() -- override user id');
|
||||
$user->authMethod("LDAP");
|
||||
|
|
@ -273,6 +278,9 @@ is($result, 0, 'deleteFromGroups() -- Visitor removed from Everyone group');
|
|||
ok($visitor->isInGroup(1), "isInGroup: Visitor is in group Visitor, hardcoded");
|
||||
ok($visitor->isInGroup(7), "isInGroup: Everyone is in group Everyone, hardcoded");
|
||||
|
||||
##Test for group membership in a non-existant group
|
||||
ok(! $visitor->isInGroup('nonExistantGroup'), 'isInGroup: Checking for membership in a non-existant group');
|
||||
|
||||
##Add Visitor back to those groups
|
||||
WebGUI::Group->new($session, '1')->addUsers([1]);
|
||||
WebGUI::Group->new($session, '7')->addUsers([1]);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
.yui-tt {
|
||||
visibility:hidden;
|
||||
position:absolute;
|
||||
.wg-hoverhelp {
|
||||
visibility: collapse;
|
||||
display: none;
|
||||
background-color: #e6ecff;
|
||||
border: 1px solid #003399;
|
||||
color: #000066;
|
||||
|
|
@ -9,5 +9,10 @@
|
|||
font-weight: normal;
|
||||
padding: 3px;
|
||||
z-index: 1000;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.wg-hoverhelp.yui-tt {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
|
|
|||
11
www/extras/hoverhelp.js
Normal file
11
www/extras/hoverhelp.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
YAHOO.util.Event.onDOMReady(function () {
|
||||
var tips = YAHOO.util.Dom.getElementsByClassName('wg-hoverhelp');
|
||||
var i;
|
||||
for (i = 0; i < tips.length; i++) {
|
||||
var myTip = new YAHOO.widget.Tooltip(tips[i], {
|
||||
autodismissdelay: 1000000,
|
||||
context: tips[i].parentNode
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -8,7 +8,10 @@ if (url != null) {
|
|||
}
|
||||
|
||||
function init() {
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
// Nasty Hack
|
||||
if (!tinyMCE.isSafari) {
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
}
|
||||
|
||||
document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','theme_advanced_link');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue