Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Issue #5: Support multiple path values for SVNParentPath

* Updated all usages of repository view/edit providers to use an additional "parent-identifier"
* Added class RepositoryParent
* List repositories under their parent-location now on list-view-page.
* Added location selection box on repository-create page.
* Expand IRepositoryViewProvider API => "getRepositoryParents", "getRepositoriesOfParent"

Issue #3: Implement cached LDAP provider
* Disabled caching by default

General fixes & updates
* Fixed "get_request_var()" to make it possible to receive integer value '0' as value.
* Fixed IF_Config: Check for array-index (isset()) before using it.
* CSS Style: Add shadow to datatables
  • Loading branch information...
commit 61cee494aee96ad79ac4fc8437ad63238af8d4ec 1 parent 4fb6cc0
@mfreiholz authored
View
5 actions/create_repository.php
@@ -19,9 +19,12 @@
// HTTP Request Vars
//
+$varParentIdentifierEnc = get_request_var('pi');
$reponame = get_request_var("reponame");
$repotype = get_request_var("repotype");
+$varParentIdentifier = rawurldecode($varParentIdentifierEnc);
+
//
// Validation
//
@@ -30,7 +33,7 @@
$engine->addException(new ValidationException(tr("You have to fill out all fields.")));
}
else {
- $r = new \svnadmin\core\entities\Repository($reponame);
+ $r = new \svnadmin\core\entities\Repository($reponame, $varParentIdentifier);
// Create repository.
try {
View
35 actions/delete_repository.php
@@ -17,8 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program.
*/
-if (!defined('ACTION_HANDLING'))
-{
+if (!defined('ACTION_HANDLING')) {
die("HaHa!");
}
@@ -26,45 +25,43 @@
// Authentication
//
-if (!$appEngine->isProviderActive(PROVIDER_REPOSITORY_EDIT))
-{
- $appEngine->forwardError(ERROR_INVALID_MODULE);
+$engine = \svnadmin\core\Engine::getInstance();
+
+if (!$engine->isProviderActive(PROVIDER_REPOSITORY_EDIT)) {
+ $engine->forwardError(ERROR_INVALID_MODULE);
}
// Disabled by config?
-if (!($appEngine->getConfig()->getValueAsBoolean('GUI', 'RepositoryDeleteEnabled', true)))
-{
- $appEngine->forwardError(ERROR_INVALID_MODULE);
+if (!($engine->getConfig()->getValueAsBoolean('GUI', 'RepositoryDeleteEnabled', true))) {
+ $engine->forwardError(ERROR_INVALID_MODULE);
}
//
// HTTP Request Vars
//
+$varParentIdentifierEnc = get_request_var('pi');
$selrepos = get_request_var("selected_repos");
$remove_accesspaths = check_request_var('delete_ap');
+$varParentIdentifier = rawurldecode($varParentIdentifierEnc);
+
//
// Validation
//
-if ($selrepos == NULL)
-{
- $appEngine->addException(new ValidationException(tr("You have to select at least one repository.")));
+if ($selrepos == NULL || $varParentIdentifier === NULL) {
+ $engine->addException(new ValidationException(tr("You have to select at least one repository.")));
}
-else
-{
+else {
try {
// Iterate all selected items.
$c = count($selrepos);
- for($i = 0; $i < $c; $i++)
- {
- $oR = new \svnadmin\core\entities\Repository();
- $oR->name = $selrepos[$i];
+ for($i = 0; $i < $c; $i++) {
+ $oR = new \svnadmin\core\entities\Repository($selrepos[$i], $varParentIdentifier);
$b = $appEngine->getRepositoryEditProvider()->delete($oR);
- if (!$b)
- {
+ if (!$b) {
throw new Exception(tr("Could not delete repository %0", array($oR->name)));
}
$appEngine->addMessage(tr("The repository %0 has been deleted.", array($oR->name)));
View
35 classes/core/entities/Repository.class.php
@@ -21,27 +21,54 @@
class Repository
{
+ /**
+ * The name of the repository.
+ * @var string
+ */
public $name;
+
+ /**
+ * The parent identifier of the repository.
+ * (Association to an SVNParentPath)
+ * @var string/int
+ */
+ public $parentIdentifier;
- public function __construct($name = null)
+ /**
+ * Constructor.
+ *
+ * @param string $name
+ * @param string $parentIdentifier
+ */
+ public function __construct($name = null, $parentIdentifier = null)
{
$this->name = $name;
+ $this->parentIdentifier = $parentIdentifier;
}
public function getName()
{
return $this->name;
}
+
+ public function getParentIdentifier()
+ {
+ return $this->parentIdentifier;
+ }
public function getEncodedName()
{
- return rawurlencode( $this->name );
+ return rawurlencode($this->name);
+ }
+
+ public function getEncodedParentIdentifier()
+ {
+ return rawurlencode($this->parentIdentifier);
}
public static function compare( $o1, $o2 )
{
- if( $o1->name == $o2->name )
- {
+ if ($o1->name == $o2->name) {
return 0;
}
return ($o1->name > $o2->name) ? +1 : -1;
View
65 classes/core/entities/RepositoryParent.class.php
@@ -0,0 +1,65 @@
+<?php
+/**
+ * iF.SVNAdmin
+ * Copyright (c) 2010 by Manuel Freiholz
+ * http://www.insanefactory.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.
+ */
+namespace svnadmin\core\entities;
+
+/**
+ * Description of RepositoryParent
+ *
+ * @author Manuel Freiholz
+ */
+class RepositoryParent
+{
+ /**
+ * The unique identifier for this repository-parent location.
+ * @var string
+ */
+ public $identifier = NULL;
+
+ /**
+ * The path to this repository-parent location.
+ * @var string
+ */
+ public $path = NULL;
+
+ /**
+ * Description for the repository-parent location.
+ * @var string
+ */
+ public $description = NULL;
+
+
+ public function __construct($identifier = NULL, $path = NULL,
+ $description = NULL)
+ {
+ $this->identifier = $identifier;
+ $this->path = $path;
+ $this->description = $description;
+ }
+
+ public function getEncodedIdentifier()
+ {
+ return rawurlencode($this->identifier);
+ }
+
+ public function getEncodedPath()
+ {
+ return rawurlencode($this->path);
+ }
+}
View
16 classes/core/interfaces/IRepositoryViewProvider.iface.php
@@ -22,11 +22,25 @@
interface IRepositoryViewProvider extends IViewProvider
{
/**
+ * Gets all configured repository parents (SVNParentPath).
+ *
+ * @return array<svnadmin\core\entities\RepositoryParent>
+ */
+ public function getRepositoryParents();
+
+ /**
* Gets all existing repositories.
*
* @return array<\svnadmin\core\entities\Repository>
*/
public function getRepositories();
+
+ /**
+ * Getes all existing repositories of a specific location.
+ *
+ * @return array<\svnadmin\core\entities\Repository>
+ */
+ public function getRepositoriesOfParent(\svnadmin\core\entities\RepositoryParent $parent);
/**
* Gets the contents of the given repository path.
@@ -35,6 +49,6 @@ public function getRepositories();
* @param string $relativePath The relative path inside the given repository.
* @return array<\svnadmin\core\entities\RepositoryPath>
*/
- public function listPath(\svnadmin\core\entities\Repository $oRepository, $relativePath );
+ public function listPath(\svnadmin\core\entities\Repository $oRepository, $relativePath);
}
?>
View
159 classes/providers/RepositoryEditProvider.class.php
@@ -22,35 +22,87 @@
class RepositoryEditProvider implements \svnadmin\core\interfaces\IRepositoryEditProvider
{
/**
- * Indicates whether the init() method has been called.
- * @var bool
- */
- private $m_init_done = false;
-
- /**
- * The directory where all the repositories takes place,
- * also known as "SVNParentPath" in Apache configuration.
- * @var string
- */
- public $svnParentPath = NULL;
-
- /**
* Object to handle operations of the "svn" executable.
* @var IF_SVNClientC
*/
- private $m_svn = NULL;
+ private $_svnClient = NULL;
/**
* Object to handle operations of the "svnadmin" executable.
* @var IF_SVNAdminC
*/
- private $m_svnadmin = NULL;
+ private $_svnAdmin = NULL;
/**
* Holds the singelton instance of this class.
* @var svnadmin\providers\RepositoryEditProvider
*/
- private static $m_instance = NULL;
+ private static $_instance = NULL;
+
+ /**
+ * Holds multiple repository configurations.
+ * e.g.: array(
+ * 0 => array(
+ * 'SVNParentPath' => '/var/svn/repositories',
+ * ...
+ * ),
+ * 1 => array(
+ * 'SVNParentPath' => '/var/svn/repository-archive-2011',
+ * ...
+ * ),
+ * 2 => array(
+ * 'SVNParentPath' => '/var/svn/repository-archive-2012',
+ * ...
+ * ),
+ * )
+ * @var array
+ */
+ private $_config = array();
+
+ /**
+ * Initializes the object by Engine configuration.
+ */
+ public function __construct()
+ {
+ $engine = \svnadmin\core\Engine::getInstance();
+ $config = $engine->getConfig();
+
+ // Subversion class for browsing.
+ $this->_svnClient = new \IF_SVNClientC($engine->getConfig()
+ ->getValue('Repositories:svnclient', 'SvnExecutable'));
+
+ // Subversion class for administration.
+ $this->_svnAdmin = new \IF_SVNAdminC($engine->getConfig()
+ ->getValue('Repositories:svnclient', 'SvnAdminExecutable'));
+
+ // Load default repository location configuration.
+ $defaultSvnParentPath = $engine->getConfig()
+ ->getValue('Repositories:svnclient', 'SVNParentPath');
+
+ // Set as default.
+ $this->_config[0]['SVNParentPath'] = $defaultSvnParentPath;
+ $this->_config[0]['description'] = 'Repositories';
+
+ // Issue #5: Support multiple path values for SVNParentPath
+ // Try to load more repository locations.
+ $index = (int) 1;
+ while (true) {
+ $svnParentPath = $config->getValue('Repositories:svnclient:' . $index, 'SVNParentPath');
+ if ($svnParentPath != null) {
+ $this->_config[$index]['SVNParentPath'] = $svnParentPath;
+ }
+ else {
+ break;
+ }
+
+ $description = $config->getValue('Repositories:svnclient:' . $index, 'Description');
+ if ($description != null) {
+ $this->_config[$index]['description'] = $description;
+ }
+
+ ++$index;
+ }
+ }
/**
* Gets the singelton instance of this object.
@@ -59,11 +111,10 @@ class RepositoryEditProvider implements \svnadmin\core\interfaces\IRepositoryEdi
*/
public static function getInstance()
{
- if( self::$m_instance == NULL )
- {
- self::$m_instance = new RepositoryEditProvider();
+ if (self::$_instance == NULL) {
+ self::$_instance = new self();
}
- return self::$m_instance;
+ return self::$_instance;
}
/**
@@ -72,14 +123,6 @@ public static function getInstance()
*/
public function init()
{
- if (!$this->m_init_done)
- {
- global $appEngine;
- $this->m_init_done = true;
- $this->svnParentPath = $appEngine->getConfig()->getValue("Repositories:svnclient", "SVNParentPath");
- $this->m_svn = new \IF_SVNClientC($appEngine->getConfig()->getValue("Repositories:svnclient", "SvnExecutable"));
- $this->m_svnadmin = new \IF_SVNAdminC($appEngine->getConfig()->getValue("Repositories:svnclient", "SvnAdminExecutable"));
- }
return true;
}
@@ -96,15 +139,17 @@ public function save()
* (non-PHPdoc)
* @see svnadmin\core\interfaces.IRepositoryEditProvider::create()
*/
- public function create(\svnadmin\core\entities\Repository $oRepository, $type = "fsfs" )
+ public function create(\svnadmin\core\entities\Repository $oRepository, $type = "fsfs")
{
- if (!file_exists($this->svnParentPath))
- {
- throw new \Exception("The repository parent path doesn't exists: " . $this->svnParentPath);
+ $svnParentPath = $this->getRepositoryConfigValue($oRepository, 'SVNParentPath');
+
+ if (!file_exists($svnParentPath)) {
+ throw new \Exception("The repository parent path doesn't exists: " .
+ $svnParentPath);
}
- $path = $this->svnParentPath."/".$oRepository->name;
- $this->m_svnadmin->create($path, $type);
+ $path = $svnParentPath . '/' . $oRepository->name;
+ $this->_svnAdmin->create($path, $type);
return true;
}
@@ -115,8 +160,16 @@ public function create(\svnadmin\core\entities\Repository $oRepository, $type =
*/
public function delete(\svnadmin\core\entities\Repository $oRepository)
{
- $path = $this->svnParentPath."/".$oRepository->name;
- $this->m_svnadmin->delete($path);
+ $svnParentPath = $this->getRepositoryConfigValue($oRepository, 'SVNParentPath');
+
+ if ($svnParentPath == NULL) {
+ throw new \Exception('Invalid parent-identifier: ' .
+ $oRepository->getParentIdentifier());
+ }
+
+ $path = $svnParentPath . '/' . $oRepository->name;
+ $this->_svnAdmin->delete($path);
+
return true;
}
@@ -126,13 +179,43 @@ public function delete(\svnadmin\core\entities\Repository $oRepository)
*/
public function mkdir(\svnadmin\core\entities\Repository $oRepository, array $paths)
{
+ $svnParentPath = $this->getRepositoryConfigValue($oRepository, 'SVNParentPath');
+
+ if ($svnParentPath == NULL) {
+ throw new \Exception('Invalid parent-identifier: ' .
+ $oRepository->getParentIdentifier());
+ }
+
// Create absolute paths.
for ($i = 0; $i < count($paths); ++$i) {
- $paths[$i] = $this->svnParentPath . '/' . $oRepository->name . '/' . $paths[$i];
+ $paths[$i] = $svnParentPath . '/' . $oRepository->name . '/' . $paths[$i];
}
- $this->m_svn->svn_mkdir($paths);
+ $this->_svnClient->svn_mkdir($paths);
+
return true;
}
+
+ /**
+ * Gets the configuration value associated to the given Repository object
+ * (identified by 'parentIdentifier')
+ *
+ * @param \svnadmin\core\entities\Repository $oRepository
+ * @param string $key
+ * @return string
+ */
+ protected function getRepositoryConfigValue(\svnadmin\core\entities\Repository $oRepository, $key = 'SVNParentPath')
+ {
+ $v = null;
+
+ if ($oRepository->parentIdentifier === null) {
+ $v = $this->_config[0][$key];
+ }
+ else if (isset($this->_config[$oRepository->parentIdentifier])){
+ $v = $this->_config[$oRepository->parentIdentifier][$key];
+ }
+
+ return $v;
+ }
}
?>
View
184 classes/providers/RepositoryViewProvider.class.php
@@ -25,31 +25,74 @@ class RepositoryViewProvider implements \svnadmin\core\interfaces\IRepositoryVie
* The singelton instance of this class.
* @var \svnadmin\providers\RepositoryViewProvider
*/
- private static $m_instance = NULL;
-
- /**
- * @var bool
- */
- private $m_init_done = false;
-
- /**
- * The directory where all the repositories takes place.
- * @var string
- */
- public $svnParentPath = NULL;
+ private static $_instance = NULL;
/**
* The svn-client class object to handle command on the repository.
* @var \IF_SVNClientC
*/
- private $m_svnclient = NULL;
+ private $_svnClient = NULL;
+
+ /**
+ * Holds multiple repository configurations.
+ * e.g.: array(
+ * 0 => array(
+ * 'SVNParentPath' => '/var/svn/repositories',
+ * ...
+ * ),
+ * 1 => array(
+ * 'SVNParentPath' => '/var/svn/repository-archive-2011',
+ * ...
+ * ),
+ * 2 => array(
+ * 'SVNParentPath' => '/var/svn/repository-archive-2012',
+ * ...
+ * ),
+ * )
+ * @var array
+ */
+ private $_config = array();
/**
- * The constructor.
+ * Initializes the object by Engine configuration.
*/
public function __construct()
{
+ $engine = \svnadmin\core\Engine::getInstance();
+ $config = $engine->getConfig();
+
+ // Subversion class for browsing.
+ $this->_svnClient = new \IF_SVNClientC($engine->getConfig()
+ ->getValue('Repositories:svnclient', 'SvnExecutable'));
+
+ // Load default repository location configuration.
+ $defaultSvnParentPath = $engine->getConfig()
+ ->getValue('Repositories:svnclient', 'SVNParentPath');
+
+ // Set as default.
+ $this->_config[0]['SVNParentPath'] = $defaultSvnParentPath;
+ $this->_config[0]['description'] = 'Repositories';
+
+ // Issue #5: Support multiple path values for SVNParentPath
+ // Try to load more repository locations.
+ $index = (int) 1;
+ while (true) {
+ $svnParentPath = $config->getValue('Repositories:svnclient:' . $index, 'SVNParentPath');
+ if ($svnParentPath != null) {
+ $this->_config[$index]['SVNParentPath'] = $svnParentPath;
+ }
+ else {
+ break;
+ }
+
+ $description = $config->getValue('Repositories:svnclient:' . $index, 'Description');
+ if ($description != null) {
+ $this->_config[$index]['description'] = $description;
+ }
+
+ ++$index;
+ }
}
/**
@@ -59,11 +102,10 @@ public function __construct()
*/
public static function getInstance()
{
- if( self::$m_instance == NULL )
- {
- self::$m_instance = new RepositoryViewProvider();
+ if (self::$_instance == null) {
+ self::$_instance = new self();
}
- return self::$m_instance;
+ return self::$_instance;
}
/**
@@ -72,13 +114,6 @@ public static function getInstance()
*/
public function init()
{
- if(!$this->m_init_done)
- {
- global $appEngine;
- $this->m_init_done = true;
- $this->svnParentPath = $appEngine->getConfig()->getValue("Repositories:svnclient", "SVNParentPath");
- $this->m_svnclient = new \IF_SVNClientC($appEngine->getConfig()->getValue("Repositories:svnclient", "SvnExecutable"));
- }
return true;
}
@@ -99,6 +134,25 @@ public function update()
{
return false;
}
+
+ /**
+ * (non-PHPdoc)
+ * @see svnadmin\core\interfaces.IRepositoryViewProvider::getRepositoryParents()
+ */
+ public function getRepositoryParents()
+ {
+ $ret = array();
+
+ foreach ($this->_config as $parentIdentifier => $options) {
+ $ret[] = new \svnadmin\core\entities\RepositoryParent(
+ $parentIdentifier,
+ $this->getRepositoryParentConfigValue($parentIdentifier, 'SVNParentPath'),
+ $this->getRepositoryParentConfigValue($parentIdentifier, 'description')
+ );
+ }
+
+ return $ret;
+ }
/**
* (non-PHPdoc)
@@ -107,13 +161,35 @@ public function update()
public function getRepositories()
{
$ret = array();
-
- $repoList = $this->m_svnclient->listRepositories($this->svnParentPath);
- foreach ($repoList as $repoName)
- {
- $ret[] = new \svnadmin\core\entities\Repository($repoName);
+
+ foreach ($this->_config as $parentIdentifier => $options) {
+ $list = $this->_svnClient->listRepositories($options['SVNParentPath']);
+
+ foreach ($list as $name) {
+ $ret[] = new \svnadmin\core\entities\Repository($name, $parentIdentifier);
+ }
}
-
+
+ return $ret;
+ }
+
+ /**
+ * (non-PHPdoc)
+ * @see svnadmin\core\interfaces.IRepositoryViewProvider::getRepositoriesOfParent()
+ */
+ public function getRepositoriesOfParent(\svnadmin\core\entities\RepositoryParent $parent)
+ {
+ $ret = array();
+
+ $svnParentPath = $this->getRepositoryParentConfigValue($parent->identifier);
+ if ($svnParentPath != NULL) {
+ $list = $this->_svnClient->listRepositories($svnParentPath);
+
+ foreach ($list as $name) {
+ $ret[] = new \svnadmin\core\entities\Repository($name, $parent->identifier);
+ }
+ }
+
return $ret;
}
@@ -123,32 +199,31 @@ public function getRepositories()
*/
public function listPath(\svnadmin\core\entities\Repository $oRepository, $relativePath)
{
+ // Get SVNParentPath of given Repository object.
+ $svnParentPath = $this->getRepositoryParentConfigValue(
+ $oRepository->getParentIdentifier(), 'SVNParentPath');
+
// Absolute path to the repository.
- $repo = $this->svnParentPath;
- $repo.= "/";
- $repo.= $oRepository->name;
+ $repo = $svnParentPath . '/' . $oRepository->name;
- if ($relativePath == "/")
- {
- $relativePath = "";
+ if ($relativePath == '/') {
+ $relativePath = '';
}
// Append the relative path.
- $uri = $repo."/".$relativePath;
+ $uri = $repo . '/' . $relativePath;
$ret = array();
// Get the file list.
// @throws Exception
- $svn_entry_list = $this->m_svnclient->svn_list($uri);
+ $svn_entry_list = $this->_svnClient->svn_list($uri);
- if (empty($svn_entry_list->entries))
- {
+ if (empty($svn_entry_list->entries)) {
return $ret;
}
- foreach ($svn_entry_list->entries as $entry)
- {
+ foreach ($svn_entry_list->entries as $entry) {
$oRP = new \svnadmin\core\entities\RepositoryPath();
$oRP->parent = $relativePath;
$oRP->name = $entry->name;
@@ -161,5 +236,28 @@ public function listPath(\svnadmin\core\entities\Repository $oRepository, $relat
return $ret;
}
+
+ /**
+ * Gets the configuration value associated to the given $parentIdentifier.
+ *
+ * @param string $parentIdentifier
+ * @param string $key
+ * @return string
+ */
+ protected function getRepositoryParentConfigValue($parentIdentifier, $key = 'SVNParentPath')
+ {
+ $v = null;
+
+ if ($parentIdentifier === null) {
+ $v = $this->_config[0][$key];
+ }
+ else if (isset($this->_config[$parentIdentifier])){
+ if (isset ($this->_config[$parentIdentifier][$key])) {
+ $v = $this->_config[$parentIdentifier][$key];
+ }
+ }
+
+ return $v;
+ }
}
?>
View
2  data/config.tpl.ini
@@ -104,7 +104,7 @@ BindDN=CN=Manuel Freiholz,CN=Users,DC=insanefactory,DC=com
BindPassword=root
# Enables/disables the LDAP user and group caching provider.
-CacheEnabled=true
+CacheEnabled=false
# Storage file of LDAP user and group cache.
CacheFile=./data/ldap.cache.json
View
5 include/config.inc.php
@@ -75,6 +75,7 @@
include_once( "./classes/core/entities/AccessPath.class.php" );
include_once( "./classes/core/entities/Repository.class.php" );
include_once( "./classes/core/entities/RepositoryPath.class.php" );
+include_once( "./classes/core/entities/RepositoryParent.class.php" );
include_once( "./classes/core/entities/Role.class.php" );
include_once( "./classes/core/interfaces/IProvider.iface.php" );
include_once( "./classes/core/interfaces/IAuthenticator.iface.php" );
@@ -186,7 +187,7 @@
$userView = null;
include_once("./classes/providers/ldap/LdapUserViewProvider.class.php");
- if ($cfg->getValueAsBoolean('Ldap', 'CacheEnabled', true)) {
+ if ($cfg->getValueAsBoolean('Ldap', 'CacheEnabled', false)) {
include_once("./classes/providers/ldap/CachedLdapUserViewProvider.class.php");
include_once("./include/ifcorelib/IF_JsonObjectStorage.class.php");
$userView = \svnadmin\providers\ldap\CachedLdapUserViewProvider::getInstance();
@@ -232,7 +233,7 @@
include_once("./classes/providers/ldap/LdapUserViewProvider.class.php");
include_once("./classes/providers/AuthFileGroupAndPathsProvider.class.php");
- if ($cfg->getValueAsBoolean('Ldap', 'CacheEnabled', true)) {
+ if ($cfg->getValueAsBoolean('Ldap', 'CacheEnabled', false)) {
include_once("./classes/providers/ldap/CachedLdapUserViewProvider.class.php");
include_once("./include/ifcorelib/IF_JsonObjectStorage.class.php");
$groupView = \svnadmin\providers\ldap\CachedLdapUserViewProvider::getInstance();
View
2  include/ifcorelib/IF_Config.class.php
@@ -169,7 +169,7 @@ public function save($path = null)
// Before we change the to the new section header,
// we need to prove whether there are any new key
// items for the previous section.
- if ($current_section != '')
+ if ($current_section != '' && isset($this->items[$current_section]))
{
foreach ($this->items[$current_section] as $key => $value)
{
View
22 include/ifcorelib/globals.php
@@ -126,19 +126,17 @@ function if_array_remove_empty_values(&$arr)
* @param(optional) reference to scalar, will be set to 'get' or 'post'
* @return bool
*/
-function check_request_var( $varname, &$method = NULL )
+function check_request_var($varname, &$method = NULL)
{
- if( isset($_POST[$varname]) && !empty($_POST[$varname]) )
- {
- $method = 'post';
- return TRUE;
- }
- else if( isset($_GET[$varname]) && !empty($_GET[$varname]) )
- {
- $method = 'get';
- return TRUE;
- }
- return FALSE;
+ if (isset($_POST[$varname])) {
+ $method = 'post';
+ return true;
+ }
+ else if (isset($_GET[$varname])) {
+ $method = 'get';
+ return true;
+ }
+ return false;
}
function get_request_var( $varname )
View
17 pages/repository/repositorycreate.html.php
@@ -20,6 +20,23 @@
<p class="hdesc"><?php Translate("Create a new repository to manage your sources."); ?></p>
<div>
<form method="POST" action="repositorycreate.php">
+
+ <div class="form-field">
+ <label for="pi"><?php Translate('Repository location'); ?></label>
+ <select name="pi" id="pi" class="">
+ <?php foreach (GetArrayValue('RepositoryParentList') as $rp) : ?>
+ <option value="<?php print($rp->getEncodedIdentifier()); ?>">
+ <?php print($rp->path); ?>
+ <?php
+ if (!empty($rp->description)) {
+ print(' - ');
+ print($rp->description);
+ }
+ ?>
+ </option>
+ <?php endforeach; ?>
+ </select>
+ </div>
<div class="form-field">
<label for="reponame"><?php Translate("Repository name"); ?></label>
View
122 pages/repository/repositorylist.html.php
@@ -1,77 +1,75 @@
<?php GlobalHeader(); ?>
-<script type="text/javascript">
-$(document).ready(function(){
- $("#selectall").click(function(){
- selectAll(this, "selected_repos[]");
- });
-});
-</script>
-
<h1><?php Translate("Repository management"); ?></h1>
<p class="hdesc"><?php Translate("On this page you can view your existing repositories and create or delete an repository."); ?></p>
-<?php HtmlFilterBox('repolist'); ?>
+<?php foreach (GetArrayValue('RepositoryParentList') as $rp) : ?>
-<form action="repositorylist.php" method="POST">
- <table id="repolist" class="datatable">
+ <h2><?php Translate('Location'); ?>: <?php print($rp->description); ?><br><small>(<?php print($rp->path); ?>)</small></h2>
- <thead>
- <tr>
- <th width="22"></th>
- <th width="20">
- <?php if (IsProviderActive(PROVIDER_REPOSITORY_EDIT) && HasAccess(ACL_MOD_REPO, ACL_ACTION_DELETE) && GetBoolValue('ShowDeleteButton')): ?>
- <input type="checkbox" id="selectall">
- <?php endif; ?>
- </th>
- <th>
- <?php Translate("Repository"); ?>
- </th>
- </tr>
- </thead>
+ <?php HtmlFilterBox('repolist_' . $rp->identifier); ?>
- <?php if (IsProviderActive(PROVIDER_REPOSITORY_EDIT) && HasAccess(ACL_MOD_REPO, ACL_ACTION_DELETE) && GetBoolValue('ShowDeleteButton')): ?>
- <tfoot>
- <tr>
- <td colspan="3">
+ <form action="repositorylist.php" method="POST">
+ <input type="hidden" name="pi" value="<?php print($rp->getEncodedIdentifier()); ?>">
+
+ <table id="repolist_<?php print($rp->identifier); ?>" class="datatable">
- <table class="datatableinline">
- <colgroup>
- <col width="50%">
- <col width="50%">
- </colgroup>
- <tr>
- <td>
- <input type="submit" name="delete" value="<?php Translate("Delete"); ?>" class="delbtn" onclick="return deletionPrompt('<?php Translate("Are you sure?"); ?>');">
+ <thead>
+ <tr>
+ <th width="22"></th>
+ <th width="20"></th>
+ <th><?php Translate("Repository"); ?></th>
+ </tr>
+ </thead>
- <?php if (IsProviderActive(PROVIDER_ACCESSPATH_EDIT) && HasAccess(ACL_MOD_ACCESSPATH, ACL_ACTION_DELETE)): ?>
- <small>(<input type="checkbox" id="delete_ap" name="delete_ap" value="1" checked><label for="delete_ap"> <?php Translate('+Remove configured Access-Paths'); ?></label>)</small>
- <?php endif; ?>
- </td>
- <td align="right"></td>
- </tr>
- </table>
+ <?php if (IsProviderActive(PROVIDER_REPOSITORY_EDIT) && HasAccess(ACL_MOD_REPO, ACL_ACTION_DELETE) && GetBoolValue('ShowDeleteButton')): ?>
+ <tfoot>
+ <tr>
+ <td colspan="3">
+
+ <table class="datatableinline">
+ <colgroup>
+ <col width="50%">
+ <col width="50%">
+ </colgroup>
+ <tr>
+ <td>
+ <input type="submit" name="delete" value="<?php Translate("Delete"); ?>" class="delbtn" onclick="return deletionPrompt('<?php Translate("Are you sure?"); ?>');">
- </td>
- </tr>
- </tfoot>
- <?php endif; ?>
+ <?php if (IsProviderActive(PROVIDER_ACCESSPATH_EDIT) && HasAccess(ACL_MOD_ACCESSPATH, ACL_ACTION_DELETE)): ?>
+ <small>(<input type="checkbox" id="delete_ap" name="delete_ap" value="1" checked><label for="delete_ap"> <?php Translate('+Remove configured Access-Paths'); ?></label>)</small>
+ <?php endif; ?>
+ </td>
+ <td align="right"></td>
+ </tr>
+ </table>
+
+ </td>
+ </tr>
+ </tfoot>
+ <?php endif; ?>
+
+ <tbody>
+ <?php
+ $list = GetArrayValue('RepositoryList');
+ $list = $list[$rp->identifier];
+ foreach ($list as $r) {
+ ?>
+ <tr>
+ <td>
+ <?php if (IsProviderActive(PROVIDER_ACCESSPATH_EDIT) && HasAccess(ACL_MOD_ACCESSPATH, ACL_ACTION_ADD)) { ?>
+ <a href="accesspathcreate.php?pi=<?php print($r->getEncodedParentIdentifier()); ?>&amp;r=<?php print($r->getEncodedName()); ?>"><img src="templates/icons/addpath.png" alt="<?php Translate("Add access path"); ?>" title="<?php Translate("Add access path"); ?>"></a>
+ <?php } ?>
+ </td>
+ <td><?php if (IsProviderActive(PROVIDER_REPOSITORY_EDIT) && HasAccess(ACL_MOD_REPO, ACL_ACTION_DELETE) && GetBoolValue('ShowDeleteButton')) { ?><input type="checkbox" name="selected_repos[]" value="<?php print($r->name); ?>"><?php } ?></td>
+ <td><a href="repositoryview.php?pi=<?php print($r->getEncodedParentIdentifier()); ?>&amp;r=<?php print($r->getEncodedName()); ?>"><?php print($r->name); ?></a></td>
+ </tr>
+ <?php } ?>
+ </tbody>
- <tbody>
- <?php foreach (GetArrayValue("RepositoryList") as $r) { ?>
- <tr>
- <td>
- <?php if (IsProviderActive(PROVIDER_ACCESSPATH_EDIT) && HasAccess(ACL_MOD_ACCESSPATH, ACL_ACTION_ADD)) { ?>
- <a href="accesspathcreate.php?r=<?php print($r->getEncodedName()); ?>"><img src="templates/icons/addpath.png" alt="<?php Translate("Add access path"); ?>" title="<?php Translate("Add access path"); ?>"></a>
- <?php } ?>
- </td>
- <td><?php if (IsProviderActive(PROVIDER_REPOSITORY_EDIT) && HasAccess(ACL_MOD_REPO, ACL_ACTION_DELETE) && GetBoolValue('ShowDeleteButton')) { ?><input type="checkbox" name="selected_repos[]" value="<?php print($r->name); ?>"><?php } ?></td>
- <td><a href="repositoryview.php?r=<?php print($r->getEncodedName()); ?>"><?php print($r->name); ?></a></td>
- </tr>
- <?php } ?>
- </tbody>
+ </table>
+ </form>
- </table>
-</form>
+<?php endforeach; ?>
<?php GlobalFooter(); ?>
View
10 pages/repository/repositoryview.html.php
@@ -2,7 +2,7 @@
<h1><?php Translate("Repository browsing"); ?></h1>
<p class="hdesc">
- <a href="repositoryview.php?r=<?php print(GetValue("Repository")->getEncodedName()); ?>"><?php print(GetValue("Repository")->getName()); ?></a>
+ <a href="repositoryview.php?pi=<?php print(GetValue("Repository")->getEncodedParentIdentifier()); ?>&amp;r=<?php print(GetValue("Repository")->getEncodedName()); ?>"><?php print(GetValue("Repository")->getName()); ?></a>
: <?php PrintStringValue("CurrentPath"); ?>
</p>
@@ -13,7 +13,7 @@
<?php if (GetBoolValue("RepositoryRoot")) { ?>
<a href="repositorylist.php"><img src="templates/icons/back.png" alt="TR{Back}}"></a>
<?php } else { ?>
- <a href="repositoryview.php?r=<?php print(GetValue("Repository")->getEncodedName()); ?>&amp;p=<?php PrintStringValue("BackLinkPathEncoded"); ?>"><img src="templates/icons/back.png" alt="<?php Translate("Back"); ?>"></a>
+ <a href="repositoryview.php?pi=<?php print(GetValue("Repository")->getEncodedParentIdentifier()); ?>&amp;r=<?php print(GetValue("Repository")->getEncodedName()); ?>&amp;p=<?php PrintStringValue("BackLinkPathEncoded"); ?>"><img src="templates/icons/back.png" alt="<?php Translate("Back"); ?>"></a>
<?php } ?>
</th>
<th width="22">#</th>
@@ -32,7 +32,7 @@
<?php if (GetBoolValue("RepositoryRoot")) { ?>
<a href="repositorylist.php"><img src="templates/icons/back.png" alt="TR{Back}}"></a>
<?php } else { ?>
- <a href="repositoryview.php?r=<?php print(GetValue("Repository")->getEncodedName()); ?>&amp;p=<?php PrintStringValue("BackLinkPathEncoded"); ?>"><img src="templates/icons/back.png" alt="<?php Translate("Back"); ?>"></a>
+ <a href="repositoryview.php?pi=<?php print(GetValue("Repository")->getEncodedParentIdentifier()); ?>&amp;r=<?php print(GetValue("Repository")->getEncodedName()); ?>&amp;p=<?php PrintStringValue("BackLinkPathEncoded"); ?>"><img src="templates/icons/back.png" alt="<?php Translate("Back"); ?>"></a>
<?php } ?>
</td>
<td></td>
@@ -50,7 +50,7 @@
<tr>
<td>
<?php if (IsProviderActive(PROVIDER_ACCESSPATH_EDIT) && HasAccess(ACL_MOD_ACCESSPATH, ACL_ACTION_ADD)) { ?>
- <a href="accesspathcreate.php?r=<?php print(GetValue("Repository")->getEncodedName()); ?>&amp;p=<?php print($item->getEncodedRelativePath()); ?>"><img src="templates/icons/addpath.png" alt="-" title="<?php Translate("Add access path"); ?>"></a>
+ <a href="accesspathcreate.php?pi=<?php print(GetValue("Repository")->getEncodedParentIdentifier()); ?>&amp;r=<?php print(GetValue("Repository")->getEncodedName()); ?>&amp;p=<?php print($item->getEncodedRelativePath()); ?>"><img src="templates/icons/addpath.png" alt="-" title="<?php Translate("Add access path"); ?>"></a>
<?php } ?>
</td>
<td>
@@ -62,7 +62,7 @@
</td>
<td>
<?php if ($item->type == 0) { ?>
- <a href="repositoryview.php?r=<?php print(GetValue("Repository")->getEncodedName()); ?>&amp;p=<?php print($item->getEncodedRelativePath()); ?>"><?php print($item->name); ?></a>
+ <a href="repositoryview.php?pi=<?php print(GetValue("Repository")->getEncodedParentIdentifier()); ?>&amp;r=<?php print(GetValue("Repository")->getEncodedName()); ?>&amp;p=<?php print($item->getEncodedRelativePath()); ?>"><?php print($item->name); ?></a>
<?php } else { ?>
<?php print($item->name); ?>
<?php } ?>
View
16 readme.md
@@ -42,6 +42,22 @@ I recommend to do clean installation, because the complete templating system has
__Note:__ You can still use your old `/data/` directory, which contains the configuration of the application.
+Additional configuration
+========================
+
+### Show Repository delete option
+
+```
+[GUI]
+RepositoryDeleteEnabled=true
+```
+
+FAQ
+===
+Q: I get a "Maximum execution time exceeded" error, if i try to update/synchronize my data.
+A: http://www.php.net/manual/de/info.configuration.php#ini.max-execution-time
+
+
Who is responsible for this crap?
---------------------------------
&copy; 2009-2012 Manuel Freiholz, [insaneFactory.com](http://www.insanefactory.com/if-svnadmin/)
View
12 repositorycreate.php
@@ -23,12 +23,13 @@
// Authentication
//
-if (!$appEngine->isRepositoryEditActive())
-{
- $appEngine->forwardInvalidModule(true);
+$engine = \svnadmin\core\Engine::getInstance();
+
+if (!$engine->isProviderActive(PROVIDER_REPOSITORY_EDIT)) {
+ $engine->forwardInvalidModule(true);
}
-$appEngine->checkUserAuthentication(true, ACL_MOD_REPO, ACL_ACTION_ADD);
+$engine->checkUserAuthentication(true, ACL_MOD_REPO, ACL_ACTION_ADD);
$appTR->loadModule("repositorycreate");
//
@@ -37,12 +38,13 @@
if (check_request_var('create'))
{
- $appEngine->handleAction('create_repository');
+ $engine->handleAction('create_repository');
}
//
// View Data
//
+SetValue('RepositoryParentList', $engine->getRepositoryViewProvider()->getRepositoryParents());
ProcessTemplate("repository/repositorycreate.html.php");
?>
View
36 repositorylist.php
@@ -23,37 +23,45 @@
// Authentication
//
-if (!$appEngine->isRepositoryViewActive())
-{
- $appEngine->forwardError(ERROR_INVALID_MODULE);
+$engine = \svnadmin\core\Engine::getInstance();
+
+if (!$engine->isProviderActive(PROVIDER_REPOSITORY_VIEW)) {
+ $engine->forwardError(ERROR_INVALID_MODULE);
}
-$appEngine->checkUserAuthentication(true, ACL_MOD_REPO, ACL_ACTION_VIEW);
+$engine->checkUserAuthentication(true, ACL_MOD_REPO, ACL_ACTION_VIEW);
$appTR->loadModule("repositorylist");
//
// Actions
//
-if (check_request_var("delete"))
-{
- $appEngine->handleAction("delete_repository");
+if (check_request_var("delete")) {
+ $engine->handleAction("delete_repository");
}
//
// View data
//
-$repos = array();
+$repositoryParentList = array();
+$repositoryList = array();
try {
- $repos = $appEngine->getRepositoryViewProvider()->getRepositories();
- usort($repos, array('\svnadmin\core\entities\Repository',"compare"));
+ // Repository parent locations.
+ $repositoryParentList = $engine->getRepositoryViewProvider()->getRepositoryParents();
+
+ // Repositories of all locations.
+ foreach ($repositoryParentList as $rp) {
+ $repositoryList[$rp->identifier] = $engine->getRepositoryViewProvider()->getRepositoriesOfParent($rp);
+ usort($repositoryList[$rp->identifier], array('\svnadmin\core\entities\Repository', 'compare'));
+ }
}
catch (Exception $ex) {
- $appEngine->addException($ex);
+ $engine->addException($ex);
}
-SetValue("ShowDeleteButton", $appEngine->getConfig()->getValueAsBoolean("GUI", "RepositoryDeleteEnabled", true));
-SetValue("RepositoryList", $repos);
-ProcessTemplate("repository/repositorylist.html.php");
+SetValue('RepositoryParentList', $repositoryParentList);
+SetValue('RepositoryList', $repositoryList);
+SetValue('ShowDeleteButton', $appEngine->getConfig()->getValueAsBoolean("GUI", "RepositoryDeleteEnabled", true));
+ProcessTemplate('repository/repositorylist.html.php');
?>
View
27 repositoryview.php
@@ -23,20 +23,24 @@
// Authentication
//
-if (!$appEngine->isRepositoryViewActive())
-{
- $appEngine->forwardInvalidModule(true);
+$engine = \svnadmin\core\Engine::getInstance();
+
+if (!$engine->isProviderActive(PROVIDER_REPOSITORY_VIEW)) {
+ $engine->forwardError(ERROR_INVALID_MODULE);
}
-$appEngine->checkUserAuthentication(true, ACL_MOD_REPO, ACL_ACTION_VIEW);
+$engine->checkUserAuthentication(true, ACL_MOD_REPO, ACL_ACTION_VIEW);
$appTR->loadModule("repositoryview");
//
// HTTP Request Vars
//
-$varRepoEnc = get_request_var("r");
-$varPathEnc = get_request_var("p");
+$varParentIdentifierEnc = get_request_var('pi');
+$varRepoEnc = get_request_var('r');
+$varPathEnc = get_request_var('p');
+
+$varParentIdentifier = rawurldecode($varParentIdentifierEnc);
$varRepo = rawurldecode($varRepoEnc);
$varPath = rawurldecode($varPathEnc);
@@ -44,16 +48,15 @@
// View Data
//
-$oR = new \svnadmin\core\entities\Repository();
-$oR->name = $varRepo;
+$oR = new \svnadmin\core\entities\Repository($varRepo, $varParentIdentifier);
try {
// Get the files of the selected repository path.
- $repoPathList = $appEngine->getRepositoryViewProvider()->listPath($oR, $varPath);
+ $repoPathList = $engine->getRepositoryViewProvider()->listPath($oR, $varPath);
// Web-Link - Directory Listing
- $apacheWebLink = $appEngine->getConfig()->getValue("Subversion:WebListing", "ApacheDirectoryListing");
- $customWebLink = $appEngine->getConfig()->getValue("Subversion:WebListing", "CustomDirectoryListing");
+ $apacheWebLink = $engine->getConfig()->getValue("Subversion:WebListing", "ApacheDirectoryListing");
+ $customWebLink = $engine->getConfig()->getValue("Subversion:WebListing", "CustomDirectoryListing");
$hasApacheWebLink = !empty($apacheWebLink) ? true : false;
$hasCustomWebLink = !empty($customWebLink) ? true : false;
@@ -113,7 +116,7 @@
SetValue("RepositoryRoot", $isRepositoryRoot);
}
catch (Exception $ex) {
- $appEngine->addException($ex);
+ $engine->addException($ex);
}
ProcessTemplate("repository/repositoryview.html.php");
?>
View
4 templates/ifappstyle.css
@@ -15,6 +15,7 @@ a:hover { color:#ff0000; text-decoration:none; }
input,textarea,select { font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif; font-size:11px; background-color:#fafafa; border:1px #aaaaaa solid; color:#000000; }
input[type=submit] { font-size:11px; cursor:pointer; padding:5px; background-color:#eeeeee; background:url("images/button-background-grey.png") repeat-x scroll left top; -moz-border-radius:11px; -khtml-border-radius:11px; -webkit-border-radius:11px; border-radius:11px; }
input[type=submit]:hover { border-color:#000000; }
+input[type=checkbox] { border:0; }
select{ padding:4px; }
ul,ol,li { list-style:none; }
@@ -171,12 +172,15 @@ div#login input[type=text], div#login input[type=password]{
table.datatable{
border-collapse:collapse;
width:100%;
+ margin-bottom: 20px;
+ box-shadow:0px 0px 5px 0px #ccc;
}
table.datatable th{
border:1px #dddddd solid;
background-color:#efefef;
font-weight:bold;
+ font-size:0.9em;
height:30px;
background-image:url("images/th-background.png");
background-position:top left;
Please sign in to comment.
Something went wrong with that request. Please try again.