Adding karma.
This commit is contained in:
parent
428dd45110
commit
566a62e6af
4 changed files with 27 additions and 10 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
insert into webguiVersion values ('4.1.0','upgrade',unix_timestamp());
|
insert into webguiVersion values ('4.1.0','upgrade',unix_timestamp());
|
||||||
alter table users add column karma int not null default 0;
|
alter table users add column karma int not null default 0;
|
||||||
alter table groups add column karmaThreshold int not null default 99999999999;
|
alter table groups add column karmaThreshold int not null default 1000000000;
|
||||||
create table karmaLog (
|
create table karmaLog (
|
||||||
userId int not null,
|
userId int not null,
|
||||||
amount int not null default 1,
|
amount int not null default 1,
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@ sub www_editGroup {
|
||||||
if (WebGUI::Privilege::isInGroup(3)) {
|
if (WebGUI::Privilege::isInGroup(3)) {
|
||||||
if ($session{form}{gid} eq "new") {
|
if ($session{form}{gid} eq "new") {
|
||||||
$group{expireAfter} = 314496000;
|
$group{expireAfter} = 314496000;
|
||||||
|
$group{karmaThreshold} = 1000000000;
|
||||||
} else {
|
} else {
|
||||||
%group = WebGUI::SQL->quickHash("select * from groups where groupId=$session{form}{gid}");
|
%group = WebGUI::SQL->quickHash("select * from groups where groupId=$session{form}{gid}");
|
||||||
}
|
}
|
||||||
|
|
@ -80,6 +81,7 @@ sub www_editGroup {
|
||||||
$f->text("groupName",WebGUI::International::get(84),$group{groupName});
|
$f->text("groupName",WebGUI::International::get(84),$group{groupName});
|
||||||
$f->textarea("description",WebGUI::International::get(85),$group{description});
|
$f->textarea("description",WebGUI::International::get(85),$group{description});
|
||||||
$f->integer("expireAfter",WebGUI::International::get(367),$group{expireAfter});
|
$f->integer("expireAfter",WebGUI::International::get(367),$group{expireAfter});
|
||||||
|
$f->integer("karmaThreshold",WebGUI::International::get(538),$group{karmaThreshold});
|
||||||
$f->submit;
|
$f->submit;
|
||||||
$output .= $f->print;
|
$output .= $f->print;
|
||||||
unless ($session{form}{gid} eq "new") {
|
unless ($session{form}{gid} eq "new") {
|
||||||
|
|
@ -116,7 +118,8 @@ sub www_editGroupSave {
|
||||||
WebGUI::SQL->write("insert into groups (groupId) values ($session{form}{gid})");
|
WebGUI::SQL->write("insert into groups (groupId) values ($session{form}{gid})");
|
||||||
}
|
}
|
||||||
WebGUI::SQL->write("update groups set groupName=".quote($session{form}{groupName}).",
|
WebGUI::SQL->write("update groups set groupName=".quote($session{form}{groupName}).",
|
||||||
description=".quote($session{form}{description}).", expireAfter='$session{form}{expireAfter}'
|
description=".quote($session{form}{description}).", expireAfter='$session{form}{expireAfter}',
|
||||||
|
karmaThreshold='$session{form}{karmaThreshold}'
|
||||||
where groupId=".$session{form}{gid});
|
where groupId=".$session{form}{gid});
|
||||||
return www_listGroups();
|
return www_listGroups();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,7 @@ sub www_editUser {
|
||||||
$f->hidden("op","editUserSave");
|
$f->hidden("op","editUserSave");
|
||||||
$f->hidden("uid",$session{form}{uid});
|
$f->hidden("uid",$session{form}{uid});
|
||||||
$f->readOnly($session{form}{uid},WebGUI::International::get(378));
|
$f->readOnly($session{form}{uid},WebGUI::International::get(378));
|
||||||
|
$f->readOnly($u->karma,WebGUI::International::get(537));
|
||||||
$f->readOnly(epochToHuman($u->dateCreated,"%z"),WebGUI::International::get(453));
|
$f->readOnly(epochToHuman($u->dateCreated,"%z"),WebGUI::International::get(453));
|
||||||
$f->readOnly(epochToHuman($u->lastUpdated,"%z"),WebGUI::International::get(454));
|
$f->readOnly(epochToHuman($u->lastUpdated,"%z"),WebGUI::International::get(454));
|
||||||
$f->text("username",WebGUI::International::get(50),$u->username);
|
$f->text("username",WebGUI::International::get(50),$u->username);
|
||||||
|
|
|
||||||
|
|
@ -30,14 +30,15 @@ use WebGUI::URL;
|
||||||
use WebGUI::User;
|
use WebGUI::User;
|
||||||
$u = WebGUI::User->new(3); or $f = WebGUI::User->new("new");
|
$u = WebGUI::User->new(3); or $f = WebGUI::User->new("new");
|
||||||
|
|
||||||
$authMethod = $u->authMethod("WebGUI");
|
$authMethod = $u->authMethod("WebGUI");
|
||||||
$connectDN = $u->authMethod("cn=Jon Doe");
|
$connectDN = $u->authMethod("cn=Jon Doe");
|
||||||
$dateCreated = $u->dateCreated;
|
$dateCreated = $u->dateCreated;
|
||||||
$identifier = $u->identifier("somepassword");
|
$identifier = $u->identifier("somepassword");
|
||||||
$lastUpdated = $u->lastUpdated;
|
$karma = $u->karma;
|
||||||
$ldapURL = $u->ldapURL("ldap://ldap.mycompany.com:389/o=MyCompany");
|
$lastUpdated = $u->lastUpdated;
|
||||||
$languagePreference = $u->profileField("language","English");
|
$ldapURL = $u->ldapURL("ldap://ldap.mycompany.com:389/o=MyCompany");
|
||||||
$username = $u->username("jonboy");
|
$languagePreference = $u->profileField("language","English");
|
||||||
|
$username = $u->username("jonboy");
|
||||||
|
|
||||||
$u->addToGroups(\@arr);
|
$u->addToGroups(\@arr);
|
||||||
$u->deleteFromGroups(\@arr);
|
$u->deleteFromGroups(\@arr);
|
||||||
|
|
@ -213,6 +214,18 @@ sub identifier {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 karma ( )
|
||||||
|
|
||||||
|
Returns the current level of karma this user has earned.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub karma {
|
||||||
|
return $_[0]->{_user}{karma};
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 lastUpdated ( )
|
=head2 lastUpdated ( )
|
||||||
|
|
||||||
Returns the epoch for when this user was last modified.
|
Returns the epoch for when this user was last modified.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue