Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
file naming
08-09-2010, 01:43 PM,
#1
file naming
Hi
first of all, thank for LetoDMS, it seems to work very well.
My question is about the naming of files.
Why are they renamed with a numbering system on the server?
I just did a back up and of course all the files have a number instead of their original titles.
This is not ideal should I decide to discontinue with LetoDMS or when I want to make a backup of all of my files.
Is there another way of configuring the naming?
thank you
Michael
Reply
08-09-2010, 03:48 PM,
#2
RE: file naming
hi Michael

how are you doing ?

thank you for using LetoDMS

if your referring to where file are upload and turn into number i think that is fine , because they are still hook up with with name on letodms when you upload it , so i mean i can understand you have to back up your file , but file are number and when you put your back up back in there, it needs to be number so LetoDMS can read it . so you can access the name on letodms and download or do whatever to it .

i hope this answers your question

Thanks

LetoDMS Team

now if someone else in the team thinks other wise please post thanks .
Reply
08-09-2010, 04:26 PM,
#3
RE: file naming
Nevertheless before a backup you can create the versioning_info.txt file (have a look on the administration tool) that is thinked for this porpouse (it reports the main information about document) including the original filename.
Reply
08-09-2010, 05:41 PM, (This post was last modified: 08-10-2010, 01:10 PM by michaelthomsen.)
#4
RE: file naming
Hi
I understand that Letodms needs number, I would just prefer to be able to download all the latest versions together and with their original names.
One reason for this is that we are working on book chapters. These files will have to be emailed to the editor and designers.
I will soon have more than 500 files in the system. It would be very tiresome to either have to download them one at a time or rename them all manually after a backup.

All I would like it the ability to zip all my documents but with the original name instead of a number.
If I can click on download document and get a download with the original name, it must be possible to perform a bulk export with original names in a zip file.

cheers and thank you
Michael


(08-09-2010, 04:26 PM)matteo lucarelli Wrote: Nevertheless before a backup you can create the versioning_info.txt file (have a look on the administration tool) that is thinked for this porpouse (it reports the main information about document) including the original filename.
Reply
08-10-2010, 05:30 PM,
#5
RE: file naming
Bulk export with original names in a zip file is a good solution.
I'm evaluting it for the next relese (1.10)
Reply
08-11-2010, 08:35 PM,
#6
RE: file naming
Hello

I'm modified backup function to backup just the last version of file, with filename and path

Code:
<?php
//    MyDMS. Document Management System
//    Copyright (C) 2002-2005  Markus Westphal
//    Copyright (C) 2006-2008 Malcolm Cowe
//    Copyright (C) 2010 Matteo Lucarelli
//
//    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; either version 2 of the License, or
//    (at your option) any later version.
//
//    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; if not, write to the Free Software
//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

include("../inc/inc.Settings.php");
include("../inc/inc.AccessUtils.php");
include("../inc/inc.ClassAccess.php");
include("../inc/inc.ClassDocument.php");
include("../inc/inc.ClassEmail.php");
include("../inc/inc.ClassFolder.php");
include("../inc/inc.ClassGroup.php");
include("../inc/inc.ClassUser.php");
include("../inc/inc.DBAccess.php");
include("../inc/inc.FileUtils.php");
include("../inc/inc.Language.php");
include("../inc/inc.ClassUI.php");
include("../inc/inc.Authentication.php");

// TODO: test if zLib is available

if (!$user->isAdmin()) {
    UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
}

// Adds file header to the tar file, it is used before adding file content.
// f: file resource (provided by eg. fopen)
// phisfn: path to file
// archfn: path to file in archive, directory names must be followed by '/'
// code by calmarius at nospam dot atw dot hu
function TarAddHeader($f,$phisfn,$archfn)
{
    $info=stat($phisfn);
    $ouid=sprintf("%6s ", decoct($info[4]));
    $ogid=sprintf("%6s ", decoct($info[5]));
    $omode=sprintf("%6s ", decoct(fileperms($phisfn)));
    $omtime=sprintf("%11s", decoct(filemtime($phisfn)));
    if (@is_dir($phisfn))
    {
         $type="5";
         $osize=sprintf("%11s ", decoct(0));
    }
    else
    {
         $type='';
         $osize=sprintf("%11s ", decoct(filesize($phisfn)));
         clearstatcache();
    }
    $dmajor = '';
    $dminor = '';
    $gname = '';
    $linkname = '';
    $magic = '';
    $prefix = '';
    $uname = '';
    $version = '';
    $chunkbeforeCS=pack("a100a8a8a8a12A12",$archfn, $omode, $ouid, $ogid, $osize, $omtime);
    $chunkafterCS=pack("a1a100a6a2a32a32a8a8a155a12", $type, $linkname, $magic, $version, $uname, $gname, $dmajor, $dminor ,$prefix,'');

    $checksum = 0;
    for ($i=0; $i<148; $i++) $checksum+=ord(substr($chunkbeforeCS,$i,1));
    for ($i=148; $i<156; $i++) $checksum+=ord(' ');
    for ($i=156, $j=0; $i<512; $i++, $j++)    $checksum+=ord(substr($chunkafterCS,$j,1));

    fwrite($f,$chunkbeforeCS,148);
    $checksum=sprintf("%6s ",decoct($checksum));
    $bdchecksum=pack("a8", $checksum);
    fwrite($f,$bdchecksum,8);
    fwrite($f,$chunkafterCS,356);
    return true;
}

// Writes file content to the tar file must be called after a TarAddHeader
// f:file resource provided by fopen
// phisfn: path to file
// code by calmarius at nospam dot atw dot hu
function TarWriteContents($f,$phisfn)
{
    if (@is_dir($phisfn))
    {
        return;
    }
    else
    {
        $size=filesize($phisfn);
        $padding=$size % 512 ? 512-$size%512 : 0;
        $f2=fopen($phisfn,"rb");
        while (!feof($f2)) fwrite($f,fread($f2,1024*1024));
        $pstr=sprintf("a%d",$padding);
        fwrite($f,pack($pstr,''));
    }
}

// Adds 1024 byte footer at the end of the tar file
// f: file resource
// code by calmarius at nospam dot atw dot hu
function TarAddFooter($f)
{
    fwrite($f,pack('a1024',''));
}

function getFolderPathPlainAST($folder) {
    $path="";
    $folderPath = $folder->getPath();
    for ($i = 0; $i  < count($folderPath); $i++) {
        $path .= $folderPath[$i]->getName();
        if ($i +1 < count($folderPath))
            $path .= "/";
    }
    return $path;
}

function createFolderTar($folder,$ark)
{
    global $settings;

    $documents=$folder->getDocuments();
    if (!empty($documents))
    {
        foreach ($documents as $document)
        {
            
            if (file_exists($settings->_contentDir.$document->getDir())){
                
                $latestContent = $document->getLatestContent();
                if (isset($latestContent))
                {
                    TarAddHeader(
                        $ark,
                        $settings->_contentDir.$latestContent->getPath(),
                        getFolderPathPlainAST($folder)."/".$latestContent->getOriginalFileName());
                    TarWriteContents($ark, $settings->_contentDir.$latestContent->getPath());
                    
                    
                }
            }    
        }
    }

    $subFolders=$folder->getSubfolders();
    foreach ($subFolders as $folder)
        if (!createFolderTar($folder,$ark))
            return false;
    
    return true;
}

// code by Kioob (php.net manual)
function gzcompressfile($source,$level=false)
{
    $dest=$source.'.gz';
    $mode='wb'.$level;
    $error=false;
    if($fp_out=gzopen($dest,$mode)){
        if($fp_in=fopen($source,'rb')){
            while(!feof($fp_in))
                gzwrite($fp_out,fread($fp_in,1024*512));
            fclose($fp_in);
        }
        else $error=true;
        gzclose($fp_out);
    }
    else $error=true;
    
    if($error) return false;
    else return $dest;
}


if (!isset($_POST["folderid"]) || !is_numeric($_POST["folderid"]) || intval($_POST["folderid"])<1) {
    UI::exitError(getMLText("admin_tools"),getMLText("invalid_folder_id"));
}
$folderid = $_POST["folderid"];
$folder = getFolder($folderid);

if (!is_object($folder)) {
    UI::exitError(getMLText("admin_tools"),getMLText("invalid_folder_id"));
}

$ark_name = $settings->_contentDir.time()."_".$folderid.".tar";

$ark = fopen($ark_name,"w");

if (!createFolderTar($folder,$ark)) {
    fclose($ark);
    unlink($ark_name);
    UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
}

TarAddFooter($ark);
fclose($ark);

if (gzcompressfile($ark_name,9)) unlink($ark_name);
else UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));

header("Location:../out/out.BackupTools.php");

?>
Reply
08-11-2010, 09:36 PM,
#7
RE: file naming
Good patch, I'm going to including it in the next release (1.10) but adding a flag on the backup page.
That's because the renaming turn the archive unusable for backup, then must be optional.
Reply
08-12-2010, 06:43 AM,
#8
RE: file naming
very good point.
there needs to be two options:

Backup tools

Archive creation
With this operation you can create an archive containing the files of one or more of the DMS folders. After creation the archive will be saved in the data folder of your server. The archive retains the original document names.

Backup creation
With this operation you can create a backup file containing the files of one of more of the DMS folders. After creation the backup will be saved in the data folder of your server. Use this backup to restore your DMS.

Note: rather than Search I suggest the button text could be Select folder...

(08-11-2010, 09:36 PM)matteo lucarelli Wrote: Good patch, I'm going to including it in the next release (1.10) but adding a flag on the backup page.
That's because the renaming turn the archive unusable for backup, then must be optional.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)

Contact Us | LetoDMS Community Forum | Return to Top | | Lite (Archive) Mode | RSS Syndication