From 63f075f9693955ec7d45fc9011a38df4a4e07b81 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Sun, 9 Aug 2015 06:47:00 +0200 Subject: [PATCH] export files saved added with approval/review --- utils/xmldump.php | 114 +++++++++++++++++++++++++++------------------- 1 file changed, 68 insertions(+), 46 deletions(-) diff --git a/utils/xmldump.php b/utils/xmldump.php index aec6fa01f..0da836569 100644 --- a/utils/xmldump.php +++ b/utils/xmldump.php @@ -107,6 +107,56 @@ $statistic = array( 'documentcategories'=>0, ); +function dumplog($type, $logs, $indent) { /* {{{ */ + switch($type) { + case 'approval': + $type2 = 'approve'; + break; + default: + $type2 = 'review'; + } + echo $indent." <".$type."s>\n"; + $curid = 0; + foreach($logs as $a) { + if($a[$type2.'ID'] != $curid) { + if($curid != 0) { + echo $indent." \n"; + } + echo $indent." <".$type." id=\"".$a[$type2.'ID']."\">\n"; + echo $indent." ".$a['type']."\n"; + echo $indent." ".$a['required']."\n"; + } + echo $indent." <".$type."log id=\"".$a[$type2.'LogID']."\">\n"; + echo $indent." ".$a['userID']."\n"; + echo $indent." ".$a['status']."\n"; + echo $indent." ".wrapWithCData($a['comment'])."\n"; + echo $indent." ".$a['date']."\n"; + if($a['file']) { + $filename = $dms->contentDir . $document->getDir().'r'.(int) $a[$type2.'LogID']; + if(file_exists($filename)) { + echo $indent." \n"; + echo chunk_split(base64_encode(file_get_contents($filename)), 76, "\n"); + echo $indent." \n"; + } else { + echo " fileref=\"".$filename."\" />\n"; + if($contentdir) { + copy($filename, $contentdir.$document->getID()."-R-".$a[$type2.'LogID']); + } else { + echo "Warning: ".$type." log file (size=".filesize($filename).") will be missing from output\n"; + } + } + } + } + echo $indent." \n"; + $curid = $a[$type2.'ID']; + } + if($curid != 0) + echo $indent." \n"; + echo $indent." \n"; +} /* }}} */ + function tree($folder, $parent=null, $indent='', $skipcurrent=false) { /* {{{ */ global $sections, $statistic, $index, $dms, $maxsize, $contentdir; @@ -258,54 +308,10 @@ function tree($folder, $parent=null, $indent='', $skipcurrent=false) { /* {{{ */ echo $indent." \n"; } if($approvalStatus) { - echo $indent." \n"; - $curapprovalid = 0; - foreach($approvalStatus as $a) { - if($a['approveID'] != $curapprovalid) { - if($curapprovalid != 0) { - echo $indent." \n"; - } - echo $indent." \n"; - echo $indent." ".$a['type']."\n"; - echo $indent." ".$a['required']."\n"; - } - echo $indent." \n"; - echo $indent." ".$a['userID']."\n"; - echo $indent." ".$a['status']."\n"; - echo $indent." ".wrapWithCData($a['comment'])."\n"; - echo $indent." ".$a['date']."\n"; - echo $indent." \n"; -// echo $indent." \n"; - $curapprovalid = $a['approveID']; - } - if($curapprovalid != 0) - echo $indent." \n"; - echo $indent." \n"; + dumplog('approval', $approvalStatus, $indent); } if($reviewStatus) { - echo $indent." \n"; - $curreviewid = 0; - foreach($reviewStatus as $a) { - if($a['reviewID'] != $curreviewid) { - if($curreviewid != 0) { - echo $indent." \n"; - } - echo $indent." \n"; - echo $indent." ".$a['type']."\n"; - echo $indent." ".$a['required']."\n"; - } - echo $indent." \n"; - echo $indent." ".$a['userID']."\n"; - echo $indent." ".$a['status']."\n"; - echo $indent." ".wrapWithCData($a['comment'])."\n"; - echo $indent." ".$a['date']."\n"; - echo $indent." \n"; -// echo $indent." \n"; - $curreviewid = $a['reviewID']; - } - if($curreviewid != 0) - echo $indent." \n"; - echo $indent." \n"; + dumplog('review', $reviewStatus, $indent); } if(file_exists($dms->contentDir . $version->getPath())) { echo $indent." contentDir . $version->getPath())."\""; @@ -415,6 +421,8 @@ $dms->setRootFolderID($settings->_rootFolderID); echo "\n"; echo "getDBVersion(), 1, 3))."\" date=\"".date('Y-m-d H:i:s')."\">\n"; + +/* Dump users {{{ */ if(!$sections || in_array('users', $sections)) { $users = $dms->getAllUsers(); if($users) { @@ -464,7 +472,9 @@ if($users) { echo "\n"; } } +/* }}} */ +/* Dump groups {{{ */ if(!$sections || in_array('groups', $sections)) { $groups = $dms->getAllGroups(); if($groups) { @@ -487,7 +497,9 @@ if($groups) { echo "\n"; } } +/* }}} */ +/* Dump keywordcategories {{{ */ if(!$sections || in_array('keywordcategories', $sections)) { $categories = $dms->getAllKeywordCategories(); if($categories) { @@ -512,7 +524,9 @@ if($categories) { echo "\n"; } } +/* }}} */ +/* Dump documentcategories {{{ */ if(!$sections || in_array('documentcategories', $sections)) { $categories = $dms->getDocumentCategories(); if($categories) { @@ -526,7 +540,9 @@ if($categories) { echo "\n"; } } +/* }}} */ +/* Dump attributedefinition {{{ */ if(!$sections || in_array('attributedefinition', $sections)) { $attrdefs = $dms->getAllAttributeDefinitions(); if($attrdefs) { @@ -561,16 +577,22 @@ if($attrdefs) { echo "\n"; } } +/* }}} */ +/* Dump folders and documents {{{ */ $folder = $dms->getFolder($folderid); if($folder) { tree($folder, null, '', $skiproot); } +/* }}} */ +/* Dump statistics {{{ */ echo "\n"; echo " \n"; foreach($statistic as $type=>$count) echo " <".$type.">".$count."\n"; echo "\n"; +/* }}} */ + echo "\n"; ?>