Merge
This commit is contained in:
commit
c9565db7a3
72
indefero/src/IDF/Form/ProjectRequest.php
Normal file
72
indefero/src/IDF/Form/ProjectRequest.php
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
class IDF_Form_ProjectRequest extends Pluf_Form
|
||||||
|
{
|
||||||
|
public $user = null;
|
||||||
|
|
||||||
|
public function initFields($extra=array())
|
||||||
|
{
|
||||||
|
|
||||||
|
$choices = array();
|
||||||
|
$options = array(
|
||||||
|
'git' => __('git'),
|
||||||
|
'svn' => __('Subversion'),
|
||||||
|
'mercurial' => __('mercurial'),
|
||||||
|
'mtn' => __('monotone'),
|
||||||
|
);
|
||||||
|
foreach (Pluf::f('allowed_scm', array()) as $key => $class) {
|
||||||
|
$choices[$options[$key]] = $key;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->fields['shortname'] = new Pluf_Form_Field_Varchar(
|
||||||
|
array('required' => true,
|
||||||
|
'label' => __('Name'),
|
||||||
|
'initial' => '',
|
||||||
|
'help_text' => __('This will be the name of your repo and of your project - however - you can change the project name later.'),
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->fields['repotype'] = new Pluf_Form_Field_Varchar(
|
||||||
|
array('required' => true,
|
||||||
|
'label' => __('Repository type'),
|
||||||
|
'initial' => 'git',
|
||||||
|
'widget_attrs' => array('choices' => $choices),
|
||||||
|
'widget' => 'Pluf_Form_Widget_SelectInput',
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->fields['desc'] = new Pluf_Form_Field_Varchar(
|
||||||
|
array('required' => true,
|
||||||
|
'label' => __('Short description'),
|
||||||
|
'help_text' => __('A one line description of the project.'),
|
||||||
|
'initial' => '',
|
||||||
|
'widget_attrs' => array('size' => '35'),
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->user = $extra['user'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function save($commit=true)
|
||||||
|
{
|
||||||
|
if (!$this->isValid()) {
|
||||||
|
throw new Exception(__('Cannot save the model from an invalid form.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$checksql = new Pluf_SQL(sprintf("shortname='%s'", $this->cleaned_data['shortname']));
|
||||||
|
$requestcheck = Pluf::factory("IDF_Project")->getCount(array('filter'=>$checksql->gen()));
|
||||||
|
if ($requestcheck == 1)
|
||||||
|
return false;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$request = new IDF_ProjectRequest();
|
||||||
|
$request->shortname = $this->cleaned_data['shortname'];
|
||||||
|
$request->repotype = $this->cleaned_data['repotype'];
|
||||||
|
$request->desc = $this->cleaned_data['desc'];
|
||||||
|
$request->submitter = $this->user;
|
||||||
|
$request->create();
|
||||||
|
return true;
|
||||||
|
} catch (Exception $e)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -55,12 +55,6 @@ class IDF_Form_Register extends Pluf_Form
|
|||||||
'help_text' => __('We will never send you any unsolicited emails. We hate spam too!'),
|
'help_text' => __('We will never send you any unsolicited emails. We hate spam too!'),
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->fields['regkey'] = new Pluf_Form_Field_Varchar(
|
|
||||||
array('required' => true,
|
|
||||||
'label' => __('Registration Key'),
|
|
||||||
'initial' => '',
|
|
||||||
'help_text' => __('Please enter the key given to you by adamsna[at]datanethost.net'),
|
|
||||||
));
|
|
||||||
|
|
||||||
$this->fields['terms'] = new Pluf_Form_Field_Boolean(
|
$this->fields['terms'] = new Pluf_Form_Field_Boolean(
|
||||||
array('required' => true,
|
array('required' => true,
|
||||||
@ -71,8 +65,7 @@ class IDF_Form_Register extends Pluf_Form
|
|||||||
|
|
||||||
public function clean_regkey()
|
public function clean_regkey()
|
||||||
{
|
{
|
||||||
if ($this->cleaned_data['regkey'] != "2rv9o4nb5")
|
|
||||||
throw new Pluf_Form_Invalid("The regkey was incorrect - please contact Nathan for the key!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
17
indefero/src/IDF/Migrations/27ProjectRequest.php
Normal file
17
indefero/src/IDF/Migrations/27ProjectRequest.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
function IDF_Migrations_27ProjectRequest_up($params=null)
|
||||||
|
{
|
||||||
|
$db = Pluf::db();
|
||||||
|
$schema = new Pluf_DB_Schema($db);
|
||||||
|
$schema->model = new IDF_ProjectRequest();
|
||||||
|
$schema->createTables();
|
||||||
|
}
|
||||||
|
|
||||||
|
function IDF_Migrations_27ProjectRequest_down($params=null)
|
||||||
|
{
|
||||||
|
$db = Pluf::db();
|
||||||
|
$schema = new Pluf_DB_Schema($db);
|
||||||
|
$schema->model = new IDF_ProjectRequest();
|
||||||
|
$schema->dropTables();
|
||||||
|
|
||||||
|
}
|
@ -55,6 +55,7 @@ function IDF_Migrations_Install_setup($params=null)
|
|||||||
'IDF_Gconf',
|
'IDF_Gconf',
|
||||||
'IDF_EmailAddress',
|
'IDF_EmailAddress',
|
||||||
'IDF_IssueRelation',
|
'IDF_IssueRelation',
|
||||||
|
'IDF_ProjectRequest'
|
||||||
);
|
);
|
||||||
$db = Pluf::db();
|
$db = Pluf::db();
|
||||||
$schema = new Pluf_DB_Schema($db);
|
$schema = new Pluf_DB_Schema($db);
|
||||||
@ -121,6 +122,7 @@ function IDF_Migrations_Install_teardown($params=null)
|
|||||||
'IDF_Project',
|
'IDF_Project',
|
||||||
'IDF_EmailAddress',
|
'IDF_EmailAddress',
|
||||||
'IDF_IssueRelation',
|
'IDF_IssueRelation',
|
||||||
|
'IDF_ProjectRequest'
|
||||||
);
|
);
|
||||||
$db = Pluf::db();
|
$db = Pluf::db();
|
||||||
$schema = new Pluf_DB_Schema($db);
|
$schema = new Pluf_DB_Schema($db);
|
||||||
|
85
indefero/src/IDF/ProjectRequest.php
Normal file
85
indefero/src/IDF/ProjectRequest.php
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* This is the model for people to request a repo
|
||||||
|
* An administrator can then approve/deny the repo
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
class IDF_ProjectRequest extends Pluf_Model
|
||||||
|
{
|
||||||
|
public $_model = __CLASS__;
|
||||||
|
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
$this->_a['table'] = 'idf_projectrequest';
|
||||||
|
$this->_a['model'] = __CLASS__;
|
||||||
|
|
||||||
|
$this->_a['cols'] = array(
|
||||||
|
// It is mandatory to have an "id" column.
|
||||||
|
'id' =>
|
||||||
|
array(
|
||||||
|
'type' => 'Pluf_DB_Field_Sequence',
|
||||||
|
'blank' => true,
|
||||||
|
),
|
||||||
|
'shortname' =>
|
||||||
|
array(
|
||||||
|
'type' => 'Pluf_DB_Field_Varchar',
|
||||||
|
'blank' => false,
|
||||||
|
'size' => 50,
|
||||||
|
'verbose' => __('shortname'),
|
||||||
|
'unique' => true,
|
||||||
|
),
|
||||||
|
'repotype' =>
|
||||||
|
array(
|
||||||
|
'type' => 'Pluf_DB_Field_Varchar',
|
||||||
|
'blank' => false,
|
||||||
|
'size' => 25,
|
||||||
|
'verbose' => __('Repository Type'),
|
||||||
|
),
|
||||||
|
'desc' =>
|
||||||
|
array(
|
||||||
|
'type' => 'Pluf_DB_Field_Varchar',
|
||||||
|
'blank' => false,
|
||||||
|
'size' => 250,
|
||||||
|
'verbose' => __('Description'),
|
||||||
|
),
|
||||||
|
'creation_dtime' =>
|
||||||
|
array(
|
||||||
|
'type' => 'Pluf_DB_Field_Datetime',
|
||||||
|
'blank' => true,
|
||||||
|
'verbose' => __('creation date'),
|
||||||
|
),
|
||||||
|
'submitter' =>
|
||||||
|
array(
|
||||||
|
'type' => 'Pluf_DB_Field_Foreignkey',
|
||||||
|
'model' => 'Pluf_User',
|
||||||
|
'blank' => false,
|
||||||
|
'verbose' => __('submitter'),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String representation of the abstract.
|
||||||
|
*/
|
||||||
|
function __toString()
|
||||||
|
{
|
||||||
|
return $this->shortname;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String ready for indexation.
|
||||||
|
*/
|
||||||
|
function _toIndex()
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function preSave($create=false)
|
||||||
|
{
|
||||||
|
if ($this->id == '') {
|
||||||
|
$this->creation_dtime = gmdate('Y-m-d H:i:s');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -74,9 +74,9 @@ class IDF_Scm_Git extends IDF_Scm
|
|||||||
|
|
||||||
foreach ($out as $line) {
|
foreach ($out as $line) {
|
||||||
$line = trim($line);
|
$line = trim($line);
|
||||||
|
|
||||||
if ($line != '') {
|
if ($line != '') {
|
||||||
$action = $line[0];
|
$action = $line[0];
|
||||||
|
|
||||||
if ($action == 'A') {
|
if ($action == 'A') {
|
||||||
$filename = trim(substr($line, 1));
|
$filename = trim(substr($line, 1));
|
||||||
$return->additions[] = $filename;
|
$return->additions[] = $filename;
|
||||||
@ -87,8 +87,19 @@ class IDF_Scm_Git extends IDF_Scm
|
|||||||
$filename = trim(substr($line, 1));
|
$filename = trim(substr($line, 1));
|
||||||
$return->patches[] = $filename;
|
$return->patches[] = $filename;
|
||||||
} else if ($action == 'R') {
|
} else if ($action == 'R') {
|
||||||
|
// This patch is needed because it seems
|
||||||
|
// that under a merge git may show a status
|
||||||
|
// of RC and not say the location of the original file
|
||||||
$matches = preg_split("/\t/", $line);
|
$matches = preg_split("/\t/", $line);
|
||||||
|
if (count($matches) != 3)
|
||||||
|
{
|
||||||
|
$return->additions[] = $matches[1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$return->renames[$matches[1]] = $matches[2];
|
$return->renames[$matches[1]] = $matches[2];
|
||||||
|
}
|
||||||
|
|
||||||
} else if ($action == 'C') {
|
} else if ($action == 'C') {
|
||||||
$matches = preg_split("/\t/", $line);
|
$matches = preg_split("/\t/", $line);
|
||||||
$return->copies[$matches[1]] = $matches[2];
|
$return->copies[$matches[1]] = $matches[2];
|
||||||
|
@ -460,6 +460,29 @@ class IDF_Views
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getOwnedProjects($user)
|
||||||
|
{
|
||||||
|
$db =& Pluf::db();
|
||||||
|
$false = Pluf_DB_BooleanToDb(false, $db);
|
||||||
|
$permSql = new Pluf_SQL(
|
||||||
|
"model_class='IDF_Project' AND owner_class='Pluf_User' ".
|
||||||
|
"AND owner_id=%s AND negative=".$false, $user->id
|
||||||
|
);
|
||||||
|
$rows = Pluf::factory('Pluf_RowPermission')->getList(array('filter' => $permSql->gen()));
|
||||||
|
$ids = array();
|
||||||
|
if ($rows->count() > 0) {
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
if (in_array($row->model_id, $ids))
|
||||||
|
continue;
|
||||||
|
$ids[] = $row->model_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sql = new Pluf_SQL(sprintf("id IN (%s)", implode(", ", $ids)));
|
||||||
|
return Pluf::factory('IDF_Project')->getList(array(
|
||||||
|
'filter'=> $sql->gen(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of global tags each carrying the number of projects that have the
|
* Returns a list of global tags each carrying the number of projects that have the
|
||||||
* particular tag set
|
* particular tag set
|
||||||
|
@ -174,6 +174,63 @@ class IDF_Views_Admin
|
|||||||
$request);
|
$request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public $projectRequestCreate_precond = array('Pluf_Precondition::staffRequired');
|
||||||
|
public function projectRequestCreate($request, $match)
|
||||||
|
{
|
||||||
|
$title = __('Create Requested Project');
|
||||||
|
$createdtext = "";
|
||||||
|
$form = null;
|
||||||
|
$errors = null;
|
||||||
|
if (count($match) == 2)
|
||||||
|
{
|
||||||
|
|
||||||
|
$projreqobj = new IDF_ProjectRequest($match[1]);
|
||||||
|
$form = new IDF_Form_Admin_ProjectCreate(array(
|
||||||
|
"name" => $projreqobj->shortname,
|
||||||
|
"shortname" => $projreqobj->shortname,
|
||||||
|
"shortdesc" => $projreqobj->desc,
|
||||||
|
"scm" => $projreqobj->repotype,
|
||||||
|
"owners" => $projreqobj->get_submitter->login,
|
||||||
|
"template" => "--"
|
||||||
|
), array("user" => $projreqobj->get_submitter));
|
||||||
|
if ($form->isValid())
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Pluf::loadFunction('Pluf_HTTP_URL_urlForView');
|
||||||
|
$from_email = Pluf::f('from_email');
|
||||||
|
$tmpl = new Pluf_Template('idf/admin/request-email.txt');
|
||||||
|
$context = new Pluf_Template_Context(array("user" => $projreqobj->get_submitter, "shortname" => $projreqobj->shortname));
|
||||||
|
$text_email = $tmpl->render($context);
|
||||||
|
$email = new Pluf_Mail($from_email, $projreqobj->get_submitter->email,
|
||||||
|
__('Status of repository request'));
|
||||||
|
$email->addTextMessage($text_email);
|
||||||
|
$email->sendMail();
|
||||||
|
|
||||||
|
$form->save();
|
||||||
|
$projreqobj->delete();
|
||||||
|
$createdtext = "Repo was created!";
|
||||||
|
} else {
|
||||||
|
$errors = $form->errors;
|
||||||
|
$createdtext = "There was an error creating the repo!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$projectreqs = Pluf::factory("IDF_ProjectRequest")->getList();
|
||||||
|
//$projectreqs[0]->creation_dtime = "123";
|
||||||
|
//print_r($projectreqs[0]->creation_dtime);
|
||||||
|
foreach($projectreqs as $p) {
|
||||||
|
$p->creation_dtime = Pluf_Date::gmDateToString($p->creation_dtime);
|
||||||
|
}
|
||||||
|
return Pluf_Shortcuts_RenderToResponse('idf/admin/approveprojects.html', array (
|
||||||
|
'page_title' => $title,
|
||||||
|
'requests' => $projectreqs,
|
||||||
|
'createdtext' => $createdtext,
|
||||||
|
'form' => $form,
|
||||||
|
'errors' => $errors
|
||||||
|
), $request);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Creation of a project.
|
* Creation of a project.
|
||||||
*
|
*
|
||||||
|
@ -61,9 +61,11 @@ class IDF_Views_Issue
|
|||||||
'id' => __('Id'),
|
'id' => __('Id'),
|
||||||
array('summary', 'IDF_Views_Issue_SummaryAndLabels', __('Summary')),
|
array('summary', 'IDF_Views_Issue_SummaryAndLabels', __('Summary')),
|
||||||
array('status', 'IDF_Views_Issue_ShowStatus', __('Status')),
|
array('status', 'IDF_Views_Issue_ShowStatus', __('Status')),
|
||||||
|
array('submitter', 'Pluf_Paginator_FkToString', __('submitter')),
|
||||||
|
array('owner', 'Pluf_Paginator_FkToString', __('owner')),
|
||||||
array('modif_dtime', 'Pluf_Paginator_DateAgo', __('Last Updated')),
|
array('modif_dtime', 'Pluf_Paginator_DateAgo', __('Last Updated')),
|
||||||
);
|
);
|
||||||
$pag->configure($list_display, array(), array('id', 'status', 'modif_dtime'));
|
$pag->configure($list_display, array(), array('id', 'status', 'owner', 'submitter', 'modif_dtime'));
|
||||||
$pag->items_per_page = 10;
|
$pag->items_per_page = 10;
|
||||||
$pag->no_results_text = __('No issues were found.');
|
$pag->no_results_text = __('No issues were found.');
|
||||||
$pag->setFromRequest($request);
|
$pag->setFromRequest($request);
|
||||||
|
@ -378,7 +378,12 @@ class IDF_Views_Source
|
|||||||
$previous = substr($request_file, 0, -strlen($l.' '));
|
$previous = substr($request_file, 0, -strlen($l.' '));
|
||||||
$scmConf = $request->conf->getVal('scm', 'git');
|
$scmConf = $request->conf->getVal('scm', 'git');
|
||||||
$props = $scm->getProperties($commit, $request_file);
|
$props = $scm->getProperties($commit, $request_file);
|
||||||
|
$cache = Pluf_Cache::factory();
|
||||||
|
$key = sha1($request_file.$commit);
|
||||||
|
if (null === ($content=$cache->get($key))) {
|
||||||
$content = IDF_FileUtil::highLight($extra['mime'], $scm->getFile($request_file_info));
|
$content = IDF_FileUtil::highLight($extra['mime'], $scm->getFile($request_file_info));
|
||||||
|
$cache->set($key, $content);
|
||||||
|
}
|
||||||
return Pluf_Shortcuts_RenderToResponse('idf/source/'.$scmConf.'/file.html',
|
return Pluf_Shortcuts_RenderToResponse('idf/source/'.$scmConf.'/file.html',
|
||||||
array(
|
array(
|
||||||
'page_title' => $page_title,
|
'page_title' => $page_title,
|
||||||
|
@ -32,6 +32,37 @@ Pluf::loadFunction('Pluf_Shortcuts_RenderToResponse');
|
|||||||
*/
|
*/
|
||||||
class IDF_Views_User
|
class IDF_Views_User
|
||||||
{
|
{
|
||||||
|
public $requestproject_precond = array('Pluf_Precondition::loginRequired');
|
||||||
|
public function requestproject($request)
|
||||||
|
{
|
||||||
|
$params = array("user" => $request->user);
|
||||||
|
$title = __('Request Project');
|
||||||
|
$success = false;
|
||||||
|
$error = false;
|
||||||
|
if ($request->method == 'POST') {
|
||||||
|
$form = new IDF_Form_ProjectRequest((array)$request->POST, $params);
|
||||||
|
if ($form->isValid()) {
|
||||||
|
$check = $form->save();
|
||||||
|
if ($check)
|
||||||
|
{
|
||||||
|
$form = new IDF_Form_ProjectRequest(null, $params);
|
||||||
|
$success = true;
|
||||||
|
} else {
|
||||||
|
$error = "Repository shortname has already been taken.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$form = new IDF_Form_ProjectRequest(null, $params);
|
||||||
|
}
|
||||||
|
return Pluf_Shortcuts_RenderToResponse('idf/user/projectrequest.html',
|
||||||
|
array('page_title' => $title,
|
||||||
|
'form' => $form,
|
||||||
|
'success' => $success,
|
||||||
|
'error' => $error),
|
||||||
|
$request);
|
||||||
|
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Dashboard of a user.
|
* Dashboard of a user.
|
||||||
*
|
*
|
||||||
@ -240,6 +271,7 @@ class IDF_Views_User
|
|||||||
*/
|
*/
|
||||||
public function view($request, $match)
|
public function view($request, $match)
|
||||||
{
|
{
|
||||||
|
$db =& Pluf::db();
|
||||||
$sql = new Pluf_SQL('login=%s', array($match[1]));
|
$sql = new Pluf_SQL('login=%s', array($match[1]));
|
||||||
$users = Pluf::factory('Pluf_User')->getList(array('filter'=>$sql->gen()));
|
$users = Pluf::factory('Pluf_User')->getList(array('filter'=>$sql->gen()));
|
||||||
if (count($users) != 1 or !$users[0]->active) {
|
if (count($users) != 1 or !$users[0]->active) {
|
||||||
@ -248,20 +280,53 @@ class IDF_Views_User
|
|||||||
|
|
||||||
$user = $users[0];
|
$user = $users[0];
|
||||||
$user_data = IDF_UserData::factory($user);
|
$user_data = IDF_UserData::factory($user);
|
||||||
//$projects = $request->user->getAllPermissions();
|
|
||||||
//print_r($request->user->permissions);
|
$otags = array();
|
||||||
//print_r($projects[0]);
|
// Note that this approach does not scale, we will need to add
|
||||||
//$projects = array();
|
// a table to cache the meaning of the tags for large forges.
|
||||||
//foreach (IDF_Views::getProjects($request->user) as $project) {
|
foreach (IDF_Views::getProjects($user) as $project) {
|
||||||
// $projects[] = $project;
|
$otags = array_merge($otags, $project->getTagIdsByStatus('open'));
|
||||||
//}
|
}
|
||||||
$projects = IDF_Views::getProjects($request->user);
|
|
||||||
//print_r($projects);
|
$false = Pluf_DB_BooleanToDb(false, $db);
|
||||||
|
$sql_results = $db->select(
|
||||||
|
'SELECT id FROM '.$db->pfx.'idf_projects '.
|
||||||
|
'WHERE '.$db->qn('private').'='.$false
|
||||||
|
);
|
||||||
|
|
||||||
|
$ids = array();
|
||||||
|
foreach ($sql_results as $id) {
|
||||||
|
$ids[] = $id['id'];
|
||||||
|
}
|
||||||
|
$f_sql = new Pluf_SQL('owner=%s AND status IN (' .implode(', ', $otags) . ') AND project IN (' . implode(', ', $ids) . ' )', array($user->id));
|
||||||
|
|
||||||
|
$pag = new Pluf_Paginator(new IDF_Issue());
|
||||||
|
$pag->class = 'recent-issues';
|
||||||
|
$pag->item_extra_props = array('current_user' => $request->user);
|
||||||
|
$pag->summary = __('This table shows the open issues.');
|
||||||
|
$pag->forced_where = $f_sql;
|
||||||
|
$pag->action = 'idf_dashboard';
|
||||||
|
$pag->sort_order = array('modif_dtime', 'ASC'); // will be reverted
|
||||||
|
$pag->sort_reverse_order = array('modif_dtime');
|
||||||
|
$list_display = array(
|
||||||
|
'id' => __('Id'),
|
||||||
|
array('project', 'Pluf_Paginator_FkToString', __('Project')),
|
||||||
|
array('summary', 'IDF_Views_IssueSummaryAndLabels', __('Summary')),
|
||||||
|
array('status', 'IDF_Views_Issue_ShowStatus', __('Status')),
|
||||||
|
array('modif_dtime', 'Pluf_Paginator_DateAgo', __('Last Updated')),
|
||||||
|
);
|
||||||
|
$pag->configure($list_display, array(), array('status', 'modif_dtime'));
|
||||||
|
$pag->items_per_page = 10;
|
||||||
|
$pag->no_results_text = __('This user has no issues assigned to them!');
|
||||||
|
$pag->setFromRequest($request);
|
||||||
|
|
||||||
|
$projects = IDF_Views::getOwnedProjects($user);
|
||||||
return Pluf_Shortcuts_RenderToResponse('idf/user/public.html',
|
return Pluf_Shortcuts_RenderToResponse('idf/user/public.html',
|
||||||
array('page_title' => (string) $user,
|
array('page_title' => (string) $user,
|
||||||
'member' => $user,
|
'member' => $user,
|
||||||
'user_data' => $user_data,
|
'user_data' => $user_data,
|
||||||
'projects' => $projects
|
'projects' => $projects,
|
||||||
|
'issues' => $pag
|
||||||
),
|
),
|
||||||
$request);
|
$request);
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,12 @@ $ctl[] = array('regex' => '#^/dashboard/$#',
|
|||||||
'method' => 'dashboard',
|
'method' => 'dashboard',
|
||||||
'name' => 'idf_dashboard');
|
'name' => 'idf_dashboard');
|
||||||
|
|
||||||
|
$ctl[] = array('regex' => '#^/requestproject/$#',
|
||||||
|
'base' => $base,
|
||||||
|
'model' => 'IDF_Views_User',
|
||||||
|
'method' => 'requestproject',
|
||||||
|
'name' => 'idf_requestproject');
|
||||||
|
|
||||||
$ctl[] = array('regex' => '#^/dashboard/submitted/$#',
|
$ctl[] = array('regex' => '#^/dashboard/submitted/$#',
|
||||||
'base' => $base,
|
'base' => $base,
|
||||||
'model' => 'IDF_Views_User',
|
'model' => 'IDF_Views_User',
|
||||||
@ -503,6 +509,16 @@ $ctl[] = array('regex' => '#^/admin/projects/create/$#',
|
|||||||
'model' => 'IDF_Views_Admin',
|
'model' => 'IDF_Views_Admin',
|
||||||
'method' => 'projectCreate');
|
'method' => 'projectCreate');
|
||||||
|
|
||||||
|
$ctl[] = array('regex' => '#^/admin/projects/createrequest/$#',
|
||||||
|
'base' => $base,
|
||||||
|
'model' => 'IDF_Views_Admin',
|
||||||
|
'method' => 'projectRequestCreate');
|
||||||
|
|
||||||
|
$ctl[] = array('regex' => '#^/admin/projects/createrequest/(\d+/)?$#',
|
||||||
|
'base' => $base,
|
||||||
|
'model' => 'IDF_Views_Admin',
|
||||||
|
'method' => 'projectRequestCreate');
|
||||||
|
|
||||||
$ctl[] = array('regex' => '#^/admin/projects/(\d+)/delete/$#',
|
$ctl[] = array('regex' => '#^/admin/projects/(\d+)/delete/$#',
|
||||||
'base' => $base,
|
'base' => $base,
|
||||||
'model' => 'IDF_Views_Admin',
|
'model' => 'IDF_Views_Admin',
|
||||||
|
60
indefero/src/IDF/templates/idf/admin/approveprojects.html
Normal file
60
indefero/src/IDF/templates/idf/admin/approveprojects.html
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
{extends "idf/gadmin/base.html"}
|
||||||
|
{block request} class="active"{/block}
|
||||||
|
|
||||||
|
{block body}
|
||||||
|
{if $createdtext}
|
||||||
|
{$createdtext}
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
{/if}
|
||||||
|
{if $errors}
|
||||||
|
{foreach $errors as $error}
|
||||||
|
{$error}
|
||||||
|
{/foreach}
|
||||||
|
{/if}
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Short Name
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Description
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Repotype
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Submitter
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Date
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Approve
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
{foreach $requests as $req}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{$req.shortname}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{$req.desc}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{$req.repotype}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{$req.get_submitter.login}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{$req.creation_dtime}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="{url 'IDF_Views_Admin::projectRequestCreate'}{$req.id}/">Approve</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/foreach}
|
||||||
|
</table>
|
||||||
|
|
||||||
|
{/block}
|
10
indefero/src/IDF/templates/idf/admin/request-email.txt
Normal file
10
indefero/src/IDF/templates/idf/admin/request-email.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
Hello {$user},
|
||||||
|
|
||||||
|
You are receiving this email because you have requested a repository.
|
||||||
|
Your request for {$shortname|safe} was approved!
|
||||||
|
|
||||||
|
If you have any questions please feel free to email a member of the development team.
|
||||||
|
|
||||||
|
Yours faithfully,
|
||||||
|
The development team.
|
||||||
|
|
@ -42,6 +42,7 @@
|
|||||||
<a href="{url 'IDF_Views_Admin::forge'}"{block tabforge}{/block}>{trans 'Forge'}</a>
|
<a href="{url 'IDF_Views_Admin::forge'}"{block tabforge}{/block}>{trans 'Forge'}</a>
|
||||||
<a href="{url 'IDF_Views_Admin::projects'}"{block tabprojects}{/block}>{trans 'Projects'}</a>
|
<a href="{url 'IDF_Views_Admin::projects'}"{block tabprojects}{/block}>{trans 'Projects'}</a>
|
||||||
<a href="{url 'IDF_Views_Admin::users'}"{block tabusers}{/block}>{trans 'People'}</a>
|
<a href="{url 'IDF_Views_Admin::users'}"{block tabusers}{/block}>{trans 'People'}</a>
|
||||||
|
<a href="{url 'IDF_Views_Admin::projectRequestCreate'}"{block request}{/block}>Approve Repo</a>
|
||||||
{if $usherConfigured}
|
{if $usherConfigured}
|
||||||
<a href="{url 'IDF_Views_Admin::usher'}"{block tabusher}{/block}>{trans 'Usher'}</a>
|
<a href="{url 'IDF_Views_Admin::usher'}"{block tabusher}{/block}>{trans 'Usher'}</a>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -3,7 +3,9 @@
|
|||||||
{if !$user.isAnonymous()}
|
{if !$user.isAnonymous()}
|
||||||
{aurl 'url', 'idf_dashboard'}
|
{aurl 'url', 'idf_dashboard'}
|
||||||
<li>{blocktrans}Welcome, <strong><a class="userw" href="{$url}">{$user}</a></strong>.{/blocktrans}
|
<li>{blocktrans}Welcome, <strong><a class="userw" href="{$url}">{$user}</a></strong>.{/blocktrans}
|
||||||
<a href="{url 'IDF_Views::logout'}">{trans 'Sign Out'}</a></li>{else}<li>
|
<a href="{url 'IDF_Views::logout'}">{trans 'Sign Out'}</a></li>
|
||||||
|
<li><a href="{url 'IDF_Views_User::requestproject'}">Request Project</a></li>
|
||||||
|
{else}
|
||||||
<a href="{url 'IDF_Views::login'}">{trans 'Sign in or create your account'}</a></li>
|
<a href="{url 'IDF_Views::login'}">{trans 'Sign in or create your account'}</a></li>
|
||||||
{/if}{if $customForgePageEnabled}
|
{/if}{if $customForgePageEnabled}
|
||||||
<li><a href="{url 'IDF_Views::index'}">{trans 'Home'}</a></li>
|
<li><a href="{url 'IDF_Views::index'}">{trans 'Home'}</a></li>
|
||||||
|
@ -19,13 +19,6 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th><strong>{$form.f.regkey.labelTag}:</strong></th>
|
|
||||||
<td>{if $form.f.regkey.errors}{$form.f.regkey.fieldErrors}{/if}
|
|
||||||
{$form.f.regkey|unsafe}<br />
|
|
||||||
<span class="helptext">{$form.f.regkey.help_text}</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th><strong>{$form.f.email.labelTag}:</strong></th>
|
<th><strong>{$form.f.email.labelTag}:</strong></th>
|
||||||
<td>{if $form.f.email.errors}{$form.f.email.fieldErrors}{/if}
|
<td>{if $form.f.email.errors}{$form.f.email.fieldErrors}{/if}
|
||||||
{$form.f.email|unsafe}<br />
|
{$form.f.email|unsafe}<br />
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{extends "idf/source/base.html"}
|
{extends "idf/source/base.html"}
|
||||||
{block extraheader}<link rel="stylesheet" type="text/css" href="{media '/idf/css/prettify.css'}" />{/block}
|
{block extraheader} {/block}
|
||||||
{block docclass}yui-t1{assign $inSourceTree=true}{/block}
|
{block docclass}yui-t1{assign $inSourceTree=true}{/block}
|
||||||
{block body}
|
{block body}
|
||||||
<h2 class="top"><a href="{url 'IDF_Views_Source::treeBase', array($project.shortname, $commit)}">{trans 'Root'}</a><span class="sep">/</span>{if $breadcrumb}{$breadcrumb|safe}{/if}</h2>
|
<h2 class="top"><a href="{url 'IDF_Views_Source::treeBase', array($project.shortname, $commit)}">{trans 'Root'}</a><span class="sep">/</span>{if $breadcrumb}{$breadcrumb|safe}{/if}</h2>
|
||||||
@ -26,6 +26,5 @@
|
|||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block javascript}
|
{block javascript}
|
||||||
<script type="text/javascript" src="{media '/idf/js/prettify.js'}"></script>
|
|
||||||
<script type="text/javascript">prettyPrint();</script>
|
|
||||||
{/block}
|
{/block}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{extends "idf/source/base.html"}
|
{extends "idf/source/base.html"}
|
||||||
{block extraheader}<link rel="stylesheet" type="text/css" href="{media '/idf/css/prettify.css'}" />{/block}
|
{block extraheader} {/block}
|
||||||
{block docclass}yui-t1{assign $inSourceTree=true}{/block}
|
{block docclass}yui-t1{assign $inSourceTree=true}{/block}
|
||||||
|
|
||||||
{block body}
|
{block body}
|
||||||
@ -27,6 +27,5 @@
|
|||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block javascript}
|
{block javascript}
|
||||||
<script type="text/javascript" src="{media '/idf/js/prettify.js'}"></script>
|
|
||||||
<script type="text/javascript">prettyPrint();</script>
|
|
||||||
{/block}
|
{/block}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{extends "idf/source/base.html"}
|
{extends "idf/source/base.html"}
|
||||||
{block extraheader}<link rel="stylesheet" type="text/css" href="{media '/idf/css/prettify.css'}" />{/block}
|
{block extraheader} {/block}
|
||||||
{block docclass}yui-t1{assign $inSourceTree=true}{/block}
|
{block docclass}yui-t1{assign $inSourceTree=true}{/block}
|
||||||
{block body}
|
{block body}
|
||||||
<h2 class="top"><a href="{url 'IDF_Views_Source::treeBase', array($project.shortname, $commit)}">{trans 'Root'}</a><span class="sep">/</span>{if $breadcrumb}{$breadcrumb|safe}{/if}</h2>
|
<h2 class="top"><a href="{url 'IDF_Views_Source::treeBase', array($project.shortname, $commit)}">{trans 'Root'}</a><span class="sep">/</span>{if $breadcrumb}{$breadcrumb|safe}{/if}</h2>
|
||||||
@ -43,6 +43,5 @@
|
|||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block javascript}
|
{block javascript}
|
||||||
<script type="text/javascript" src="{media '/idf/js/prettify.js'}"></script>
|
|
||||||
<script type="text/javascript">prettyPrint();</script>
|
|
||||||
{/block}
|
{/block}
|
||||||
|
60
indefero/src/IDF/templates/idf/user/projectrequest.html
Normal file
60
indefero/src/IDF/templates/idf/user/projectrequest.html
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
{extends "idf/base-simple.html"}
|
||||||
|
{block body}
|
||||||
|
|
||||||
|
{if $form.errors}
|
||||||
|
<div class="px-message-error">
|
||||||
|
<p>{trans 'Oops, please check the errors on the form.'}</p>
|
||||||
|
{if $form.get_top_errors}
|
||||||
|
{$form.render_top_errors|unsafe}
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{if $success}
|
||||||
|
<div>
|
||||||
|
<p>
|
||||||
|
Thank you - your request has been received and will be approved by an admin shortly.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{if $error}
|
||||||
|
<div class="px-message-error">
|
||||||
|
{$error}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<form method="post" action=".">
|
||||||
|
<table class="form" summary="">
|
||||||
|
<tr>
|
||||||
|
<th><strong>{$form.f.shortname.labelTag}:</strong></th>
|
||||||
|
<td>{if $form.f.shortname.errors}{$form.f.shortname.fieldErrors}{/if}
|
||||||
|
{$form.f.shortname|unsafe}<br />
|
||||||
|
<span class="helptext">{$form.f.shortname.help_text}</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><strong>{$form.f.repotype.labelTag}:</strong></th>
|
||||||
|
<td>{if $form.f.repotype.errors}{$form.f.repotype.fieldErrors}{/if}
|
||||||
|
{$form.f.repotype|unsafe}<br />
|
||||||
|
<span class="helptext">{$form.f.repotype.help_text}</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><strong>{$form.f.desc.labelTag}:</strong></th>
|
||||||
|
<td>{if $form.f.desc.errors}{$form.f.desc.fieldErrors}{/if}
|
||||||
|
{$form.f.desc|unsafe}<br />
|
||||||
|
<span class="helptext">{$form.f.desc.help_text}</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
<td><input type="submit" value="Request Project" name="submit" /></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{/block}
|
||||||
|
{block context}
|
||||||
|
|
||||||
|
|
||||||
|
{/block}
|
@ -56,6 +56,8 @@ Projects:
|
|||||||
{/if}
|
{/if}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</table>
|
</table>
|
||||||
|
Issues user is working on:<br/><br/>
|
||||||
|
{$issues.render}
|
||||||
{/block}
|
{/block}
|
||||||
{block context}
|
{block context}
|
||||||
<div class="issue-submit-info">
|
<div class="issue-submit-info">
|
||||||
|
11
indefero/www/media/idf/js/allowtabs.js
Executable file
11
indefero/www/media/idf/js/allowtabs.js
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
$("textarea").keydown(function(e) {
|
||||||
|
var $this, end, start;
|
||||||
|
if (e.keyCode === 9) {
|
||||||
|
start = this.selectionStart;
|
||||||
|
end = this.selectionEnd;
|
||||||
|
$this = $(this);
|
||||||
|
$this.val($this.val().substring(0, start) + "\t" + $this.val().substring(end));
|
||||||
|
this.selectionStart = this.selectionEnd = start + 1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
@ -94,7 +94,7 @@ class Pluf_Cache_Apc extends Pluf_Cache
|
|||||||
public function get($key, $default=null)
|
public function get($key, $default=null)
|
||||||
{
|
{
|
||||||
$success = false;
|
$success = false;
|
||||||
$value = apc_fetch($this->keyprefix.$key, &$success);
|
$value = apc_fetch($this->keyprefix.$key, $success);
|
||||||
if (!$success) return $default;
|
if (!$success) return $default;
|
||||||
if ($this->compress) $value = gzinflate($value);
|
if ($this->compress) $value = gzinflate($value);
|
||||||
return unserialize($value);
|
return unserialize($value);
|
||||||
|
@ -27,7 +27,8 @@
|
|||||||
*/
|
*/
|
||||||
class Pluf_Search_ResultSet implements Iterator
|
class Pluf_Search_ResultSet implements Iterator
|
||||||
{
|
{
|
||||||
protected $results = array();
|
// Needs to be public for using in Wiki when there are over 100 pages
|
||||||
|
public $results = array();
|
||||||
|
|
||||||
public function __construct($search_res)
|
public function __construct($search_res)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user