Skip to content

Commit

Permalink
Version bump and project type selector option
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelfolaron committed Jul 22, 2023
1 parent 30dde6b commit ffc36f1
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/domain/menu/js/menuController.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ leantime.menuController = (function () {

var activeProgramParent = jQuery(".programList .activeChild").attr("data-program-id");
var activeStrategyParent = jQuery(".strategyList .activeChild").attr("data-strategy-id");
var activeParent = '';
var activeParent = 'noparent';

if(activeStrategyParent !== undefined && activeStrategyParent !== ''){
activeParent = activeStrategyParent;
Expand Down
4 changes: 3 additions & 1 deletion app/domain/projects/controllers/class.newProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function run()
'state' => $_POST['projectState'],
'psettings' => $_POST['globalProjectUserAccess'],
'menuType' => $_POST['menuType'] ?? 'default',
'type' => 'project',
'type' => $_POST['type'] ?? 'project',
'parent' => $_POST['parent'] ?? '',
'start' => $this->language->getISODateString($_POST['start']),
'end' => $_POST['end'] ? $this->language->getISODateString($_POST['end']) : ''
Expand Down Expand Up @@ -150,6 +150,8 @@ public function run()
$this->tpl->assign('project', $values);
$this->tpl->assign('availableUsers', $this->userRepo->getAll());
$this->tpl->assign('clients', $this->clientsRepo->getAll());
$this->tpl->assign('projectTypes', $this->projectService->getProjectTypes());

$this->tpl->assign('info', $msgKey);

$this->tpl->display('projects.newProject');
Expand Down
3 changes: 3 additions & 0 deletions app/domain/projects/controllers/class.showProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public function run()
{

if (isset($_GET['id']) === true) {
$projectTypes = $this->projectService->getProjectTypes();

$id = (int)($_GET['id']);

//Mattermost integration
Expand Down Expand Up @@ -330,6 +332,7 @@ public function run()
$this->tpl->assign('numComments', $this->commentsRepo->countComments('project', $_GET['id']));

$this->tpl->assign('menuTypes', $this->menuRepo->getMenuTypes());
$this->tpl->assign('projectTypes', $projectTypes);

$this->tpl->assign('state', $this->projectRepo->state);
$this->tpl->assign('role', $_SESSION['userdata']['role']);
Expand Down
3 changes: 3 additions & 0 deletions app/domain/projects/repositories/class.projects.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function __construct()
$this->db = core\db::getInstance();
}


/**
* getAll - get all projects open and closed
*
Expand Down Expand Up @@ -612,6 +613,7 @@ public function editProject(array $values, $id)
dollarBudget = :dollarBudget,
psettings = :psettings,
menuType = :menuType,
type = :type,
parent = :parent,
start = :start,
end = :end
Expand All @@ -629,6 +631,7 @@ public function editProject(array $values, $id)
$stmn->bindValue('dollarBudget', $values['dollarBudget'], PDO::PARAM_STR);
$stmn->bindValue('psettings', $values['psettings'], PDO::PARAM_STR);
$stmn->bindValue('menuType', $values['menuType'], PDO::PARAM_STR);
$stmn->bindValue('type', $values['type'] ?? 'project', PDO::PARAM_STR);
$stmn->bindValue('id', $id, PDO::PARAM_STR);
$stmn->bindValue('parent', $values['parent'] ?? null, PDO::PARAM_STR);

Expand Down
22 changes: 22 additions & 0 deletions app/domain/projects/services/class.projects.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,24 @@ public function __construct()
$this->notificationService = new notifications();
}

public function getProjectTypes() {

$types = array("project"=>"label.project");

$filtered = static::dispatch_filter("filterProjectType", $types);

//Strategy & Program are protected types
if(isset($filtered["strategy"])){
unset($filtered["strategy"]);
}

if(isset($filtered["program"])){
unset($filtered["program"]);
}

return $filtered;
}

public function getProject($id)
{
return $this->projectRepository->getProject($id);
Expand Down Expand Up @@ -320,6 +338,10 @@ public function getProjectHierarchyAssignedToUser($userId, $projectStatus = "ope
//IF the pgm module is not active, add all items
if($projectHierarchy['program']["enabled"] === false) {
if ($project['type'] != "program" && $project['type'] != "strategy") {

if($project['parent'] == 0 || $project['parent'] == '' || $project['parent'] == null){
$project['parent'] = "noparent";
}
$projectHierarchy["project"]["items"]['project'][$project['id']] = $project;
}
} else {
Expand Down
13 changes: 13 additions & 0 deletions app/domain/projects/templates/newProject.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,19 @@

<div class="span4">

<?php if($this->get('projectTypes') && count($this->get('projectTypes')) > 1) {?>
<h4 class="widgettitle title-light"><i class="fa-regular fa-rectangle-list"></i> Project Type</h4>
<p>The type of the project. This will determine which features are available.</p>
<select name="type">
<?php foreach($this->get('projectTypes') as $key => $type){ ?>
<option value="<?=$this->escape($key)?>"
<?php if($project['type'] == $key) echo " selected='selected' "; ?>
><?=$this->__($this->escape($type))?></option>
<?php } ?>
</select>
<br /><br />
<?php } ?>

<?php $this->dispatchTplEvent("beforeClientPicker", $project) ?>

<div class="row-fluid marginBottom">
Expand Down
15 changes: 15 additions & 0 deletions app/domain/projects/templates/submodules/projectDetails.sub.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@
<div class="span4">

<div class="row-fluid marginBottom">

<?php if($this->get('projectTypes') && count($this->get('projectTypes')) > 1) {?>
<h4 class="widgettitle title-light"><i class="fa-regular fa-rectangle-list"></i> Project Type</h4>
<p>The type of the project. This will determine which features are available.</p>
<select name="type">
<?php foreach($this->get('projectTypes') as $key => $type){ ?>
<option value="<?=$this->escape($key)?>"
<?php if($project['type'] == $key) echo " selected='selected' "; ?>
><?=$this->__($this->escape($type))?></option>
<?php } ?>
</select>
<br /><br />
<?php } ?>


<h4 class="widgettitle title-light"><span
class="fa fa-picture-o"></span><?php echo $this->__('label.project_avatar'); ?></h4>
<div class="span12 center">
Expand Down
2 changes: 1 addition & 1 deletion config/appSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class appSettings
{

public $appVersion = "2.3.26";
public $appVersion = "2.3.27";

public $dbVersion = "2.1.21";

Expand Down
2 changes: 1 addition & 1 deletion config/configuration.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class config
public $sitename = 'Leantime'; //Name of your site, can be changed later
public $language = 'en-US'; //Default language
public $logoPath = '/dist/images/logo.svg'; //Default logo path, can be changed later
public $printLogoURL = '/dist/images/logo.jpg'; //Default logo URL use for printing (must be jpg or png format)
public $printLogoURL = '/dist/images/logo.png'; //Default logo URL use for printing (must be jpg or png format)
public $appUrl = ''; //Base URL, trailing slash not needed
public $appUrlRoot = ''; //Base of application withotu trailing slash (used for cookies), e.g, /leantime
public $defaultTheme = 'default'; //Default theme
Expand Down
2 changes: 1 addition & 1 deletion config/sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ LEAN_LOG_PATH = '' # Default Log Path (including

## Look & Feel, these settings are available in the UI and can be overwritten there.
LEAN_LOGO_PATH = '/dist/images/logo.svg' # Default logo path, can be changed later
LEAN_PRINT_LOGO_URL = '/images/logo.jpg' # Default logo URL use for printing (must be jpg or png format)
LEAN_PRINT_LOGO_URL = '/dist/images/logo.png' # Default logo URL use for printing (must be jpg or png format)
LEAN_DEFAULT_THEME = 'default' # Default theme
LEAN_PRIMARY_COLOR = '#1b75bb' # Primary Theme color
LEAN_SECONDARY_COLOR = '#81B1A8' # Secondary Theme Color
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "leantime",
"version": "2.3.26",
"version": "2.3.27",
"description": "Open source innovation management system",
"dependencies": {
"@assuradeurengilde/fontawesome-iconpicker": "^3.2.3",
Expand Down

0 comments on commit ffc36f1

Please sign in to comment.