Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
Sync between commit-digest and enzyme, framework version 1.23
Browse files Browse the repository at this point in the history
  • Loading branch information
dannya committed Jul 10, 2012
1 parent 10e1491 commit 6749399
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 77 deletions.
1 change: 1 addition & 0 deletions src/404.php
Expand Up @@ -16,4 +16,5 @@


echo '404';

?>
15 changes: 10 additions & 5 deletions src/classes/shared/date.php
Expand Up @@ -44,7 +44,7 @@ public static function ago($timestamp, $comparison = null) {
_('%d months ago'),
_('%d years ago'));

$lengths = array(60, 60, 24, 7, 4.35, 12);
$lengths = array(60, 60, 24, 7, 4.35, 12, 1);

// process input?
if (!is_int($timestamp)) {
Expand All @@ -61,14 +61,19 @@ public static function ago($timestamp, $comparison = null) {

// find correct period
for ($j = 0; $difference >= $lengths[$j]; $j++) {
if ($j > 5) {
$difference = $difference / $lengths[$j];

if ($j >= 6) {
break;
}

$difference /= $lengths[$j];
}

$difference = round($difference);
// handle years string better
if ($j == 6) {
$difference = round($difference, 2);
} else {
$difference = round($difference);
}

return sprintf($periods[$j], $difference);
}
Expand Down
100 changes: 50 additions & 50 deletions src/classes/shared/developer.php
Expand Up @@ -16,7 +16,7 @@


class Developer {
public $data = null;
public $data = null;
public $privacy = null;
public $access = null;
public $surveyDone = false;
Expand All @@ -30,7 +30,7 @@ class Developer {
// display: where the field is displayed ('all', 'admin', 'hidden')
// editable: whether this value can be changed within Enzyme
// privacy: whether privacy can be enabled/disabled for this field (wrap in array to represent enum)
public static $fields = array('account' => array('type' => 'string',
public static $fields = array('account' => array('type' => 'string',
'display' => 'all',
'editable' => false,
'privacy' => false),
Expand All @@ -42,69 +42,69 @@ class Developer {
'display' => 'all',
'editable' => true,
'privacy' => 'email'),
'nickname' => array('type' => 'string',
'nickname' => array('type' => 'string',
'display' => 'all',
'editable' => true,
'privacy' => 'nickname'),
'dob' => array('type' => 'date',
'dob' => array('type' => 'date',
'display' => 'all',
'editable' => true,
'privacy' => array('dob')),
'gender' => array('type' => 'enum',
'gender' => array('type' => 'enum',
'display' => 'all',
'editable' => true,
'privacy' => 'gender'),
'motivation' => array('type' => 'enum',
'motivation' => array('type' => 'enum',
'display' => 'all',
'editable' => true,
'privacy' => 'motivation'),
'employer' => array('type' => 'string',
'employer' => array('type' => 'string',
'display' => 'all',
'editable' => true,
'privacy' => 'employer'),
'colour' => array('type' => 'enum',
'colour' => array('type' => 'enum',
'display' => 'all',
'editable' => true,
'privacy' => 'colour'),

'continent' => array('type' => 'enum',
'continent' => array('type' => 'enum',
'display' => 'all',
'editable' => true,
'privacy' => 'continent'),
'country' => array('type' => 'enum',
'display' => 'all',
'editable' => true,
'privacy' => 'country'),
'location' => array('type' => 'string',
'location' => array('type' => 'string',
'display' => 'all',
'editable' => true,
'privacy' => 'location'),
'latitude' => array('type' => 'float',
'latitude' => array('type' => 'float',
'display' => 'all',
'editable' => true,
'privacy' => 'location'),
'longitude' => array('type' => 'float',
'longitude' => array('type' => 'float',
'display' => 'all',
'editable' => true,
'privacy' => 'location'),

'homepage' => array('type' => 'string',
'homepage' => array('type' => 'string',
'display' => 'all',
'editable' => true,
'privacy' => 'homepage'),
'blog' => array('type' => 'string',
'blog' => array('type' => 'string',
'display' => 'all',
'editable' => true,
'privacy' => 'blog'),
'lastfm' => array('type' => 'string',
'lastfm' => array('type' => 'string',
'display' => 'all',
'editable' => true,
'privacy' => 'lastfm'),
'microblog_type' => array('type' => 'enum',
'microblog_type' => array('type' => 'enum',
'display' => 'all',
'editable' => true,
'privacy' => 'microblog'),
'microblog_user' => array('type' => 'string',
'microblog_user' => array('type' => 'string',
'display' => 'all',
'editable' => true,
'privacy' => 'microblog'),
Expand Down Expand Up @@ -174,31 +174,31 @@ public function load($value = null, $field = 'account', $createBuffer = false) {
// check if survey has been completed
$this->surveyDone = Db::exists('developer_survey', array('account' => $privacy['account']));

// set privacy settings to each data value
foreach (self::$fields as $id => $spec) {
if (!isset($spec['privacy'])) {
continue;
}
// set privacy settings to each data value
foreach (self::$fields as $id => $spec) {
if (!isset($spec['privacy'])) {
continue;
}

if ($spec['privacy'] === false) {
// set privacy as irrelevant for this field
$this->privacy[$id] = null;
if ($spec['privacy'] === false) {
// set privacy as irrelevant for this field
$this->privacy[$id] = null;

} else if (is_array($spec['privacy'])) {
$spec['privacy'] = reset($spec['privacy']);
} else if (is_array($spec['privacy'])) {
$spec['privacy'] = reset($spec['privacy']);

// note that we cast to int here if possible (not bool, as done below)!
if (is_numeric($privacy[$spec['privacy']])) {
$this->privacy[$id] = (int)$privacy[$spec['privacy']];
} else {
$this->privacy[$id] = $privacy[$spec['privacy']];
}

// note that we cast to int here if possible (not bool, as done below)!
if (is_numeric($privacy[$spec['privacy']])) {
$this->privacy[$id] = (int)$privacy[$spec['privacy']];
} else {
$this->privacy[$id] = $privacy[$spec['privacy']];
// cast to boolean for ease of use
$this->privacy[$id] = (bool)$privacy[$spec['privacy']];
}

} else {
// cast to boolean for ease of use
$this->privacy[$id] = (bool)$privacy[$spec['privacy']];
}
}

// make terms_accepted version available too
$this->privacy['terms_accepted'] = $privacy['terms_accepted'];
Expand All @@ -210,12 +210,12 @@ public function load($value = null, $field = 'account', $createBuffer = false) {
$this->internalPrivacy = $privacy;


// set access details (if this method of loading was used)
if ($field == 'access_code') {
$this->access = array('ip' => $privacy['access_ip'],
'code' => $privacy['access_code'],
'timeout' => $privacy['access_timeout']);
}
// set access details (if this method of loading was used)
if ($field == 'access_code') {
$this->access = array('ip' => $privacy['access_ip'],
'code' => $privacy['access_code'],
'timeout' => $privacy['access_timeout']);
}
}


Expand Down Expand Up @@ -329,21 +329,21 @@ public function changePrivacy($field, $newValue, $save = false) {


public static function getFieldStrings() {
$fields = array('account' => _('Account'),
$fields = array('account' => _('Account'),
'name' => _('Name'),
'email' => _('Email'),
'nickname' => _('Nickname'),
'nickname' => _('Nickname'),
'dob' => _('Date of Birth'),
'gender' => _('Gender'),
'gender' => _('Gender'),
'motivation' => _('Motivation'),
'employer' => _('Employer'),
'colour' => _('Colour'),

'continent' => _('Continent'),
'country' => _('Country'),
'location' => _('Location'),
'latitude' => _('Latitude'),
'longitude' => _('Longitude'),
'continent' => _('Continent'),
'country' => _('Country'),
'location' => _('Location'),
'latitude' => _('Latitude'),
'longitude' => _('Longitude'),

'homepage' => _('Homepage URL'),
'blog' => _('Blog URL'),
Expand Down
6 changes: 3 additions & 3 deletions src/classes/shared/digest.php
Expand Up @@ -333,9 +333,9 @@ public static function loadDigest($date, &$digest = null) {
// could be name or account
$identifier = $row['identifier'];

// record person so we can get name, etc later
$people[$row['identifier']] = $row['identifier'];
}
// record person so we can get name, etc later
$people[$row['identifier']] = $row['identifier'];
}

$digest['stats']['bugfixers'][$identifier] = $row['value'];
}
Expand Down
10 changes: 5 additions & 5 deletions src/classes/shared/enzyme.php
Expand Up @@ -2,7 +2,7 @@

/*-------------------------------------------------------+
| Enzyme
| Copyright 2010-2011 Danny Allen <danny@enzyme-project.org>
| Copyright 2010-2012 Danny Allen <danny@enzyme-project.org>
| http://www.enzyme-project.org/
+--------------------------------------------------------+
| This program is released as free software under the
Expand Down Expand Up @@ -878,9 +878,9 @@ public static function generateStatsFromDb($start, $end) {
Ui::displayMsg(_('Getting revision data...'));


$data = Db::load('commits',
$data = Db::load('commits',
array('date' => array('type' => 'range',
'args' => array($boundaries['start'], $boundaries['end']))),
'args' => array($boundaries['start'], $boundaries['end']))),
null,
'*',
true,
Expand Down Expand Up @@ -1188,8 +1188,8 @@ public static function processExtendedStats($date, array $stats, array $revision


// extract overall numbers
preg_match_all('/ [0-9]+ /', $page->find('div#main h3', 0)->innertext, $totalBugs);
preg_match_all('/[0-9]+ /', $page->find('div#main h4', 0)->innertext, $weekBugs);
preg_match_all('/ [0-9]+ /', $page->find('div#bugzilla-body h3', 0)->innertext, $totalBugs);
preg_match_all('/[0-9]+ /', $page->find('div#bugzilla-body h4', 0)->innertext, $weekBugs);

$totalBugs = reset($totalBugs);
$weekBugs = reset($weekBugs);
Expand Down
6 changes: 3 additions & 3 deletions src/classes/shared/ui.php
Expand Up @@ -150,9 +150,9 @@ public static function htmlSelector($id, $items, $preselectKey = null,

} else {
// if items are numerically-indexed, use safer method
$items[''] = '';
ksort($items);
}
$items[''] = '';
ksort($items);
}
}


Expand Down
4 changes: 2 additions & 2 deletions src/classes/specific/config.php
Expand Up @@ -16,13 +16,13 @@


final class Config {
public static $framework = array('version' => '20111004');
public static $framework = array('version' => '20120710');


// define app constants
public static $app = array('id' => 'enzyme',
'name' => 'Enzyme',
'version' => '1.22');
'version' => '1.23');


// define meta information
Expand Down
2 changes: 1 addition & 1 deletion src/get/reset-password.php
Expand Up @@ -79,7 +79,7 @@


// send email
$email = new Email($to, sprintf('%s Reset Password', Config::getSetting('enzyme', 'PROJECT_NAME')), $message);
$email = new Email($to, sprintf(_('%s Reset Password'), Config::getSetting('enzyme', 'PROJECT_NAME')), $message);
$json['success'] = $email->send();
}

Expand Down
5 changes: 3 additions & 2 deletions src/js/frame/usersui.js
Expand Up @@ -232,11 +232,12 @@ function saveChange(user, event) {

// if "username" (which is also the database identifier!) changes, update method calls and DOM
if (theDataType == 'username') {
alert('s');
// TODO: we also need to change the username references in the db!

var username = element.value;
var parentRow = element.up('tr');
var fields = parentRow.select('input');

// update account status button
var accountButton = parentRow.select('div.account-status').first();
accountButton.writeAttribute('id', "active-" + username);
Expand Down
2 changes: 1 addition & 1 deletion src/js/index.php
Expand Up @@ -2,7 +2,7 @@

/*-------------------------------------------------------+
| Enzyme
| Copyright 2010-2011 Danny Allen <danny@enzyme-project.org>
| Copyright 2010-2012 Danny Allen <danny@enzyme-project.org>
| http://www.enzyme-project.org/
+--------------------------------------------------------+
| This program is released as free software under the
Expand Down

0 comments on commit 6749399

Please sign in to comment.