add: Friends network

This commit is contained in:
Doug Bell 2007-10-22 19:42:11 +00:00
parent f73233de48
commit 587443b801
16 changed files with 1383 additions and 49 deletions

View file

@ -6,6 +6,7 @@
- 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

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

@ -21,17 +21,83 @@ 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.\n" unless ($quiet);
# # and here's our code
# 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 ----