From: Chris Han Date: Fri, 02 Nov 2012 01:31:18 +0000 Subject: Add option to show restricted projects as disabled X-Git-Url: https://git.razvi.ro/?p=gitphp.git&a=commitdiff&h=c3c8003e7608a889dd93b66ac4aa865929b37913 --- Add option to show restricted projects as disabled --- --- a/config/gitphp.conf.defaults.php +++ b/config/gitphp.conf.defaults.php @@ -285,6 +285,16 @@ * with the string GIT_SILENT in the commit message. */ //$gitphp_conf['feedfilter'] = '/GIT_SILENT/'; + +/* + * showrestrictedprojects + * By default, when user-based restrictions are enabled, + * projects that are not available to the logged in user + * will be hidden in the project list. Setting this option + * will instead display these projects as disabled in the + * project list. + */ +$gitphp_conf['showrestrictedprojects'] = false; /* --- a/css/gitphpskin.css +++ b/css/gitphpskin.css @@ -555,6 +555,10 @@ margin-left: 8px; } +.projectRow.disabled { + color: #888; +} + /* * Tree view --- a/include/controller/ControllerBase.class.php +++ b/include/controller/ControllerBase.class.php @@ -122,9 +122,6 @@ if ($this->multiProject) { $this->projectList->LoadProjects(); - if ($this->userList && ($this->userList->GetCount() > 0)) { - $this->projectList->FilterByUser((!empty($_SESSION['gitphpuser']) ? $_SESSION['gitphpuser'] : null)); - } } if (!empty($this->params['project'])) { --- a/include/controller/Controller_ProjectList.class.php +++ b/include/controller/Controller_ProjectList.class.php @@ -18,6 +18,12 @@ $this->multiProject = true; parent::Initialize(); + + if ($this->userList && ($this->userList->GetCount() > 0)) { + if (!$this->config->GetValue('showrestrictedprojects') || (isset($this->params['opml']) && ($this->params['opml'] === true)) || (isset($this->params['txt']) && ($this->params['txt'] === true))) { + $this->projectList->FilterByUser((!empty($_SESSION['gitphpuser']) ? $_SESSION['gitphpuser'] : null)); + } + } if (empty($this->params['sort'])) $this->params['sort'] = 'project'; --- a/js/modules/projectsearch.js +++ b/js/modules/projectsearch.js @@ -60,12 +60,12 @@ } function searchRow(row, searchString) { - var projectName = row.find('td.projectName a').text(); + var projectName = row.find('td.projectName span').text(); if ((projectName.length > 0) && (projectName.toLowerCase().indexOf(searchString) != -1)) { return true; } - var projectDesc = row.find('td.projectDescription a').text(); + var projectDesc = row.find('td.projectDescription span').text(); if ((projectDesc.length > 0) && (projectDesc.toLowerCase().indexOf(searchString) != -1)) { return true; } --- a/templates/projectlist.tpl +++ b/templates/projectlist.tpl @@ -75,11 +75,21 @@ {/if} {/if} - + UserCanAccess($loggedinuser)}disabled{/if}"> - {$proj->GetProject()} + {if !$loginenabled || $proj->UserCanAccess($loggedinuser)} + {$proj->GetProject()} + {else} + {$proj->GetProject()} + {/if} - {$proj->GetDescription()|escape} + + {if !$loginenabled || $proj->UserCanAccess($loggedinuser)} + {$proj->GetDescription()|escape} + {else} + {$proj->GetDescription()|escape} + {/if} + {$proj->GetOwner()|escape:'html'} {assign var=projecthead value=$proj->GetHeadCommit()} @@ -96,6 +106,7 @@ {/if} + {if !$loginenabled || $proj->UserCanAccess($loggedinuser)} {t}summary{/t} {if $projecthead} | @@ -104,6 +115,7 @@ {t}tree{/t} | {t}snapshot{/t} {/if} + {/if} {foreachelse}