<?php global $rootFolder; require_once "classes/model/AppFolder.php"; $oPMFolder = new AppFolder(); if ($rootFolder == '0' || $rootFolder == 0) { $folderPath['PATH'] = "/"; } else { $folderPath = $oPMFolder->getFolderStructure($rootFolder); } $html = ' <div> <div class="boxTopBlue"><div class="a"></div><div class="b"></div><div class="c"></div></div> <div class="boxContentBlue"> <table style="margin:0px;" cellspacing="0" cellpadding="0"> <tr> <td class="userGroupTitle"><div class="userGroupLink">' . G::LoadTranslation("ID_PM_FOLDER") . ': <a href="javascript:openPMFolder(\'' . $rootFolder . '\',\'' . $rootFolder . '\')">' . $folderPath['PATH'] . '</a></div></td> </tr> </table> </div> <div class="boxBottomBlue"><div class="a"></div><div class="b"></div><div class="c"></div></div> '; $html .= '<div class="treeBase" style="width:360px;height: expression( this.scrollHeight > 319 ? \'320px\' : \'auto\' ); /* sets max-height for IE */ max-height: 320px; /* sets max-height value for all standards-compliant browsers */ overflow:hidden;"> <div class="boxTop"> <div class="a"></div> <div class="b"></div> <div class="c"></div> </div>
} $fieldName = $arrayField[$i]["grdName"] . "_" . $arrayField[$i]["index"] . "_" . $arrayField[$i]["grdFieldName"]; } else { if (isset($_POST["INPUTS"][$arrayField[$i]]) && !empty($_POST["INPUTS"][$arrayField[$i]])) { $indocUid = $_POST["INPUTS"][$arrayField[$i]]; } $fieldName = $arrayField[$i]; } if ($indocUid != null) { //require_once ("classes/model/AppFolder.php"); //require_once ("classes/model/InputDocument.php"); $oInputDocument = new InputDocument(); $aID = $oInputDocument->load($indocUid); //Get the Custom Folder ID (create if necessary) $oFolder = new AppFolder(); $documentFileStructure = $oFolder->getFolderStructure(); $aFields = array("APP_UID" => $_SESSION["APPLICATION"], "DEL_INDEX" => $_SESSION["INDEX"], "USR_UID" => $_SESSION["USER_LOGGED"], "DOC_UID" => $indocUid, "APP_DOC_TYPE" => "INPUT", "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"), "APP_DOC_COMMENT" => "", "APP_DOC_TITLE" => "", "APP_DOC_FILENAME" => $arrayFileName[$i], "FOLDER_UID" => $oFolder->createFromPath($aID["INP_DOC_DESTINATION_PATH"]), "APP_DOC_TAGS" => $oFolder->parseTags($aID["INP_DOC_TAGS"]), "APP_DOC_FIELDNAME" => $fieldName); } else { $aFields = array("APP_UID" => $_SESSION["APPLICATION"], "DEL_INDEX" => $_SESSION["INDEX"], "USR_UID" => $_SESSION["USER_LOGGED"], "DOC_UID" => -1, "APP_DOC_TYPE" => "ATTACHED", "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"), "APP_DOC_COMMENT" => "", "APP_DOC_TITLE" => "", "APP_DOC_FILENAME" => $arrayFileName[$i], "APP_DOC_FIELDNAME" => $fieldName); } $oAppDocument = new AppDocument(); $oAppDocument->create($aFields); $iDocVersion = $oAppDocument->getDocVersion(); $sAppDocUid = $oAppDocument->getAppDocUid(); $aInfo = pathinfo($oAppDocument->getAppDocFilename()); $sExtension = isset($aInfo["extension"]) ? $aInfo["extension"] : ""; $pathUID = G::getPathFromUID($_SESSION["APPLICATION"]); $sPathName = PATH_DOCUMENT . $pathUID . PATH_SEP; // . $documentFileStructure; $sFileName = $sAppDocUid . "_" . $iDocVersion . "." . $sExtension; G::uploadFile($arrayFileTmpName[$i], $sPathName, $sFileName);
$docUid = $_POST['form']['DOC_UID']; $appDocUid = $_POST['form']['APP_DOC_UID']; $docVersion = $_POST['form']['docVersion']; $actionType = $_POST['form']['actionType']; $appId = $_GET['appId']; $docType = isset($_GET['docType']) ? $_GET['docType'] : ""; //save info require_once "classes/model/AppDocument.php"; require_once 'classes/model/AppFolder.php'; require_once 'classes/model/InputDocument.php'; $oInputDocument = new InputDocument(); if ($_GET['UID'] != -1) { $aID = $oInputDocument->load($_GET['UID']); } else { $oFolder = new AppFolder(); $folderStructure = $oFolder->getFolderStructure(isset($_GET['folderId']) ? $_GET['folderId'] : "/"); $aID = array('INP_DOC_DESTINATION_PATH' => $folderStructure['PATH']); } $oAppDocument = new AppDocument(); //Get the Custom Folder ID (create if necessary) $oFolder = new AppFolder(); if ($_GET['UID'] != -1) { //krumo("jhl"); $folderId = $oFolder->createFromPath($aID['INP_DOC_DESTINATION_PATH'], $appId); //Tags $fileTags = $oFolder->parseTags($aID['INP_DOC_TAGS'], $appId); } else { $folderId = isset($_GET['folderId']) ? $_GET['folderId'] : "/"; $fileTags = "EXTERNAL"; } switch ($actionType) {
function newFolder() { require_once ("classes/model/AppFolder.php"); $oPMFolder = new AppFolder (); //G::pr($_POST); if ($_POST ['dir']=="") { $_POST ['dir']="/"; } if ($_POST ['dir']=="root") { $_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"]= G::LoadTranslation('ID_CREATE_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,true); Ext.getCmp("simpleform").getForm().submit({ //reset: true, reset: false, waitTitle : " ", 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 (); $folderStructure = $oPMFolder->getFolderStructure ($_POST ['folderID']); $Fields ['FOLDER_PATH'] = $folderStructure ['PATH']; $Fields ['FOLDER_PARENT_UID'] = $_POST ['folderID']; $Fields ['FOLDER_UID'] = G::GenerateUniqueID (); $G_PUBLISH = new Publisher (); $G_PUBLISH->AddContent ('xmlform', 'xmlform', 'appFolder/appFolderEdit', '', $Fields, 'appFolderSave'); G::RenderPage ('publish', 'raw'); */ }