Skip to content

Commit 216e55f

Browse files
committed
[smarcet] - initial commit
0 parents  commit 216e55f

File tree

2,783 files changed

+423514
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,783 files changed

+423514
-0
lines changed

.gitignore

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#assets
2+
!assets/error-404.html
3+
!assets/error-500.html
4+
assets/*
5+
6+
sortablegridfield
7+
framework
8+
colorpicker
9+
cms
10+
translatable
11+
vendor
12+
13+
/openstack-marketing-portal/*
14+
/blog/*
15+
/cache/*
16+
.htaccess
17+
debug.log
18+
openstack/_live-config.php
19+
_ss_environment.php
20+
simplepie/cache/*
21+
silverstripe-cache/*
22+
silverstripe-cache/
23+
silverstripe-cache
24+
/.buildpath
25+
/.project
26+
27+
# PDT-specific
28+
.buildpath
29+
30+
# Locally stored "Eclipse launch configurations"
31+
*.launch
32+
.settings/
33+
34+
.idea/
35+
36+
37+
#composer
38+
composer.lock
39+
composer.phar
40+
backup_scripts/cron-backup-config.php
41+
logs
42+
feeds/cache
43+
openstack/_config.php
44+
logs/*
45+
sapphire/thirdparty/htmlpurifier-4.4.0/library/HTMLPurifier/DefinitionCache/Serializer/HTML/
46+
elections/input

ICLA/_config.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
//decorators
4+
Object::add_extension('Member', 'ICLAMemberDecorator');
5+
Object::add_extension('Company', 'ICLACompanyDecorator');
6+
Object::add_extension('SangriaPage_Controller', 'SangriaPageICLACompaniesExtension');
7+
Object::add_extension('EditProfilePage_Controller', 'EditProfilePageICLAExtension');
8+
9+
//configuration
10+
define('ICLA_GROUP_ID', 'a49e4febb69477d0aa5737038c1802dd6cab67c5');
11+
define('GERRIT_BASE_URL', 'https://review.openstack.org');
12+
define('GERRIT_USER', 'smarcet');
13+
define('GERRIT_PASSWORD', 'TwxKcgZurLX6');
14+
define('PULL_ICLA_DATA_FROM_GERRIT_BATCH_SIZE', 1000);
15+
define('PULL_LAST_COMMITTED_DATA_FROM_GERRIT_BATCH_SIZE', 1000);
16+
define('CCLA_TEAM_INVITATION_EMAIL_FROM','[email protected]');
17+
18+
define('CCLA_DEBUG_EMAIL','[email protected]');
19+
20+
PublisherSubscriberManager::getInstance()->subscribe('new_user_registered', function($member_id){
21+
//check if user has pending invitations
22+
$team_manager = new CCLATeamManager(new SapphireTeamInvitationRepository,
23+
new SapphireCLAMemberRepository,
24+
new TeamInvitationFactory,
25+
new TeamFactory,
26+
new CCLAValidatorFactory,
27+
new SapphireTeamRepository,
28+
SapphireTransactionManager::getInstance());
29+
30+
$team_manager->verifyInvitations($member_id, new TeamInvitationEmailSender(new SapphireTeamInvitationRepository));
31+
});

ICLA/_config/routes.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
Name: iclaroutes
3+
After: 'framework/routes#coreroutes'
4+
---
5+
Director:
6+
rules:
7+
'api/v1/ccla': 'ICLARestfulAPI'
8+
'team-invitations': 'TeamInvitationConfirmation_Controller'
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?php
2+
3+
/**
4+
* Class BatchTask
5+
*/
6+
final class BatchTask
7+
extends DataObject
8+
implements IBatchTask {
9+
10+
static $create_table_options = array('MySQLDatabase' => 'ENGINE=InnoDB');
11+
12+
static $db = array(
13+
'Name' => 'Text',
14+
'LastResponse' => 'Text',
15+
'LastRecordIndex' => 'Int',
16+
'LastResponseDate' => 'SS_Datetime',
17+
'TotalRecords' => 'Int',
18+
);
19+
20+
/***
21+
* @return string
22+
*/
23+
public function name()
24+
{
25+
return (string)$this->getField('Name');
26+
}
27+
28+
/***
29+
* @return int
30+
*/
31+
public function lastRecordProcessed()
32+
{
33+
return (int)$this->getField('LastRecordIndex');
34+
}
35+
36+
/**
37+
* @return string
38+
*/
39+
public function lastResponse()
40+
{
41+
return (string)$this->getField('LastResponse');
42+
}
43+
44+
/**
45+
* @return DateTime
46+
*/
47+
public function lastResponseDate()
48+
{
49+
return new DateTime($this->getField('LastResponseDate'));
50+
}
51+
52+
/**
53+
* @return int
54+
*/
55+
public function totalRecords()
56+
{
57+
return (int)$this->getField('TotalRecords');
58+
}
59+
60+
/**
61+
* @param string $response
62+
* @return void
63+
*/
64+
public function updateResponse($response)
65+
{
66+
$this->setField('LastResponse', $response);
67+
}
68+
69+
/**
70+
* @return void
71+
*/
72+
public function updateLastRecord()
73+
{
74+
$last = $this->lastRecordProcessed();
75+
$this->setField('LastRecordIndex', $last+1 );
76+
}
77+
78+
/**
79+
* @return int
80+
*/
81+
public function getIdentifier()
82+
{
83+
return (int)$this->getField('ID');
84+
}
85+
86+
/**
87+
* @param int $total_qty
88+
* @return void
89+
*/
90+
public function initialize($total_qty){
91+
$this->setField('LastRecordIndex', 0 );
92+
$this->setField('TotalRecords', $total_qty );
93+
}
94+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?php
2+
3+
/**
4+
* Class ICLACompanyDecorator
5+
*/
6+
class ICLACompanyDecorator
7+
extends DataExtension
8+
{
9+
//Add extra database fields
10+
11+
private static $db = array(
12+
'CCLASigned' => 'Boolean',
13+
'CCLADate' => 'SS_Datetime',
14+
);
15+
16+
private static $defaults = array(
17+
'CCLASigned' => FALSE,
18+
);
19+
20+
21+
private static $has_many = array(
22+
'Teams' => 'Team'
23+
);
24+
25+
26+
/**
27+
* @return void
28+
*/
29+
public function signICLA()
30+
{
31+
$this->owner->setField('CCLASigned',true);
32+
$this->owner->setField('CCLADate', SS_Datetime::now()->Rfc2822());
33+
}
34+
35+
/**
36+
* @return void
37+
*/
38+
public function unsignICLA()
39+
{
40+
$this->owner->setField('CCLASigned',false);
41+
$this->owner->setField('CCLADate', null);
42+
}
43+
44+
/**
45+
* @return bool
46+
*/
47+
public function isICLASigned()
48+
{
49+
return (bool)$this->owner->getField('CCLASigned');
50+
}
51+
52+
/**
53+
* @return Datetime
54+
*/
55+
public function ICLASignedDate()
56+
{
57+
$ss_datetime = $this->owner->getField('CCLADate');
58+
return new DateTime($ss_datetime);
59+
}
60+
61+
/**
62+
* @return int
63+
*/
64+
public function getIdentifier()
65+
{
66+
return (int)$this->owner->getField('ID');
67+
}
68+
69+
70+
/**
71+
* @return ITeam[]
72+
*/
73+
public function Teams()
74+
{
75+
return AssociationFactory::getInstance()->getOne2ManyAssociation($this->owner , 'Teams', new QueryObject)->toArray();
76+
}
77+
78+
public function addTeam(ITeam $team)
79+
{
80+
AssociationFactory::getInstance()->getOne2ManyAssociation($this->owner , 'Teams', new QueryObject)->add($team);
81+
}
82+
83+
}

0 commit comments

Comments
 (0)