merged with SVN to get friends stuff

This commit is contained in:
Doug Bell 2007-10-26 00:50:05 +00:00
commit 7e12c6c2f0
73 changed files with 3262 additions and 424 deletions

View file

@ -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

View 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;
}

View file

@ -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>

View 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;">&nbsp;</td>
<td style="width:3px;background-color:silver;">&nbsp;</td>
<td style="width:10px;">&nbsp;</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>

View 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;">&nbsp;</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;">&nbsp;</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>&#160;</td>
<td>&#160;</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>&#160;</td>
<td>&#160;</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>

View 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>&#160;</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>&#160;</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>

View 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>

View 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>

View 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>

View 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;
}

View file

@ -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;
}
}
}

View 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;
}