[Fusionforge-commits] r11034 - in trunk/src: common/docman/include common/include www/docman

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Sat Oct 16 17:46:38 CEST 2010


Author: nerville
Date: 2010-10-16 17:46:38 +0200 (Sat, 16 Oct 2010)
New Revision: 11034

Modified:
   trunk/src/common/docman/include/webdav.php
   trunk/src/common/include/Group.class.php
   trunk/src/www/docman/view.php
Log:
prepare storage API

Modified: trunk/src/common/docman/include/webdav.php
===================================================================
--- trunk/src/common/docman/include/webdav.php	2010-10-16 08:27:15 UTC (rev 11033)
+++ trunk/src/common/docman/include/webdav.php	2010-10-16 15:46:38 UTC (rev 11034)
@@ -27,7 +27,7 @@
 
 require_once "HTTP/WebDAV/Server.php";
 
-class HTTP_WebDAV_Server_Docman extends HTTP_WebDAV_Server {
+class HTTP_WebDAV_Server_Docman_DB extends HTTP_WebDAV_Server {
 
 	function GET(&$options) {
 		$arr_path = explode('/',$options['path']);

Modified: trunk/src/common/include/Group.class.php
===================================================================
--- trunk/src/common/include/Group.class.php	2010-10-16 08:27:15 UTC (rev 11033)
+++ trunk/src/common/include/Group.class.php	2010-10-16 15:46:38 UTC (rev 11034)
@@ -4,6 +4,7 @@
  *
  * Copyright 1999-2001, VA Linux Systems, Inc.
  * Copyright 2009, Roland Mas
+ * Copyright 2010, Franck Villaume - Capgemini
  *
  * This file is part of FusionForge.
  *
@@ -2839,6 +2840,14 @@
 			return true;
 		}
 	}
+
+	function setStorageAPI($type) {
+		return true;
+	}
+
+	function getStorageAPI() {
+		return 1;
+	}
 }
 
 /**

Modified: trunk/src/www/docman/view.php
===================================================================
--- trunk/src/www/docman/view.php	2010-10-16 08:27:15 UTC (rev 11033)
+++ trunk/src/www/docman/view.php	2010-10-16 15:46:38 UTC (rev 11034)
@@ -39,16 +39,16 @@
 $group_id=$arr[3];
 $docid=$arr[4];
 
+$g =& group_get_object($group_id);
+if (!$g || !is_object($g)) {
+	exit_no_group();
+} elseif ($g->isError()) {
+	exit_error($g->getErrorMessage(),'docman');
+}
+
 if ($docid != 'backup' && $docid != 'webdav' ) {
 	$docname=urldecode($arr[5]);
 
-	$g =& group_get_object($group_id);
-	if (!$g || !is_object($g)) {
-		exit_no_group();
-	} elseif ($g->isError()) {
-		exit_error($g->getErrorMessage(),'docman');
-	}
-
 	$d = new Document($g,$docid);
 	if (!$d || !is_object($d)) {
 		exit_error(_('Document is not available.'),'docman');
@@ -80,12 +80,6 @@
 	echo $d->getFileData();
 
 } else if ( $docid == 'backup' ) {
-	$g =& group_get_object($group_id);
-	if (!$g || !is_object($g)) {
-		exit_no_group();
-	} elseif ($g->isError()) {
-		exit_error($g->getErrorMessage(),'docman');
-	}
 
 	$df = new DocumentFactory($g);
 	if ($df->isError())
@@ -125,7 +119,13 @@
 	}
 } else if ( $docid == 'webdav' ) {
 	$_SERVER['SCRIPT_NAME'] = '';
-	$server = new HTTP_WebDAV_Server_Docman;
+	switch ($g->getStorageAPI()) {
+	case '1':
+		$server = new HTTP_WebDAV_Server_Docman_DB;
+		break;
+	default:
+		exit_error(_('Webdav Storage API not implemented'),'docman');
+	}
 	$server->ServeRequest();
 	exit;
 } else {




More information about the Fusionforge-commits mailing list