echo $lng[16][16]; ?> </a> <tr valign="top"> <td> <table border="0" cellpadding="2" cellspacing="2" class="content" width="100%"> <tr class="gray"> <td align="center" width="100%"><b><?php echo $lng[16][17]; ?> </b></td> </tr> <?php $r_parent_tmp = 1; $cnt = 0; $parent = checkTree($r_id); // die($parent); ?> <?php $query3 = "select r_id, r_name, r_parent_id from requirements where r_id=" . $parent; $rs3 = mysql_query($query3) or die(mysql_error()); if ($row3 = mysql_fetch_array($rs3)) { ?> <tr class="blue"> <?php if ($row3['r_id'] == $r_id) { ?> <td> +<?php echo $row3['r_name']; ?>
<td> <select name="r_parent_id"> <option value='0'><?php echo $lng[15][37]; ?> <?php //getting list of childs in order to prevent endless cycle if ($r_id != "") { //getting tree array $query = "select * from requirements where r_parent_id=" . $r_id . " order by r_pos asc"; $rs = mysql_query($query) or die(mysql_error()); $cnt3 = 0; while ($row = mysql_fetch_array($rs)) { $cnt3++; $arr_[] = $cnt3 . "|" . $row['r_id']; if (checkTree($r_id) != -1) { getTree2($row['r_id'], $cnt3, $arr_); } } $arrs = "0"; while ($cnt3 > 0 && (list($key, $val) = each($arr_))) { $arrs .= "," . substr($val, strpos($val, "|") + 1); } } //requirements list if (!isset($add_q)) { $add_q = ""; } if ($r_id != "") { $add_q .= " and r_id not in (" . $arrs . ") and r_id<>" . $r_id; }
$cnt2 = $all_count; } else { $cnt2 = $from + $paging; } //getting requirements - recently modified $cnt = 0; $r_ids = ","; $query = "select r.* from requirements r left outer join projects p on r.r_p_id=p.p_id left outer join users u on r.r_u_id=u.u_id left outer join users u2 on r.r_assigned_u_id=u2.u_id where r.r_p_id in (" . $project_list . ") " . $search; $rs = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($rs)) { $r_ids .= $row['r_id'] . ","; } $pieces = explode(",", $r_ids); while (list($key, $val) = each($pieces)) { if ($val != "") { $parent_ids .= "," . checkTree($val); } } ?> <input type=hidden name=viewalltype value="tree"> <input type=hidden name=srch value="<?php echo $search; ?> "> </form> <table border=0 width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top" width="40%"> <?php
function uploadExternalDocument() { $response['action']=$_POST['action']. " - ".$_POST['option']; $response['error']="error"; $response['message']="error"; $response['success']=false; $overwrite = (isset($_REQUEST['overwrite_files'])) ? $_REQUEST['overwrite_files'] : false; if (isset($_POST["confirm"]) && $_POST["confirm"] == "true") { if (isset($_FILES['uploadedFile'])) { $uploadedInstances=count($_FILES['uploadedFile']['name']); $sw_error=false; $sw_error_exists=isset($_FILES['uploadedFile']['error']); $emptyInstances=0; $quequeUpload=array(); //overwrite files if ($overwrite) { for ($i=0; $i<$uploadedInstances; $i++) { overwriteFile($_REQUEST['dir'], stripslashes($_FILES['uploadedFile']['name'][$i])); } } // 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; } } elseif (isset($_POST['selitems'])) { $response=""; $response['msg']= "correct reload"; $response['success']=true; if (isset($_REQUEST['option']) && isset($_REQUEST['copyMove'])) { if ($_REQUEST['option'] == 'directory' && $_REQUEST['copyMove'] == 'all') { $response['action'] = $_POST['action']. " - ".$_POST['option']; $response['error'] = "Complete"; $response['message']= str_replace("Execute", "", $_POST['action']). " ". "Complete"; $response['success']= 'success'; $response['node'] = ''; $_POST ['node'] = ""; $newFolderUid = checkTree($_REQUEST['dir'], $_REQUEST['new_dir']); } $_POST['selitems'] = array(); } else { require_once ("classes/model/AppDocument.php"); $oAppDocument = new AppDocument(); if (isset($_POST['selitems']) && is_array($_POST['selitems'])) { foreach ($_POST['selitems'] as $docId) { $arrayDocId = explode ('_',$docId); $docInfo=$oAppDocument->load($arrayDocId[0]); $docInfo['FOLDER_UID'] = $_POST['new_dir']; $docInfo['APP_DOC_CREATE_DATE'] = date('Y-m-d H:i:s'); $oAppDocument->update($docInfo); } } } } //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']); } //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) { $oAppDocument = new AppDocument(); 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 . G::getPathFromUID($appId) . PATH_SEP; $file = G::getPathFromFileUID($appId, $sAppDocUid); $sPathName .= $file[0]; $sFileName = $file[1] . "_" . $iDocVersion . '.' . $ext; G::uploadFile($fileObj['tempName'], $sPathName, $sFileName); //upload //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']= G::LoadTranslation('ID_UPLOAD_LEAST_FILE'); $response['message']= G::LoadTranslation('ID_UPLOAD_LEAST_FILE'); $response['success']=false; } else { $response['error']= G::LoadTranslation('ID_UPLOAD_COMPLETE'); $response['message']="Upload complete"; $response['success']=true; } } } } print_r(G::json_encode($response)); /* G::LoadClass ('case'); $oCase = new Cases (); $G_PUBLISH = new Publisher (); $Fields ['DOC_UID'] = "-1"; $Fields ['appId'] = "00000000000000000000000000000000"; $G_PUBLISH->AddContent ('xmlform', 'xmlform', 'cases/cases_AttachInputDocumentGeneral', '', $Fields, 'appFolderSaveDocument?UID=-1&appId=' . $Fields ['appId'] . "&folderId=" . $_POST ['folderID']); G::RenderPage ('publish', 'raw'); */ }
<tr class="gray"> <td align="center"><b><?php echo $lng[40][1]; ?> </b></td> </tr> <tr class="blue"> <td align="left"> <?php //requirements include "ajax.php"; $query = "select * from review_requirements where rr_rev_id='" . $r_id . "' order by rr_id asc"; $rs = mysql_query($query) or die(mysql_error()); $req_ids = ","; while ($row = mysql_fetch_array($rs)) { $parent_ids .= checkTree($row['rr_req_id']) . ","; $req_ids .= $row['rr_req_id'] . ","; } $query = "select * from requirements where r_id in (" . $parent_ids . "0) and r_parent_id=0 order by r_pos asc"; $rs = mysql_query($query) or die(mysql_error()); $cnt3 = 0; while ($row = mysql_fetch_array($rs)) { $cnt3++; $arr[] = $cnt3 . "|" . $row['r_id']; getTree2($row['r_id'], $cnt3, $arr); } ?> <script src="dhtmlxTree/codebase/dhtmlxcommon.js"></script> <script src="dhtmlxTree/codebase/dhtmlxtree.js"></script>