Documents upgrade ..
This commit is contained in:
@@ -1,17 +1,30 @@
|
||||
<?php
|
||||
|
||||
//if (($RBAC_Response=$RBAC->userCanAccess("PM_USERS"))!=1) return $RBAC_Response;
|
||||
G::LoadInclude ( 'ajax' );
|
||||
$_POST ['action'] = get_ajax_value ( 'action' );
|
||||
if (! isset ( $_REQUEST ['action'] )) {
|
||||
$res ['success'] = 'failure';
|
||||
$res ['message'] = 'You may request an action';
|
||||
print G::json_encode ( $res);
|
||||
die ();
|
||||
}
|
||||
if (! function_exists ( $_REQUEST ['action'] )) {
|
||||
$res ['success'] = 'failure';
|
||||
$res ['message'] = 'The requested action doesn\'t exists';
|
||||
print G::json_encode ( $res );
|
||||
die ();
|
||||
}
|
||||
|
||||
$functionName = $_REQUEST ['action'];
|
||||
$functionParams = isset ( $_REQUEST ['params'] ) ? $_REQUEST ['params'] : array ();
|
||||
|
||||
$functionName ( $functionParams );
|
||||
|
||||
function expandNode(){
|
||||
require_once ("classes/model/AppFolder.php");
|
||||
|
||||
$oPMFolder = new AppFolder ( );
|
||||
|
||||
$rootFolder = "/";
|
||||
switch ($_POST ['action']) {
|
||||
|
||||
case 'expandNode':
|
||||
if($_POST ['node']=="") $_POST ['node'] ="/";
|
||||
if($_POST ['node']=="root") $_POST ['node'] ="/";
|
||||
if(!(isset($_POST['sendWhat']))) $_POST['sendWhat']="both";
|
||||
@@ -178,8 +191,9 @@ switch ($_POST ['action']) {
|
||||
}
|
||||
|
||||
print G::json_encode ( $processListTree );
|
||||
break;
|
||||
case 'openPMFolder' :
|
||||
}
|
||||
|
||||
function openPMFolder(){
|
||||
$WIDTH_PANEL = 350;
|
||||
G::LoadClass ( 'tree' );
|
||||
$folderContent = $oPMFolder->getFolderList ( $_POST ['folderID'] != '0' ? $_POST ['folderID'] == 'NA' ? "" : $_POST ['folderID'] : $rootFolder );
|
||||
@@ -243,8 +257,9 @@ GHTML;
|
||||
|
||||
print ($tree->render ()) ;
|
||||
|
||||
break;
|
||||
case 'getPMFolderContent' :
|
||||
}
|
||||
|
||||
function getPMFolderContent(){
|
||||
$swSearch = false;
|
||||
|
||||
if (isset ( $_POST ['folderID'] )) { //Render content of a folder
|
||||
@@ -289,9 +304,9 @@ GHTML;
|
||||
|
||||
G::RenderPage ( 'publish', 'raw' );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "getPMFolderTags" :
|
||||
function getPMFolderTags(){
|
||||
// Default font sizes
|
||||
$min_font_size = 12;
|
||||
$max_font_size = 30;
|
||||
@@ -323,9 +338,9 @@ GHTML;
|
||||
|
||||
print "$cloud_html";
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "uploadDocument" :
|
||||
function uploadDocument(){
|
||||
|
||||
$uploadDocumentComponent=array();
|
||||
|
||||
@@ -567,8 +582,81 @@ foreach($functionsToReplace as $key => $originalFunction){
|
||||
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'cases/cases_AttachInputDocumentGeneral', '', $Fields, 'appFolderSaveDocument?UID=' . $_POST ['docID'] . '&appId=' . $_POST ['appId'] . '&docType=' . $_POST ['docType'] );
|
||||
G::RenderPage ( 'publish', 'raw' );
|
||||
*/
|
||||
break;
|
||||
case "documentVersionHistory" :
|
||||
}
|
||||
|
||||
function copyAction(){
|
||||
$dir=$_REQUEST['dir'];
|
||||
$copyDialog["xtype"]="form";
|
||||
$copyDialog["id"]="simpleform";
|
||||
$copyDialog["labelWidth"]=125;
|
||||
$copyDialog["width"]=340;
|
||||
$copyDialog["url"]="URL_SCRIPT";
|
||||
$copyDialog["dialogtitle"]= "Copy/Move";
|
||||
$copyDialog["frame"]= true;
|
||||
$copyDialog["items"]=array();
|
||||
|
||||
$itemField=array();
|
||||
$itemField["xtype"]="textfield";
|
||||
$itemField["fieldLabel"]="Destination";
|
||||
$itemField["name"]="new_dir";
|
||||
$itemField["value"]="$dir/";
|
||||
$itemField["width"]=175;
|
||||
$itemField["allowBlank"]=false;
|
||||
$copyDialog["items"][]=$itemField;
|
||||
|
||||
|
||||
|
||||
$copyDialog["buttons"]=array();
|
||||
|
||||
$itemButton=array();
|
||||
$itemButton["text"]= "Create";
|
||||
$itemButton["handler"]="copyDialogCreateButtonFunction";
|
||||
$functionsToReplace["copyDialogCreateButtonFunction"]="function() {
|
||||
form = Ext.getCmp('simpleform').getForm();
|
||||
statusBarMessage( 'Please wait...', true );
|
||||
var requestParams = getRequestParams();
|
||||
requestParams.confirm = 'true';
|
||||
requestParams.action = 'copyExecute';
|
||||
form.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.MessageBox.alert('Error!', action.result.error);
|
||||
statusBarMessage( action.result.error, false, false );
|
||||
},
|
||||
scope: form,
|
||||
// add some vars to the request, similar to hidden fields
|
||||
params: requestParams
|
||||
});
|
||||
}";
|
||||
$copyDialog["buttons"][]=$itemButton;
|
||||
|
||||
$itemButton=array();
|
||||
$itemButton["text"]="Cancel";
|
||||
$itemButton["handler"]= "copyDialogCancelButtonFunction";
|
||||
$functionsToReplace["copyDialogCancelButtonFunction"]="function() { Ext.getCmp('dialog').destroy(); }";
|
||||
$copyDialog["buttons"][]=$itemButton;
|
||||
|
||||
$finalResponse=G::json_encode($copyDialog);
|
||||
foreach($functionsToReplace as $key => $originalFunction){
|
||||
|
||||
$finalResponse=str_replace('"'.$key.'"',$originalFunction,$finalResponse);
|
||||
}
|
||||
$finalResponse=str_replace("URL_SCRIPT","../appFolder/appFolderAjax.php",$finalResponse);
|
||||
echo ($finalResponse);
|
||||
|
||||
}
|
||||
|
||||
function documentVersionHistory(){
|
||||
|
||||
$folderID = $_POST ['folderID'] != '0' ? $_POST ['folderID'] == 'NA' ? "" : $_POST ['folderID'] : $rootFolder;
|
||||
$folderContent = $oPMFolder->getFolderContent ( $folderID, array ($_POST ['appDocId'] ) );
|
||||
@@ -593,9 +681,9 @@ foreach($functionsToReplace as $key => $originalFunction){
|
||||
|
||||
G::RenderPage ( 'publish', 'raw' );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "uploadExternalDocument" :
|
||||
function uploadExternalDocument(){
|
||||
|
||||
$response['action']=$_POST['action']. " - ".$_POST['option'];
|
||||
$response['error']="error";
|
||||
@@ -812,9 +900,9 @@ foreach($functionsToReplace as $key => $originalFunction){
|
||||
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'cases/cases_AttachInputDocumentGeneral', '', $Fields, 'appFolderSaveDocument?UID=-1&appId=' . $Fields ['appId'] . "&folderId=" . $_POST ['folderID'] );
|
||||
G::RenderPage ( 'publish', 'raw' );
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
case "newFolder" :
|
||||
function newFolder(){
|
||||
//G::pr($_POST);
|
||||
if($_POST ['dir']=="") $_POST ['dir']="/";
|
||||
$folderStructure = $oPMFolder->getFolderStructure ( $_POST ['dir'] );
|
||||
@@ -937,8 +1025,9 @@ foreach($functionsToReplace as $key => $originalFunction){
|
||||
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'appFolder/appFolderEdit', '', $Fields, 'appFolderSave' );
|
||||
G::RenderPage ( 'publish', 'raw' );
|
||||
*/
|
||||
break;
|
||||
case "appFolderSave":
|
||||
}
|
||||
|
||||
function appFolderSave(){
|
||||
$form = $_POST['form'];
|
||||
$FolderUid = $form['FOLDER_UID'];
|
||||
$FolderParentUid = $form['FOLDER_PARENT_UID'];
|
||||
@@ -956,8 +1045,9 @@ foreach($functionsToReplace as $key => $originalFunction){
|
||||
print_r(G::json_encode($response));
|
||||
|
||||
|
||||
break;
|
||||
case "documentInfo" :
|
||||
}
|
||||
|
||||
function documentInfo(){
|
||||
$oFolder = new AppFolder ( );
|
||||
$Fields = $oPMFolder->getCompleteDocumentInfo ( $_POST ['appId'], $_POST ['appDocId'], $_POST ['docVersion'], $_POST ['docID'], $_POST ['usrUid'] );
|
||||
$G_PUBLISH = new Publisher ( );
|
||||
@@ -965,9 +1055,9 @@ foreach($functionsToReplace as $key => $originalFunction){
|
||||
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'appFolder/appFolderDocumentInfo', '', $Fields, '' );
|
||||
G::RenderPage ( 'publish', 'raw' );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "documentdelete":
|
||||
function documentdelete(){
|
||||
include_once ("classes/model/AppDocument.php");
|
||||
$oAppDocument = new AppDocument ( );
|
||||
$oAppDocument->remove($_POST['sFileUID'],$_POST['docVersion']);
|
||||
@@ -975,16 +1065,15 @@ foreach($functionsToReplace as $key => $originalFunction){
|
||||
$appId= "00000000000000000000000000000000";
|
||||
$sPathName = PATH_DOCUMENT . $appId . PATH_SEP;
|
||||
unlink($sPathName.$_POST['sFileUID'].'_1.jpg');*/
|
||||
break;
|
||||
}
|
||||
|
||||
case "deletePMFolder":
|
||||
function deletePMFolder(){
|
||||
include_once ("classes/model/AppFolder.php");
|
||||
$oAppFoder = new AppFolder ( );
|
||||
$oAppFoder->remove($_POST['sFileUID'],$_POST['rootfolder']);
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
function getMime($fileName){
|
||||
$fileName=basename($fileName);
|
||||
$fileNameA=explode(".",$fileName);
|
||||
@@ -997,9 +1086,11 @@ function getMime($fileName){
|
||||
}
|
||||
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'));
|
||||
}
|
||||
@@ -1018,6 +1109,7 @@ function calc_php_setting_bytes( $value ) {
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
function get_abs_item($dir, $item) { // get absolute file+path
|
||||
if( is_array( $item )) {
|
||||
// FTP Mode
|
||||
@@ -1027,6 +1119,7 @@ function get_abs_item($dir, $item) { // get absolute file+path
|
||||
}
|
||||
return extPathName( get_abs_dir($dir)."/".$item );
|
||||
}
|
||||
|
||||
function extPathName($p_path,$p_addtrailingslash = false) {
|
||||
$retval = "";
|
||||
|
||||
|
||||
@@ -5,6 +5,9 @@ Ext.FlashComponent.EXPRESS_INSTALL_URL = '/images/expressinstall.swf';
|
||||
// The Quicktips are used for the toolbar and Tree mouseover tooltips!
|
||||
Ext.QuickTips.init();
|
||||
|
||||
try{rc=new RegExp('^("(\\\\.|[^"\\\\\\n\\r])*?"|[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t])+?$')}
|
||||
catch(z){rc=/^(true|false|null|\[.*\]|\{.*\}|".*"|\d+|\d+\.\d+)$/}
|
||||
|
||||
var conn = new Ext.data.Connection();
|
||||
|
||||
function chDir( directory, loadGridOnly ) {
|
||||
@@ -144,7 +147,7 @@ var conn = new Ext.data.Connection();
|
||||
}
|
||||
|
||||
switch( action ) {
|
||||
case 'copy':
|
||||
case 'copyAction':
|
||||
case 'edit':
|
||||
case 'newFolder':
|
||||
case 'move':
|
||||
@@ -192,7 +195,9 @@ var conn = new Ext.data.Connection();
|
||||
// Ext.Msg.alert("Debug",
|
||||
// oResponse.responseText
|
||||
// );
|
||||
try{ json = Ext.decode( oResponse.responseText );
|
||||
try{
|
||||
json = Ext.decode( oResponse.responseText );
|
||||
|
||||
if( json.error && typeof json.error != 'xml' ) {
|
||||
Ext.Msg.alert( "error", json.error );
|
||||
dialog.destroy();
|
||||
@@ -298,6 +303,7 @@ var conn = new Ext.data.Connection();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function handleCallback(requestParams, node) {
|
||||
// console.log("handleCallback "+requestParams +" -- "+node);
|
||||
// console.trace();
|
||||
@@ -670,7 +676,7 @@ var gridtb = new Ext.Toolbar(
|
||||
cls : 'x-btn-icon',
|
||||
disabled : false,
|
||||
handler : function() {
|
||||
openActionDialog(this, 'copy');
|
||||
openActionDialog(this, 'copyAction');
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -993,7 +999,7 @@ gridCtxMenu = new Ext.menu.Menu({
|
||||
icon : '/images/documents/_editcopy.png',
|
||||
text : 'copylink',
|
||||
handler : function() {
|
||||
openActionDialog(this, 'copy');
|
||||
openActionDialog(this, 'copyAction');
|
||||
}
|
||||
}, {
|
||||
id : 'gc_move',
|
||||
@@ -1100,7 +1106,7 @@ var dirCtxMenu = new Ext.menu.Menu(
|
||||
text : 'Copy',
|
||||
handler : function() {
|
||||
dirCtxMenu.hide();
|
||||
openActionDialog(this, 'copy');
|
||||
openActionDialog(this, 'copyAction');
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -1155,7 +1161,7 @@ var copymoveCtxMenu = new Ext.menu.Menu({
|
||||
text : 'copylink',
|
||||
handler : function() {
|
||||
copymoveCtxMenu.hide();
|
||||
copymove('copy');
|
||||
copymove('copyAction');
|
||||
}
|
||||
}, {
|
||||
id : 'copymoveCtxMenu_move',
|
||||
@@ -1300,6 +1306,7 @@ var documentsTab = {
|
||||
tbar : gridtb,
|
||||
bbar : gridbb,
|
||||
ddGroup : 'TreeDD',
|
||||
enableDragDrop: true,
|
||||
selModel : new Ext.grid.RowSelectionModel({
|
||||
listeners : {
|
||||
'rowselect' : {
|
||||
@@ -1318,7 +1325,7 @@ var documentsTab = {
|
||||
stopEvent : true,
|
||||
handler : function() {
|
||||
openActionDialog(this,
|
||||
'copy');
|
||||
'copyAction');
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@@ -7,7 +7,6 @@ Ext.QuickTips.init();
|
||||
|
||||
var conn = new Ext.data.Connection();
|
||||
|
||||
|
||||
function getOtherDashboards(dashboardTabPanels) {
|
||||
conn.request({
|
||||
url : 'casesStartPage_Ajax.php',
|
||||
@@ -108,7 +107,7 @@ Ext
|
||||
{
|
||||
initEvents : function() {
|
||||
MainPanel.superclass.initEvents.call(this);
|
||||
this.body.on('click', this.onClick, this);
|
||||
//this.body.on('click', this.onClick, this);
|
||||
},
|
||||
|
||||
onClick : function(e, target, elementselected) {
|
||||
@@ -149,6 +148,8 @@ Ext
|
||||
"action" : 'getRegisteredDashboards'
|
||||
},
|
||||
success : function(responseObject) {
|
||||
|
||||
|
||||
var response = Ext.util.JSON
|
||||
.decode(responseObject.responseText);
|
||||
for (var i in response) {
|
||||
|
||||
Reference in New Issue
Block a user