Difference between revisions of "Utilities"

From OpenKM Documentation
Jump to: navigation, search
(PHP Utilities)
 
(69 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{TOCright}} __TOC__
 +
 
These are OpenKM utilities created by the community.
 
These are OpenKM utilities created by the community.
 +
== General Utilities ==
 +
* [[Direct link]] ( Link documents outside OpenKM )
 +
* [[Fast extension sample]] ( Show how to fastly extend openkm UI features ).
 +
* [[Bash document import]] ( Bash script to import documents )
 +
* [[Extra tab with OpenKM url link]] ( Show how to access GWT javascript functions from iframe )
  
== File upload ==
+
== Script Utilities ==
<source lang="php">
+
* [[Folders deep]] ( Find folder with some depth )
  <?php
+
* [[Cognitive PDF/A]] ( Cognitive PDF/A integration example )
  $okmurl="http://localhost:8080/OpenKM/";
+
* [[Low level security change]] ( For great size repositories change security in low level mode )
  $okmid="username";
+
* [[CSV importer]] ( Import metadata from CSV files )
  $okmpw="password";
+
* [[Export folder to server as zip]]
  $impfile = $argv[1];
+
* [[Convert Exchange Legacy DN]]
 
 
  $OKMAuth = new SoapClient($okmurl."OKMAuth?wsdl");
 
  $OKMDocument = new SoapClient($okmurl."OKMDocument?wsdl");
 
 
 
  // open file and encode if necessary
 
  $handle = fopen($impfile,'rb');
 
  $file_content = fread($handle,filesize($impfile));
 
  fclose($handle);
 
  $encoded = base64_encode($file_content);
 
  
  // Login
+
== Automation ==
  $token = $OKMAuth->login($okmid, $okmpw);
+
* [[Incremental autonumeric]] ( creates incremental autonumeric for each new document )
  $OKMDocument->createSimple($token,"/okm:root/file.to.upload",$file_content);
+
* [[OMR scripting]] ( automatically process images by OMR engine )
 +
* [[Unique name]] ( automatically creates unique document name based in metadata values )
 +
* [[Simple autotagging]] ( automatically autotaggin documents based in database metadata values )
 +
* [[Folder Style assigned by metadata]] ( automatically assign folder style based on metadata document values into )
  
  // Logout
+
== Reports ==
  $OKMAuth->logout($token);
+
* [[File:SQLReportPattern.jrxml]] ( sql basic report pattern )
?>
+
* [[File:JavaReportPattern.jrxml]] ( java basic report pattern )
</source>
 
  
<source lang="bash">
+
== Crontab Utilites ==
#!/bin/bash
+
* [[Crontab importer with metadata]] ( import files with metadata values in the filename from server filesystem).
# JOAKO Import 1.0.0 - Copyright 2011 Andrew Joakimsen
+
* [[Crontab simple importer]] ( import files from server filesystem )
# Distributed under the terms of the GNU General Public
+
* [[Crontab xml importer]] ( import files from server filesystem with metadata values)
# License Version 2 and no future versions.
 
#
 
# Script to import files into OpenKM and report error/success.
 
# Requires the PHP import script written by snowman, with a
 
# few small tweaks.
 
  
###################################
+
== PHP Utilities ==
###                            ###
+
* [[PHP AutoImport]] ( Import pdf files from some local path to specific OpenKM server path )
###  C O N F I G U R A T I O N  ###
+
* [[PHP fileUpoad]] ( Shell script that uses php support to import files )
###                            ###
+
* [[PHP Download file]] ( download file using webservices )
###################################
+
* [http://code.google.com/p/openkm-php-class/ PHP Class made for OpenKM Document Manager]
  
# OpenKM directory where files are imported to
+
== Others ==
OKM_IMPORT_DIR=NEW
+
* [[Version number sample]]
  
# Filesystem directory (no trailing slash) where we put imported files (it will be created)
+
== Remote Importer ==
STORE_DIR=~/we-test
+
This utility is designed to import documents to a remote OpenKM instance. It uses OpenKM WebServices API so is firewall friendly.
  
# Filesystem directory (no trailing slash) where we put files that encountered import errors
+
You need Java 7 installed in your computer since v1.0.
ERROR_STORE_DIR=~/error-test
 
  
####################################
 
# First let's see if the runtime condition is sane
 
if [ -z "$1" ]; then
 
    echo "JOAKO Import: Missing file name"
 
    echo "Usage: import.sh [filename] [target-directory]"
 
    exit 1
 
fi
 
  
# If ARG1 is a real file
+
{| align="center"
if [ -d "$1" ]; then
+
|[[File:Remote Importer 01.png|300px|center]]
    echo "ERROR: \"$1\" is a directory!"
+
|[[File:Remote Importer 02.png|300px|center]]
    exit 1
+
|}
fi
 
if [ ! -f "$1" ]; then
 
    echo "ERROR: \"$1\" Invalid file name "
 
    exit 1
 
else
 
    INFILE=$1
 
fi
 
  
# Check if OKM_IMPORT_DIR was passed as argument
 
if [ -z "$2" ]; then
 
    OKM_DIR=$OKM_IMPORT_DIR
 
else
 
    OKM_DIR=$2
 
fi
 
  
# Check if the imported files directory exsists
+
{{Note|The '''preserve creation date''' feature in only compatible since OpenKM Professional 6.2.10 and OpenKM Community 6.2.3.}}
if [ ! -d $STORE_DIR/$OKM_DIR ]; then
 
    if [ ! -d ~/$STORE_DIR ]; then
 
        mkdir $STORE_DIR
 
    fi
 
    mkdir $STORE_DIR/$OKM_DIR
 
fi
 
  
# Run the import Process
 
RESULT=$(php /opt/openkm/import.php $INFILE ${INFILE##*/} $OKM_DIR 2>&1)
 
RESULTCODE=$?
 
  
# Deal with the consequences
+
[http://www.openkm.com/utils/wsImporter.jnlp Download & Execute]
function importer-error {
 
    # Check if the import error directory exsists
 
    if [ ! -d $ERROR_STORE_DIR/$OKM_DIR ]; then
 
        if [ ! -d $ERROR_STORE_DIR ]; then
 
            mkdir $ERROR_STORE_DIR
 
        fi
 
        mkdir $ERROR_STORE_DIR/$OKM_DIR
 
    fi
 
    echo "`date` JOAKO Import Encountered an error type $RESULTCODE."
 
    echo "$RESULT"
 
    mv $INFILE $ERROR_STORE_DIR/$OKM_DIR &> /dev/null
 
    exit $?
 
}
 
  
if [ $RESULTCODE -ne 0 ]; then # There was an error
+
[[Category: Utilities]]
    importer-error
 
else # We check further
 
    if [ -n "$RESULT" ]; then # There was an error
 
        importer-error
 
    else # No error detected
 
        echo "`date` JOAKO Import: Imported file [${INFILE##*/}] to [$OKM_DIR] directory"
 
        mv $INFILE $STORE_DIR/$OKM_DIR &> /dev/null
 
        exit 0
 
    fi
 
fi
 
</source>
 

Latest revision as of 17:33, 13 May 2015

These are OpenKM utilities created by the community.

General Utilities

Script Utilities

Automation

Reports

Crontab Utilites

PHP Utilities

Others

Remote Importer

This utility is designed to import documents to a remote OpenKM instance. It uses OpenKM WebServices API so is firewall friendly.

You need Java 7 installed in your computer since v1.0.


Remote Importer 01.png
Remote Importer 02.png



Nota clasica.png The preserve creation date feature in only compatible since OpenKM Professional 6.2.10 and OpenKM Community 6.2.3.


Download & Execute