mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 07:04:57 +00:00
export files saved added with approval/review
This commit is contained in:
parent
ce756a5939
commit
63f075f969
|
@ -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." </".$type.">\n";
|
||||
}
|
||||
echo $indent." <".$type." id=\"".$a[$type2.'ID']."\">\n";
|
||||
echo $indent." <attr name=\"type\">".$a['type']."</attr>\n";
|
||||
echo $indent." <attr name=\"required\">".$a['required']."</attr>\n";
|
||||
}
|
||||
echo $indent." <".$type."log id=\"".$a[$type2.'LogID']."\">\n";
|
||||
echo $indent." <attr name=\"user\">".$a['userID']."</attr>\n";
|
||||
echo $indent." <attr name=\"status\">".$a['status']."</attr>\n";
|
||||
echo $indent." <attr name=\"comment\">".wrapWithCData($a['comment'])."</attr>\n";
|
||||
echo $indent." <attr name=\"date\" format=\"Y-m-d H:i:s\">".$a['date']."</attr>\n";
|
||||
if($a['file']) {
|
||||
$filename = $dms->contentDir . $document->getDir().'r'.(int) $a[$type2.'LogID'];
|
||||
if(file_exists($filename)) {
|
||||
echo $indent." <data length=\"".filesize($filename)."\"";
|
||||
if(filesize($filesize) < $maxsize) {
|
||||
echo ">\n";
|
||||
echo chunk_split(base64_encode(file_get_contents($filename)), 76, "\n");
|
||||
echo $indent." </data>\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." </".$type."log>\n";
|
||||
$curid = $a[$type2.'ID'];
|
||||
}
|
||||
if($curid != 0)
|
||||
echo $indent." </".$type.">\n";
|
||||
echo $indent." </".$type."s>\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." </status>\n";
|
||||
}
|
||||
if($approvalStatus) {
|
||||
echo $indent." <approvals>\n";
|
||||
$curapprovalid = 0;
|
||||
foreach($approvalStatus as $a) {
|
||||
if($a['approveID'] != $curapprovalid) {
|
||||
if($curapprovalid != 0) {
|
||||
echo $indent." </approval>\n";
|
||||
}
|
||||
echo $indent." <approval id=\"".$a['approveID']."\">\n";
|
||||
echo $indent." <attr name=\"type\">".$a['type']."</attr>\n";
|
||||
echo $indent." <attr name=\"required\">".$a['required']."</attr>\n";
|
||||
}
|
||||
echo $indent." <approvallog id=\"".$a['approveLogID']."\">\n";
|
||||
echo $indent." <attr name=\"user\">".$a['userID']."</attr>\n";
|
||||
echo $indent." <attr name=\"status\">".$a['status']."</attr>\n";
|
||||
echo $indent." <attr name=\"comment\">".wrapWithCData($a['comment'])."</attr>\n";
|
||||
echo $indent." <attr name=\"date\" format=\"Y-m-d H:i:s\">".$a['date']."</attr>\n";
|
||||
echo $indent." </approvallog>\n";
|
||||
// echo $indent." </approval>\n";
|
||||
$curapprovalid = $a['approveID'];
|
||||
}
|
||||
if($curapprovalid != 0)
|
||||
echo $indent." </approval>\n";
|
||||
echo $indent." </approvals>\n";
|
||||
dumplog('approval', $approvalStatus, $indent);
|
||||
}
|
||||
if($reviewStatus) {
|
||||
echo $indent." <reviews>\n";
|
||||
$curreviewid = 0;
|
||||
foreach($reviewStatus as $a) {
|
||||
if($a['reviewID'] != $curreviewid) {
|
||||
if($curreviewid != 0) {
|
||||
echo $indent." </review>\n";
|
||||
}
|
||||
echo $indent." <review id=\"".$a['reviewID']."\">\n";
|
||||
echo $indent." <attr name=\"type\">".$a['type']."</attr>\n";
|
||||
echo $indent." <attr name=\"required\">".$a['required']."</attr>\n";
|
||||
}
|
||||
echo $indent." <reviewlog id=\"".$a['reviewLogID']."\">\n";
|
||||
echo $indent." <attr name=\"user\">".$a['userID']."</attr>\n";
|
||||
echo $indent." <attr name=\"status\">".$a['status']."</attr>\n";
|
||||
echo $indent." <attr name=\"comment\">".wrapWithCData($a['comment'])."</attr>\n";
|
||||
echo $indent." <attr name=\"date\" format=\"Y-m-d H:i:s\">".$a['date']."</attr>\n";
|
||||
echo $indent." </reviewlog>\n";
|
||||
// echo $indent." </review>\n";
|
||||
$curreviewid = $a['reviewID'];
|
||||
}
|
||||
if($curreviewid != 0)
|
||||
echo $indent." </review>\n";
|
||||
echo $indent." </reviews>\n";
|
||||
dumplog('review', $reviewStatus, $indent);
|
||||
}
|
||||
if(file_exists($dms->contentDir . $version->getPath())) {
|
||||
echo $indent." <data length=\"".filesize($dms->contentDir . $version->getPath())."\"";
|
||||
|
@ -415,6 +421,8 @@ $dms->setRootFolderID($settings->_rootFolderID);
|
|||
|
||||
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
|
||||
echo "<dms dbversion=\"".implode('.', array_slice($dms->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 "</users>\n";
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* Dump groups {{{ */
|
||||
if(!$sections || in_array('groups', $sections)) {
|
||||
$groups = $dms->getAllGroups();
|
||||
if($groups) {
|
||||
|
@ -487,7 +497,9 @@ if($groups) {
|
|||
echo "</groups>\n";
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* Dump keywordcategories {{{ */
|
||||
if(!$sections || in_array('keywordcategories', $sections)) {
|
||||
$categories = $dms->getAllKeywordCategories();
|
||||
if($categories) {
|
||||
|
@ -512,7 +524,9 @@ if($categories) {
|
|||
echo "</keywordcategories>\n";
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* Dump documentcategories {{{ */
|
||||
if(!$sections || in_array('documentcategories', $sections)) {
|
||||
$categories = $dms->getDocumentCategories();
|
||||
if($categories) {
|
||||
|
@ -526,7 +540,9 @@ if($categories) {
|
|||
echo "</documentcategories>\n";
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* Dump attributedefinition {{{ */
|
||||
if(!$sections || in_array('attributedefinition', $sections)) {
|
||||
$attrdefs = $dms->getAllAttributeDefinitions();
|
||||
if($attrdefs) {
|
||||
|
@ -561,16 +577,22 @@ if($attrdefs) {
|
|||
echo "</attrіbutedefinitions>\n";
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* Dump folders and documents {{{ */
|
||||
$folder = $dms->getFolder($folderid);
|
||||
if($folder) {
|
||||
tree($folder, null, '', $skiproot);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* Dump statistics {{{ */
|
||||
echo "<statistics>\n";
|
||||
echo " <command><![CDATA[".implode(" ", $argv)."]]></command>\n";
|
||||
foreach($statistic as $type=>$count)
|
||||
echo " <".$type.">".$count."</".$type.">\n";
|
||||
echo "</statistics>\n";
|
||||
/* }}} */
|
||||
|
||||
echo "</dms>\n";
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue
Block a user