Documents at 65%. Display folders and documents, no pagination yet.. Posible to create Folders and upload external files. Working on Download, search

This commit is contained in:
Hugo Loza
2010-12-17 22:30:02 +00:00
parent 09a7399838
commit 779a87e046
121 changed files with 3746 additions and 1287 deletions

View File

@@ -0,0 +1,438 @@
/*
* Copyright 2008, brainbits GmbH All rights reserved.
* Author: Stephan Wentz. swentz[at]brainbits.net
*
* http://www.brainbits.net/
*/
/**
* LocationBar class
* Version: 0.1
* @class Ext.ux.Locationbar
* @extends Ext.Toolbar
* Locationbar class.
* @constructor
* Creates a new LocationBar
* @param {Object/Array} config A config object or an array of buttons to add
*/
Ext.ux.LocationBar = Ext.extend(Ext.Toolbar, {
/**
* @cfg {Number} maxItem Maximum number of items the Locationbar takes before the first items are removed (defaults to 15).
* Set to 0 for unlimited items.
*/
maxItems: 15,
/**
* @cfg {String} emptyText The that is shown if no history is available (defaults to 'No node selected.').
*/
emptyText: 'No node selected.',
/**
* @cfg {Boolean} noReload If set to true the reload button will not be visible (defaults to false).
*/
noReload: false,
/**
* @cfg {Function} selectHandler The function to
* call when clicked. Arguments passed are:<ul>
* <li><b>node</b> : Object<p style="margin-left:1em">The node associated with the clicked item.</p></li>
* </ul>
*/
selectHandler: null,
/**
* @cfg {Function} reloadHandler The function to
* call when clicked. Arguments passed are:<ul>
* <li><b>node</b> : Object<p style="margin-left:1em">The node associated with the current item.</p></li>
* </ul>
*/
reloadHandler: null,
/**
* @cfg {String} locationItems Initial items (defaults to []).
*/
locationItems: [],
/**
* @cfg {String} folderIconCls Iconclass for folder icons.
*/
folderIconCls: 'x-locationbar-folder-icon',
/**
* @cfg {String} folderIconCls Iconclass for the backward icon.
*/
backwardIconCls: 'x-locationbar-back-icon',
/**
* @cfg {String} folderIconCls Iconclass for the forward icon.
*/
forwardIconCls: 'x-locationbar-forward-icon',
/**
* @cfg {String} folderIconCls Iconclass for the reload icon.
*/
reloadIconCls: 'x-locationbar-reload-icon',
/**
* @cfg {Ext.tree.TreePanel} tree The treePanel this Locationbar is associated with.
*/
tree: null,
// private
historyItemNodes: {},
// private
historyItems: [],
// private
currentItem: false,
// private
historyNext: true,
// private
initComponent: function() {
//console.log("initComponent location bar");
if(this.tree) {
//console.log("tree exists");
//console.debug(this.tree);
//console.log("adding listener LOAD");
this.tree.getLoader().addListener('load',function(tl,node,resp){
//console.log("tree get loader LOAD -> "+node);
if(node){
node.loaded=true;
this.setNode(node);
}
},this);
//console.log("complete listener LOAD");
//console.log("adding listenr SELECTIONCHANGE");
this.tree.getSelectionModel().addListener('selectionchange', function(sm, node) {
//console.log("tree get loader SELECTION CHANGE");
if( node && node.id ) {
//console.log("changing to dir (form location bar) "+node.id);
chDir( node.id, true );
}
if (node.isLeaf()==false && node.childNodes.length==0){
//console.log(node.isLeaf(),node.childNodes.length)
this.nodeJustLoaded=node;
//this.tree.getLoader().load(node);
//this.loadNode(node);
}else{
this.setNode(node);
}
}, this);
//console.log("complete add listener SELECTIONCHANGE");
}
//this.addListener('render', this.repaint, this);
// Ext.ux.LocationBar.superclass.initComponent.call(this);
},
// private
autoCreate: {
cls:'x-toolbar x-small-editor x-locationbar',
html:'<table cellspacing="0"><tr></tr></table>'
},
// private
onRender: function(ct, position) {
Ext.ux.LocationBar.superclass.onRender.call(this, ct, position);
this.repaint();
},
// private
onClick: function(node) {
if (this.selectHandler) {
this.selectHandler(node);
} else {
if(node.parentNode) {
node.parentNode.expand(false,true);
node.ensureVisible();
}
node.select();
}
},
// private
onReload: function(node) {
if (this.reloadHandler) {
this.reloadHandler(node);
} else if(node.reload) {
node.reload();
}
},
/**
* Clears all items from the LocationBar.
*/
clear: function() {
this.locationItems = [];
this.repaint;
},
/**
* Sets the current Treenode
* If a tree was provided as a config to this LocationBar, this should
* be called automatically.
* @param {Ext.ux.TreeNode} node The currently selected TreeNode
*/
setNode: function(node) {
var path = [];
var pNode = node;
var i;
do {
var conf = {
text: pNode.attributes.text,
node: pNode,
handler: this.onClick.createDelegate(this, [pNode], false)
};
if (pNode.childNodes.length) {
var childs = [];
for (i = 0; i < pNode.childNodes.length; i++) {
childs[i] = {
text: pNode.childNodes[i].attributes.text,
node: pNode.childNodes[i],
iconCls: this.folderIconCls,
handler: this.onClick.createDelegate(this, [pNode.childNodes[i]], false)
};
}
conf.xtype = 'tbsplit';
conf.menu = childs;
}
conf.fullPath = pNode.getPath('text').substr(1);
path.unshift(conf);
} while (pNode.parentNode && (pNode = pNode.parentNode) && pNode.id != 'root');
this.locationItems = [];
for(i=0; i<path.length; i++) {
this.addPathItemRaw(path[i]);
}
this.currentItem = path[path.length - 1];
this.addHistoryItemRaw(this.currentItem);
this.repaint();
},
// private
addHistoryItemRaw: function(item){
if(this.historyItems.indexOf(item.text) != -1) {
this.historyItems.remove(item.text);
delete this.historyItemNodes[item.text];
}
this.historyItems.push(item.text);
this.historyItemNodes[item.text] = item;
},
// private
addPathItemRaw: function(item){
// if number of items > maxItems, remove last
if(this.maxItems && this.locationItems.length > this.maxItems) {
this.locationItems.pop();
}
// put new item at the end
this.locationItems.push(item);
},
// private
repaint: function() {
if (this.items && this.items.length) {
var _doLayout = true;
this.items.each(function(item){
this.items.remove(item);
item.destroy();
}, this.items);
} else {
var _doLayout = false;
}
try {
this.items.each(function(item){
this.items.remove(item);
item.destroy();
}, this.items);
} catch(e) {}
// back button
this.add({
cls: 'x-btn-icon',
iconCls: this.backwardIconCls,
handler: function() {
this.historyNext = this.historyItems.pop();
var itemKey = this.historyItems.pop();
var item = this.historyItemNodes[itemKey];
this.onClick(item.node);
},
scope: this,
disabled: this.historyItems.length > 1 ? false : true
});
// forward button
// TODO: disabled, FUBAR
this.add({
cls: 'x-btn-icon',
iconCls: this.forwardIconCls,
handler: function() {
var node = this.historyNext.node;
this.historyNext = false;
this.onClick(node);
},
scope: this,
disabled: true //this.historyNext ? false : true
});
this.add(' ','-',' ');
if (this.locationItems.length) {
// folder icon
this.add({
cls: 'x-btn-icon',
iconCls: this.folderIconCls,
ctCls: 'x-locationbar-location x-locationbar-location-first',
disabled: true
});
var text;
for (var i = 0; i < this.locationItems.length; i++) {
var locationItem = this.locationItems[i];
var item = {};
if (typeof locationItem == 'object') {
item = locationItem;
}
else {
item.text = locationItem;
}
if(!item.text) {
item.text = 'n/a';
}
item.handler = this.onClick.createDelegate(this, [locationItem.node], false);
item.ctCls = 'x-locationbar-location';
this.add(item);
}
// spacer
this.addItem(
{
cls: 'x-locationbar-location x-locationbar-location-last',
xtype: 'tbfill'
});
menu = [];
for(var i=this.historyItems.length-2; i>=0; i--) {
menu.push({
text: this.historyItemNodes[this.historyItems[i]].fullPath,
iconCls: this.folderIconCls,
node: this.historyItemNodes[this.historyItems[i]].node,
handler: function(item) {
this.onClick(item.node);
},
scope: this
});
}
this.add({
cls: 'x-btn-icon',
ctCls: 'x-locationbar-location x-locationbar-location-last',
menuAlign: 'tr-br?',
menu: menu
});
if(!this.noReload) {
this.add(' ');
// reload button
this.add({
cls: 'x-btn-icon',
iconCls: this.reloadIconCls,
handler: function() {
this.onReload(this.currentItem.node);
},
scope: this
});
}
this.add(' ');
} else {
this.add({
cls: 'x-btn-icon',
iconCls: this.folderIconCls,
ctCls: 'x-locationbar-location x-locationbar-location-first',
disabled: true
});
if(this.emptyText) {
this.add({
xtype: 'lbtext',
text: this.emptyText
});
}
this.addItem(new Ext.ux.LocationBar.Fill());
this.add({
cls: 'x-btn-icon',
ctCls: 'x-locationbar-location x-locationbar-location-last',
menuAlign: 'tr-br?',
disabled: true
});
this.add(' ');
this.add({
cls: 'x-btn-icon',
iconCls: this.reloadIconCls,
disabled: true
});
this.add(' ');
}
if (_doLayout === true) {
this.doLayout();
}
}
});
Ext.reg('locationbar', Ext.ux.LocationBar);
Ext.ux.Fill = Ext.extend(Ext.Toolbar.Spacer, {
// private
render : function(td){
td.style.width = '100%';
Ext.fly(td).addClass('x-locationbar-location');
Ext.ux.Fill.superclass.render.call(this, td);
}
});
Ext.reg('tbfill', Ext.ux.Fill);
Ext.ux.LocationBar.Fill = Ext.extend(Ext.Toolbar.Fill, {
// private
render : function(td){
td.className = 'x-locationbar-location';
// insert a &nbsp;
var data = document.createTextNode('\u00a0');
this.el.appendChild(data);
Ext.ux.LocationBar.Fill.superclass.render.call(this, td);
}
});
Ext.reg('lbfill', Ext.ux.LocationBar.Fill);
Ext.ux.LocationBar.TextItem = Ext.extend(Ext.Toolbar.TextItem, {
// private
render : function(td){
td.className = 'x-locationbar-location';
Ext.ux.LocationBar.Fill.superclass.render.call(this, td);
}
});
Ext.reg('lbtext', Ext.ux.LocationBar.TextItem);

View File

@@ -0,0 +1,80 @@
Ext.namespace('Ext.ux');
Ext.ux.StatusBar = Ext.extend(Ext.Toolbar, {
textId: '',
defaultText: '',
autoClear: 5000,
task: null,
initComponent: function() {
this.textId = Ext.id();
this.defaultText = this.initialConfig.defaultText || '';
var text = this.initialConfig.text || this.defaultText;
var config = {
items: [
'<span id="'+this.textId+'">'+text+'</span>', // status text
'->' // make it greedy
]
};
if (this.initialConfig.items) {
config.items = config.items.concat(this.initialConfig.items);
delete this.initialConfig.items;
}
Ext.apply(this, Ext.apply(this.initialConfig, config));
Ext.ux.StatusBar.superclass.initComponent.apply(this, arguments);
this.task = new Ext.util.DelayedTask(function() {
var el = Ext.get(this.textId);
var defaultText = this.defaultText;
el.fadeOut({
callback: function() {
el.update(defaultText);
el.show();
},
duration: 1
});
}, this);
},
onRender: function() {
Ext.ux.StatusBar.superclass.onRender.apply(this, arguments);
},
setText: function(text) {
var el = Ext.get(this.textId);
el.update(text);
},
setStatus: function(config) {
var defaults = {
clear: {
wait: this.autoClear,
anim: true,
useDefaults: true
}
};
if (config.clear === true) {
delete config.clear;
}
if (!Ext.isArray(config)) {
config = {
text: config.text || ''
}
}
Ext.apply(config, defaults);
var el = Ext.get(this.textId);
el.update(config.text);
var clear = config.clear;
var defaultText = this.defaultText;
if (clear.wait) {
this.task.delay(clear.wait);
}
else {
this.task.cancel();
}
},
clearStatus: function() {
this.setText(this.defaultText);
this.task.cancel();
},
showBusy: function(msg) {
// stub for now
}
});

View File

@@ -0,0 +1,159 @@
// vim: ts=4:sw=4:nu:fdc=4:nospell
/* global Ext */
/**
* @class Ext.ux.tree.TreeFilterX
* @extends Ext.tree.TreeFilter
*
* <p>
* Shows also parents of matching nodes as opposed to default TreeFilter. In
* other words this filter works "deep way".
* </p>
*
* @author Ing. Jozef Sakáloš
* @version 1.0
* @date 17. December 2008
* @revision $Id: Ext.ux.tree.TreeFilterX.js 589 2009-02-21 23:30:18Z jozo $
* @see <a
* href="http://extjs.com/forum/showthread.php?p=252709">http://extjs.com/forum/showthread.php?p=252709</a>
*
* @license Ext.ux.tree.CheckTreePanel is licensed under the terms of the Open
* Source LGPL 3.0 license. Commercial use is permitted to the extent
* that the code/component(s) do NOT become part of another Open Source
* or Commercially licensed development library or toolkit without
* explicit permission.
*
* <p>
* License details: <a href="http://www.gnu.org/licenses/lgpl.html"
* target="_blank">http://www.gnu.org/licenses/lgpl.html</a>
* </p>
*
* @forum 55489
* @demo http://remotetree.extjs.eu
*
* @donate <form action="https://www.paypal.com/cgi-bin/webscr" method="post"
* target="_blank"> <input type="hidden" name="cmd" value="_s-xclick">
* <input type="hidden" name="hosted_button_id" value="3430419"> <input
* type="image"
* src="https://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif"
* border="0" name="submit" alt="PayPal - The safer, easier way to pay
* online."> <img alt="" border="0"
* src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1"
* height="1"> </form>
*/
Ext.ns('Ext.ux.tree');
/**
* Creates new TreeFilterX
*
* @constructor
* @param {Ext.tree.TreePanel}
* tree The tree panel to attach this filter to
* @param {Object}
* config A config object of this filter
*/
Ext.ux.tree.TreeFilterX = Ext.extend(Ext.tree.TreeFilter, {
/**
* @cfg {Boolean} expandOnFilter Deeply expands startNode before filtering
* (defaults to true)
*/
expandOnFilter : true
// {{{
/**
* Filter the data by a specific attribute.
*
* @param {String/RegExp}
* value Either string that the attribute value should start with
* or a RegExp to test against the attribute
* @param {String}
* attr (optional) The attribute passed in your node's attributes
* collection. Defaults to "text".
* @param {TreeNode}
* startNode (optional) The node to start the filter at.
*/
,
filter : function(value, attr, startNode) {
// expand start node
if (false !== this.expandOnFilter) {
startNode = startNode || this.tree.root;
var animate = this.tree.animate;
this.tree.animate = false;
startNode.expand(true, false, function() {
// call parent after expand
Ext.ux.tree.TreeFilterX.superclass.filter.call(this, value,
attr, startNode);
}.createDelegate(this));
this.tree.animate = animate;
} else {
// call parent
Ext.ux.tree.TreeFilterX.superclass.filter.apply(this, arguments);
}
} // eo function filter
// }}}
// {{{
/**
* Filter by a function. The passed function will be called with each node
* in the tree (or from the startNode). If the function returns true, the
* node is kept otherwise it is filtered. If a node is filtered, its
* children are also filtered. Shows parents of matching nodes.
*
* @param {Function}
* fn The filter function
* @param {Object}
* scope (optional) The scope of the function (defaults to the
* current node)
*/
,
filterBy : function(fn, scope, startNode) {
startNode = startNode || this.tree.root;
if (this.autoClear) {
this.clear();
}
var af = this.filtered, rv = this.reverse;
var f = function(n) {
if (n === startNode) {
return true;
}
if (af[n.id]) {
return false;
}
var m = fn.call(scope || n, n);
if (!m || rv) {
af[n.id] = n;
n.ui.hide();
return true;
} else {
n.ui.show();
var p = n.parentNode;
while (p && p !== this.root) {
p.ui.show();
p = p.parentNode;
}
return true;
}
return true;
};
startNode.cascade(f);
if (this.remove) {
for ( var id in af) {
if (typeof id != "function") {
var n = af[id];
if (n && n.parentNode) {
n.parentNode.removeChild(n);
}
}
}
}
} // eo function filterBy
// }}}
}); // eo extend
// eof

View File

@@ -24,7 +24,12 @@ class AppFolder extends BaseAppFolder {
* @param strin(32) $folderParent * @param strin(32) $folderParent
* @return Ambigous <>|number * @return Ambigous <>|number
*/ */
function createFolder($folderName, $folderParent = "/") { function createFolder($folderName, $folderParent = "/", $action="createifnotexists") {
$validActions=array("createifnotexists","create","update");
if(!in_array($action,$validActions)) $action="createifnotexists";
//Clean Folder and Parent names (delete spaces...)
$folderName=trim($folderName);
$folderParent=trim($folderParent);
//Try to Load the folder (Foldername+FolderParent) //Try to Load the folder (Foldername+FolderParent)
$oCriteria = new Criteria ( 'workflow' ); $oCriteria = new Criteria ( 'workflow' );
$oCriteria->add ( AppFolderPeer::FOLDER_NAME, $folderName ); $oCriteria->add ( AppFolderPeer::FOLDER_NAME, $folderName );
@@ -32,11 +37,13 @@ class AppFolder extends BaseAppFolder {
$oDataset = AppFolderPeer::doSelectRS ( $oCriteria ); $oDataset = AppFolderPeer::doSelectRS ( $oCriteria );
$oDataset->setFetchmode ( ResultSet::FETCHMODE_ASSOC ); $oDataset->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
$oDataset->next (); $oDataset->next ();
if ($aRow = $oDataset->getRow ()) { //Folder exist, then return the ID if ($aRow = $oDataset->getRow ()) {//Folder exist, then return the ID
return ($aRow ['FOLDER_UID']); $response['success']=false;
} else { //Folder doesn't exist. Create and return the ID $response['message']=$response['error']="Can't create folder <br /> A folder with same name already exists. <br /> $folderParent$folderName";
$response['folderUID']=$aRow ['FOLDER_UID'];
//return ($aRow ['FOLDER_UID']);
return ($response);
} else {//Folder doesn't exist. Create and return the ID
$folderUID = G::GenerateUniqueID (); $folderUID = G::GenerateUniqueID ();
$tr = new AppFolder ( ); $tr = new AppFolder ( );
$tr->setFolderUid ( $folderUID ); $tr->setFolderUid ( $folderUID );
@@ -47,7 +54,11 @@ class AppFolder extends BaseAppFolder {
if ($tr->validate ()) { if ($tr->validate ()) {
// we save it, since we get no validation errors, or do whatever else you like. // we save it, since we get no validation errors, or do whatever else you like.
$res = $tr->save (); $res = $tr->save ();
return $folderUID; $response['success']=true;
$response['message']=$response['error']="Folder successfully created. <br /> $folderParent$folderName";
$response['folderUID']=$folderUID;
return ($response);
//return $folderUID;
} else { } else {
// Something went wrong. We can now get the validationFailures and handle them. // Something went wrong. We can now get the validationFailures and handle them.
$msg = ''; $msg = '';
@@ -55,7 +66,10 @@ class AppFolder extends BaseAppFolder {
foreach ( $validationFailuresArray as $objValidationFailure ) { foreach ( $validationFailuresArray as $objValidationFailure ) {
$msg .= $objValidationFailure->getMessage () . "<br/>"; $msg .= $objValidationFailure->getMessage () . "<br/>";
} }
krumo ( $msg ); $response['success']=false;
$response['message']=$response['error']="Can't create folder \n A \n ".$msg;
return ($response);
} }
} }
} }
@@ -80,7 +94,8 @@ class AppFolder extends BaseAppFolder {
$folderRoot = "/"; //Always starting from Root $folderRoot = "/"; //Always starting from Root
foreach ( $folderPathParsedArray as $folderName ) { foreach ( $folderPathParsedArray as $folderName ) {
if (trim ( $folderName ) != "") { if (trim ( $folderName ) != "") {
$folderRoot = $this->createFolder ( $folderName, $folderRoot ); $response = $this->createFolder ( $folderName, $folderRoot );
$folderRoot=$response['folderUID'];
} }
} }
return $folderRoot != "/" ? $folderRoot : ""; return $folderRoot != "/" ? $folderRoot : "";
@@ -195,7 +210,11 @@ class AppFolder extends BaseAppFolder {
$oCase->verifyTable (); $oCase->verifyTable ();
$oCriteria->setOffset(0);
$oCriteria->setLimit(150);
$oCriteria->addAscendingOrderByColumn ( AppDocumentPeer::APP_DOC_INDEX ); $oCriteria->addAscendingOrderByColumn ( AppDocumentPeer::APP_DOC_INDEX );
$oCriteria->addDescendingOrderByColumn ( AppDocumentPeer::DOC_VERSION );
$rs = AppDocumentPeer::doSelectRS ( $oCriteria ); $rs = AppDocumentPeer::doSelectRS ( $oCriteria );
$rs->setFetchmode ( ResultSet::FETCHMODE_ASSOC ); $rs->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
@@ -206,11 +225,12 @@ class AppFolder extends BaseAppFolder {
$oApp = new Application ( ); $oApp = new Application ( );
if (($oApp->exists ( $row ['APP_UID'] )) || ($row ['APP_UID'] == "00000000000000000000000000000000")) { if (($oApp->exists ( $row ['APP_UID'] )) || ($row ['APP_UID'] == "00000000000000000000000000000000")) {
$completeInfo = array("APP_DOC_FILENAME" => $row ["APP_DOC_UID"],"APP_DOC_UID"=>$row ['APP_UID']);
$completeInfo = $this->getCompleteDocumentInfo ( $row ['APP_UID'], $row ['APP_DOC_UID'], $row ['DOC_VERSION'], $row ['DOC_UID'], $row ['USR_UID'] ); $completeInfo = $this->getCompleteDocumentInfo ( $row ['APP_UID'], $row ['APP_DOC_UID'], $row ['DOC_VERSION'], $row ['DOC_UID'], $row ['USR_UID'] );
$oAppDocument = new AppDocument ( ); $oAppDocument = new AppDocument ( );
$lastVersion = $oAppDocument->getLastAppDocVersion ( $row ['APP_DOC_UID'], $row ['APP_UID'] ); $lastVersion = $oAppDocument->getLastAppDocVersion ( $row ['APP_DOC_UID'], $row ['APP_UID'] );
$filesResult [] = $completeInfo;
if ($completeInfo ['APP_DOC_STATUS'] != "DELETED") { if ($completeInfo ['APP_DOC_STATUS'] != "DELETED") {
if ((in_array ( $row ['APP_DOC_UID'], $completeInfo ['INPUT_DOCUMENTS'] )) || (in_array ( $row ['APP_DOC_UID'], $completeInfo ['OUTPUT_DOCUMENTS'] )) || (in_array ( $completeInfo ['USR_UID'], array ($_SESSION ['USER_LOGGED'], '-1' ) ))) { if ((in_array ( $row ['APP_DOC_UID'], $completeInfo ['INPUT_DOCUMENTS'] )) || (in_array ( $row ['APP_DOC_UID'], $completeInfo ['OUTPUT_DOCUMENTS'] )) || (in_array ( $completeInfo ['USR_UID'], array ($_SESSION ['USER_LOGGED'], '-1' ) ))) {
if (count ( $docIdFilter ) > 0) { if (count ( $docIdFilter ) > 0) {
@@ -319,7 +339,7 @@ class AppFolder extends BaseAppFolder {
} }
$oUser = new Users ( ); $oUser = new Users ( );
if ($usrId != "-1") { if (($usrId != "-1")&&($oUser->userExists($usrId))) {
$row5 = $oUser->load ( $usrId ); $row5 = $oUser->load ( $usrId );
} else { } else {
$row5 ['USR_USERNAME'] = "***"; $row5 ['USR_USERNAME'] = "***";

View File

@@ -63,6 +63,24 @@ class Users extends BaseUsers {
throw($e); throw($e);
} }
} }
public function userExists($UsrUid)
{
try {
$oRow = UsersPeer::retrieveByPK( $UsrUid );
if (!is_null($oRow))
{
return true;
}
else {
return false;
}
}
catch (Exception $oError) {
return false;
}
}
public function load($UsrUid) public function load($UsrUid)
{ {
try { try {

View File

@@ -60,7 +60,7 @@
$G_TMP_MENU->AddIdRawOption('CASES_HOME', 'casesStartPage', G::LoadTranslation('ID_CASES_START_PAGE'), '', '', 'blockHeader'); $G_TMP_MENU->AddIdRawOption('CASES_HOME', 'casesStartPage', G::LoadTranslation('ID_CASES_START_PAGE'), '', '', 'blockHeader');
//$G_TMP_MENU->AddIdRawOption('CASES_FOLDERS', 'casesStartPage?action=documents', G::LoadTranslation('ID_FOLDERS'), 'folderV2.gif' ); $G_TMP_MENU->AddIdRawOption('CASES_FOLDERS', 'casesStartPage?action=documents', G::LoadTranslation('ID_FOLDERS'), 'folderV2.gif' );
//$G_TMP_MENU->AddIdRawOption('CASES_START_PAGE', 'casesStartPage?action=mainDashboard', ucwords(strtolower(G::LoadTranslation('ID_DASHBOARD'))), '' ); //$G_TMP_MENU->AddIdRawOption('CASES_START_PAGE', 'casesStartPage?action=mainDashboard', ucwords(strtolower(G::LoadTranslation('ID_DASHBOARD'))), '' );
//Load Other registered Dashboards (From plugins) //Load Other registered Dashboards (From plugins)

View File

@@ -12,20 +12,49 @@ $rootFolder = "/";
switch ($_POST ['action']) { switch ($_POST ['action']) {
case 'expandNode': case 'expandNode':
if($_POST ['node']=="") $_POST ['node'] ="/";
if($_POST ['node']=="root") $_POST ['node'] ="/";
if(!(isset($_POST['sendWhat']))) $_POST['sendWhat']="both";
if(($_POST['sendWhat']=="dirs")||($_POST['sendWhat']=="both")){
$folderList = $oPMFolder->getFolderList ( $_POST ['node'] != 'root' ? $_POST ['node'] == 'NA' ? "" : $_POST ['node'] : $rootFolder ); $folderList = $oPMFolder->getFolderList ( $_POST ['node'] != 'root' ? $_POST ['node'] == 'NA' ? "" : $_POST ['node'] : $rootFolder );
//G::pr($folderList);
}
if(($_POST['sendWhat']=="files")||($_POST['sendWhat']=="both")){
$folderContent = $oPMFolder->getFolderContent ( $_POST ['node'] != 'root' ? $_POST ['node'] == 'NA' ? "" : $_POST ['node'] : $rootFolder ); $folderContent = $oPMFolder->getFolderContent ( $_POST ['node'] != 'root' ? $_POST ['node'] == 'NA' ? "" : $_POST ['node'] : $rootFolder );
//G::pr($folderContent); //G::pr($folderContent);
}
//G::pr($folderContent);
$processListTree=array(); $processListTree=array();
if(isset($folderList)){
$tempTree=array();
foreach ( $folderList as $key => $obj ) { foreach ( $folderList as $key => $obj ) {
//$tempTree ['all-obj'] = $obj;
$tempTree ['text'] = $obj['FOLDER_NAME']; $tempTree ['text'] = $obj['FOLDER_NAME'];
$tempTree ['id'] = $obj['FOLDER_UID']; $tempTree ['id'] = $obj['FOLDER_UID'];
$tempTree ['folderID'] = $obj['FOLDER_UID']; $tempTree ['folderID'] = $obj['FOLDER_UID'];
$tempTree ['cls'] = 'folder'; $tempTree ['cls'] = 'folder';
$tempTree ['draggable'] = true; $tempTree ['draggable'] = true;
$tempTree ['name'] = $obj['FOLDER_NAME'];
$tempTree ['type'] = "Directory";
$tempTree ['is_file'] = false;
$tempTree ['appDocCreateDate'] = $obj['FOLDER_CREATE_DATE'];
$tempTree ['qtip'] ='<strong>Directory: </strong>'.$obj['FOLDER_NAME'].'<br /><strong>Create Date:</strong> '.$obj['FOLDER_CREATE_DATE'].'';
$tempTree ['is_writable'] =true;
$tempTree ['is_chmodable'] =true;
$tempTree ['is_readable'] =true;
$tempTree ['is_deletable'] =true;
if((isset($_POST['option']))&&($_POST['option']=="gridDocuments")){
$tempTree ['icon'] = "/images/documents/extension/folder.png";
}
//$tempTree ['leaf'] = true; //$tempTree ['leaf'] = true;
//$tempTree ['optionType'] = "category"; //$tempTree ['optionType'] = "category";
//$tempTree['allowDrop']=false; //$tempTree['allowDrop']=false;
$tempTree ['singleClickExpand'] = true; //$tempTree ['singleClickExpand'] = false;
/* /*
if ($key != "No Category") { if ($key != "No Category") {
$tempTree ['expanded'] = true; $tempTree ['expanded'] = true;
@@ -35,7 +64,47 @@ switch ($_POST ['action']) {
} }
*/ */
$processListTree [] = $tempTree; $processListTree [] = $tempTree;
$tempTree=array();
} }
if($_POST ['node'] == '/'){
$notInFolderLabel = G::LoadTranslation ( 'ID_NOT_IN_FOLDER' );
$tempTree ['text'] = $notInFolderLabel;
$tempTree ['id'] = "NA";
$tempTree ['folderID'] = "NA";
$tempTree ['cls'] = 'folder';
$tempTree ['draggable'] = true;
$tempTree ['name'] = $notInFolderLabel;
$tempTree ['type'] = "Directory";
$tempTree ['is_file'] = false;
$tempTree ['qtip'] ='<strong>Directory: </strong>'.$notInFolderLabel.'<br /><i>Unfiled Files</i> ';
$tempTree ['is_writable'] =true;
$tempTree ['is_chmodable'] =true;
$tempTree ['is_readable'] =true;
$tempTree ['is_deletable'] =true;
if((isset($_POST['option']))&&($_POST['option']=="gridDocuments")){
$tempTree ['icon'] = "/images/documents/extension/bz2.png";
}
//$tempTree ['leaf'] = true;
//$tempTree ['optionType'] = "category";
//$tempTree['allowDrop']=false;
//$tempTree ['singleClickExpand'] = false;
/*
if ($key != "No Category") {
$tempTree ['expanded'] = true;
} else {
//$tempTree ['expanded'] = false;
$tempTree ['expanded'] = true;
}
*/
$processListTree [] = $tempTree;
$tempTree=array();
}
}
if(isset($folderContent)){
foreach ( $folderContent as $key => $obj ) { foreach ( $folderContent as $key => $obj ) {
$tempTree ['text'] = $obj['APP_DOC_FILENAME']; $tempTree ['text'] = $obj['APP_DOC_FILENAME'];
$tempTree ['id'] = $obj['APP_DOC_UID']; $tempTree ['id'] = $obj['APP_DOC_UID'];
@@ -43,6 +112,50 @@ switch ($_POST ['action']) {
$tempTree ['cls'] = 'file'; $tempTree ['cls'] = 'file';
//$tempTree ['draggable'] = true; //$tempTree ['draggable'] = true;
$tempTree ['leaf'] = true; $tempTree ['leaf'] = true;
$tempTree ['name'] = $obj['APP_DOC_FILENAME'];
$mimeInformation=getMime($obj['APP_DOC_FILENAME']);
$tempTree ['type'] = $mimeInformation['description'];
$tempTree ['is_file'] = true;
//if((isset($_POST['option']))&&($_POST['option']=="gridDocuments")){
$tempTree ['icon'] = $mimeInformation['icon'];
//}
$tempTree ['docVersion'] = $obj['DOC_VERSION'];
$tempTree ['appUid'] = $obj['APP_UID'];
$tempTree ['usrUid'] = $obj['USR_UID'];
$tempTree ['appDocType'] = $obj['APP_DOC_TYPE'];
$tempTree ['appDocCreateDate'] = $obj['APP_DOC_CREATE_DATE'];
$tempTree ['appDocPlugin'] = $obj['APP_DOC_PLUGIN'];
$tempTree ['appDocTags'] = $obj['APP_DOC_TAGS'];
$tempTree ['appDocTitle'] = $obj['APP_DOC_TITLE'];
$tempTree ['appDocComment'] = $obj['APP_DOC_COMMENT'];
$tempTree ['appDocFileName'] = $obj['APP_DOC_FILENAME'];
if(isset($obj['APP_NUMBER'])){
$tempTree ['appLabel'] = sprintf("%s '%s' (%s)",$obj['APP_NUMBER'],$obj['APP_TITLE'],$obj['STATUS']);
}else{
$tempTree ['appLabel'] = "No case related";
}
$tempTree ['proTitle'] = $obj['PRO_TITLE'];
$tempTree ['appDocVersionable'] = 0;
if(isset($obj['OUT_DOC_VERSIONING'])){
$tempTree ['appDocVersionable'] = $obj['OUT_DOC_VERSIONING'];
}elseif(isset($obj['INP_DOC_VERSIONING'])){
$tempTree ['appDocVersionable'] = $obj['INP_DOC_VERSIONING'];
}
if(isset($obj['USR_LASTNAME'])&&isset($obj['USR_LASTNAME'])){
$tempTree ['owner'] = sprintf("%s %s (%s)",$obj['USR_LASTNAME'],$obj['USR_FIRSTNAME'],$obj['USR_USERNAME']);
}else{
$tempTree ['owner'] = sprintf("%s",$obj['USR_USERNAME']);
}
$tempTree ['deletelabel'] = $obj['DELETE_LABEL'];
$tempTree ['downloadLabel'] = $obj['DOWNLOAD_LABEL'];
$tempTree ['downloadLink'] = $obj['DOWNLOAD_LINK'];
$tempTree ['downloadLabel1'] = $obj['DOWNLOAD_LABEL1'];
$tempTree ['downloadLink1'] = $obj['DOWNLOAD_LINK1'];
$tempTree ['appDocUidVersion'] = $obj['APP_DOC_UID_VERSION'];
//$tempTree ['optionType'] = "category"; //$tempTree ['optionType'] = "category";
//$tempTree['allowDrop']=false; //$tempTree['allowDrop']=false;
//$tempTree ['singleClickExpand'] = true; //$tempTree ['singleClickExpand'] = true;
@@ -55,7 +168,15 @@ switch ($_POST ['action']) {
} }
*/ */
$processListTree [] = $tempTree; $processListTree [] = $tempTree;
$tempTree=array();
} }
}
if((isset($_POST['option']))&&($_POST['option']=="gridDocuments")){
$processListTreeTemp['totalCount']=count($processListTree);
$processListTreeTemp['items']=$processListTree;
$processListTree = $processListTreeTemp;
}
print G::json_encode ( $processListTree ); print G::json_encode ( $processListTree );
break; break;
case 'openPMFolder' : case 'openPMFolder' :
@@ -205,6 +326,232 @@ GHTML;
break; break;
case "uploadDocument" : case "uploadDocument" :
$uploadDocumentComponent=array();
$uploadDocumentComponent["xtype"]= "tabpanel";
$uploadDocumentComponent["stateId"]= "upload_tabpanel";
$uploadDocumentComponent["activeTab"]= "uploadform";
$uploadDocumentComponent["dialogtitle"]= "actupload";
$uploadDocumentComponent["stateful"]= true;
$uploadDocumentComponent["stateEvents"]= array("tabchange");
$uploadDocumentComponent["getState"]= "function_getState";
$functionsToReplace['function_getState']="function() { return {
activeTab:this.items.indexOf(this.getActiveTab())
};
}";
$uploadDocumentComponent["listeners"]["resize"]["fn"]="function_listeners_resize";
$functionsToReplace['function_listeners_resize'] = "function(panel) {
panel.items.each( function(item) { item.setHeight(500);return true } );
}";
$uploadDocumentComponent["items"]=array();
$itemA=array();
$itemA["xtype"]= "swfuploadpanel";
$itemA["title"]= "flashupload";
$itemA["height"]= "300";
$itemA["id"]= "swfuploader";
$itemA["viewConfig"]["forceFit"]=true;
$itemA["listeners"]["allUploadsComplete"]["fn"]="function_listeners_allUploadsComplete";
$functionsToReplace['function_listeners_allUploadsComplete'] = "function(panel) {
datastore.reload();
panel.destroy();
Ext.getCmp('dialog').destroy();
statusBarMessage('upload_completed', false );
}";
// Uploader Params
$itemA["upload_url"]= "../appFolder/appFolderAjax.php";
$itemA["post_params"][session_name()]=session_id();
$itemA["post_params"]["option"]="uploadFile";
$itemA["post_params"]["action"]="upload";
$itemA["post_params"]["dir"]="datastore.directory";
$itemA["post_params"]["requestType"]="xmlhttprequest";
$itemA["post_params"]["confirm"]="true";
$itemA["flash_url"]="/scripts/extjs3-ext/ux.swfupload/swfupload.swf";
$itemA["file_size_limit"]=get_max_file_size();
// Custom Params
$itemA["single_file_select"]=false; // Set to true if you only want to select one file from the FileDialog.
$itemA["confirm_delete"]=false; // This will prompt for removing files from queue.
$itemA["remove_completed"]=false; // Remove file from grid after uploaded.
//$uploadDocumentComponent["items"][]=$itemA;
//Standard Upload
$itemA=array();
$itemA["xtype"]="form";
$itemA["autoScroll"]=true;
$itemA["autoHeight"]=true;
$itemA["id"]="uploadform";
$itemA["fileUpload"]=true;
$itemA["labelWidth"]="125";
$itemA["url"]="URL_SCRIPT";
$itemA["title"]="standardupload";
//$itemA["tooltip"]="Max File Size <strong>". ((get_max_file_size() / 1024) / 1024)." MB</strong><br />Max Post Size<strong>". ((get_max_upload_limit() / 1024) / 1024)." MB</strong><br />";
$itemA["frame"]=true;
$itemA["items"]=array();
$itemB=array();
$itemB["xtype"]="displayfield";
$itemB["value"]="Max File Size <strong>". ((get_max_file_size() / 1024) / 1024)." MB</strong><br />Max Post Size<strong>". ((get_max_upload_limit() / 1024) / 1024)." MB</strong><br />";
//$itemA["items"][]=$itemB;
for($i=0;$i<7;$i++) {
$itemB=array();
$itemB["xtype"]="fileuploadfield";
$itemB["fieldLabel"]="File ".($i+1);
$itemB["id"]="uploadedFile[$i]";
$itemB["name"]="uploadedFile[$i]";
$itemB["width"]=275;
$itemB["buttonOnly"]= false;
$itemA["items"][]=$itemB;
}
$itemB=array();
$itemB["xtype"]="checkbox";
$itemB["fieldLabel"]="overwrite_files";
$itemB["name"]="overwrite_files";
$itemB["checked"]=true;
$itemA["items"][]=$itemB;
$itemA["buttons"]=array();
$buttonA=array();
$buttonA["text"]="btnsave";
$buttonA["handler"]="function_standardupload_btnsave";
$functionsToReplace["function_standardupload_btnsave"]=' function() {
statusBarMessage( "upload_processing", true );
form = Ext.getCmp("uploadform").getForm();
//Ext.getCmp("uploadform").getForm().submit();
console.log(form);
console.log(form.url);
Ext.getCmp("uploadform").getForm().submit({
//reset: true,
reset: false,
success: function(form, action) {
datastore.reload();
statusBarMessage( action.result.message, false, true );
Ext.getCmp("dialog").destroy();
},
failure: function(form, action) {
if( !action.result ) return;
Ext.MessageBox.alert("error", action.result.error);
statusBarMessage( action.result.error, false, false );
},
scope: Ext.getCmp("uploadform"),
// add some vars to the request, similar to hidden fields
params: {
option: "standardupload",
action: "uploadExternalDocument",
dir: datastore.directory,
requestType: "xmlhttprequest",
confirm: "true",
docUid: "-1",
appId: "00000000000000000000000000000000"
}
});
}';
$itemA["buttons"][]=$buttonA;
$buttonA=array();
$buttonA["text"]= "btncancel";
$buttonA["handler"]="function_standardupload_btncancel";
$functionsToReplace["function_standardupload_btncancel"]=' function() { Ext.getCmp("dialog").destroy(); }';
$itemA["buttons"][]=$buttonA;
$uploadDocumentComponent["items"][]=$itemA;
$itemA=array();
$itemA["xtype"]="form";
$itemA["id"]="transferform";
$itemA["url"]="../appFolder/appFolderAjax.php";
$itemA["hidden"]="true";
$itemA["title"]="acttransfer";
$itemA["autoHeight"]="true";
$itemA["labelWidth"]=225;
$itemA["frame"]= true;
$itemA["items"]=array();
for($i=0;$i<7;$i++) {
$itemB=array();
$itemB["xtype"]= "textfield";
$itemB["fieldLabel"]= "url_to_file";
$itemB["name"]= "userfile[$i]";
$itemB["width"]=275;
$itemA["items"][]=$itemB;
}
$itemB=array();
$itemB["xtype"]="checkbox";
$itemB["fieldLabel"]="overwrite_files";
$itemB["name"]="overwrite_files";
$itemB["checked"]=true;
$itemA["items"][]=$itemB;
$itemA["buttons"]=array();
$buttonA=array();
$buttonA["text"]="btnsave";
$buttonA["handler"]="function_transfer_btnsave";
$functionsToReplace["function_transfer_btnsave"]='function() {
statusBarMessage( "transfer_processing", true );
transfer = Ext.getCmp("transferform").getForm();
transfer.submit({
//reset: true,
reset: false,
success: function(form, action) {
datastore.reload();
statusBarMessage( action.result.message, false, true );
Ext.getCmp("dialog").destroy();
},
failure: function(form, action) {
if( !action.result ) return;
Ext.MessageBox.alert("error", action.result.error);
statusBarMessage( action.result.error, false, false );
},
scope: transfer,
// add some vars to the request, similar to hidden fields
params: {
"option": "com_extplorer",
"action": "transfer",
"dir": datastore.directory,
"confirm": "true"
}
});
}';
$itemA["buttons"]=$buttonA;
$buttonA=array();
$buttonA["text"]="btncancel";
$buttonA["handler"]="function_transfer_btncancel";
$functionsToReplace["function_transfer_btncancel"]='function() { Ext.getCmp("dialog").destroy(); }';
$itemA["buttons"]=$buttonA;
// $uploadDocumentComponent["items"][]=$itemA;
$finalResponse=G::json_encode($uploadDocumentComponent);
$finalResponse=str_replace("URL_SCRIPT","../appFolder/appFolderAjax.php",$finalResponse);
foreach($functionsToReplace as $key => $originalFunction){
$finalResponse=str_replace('"'.$key.'"',$originalFunction,$finalResponse);
}
echo ($finalResponse);
/*
//krumo($_POST); //krumo($_POST);
G::LoadClass ( 'case' ); G::LoadClass ( 'case' );
$oCase = new Cases ( ); $oCase = new Cases ( );
@@ -219,7 +566,7 @@ GHTML;
$Fields ['docType'] = $_POST ['docType']; $Fields ['docType'] = $_POST ['docType'];
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'cases/cases_AttachInputDocumentGeneral', '', $Fields, 'appFolderSaveDocument?UID=' . $_POST ['docID'] . '&appId=' . $_POST ['appId'] . '&docType=' . $_POST ['docType'] ); $G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'cases/cases_AttachInputDocumentGeneral', '', $Fields, 'appFolderSaveDocument?UID=' . $_POST ['docID'] . '&appId=' . $_POST ['appId'] . '&docType=' . $_POST ['docType'] );
G::RenderPage ( 'publish', 'raw' ); G::RenderPage ( 'publish', 'raw' );
*/
break; break;
case "documentVersionHistory" : case "documentVersionHistory" :
@@ -249,6 +596,211 @@ GHTML;
break; break;
case "uploadExternalDocument" : case "uploadExternalDocument" :
$response['action']=$_POST['action']. " - ".$_POST['option'];
$response['error']="error";
$response['message']="error";
$response['success']=false;
if(isset($_POST["confirm"]) && $_POST["confirm"]=="true") {
//G::pr($_FILES);
$uploadedInstances=count($_FILES['uploadedFile']['name']);
$sw_error=false;
$sw_error_exists=isset($_FILES['uploadedFile']['error']);
$emptyInstances=0;
$quequeUpload=array();
// upload files & check for errors
for($i=0;$i<$uploadedInstances;$i++) {
$errors[$i]=NULL;
$tmp = $_FILES['uploadedFile']['tmp_name'][$i];
$items[$i] = stripslashes($_FILES['uploadedFile']['name'][$i]);
if($sw_error_exists) $up_err = $_FILES['uploadedFile']['error'][$i];
else $up_err=(file_exists($tmp)?0:4);
if($items[$i]=="" || $up_err==4){
$emptyInstances++;
continue;
}
if($up_err==1 || $up_err==2) {
$errors[$i]='miscfilesize';
$sw_error=true; continue;
}
if($up_err==3) {
$errors[$i]='miscfilepart';
$sw_error=true; continue;
}
if(!@is_uploaded_file($tmp)) {
$errors[$i]='uploadfile';
$sw_error=true; continue;
}
//The uplaoded files seems to be correct and ready to be uploaded. Add to the Queque
$fileInfo=array("tempName"=>$tmp,"fileName"=>$items[$i]);
$quequeUpload[]=$fileInfo;
}
//G::pr($quequeUpload);
//Read. Instance Document classes
if(!empty($quequeUpload)){
$docUid=$_POST['docUid'];
$appDocUid=isset($_POST['APP_DOC_UID'])?$_POST['APP_DOC_UID']:"";
$docVersion=isset($_POST['docVersion'])?$_POST['docVersion']:"";
$actionType=isset($_POST['actionType'])?$_POST['actionType']:"";
$folderId=$_POST['dir']==""?"/":$_POST['dir'];
$appId=$_POST['appId'];
$docType=isset($_POST['docType'])?$_GET['docType']:"INPUT";
//save info
require_once ( "classes/model/AppDocument.php" );
require_once ('classes/model/AppFolder.php');
require_once ('classes/model/InputDocument.php');
$oInputDocument = new InputDocument();
if($docUid!=-1){
$aID = $oInputDocument->load($docUid);
}else{
$oFolder=new AppFolder();
$folderStructure=$oFolder->getFolderStructure($folderId);
$aID=array('INP_DOC_DESTINATION_PATH'=>$folderStructure['PATH']);
}
$oAppDocument = new AppDocument();
//Get the Custom Folder ID (create if necessary)
$oFolder=new AppFolder();
if($docUid!=-1){
//krumo("jhl");
$folderId=$oFolder->createFromPath($aID['INP_DOC_DESTINATION_PATH'],$appId);
//Tags
$fileTags=$oFolder->parseTags($aID['INP_DOC_TAGS'],$appId);
}else{
$folderId=$folderId;
$fileTags="EXTERNAL";
}
foreach($quequeUpload as $key =>$fileObj){
switch($actionType){
case "R": //replace
$aFields = array('APP_DOC_UID' => $appDocUid,
'APP_UID' => $appId,
'DOC_VERSION' => $docVersion,
'DEL_INDEX' => 1,
'USR_UID' => $_SESSION['USER_LOGGED'],
'DOC_UID' => $docUid,
'APP_DOC_TYPE' => $docType,
'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'),
'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ? $_POST['form']['APP_DOC_COMMENT'] : '',
'APP_DOC_TITLE' => '',
'APP_DOC_FILENAME' => $fileObj['fileName'],
'FOLDER_UID' => $folderId,
'APP_DOC_TAGS' => $fileTags);
$oAppDocument->update($aFields);
break;
case "NV": //New Version
$aFields = array('APP_DOC_UID' => $appDocUid,
'APP_UID' => $appId,
'DEL_INDEX' => 1,
'USR_UID' => $_SESSION['USER_LOGGED'],
'DOC_UID' => $docUid,
'APP_DOC_TYPE' => $docType,
'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'),
'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ? $_POST['form']['APP_DOC_COMMENT'] : '',
'APP_DOC_TITLE' => '',
'APP_DOC_FILENAME' => $fileObj['fileName'],
'FOLDER_UID' => $folderId,
'APP_DOC_TAGS' => $fileTags);
$oAppDocument->create($aFields);
break;
default: //New
$aFields = array('APP_UID' => $appId,
'DEL_INDEX' => isset($_SESSION['INDEX'])?$_SESSION['INDEX']:1,
'USR_UID' => $_SESSION['USER_LOGGED'],
'DOC_UID' => $docUid,
'APP_DOC_TYPE' => $docType,
'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'),
'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ? $_POST['form']['APP_DOC_COMMENT'] : '',
'APP_DOC_TITLE' => '',
'APP_DOC_FILENAME' => $fileObj['fileName'],
'FOLDER_UID' => $folderId,
'APP_DOC_TAGS' => $fileTags);
$oAppDocument->create($aFields);
break;
}
$sAppDocUid = $oAppDocument->getAppDocUid();
$iDocVersion = $oAppDocument->getDocVersion();
$info = pathinfo( $oAppDocument->getAppDocFilename() );
$ext = (isset($info['extension']) ? $info['extension'] : '');
//save the file
// if (!empty($_FILES['form'])) {
// if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) {
$sPathName = PATH_DOCUMENT . $appId . PATH_SEP;
$sFileName = $sAppDocUid . "_".$iDocVersion. '.' . $ext;
G::uploadFile($fileObj['tempName'], $sPathName, $sFileName );
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry =& PMPluginRegistry::getSingleton();
if ( $oPluginRegistry->existsTrigger ( PM_UPLOAD_DOCUMENT ) && class_exists ('uploadDocumentData' ) ) {
$oData['APP_UID'] = $appId;
$documentData = new uploadDocumentData (
$appId,
$_SESSION['USER_LOGGED'],
$sPathName . $sFileName,
$fileObj['fileName'],
$sAppDocUid
);
//$oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT , $documentData );
//unlink ( $sPathName . $sFileName );
}
//end plugin
}
}
if($sw_error) { // there were errors
$err_msg="";
for($i=0;$i<$uploadedInstances;$i++) {
if($errors[$i]==NULL) continue;
$err_msg .= $items[$i]." : ".$errors[$i]."\n";
}
$response['error']=$err_msg;
$response['message']=$err_msg;
$response['success']=false;
}elseif($emptyInstances==$uploadedInstances){
$response['error']="You may upload at least one file";
$response['message']="You may upload at least one file";
$response['success']=false;
}else{
$response['error']="Upload complete";
$response['message']="Upload complete";
$response['success']=true;
}
}
print_r(G::json_encode($response));
/*
G::LoadClass ( 'case' ); G::LoadClass ( 'case' );
$oCase = new Cases ( ); $oCase = new Cases ( );
@@ -259,10 +811,122 @@ GHTML;
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'cases/cases_AttachInputDocumentGeneral', '', $Fields, 'appFolderSaveDocument?UID=-1&appId=' . $Fields ['appId'] . "&folderId=" . $_POST ['folderID'] ); $G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'cases/cases_AttachInputDocumentGeneral', '', $Fields, 'appFolderSaveDocument?UID=-1&appId=' . $Fields ['appId'] . "&folderId=" . $_POST ['folderID'] );
G::RenderPage ( 'publish', 'raw' ); G::RenderPage ( 'publish', 'raw' );
*/
break; break;
case "newFolder" : case "newFolder" :
//G::pr($_POST);
if($_POST ['dir']=="") $_POST ['dir']="/";
$folderStructure = $oPMFolder->getFolderStructure ( $_POST ['dir'] );
//G::pr($folderStructure);
$folderPath = $folderStructure ['PATH'];
$parentUid = $_POST ['dir'];
$folderUid = G::GenerateUniqueID ();
$formNewFolder=array();
$formNewFolder["xtype"]="form";
$formNewFolder["id"]= "simpleform";
$formNewFolder["labelWidth"]=125;
$formNewFolder["url"]="../appFolder/appFolderAjax.php";
$formNewFolder["dialogtitle"]= "Create New Folder";
$formNewFolder["frame"]= true;
$formNewFolder["items"]= array();
$field=array();
$field["xtype"]= "label";
$field["fieldLabel"]= "Path";
$field["name"]= "form[FOLDER_PATH]";
$field["id"]= "form[FOLDER_PATH]";
$field["width"]=175;
$field["allowBlank"]=false;
$field["value"]=$folderPath;
$field["text"]=$folderPath;
$formNewFolder["items"][]= $field;
$field=array();
$field["xtype"]= "hidden";
$field["fieldLabel"]= "Uid";
$field["name"]= "form[FOLDER_UID]";
$field["id"]= "form[FOLDER_UID]";
$field["width"]=175;
$field["allowBlank"]=false;
$field["value"]=$folderUid;
$formNewFolder["items"][]= $field;
$field=array();
$field["xtype"]= "hidden";
$field["fieldLabel"]= "Parent";
$field["name"]= "form[FOLDER_PARENT_UID]";
$field["id"]= "form[FOLDER_PARENT_UID]";
$field["width"]=175;
$field["allowBlank"]=false;
$field["value"]=$parentUid;
$formNewFolder["items"][]= $field;
$field=array();
$field["xtype"]= "textfield";
$field["fieldLabel"]= "Name";
$field["name"]= "form[FOLDER_NAME]";
$field["id"]= "form[FOLDER_NAME]";
$field["width"]=175;
$field["allowBlank"]=false;
$formNewFolder["items"][]= $field;
$formNewFolder["buttons"]= array();
$button=array();
$button["text"]= "Create";
$button["handler"]= 'handlerCreate';
$formNewFolder["buttons"][]= $button;
$button=array();
$button["text"]= "Cancel";
$button["handler"]= 'handlerCancel';
$formNewFolder["buttons"][]= $button;
$handlerCreate='function() {
statusBarMessage( "Please wait...", true );
Ext.getCmp("simpleform").getForm().submit({
//reset: true,
reset: false,
success: function(form, action) {
statusBarMessage( action.result.message, false, true );
try{
dirTree.getSelectionModel().getSelectedNode().reload();
} catch(e) {}
datastore.reload();
Ext.getCmp("dialog").destroy();
},
failure: function(form, action) {
if( !action.result ) return;
Ext.Msg.alert("Error!", action.result.error);
statusBarMessage( action.result.error, false, false );
},
scope: Ext.getCmp("simpleform"),
// add some vars to the request, similar to hidden fields
params: {option: "new",
action: "appFolderSave",
dir: datastore.directory,
confirm: "true"}
})
}';
$handlerCancel='function() { Ext.getCmp("dialog").destroy(); }';
$response=G::json_encode($formNewFolder);
//This will add the functions to the Json response without quotes!
$response=str_replace('"handlerCreate"',$handlerCreate,$response);
$response=str_replace('"handlerCancel"',$handlerCancel,$response);
print_r($response);
/*
$oFolder = new AppFolder ( ); $oFolder = new AppFolder ( );
$folderStructure = $oPMFolder->getFolderStructure ( $_POST ['folderID'] ); $folderStructure = $oPMFolder->getFolderStructure ( $_POST ['folderID'] );
$Fields ['FOLDER_PATH'] = $folderStructure ['PATH']; $Fields ['FOLDER_PATH'] = $folderStructure ['PATH'];
@@ -272,9 +936,27 @@ GHTML;
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'appFolder/appFolderEdit', '', $Fields, 'appFolderSave' ); $G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'appFolder/appFolderEdit', '', $Fields, 'appFolderSave' );
G::RenderPage ( 'publish', 'raw' ); G::RenderPage ( 'publish', 'raw' );
*/
break;
case "appFolderSave":
$form = $_POST['form'];
$FolderUid = $form['FOLDER_UID'];
$FolderParentUid = $form['FOLDER_PARENT_UID'];
$FolderName = $form['FOLDER_NAME'];
$FolderCreateDate = 'now';
$FolderUpdateDate = 'now';
$response['action']=$_POST['action']. " - ".$_POST['option'];
$response['error']="error";
$response['message']="error";
$response['success']=false;
$folderCreateResponse = $oPMFolder->createFolder ( $FolderName, $FolderParentUid, "new" );
$response=array_merge($response,$folderCreateResponse);
print_r(G::json_encode($response));
break; break;
case "documentInfo" : case "documentInfo" :
$oFolder = new AppFolder ( ); $oFolder = new AppFolder ( );
$Fields = $oPMFolder->getCompleteDocumentInfo ( $_POST ['appId'], $_POST ['appDocId'], $_POST ['docVersion'], $_POST ['docID'], $_POST ['usrUid'] ); $Fields = $oPMFolder->getCompleteDocumentInfo ( $_POST ['appId'], $_POST ['appDocId'], $_POST ['docVersion'], $_POST ['docID'], $_POST ['usrUid'] );
@@ -303,3 +985,90 @@ GHTML;
break; break;
} }
function getMime($fileName){
$fileName=basename($fileName);
$fileNameA=explode(".",$fileName);
$return['description']=G::LoadTranslation("MIME_DES_DOCUMENT");
$return['icon']="/images/documents/extension/document.png";
if(count($fileNameA)>1){
$extension=$fileNameA[count($fileNameA)-1];
$return['description']=G::LoadTranslation("MIME_DES_".strtoupper($extension));
$return['icon']="/images/documents/extension/".strtolower($extension).".png";
}
return $return;
}
function get_max_file_size() { // get php max_upload_file_size
return calc_php_setting_bytes( ini_get("upload_max_filesize") );
}
function get_max_upload_limit() {
return calc_php_setting_bytes( ini_get('post_max_size'));
}
function calc_php_setting_bytes( $value ) {
if(@eregi("G$",$value)) {
$value = substr($value,0,-1);
$value = round($value*1073741824);
} elseif(@eregi("M$",$value)) {
$value = substr($value,0,-1);
$value = round($value*1048576);
} elseif(@eregi("K$",$value)) {
$value = substr($value,0,-1);
$value = round($value*1024);
}
return $value;
}
function get_abs_item($dir, $item) { // get absolute file+path
if( is_array( $item )) {
// FTP Mode
$abs_item = '/' . get_abs_dir($dir)."/".$item['name'];
if( get_is_dir($item)) $abs_item.='/';
return extPathName($abs_item);
}
return extPathName( get_abs_dir($dir)."/".$item );
}
function extPathName($p_path,$p_addtrailingslash = false) {
$retval = "";
$isWin = (substr(PHP_OS, 0, 3) == 'WIN');
if ($isWin) {
$retval = str_replace( '/', '\\', $p_path );
if ($p_addtrailingslash) {
if (substr( $retval, -1 ) != '\\') {
$retval .= '\\';
}
}
// Check if UNC path
$unc = substr($retval,0,2) == '\\\\' ? 1 : 0;
// Remove double \\
$retval = str_replace( '\\\\', '\\', $retval );
// If UNC path, we have to add one \ in front or everything breaks!
if ( $unc == 1 ) {
$retval = '\\'.$retval;
}
} else {
$retval = str_replace( '\\', '/', $p_path );
if ($p_addtrailingslash) {
if (substr( $retval, -1 ) != '/') {
$retval .= '/';
}
}
// Check if UNC path
$unc = substr($retval,0,2) == '//' ? 1 : 0;
// Remove double //
$retval = str_replace('//','/',$retval);
// If UNC path, we have to add one / in front or everything breaks!
if ( $unc == 1 ) {
$retval = '/'.$retval;
}
}
return $retval;
}

View File

@@ -5,6 +5,14 @@
} }
$oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher =& headPublisher::getSingleton();
//$oHeadPublisher->setExtSkin( 'xtheme-gray');
//$oHeadPublisher->usingExtJs('ux/TabCloseMenu');
$oHeadPublisher->usingExtJs('ux.treefilterx/Ext.ux.tree.TreeFilterX');
$oHeadPublisher->usingExtJs('ux.locationbar/Ext.ux.LocationBar');
$oHeadPublisher->usingExtJs('ux.statusbar/ext-statusbar');
//$oHeadPublisher->usingExtJs('ux/ColumnHeaderGroup');
$oHeadPublisher->addExtJsScript('cases/casesStartPage', false); //adding a javascript file .js $oHeadPublisher->addExtJsScript('cases/casesStartPage', false); //adding a javascript file .js
$oHeadPublisher->addContent( 'cases/casesStartPage'); //adding a html file .html. $oHeadPublisher->addContent( 'cases/casesStartPage'); //adding a html file .html.

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 774 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 860 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 805 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 892 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 995 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 898 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 906 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 916 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 817 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 817 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 987 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 817 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 941 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 817 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 943 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 948 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 943 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 987 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 892 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 776 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 776 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 980 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 779 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 997 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 997 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 997 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 997 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 997 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 924 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 924 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 924 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 977 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 977 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Some files were not shown because too many files have changed in this diff Show More