BUG 0000 Adjustment for the standardization of code. CODE_STYLE

This commit is contained in:
Hector Cortez
2013-03-14 15:50:49 -04:00
parent 229c49e9ef
commit 3a3c09dabd
7 changed files with 960 additions and 1021 deletions

View File

@@ -24,12 +24,15 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
if (! defined( 'JAVA_BRIDGE_PATH' )) if (! defined( 'JAVA_BRIDGE_PATH' )) {
define( 'JAVA_BRIDGE_PATH', 'JavaBridgePM' ); define( 'JAVA_BRIDGE_PATH', 'JavaBridgePM' );
if (! defined( 'JAVA_BRIDGE_PORT' )) }
if (! defined( 'JAVA_BRIDGE_PORT' )) {
define( 'JAVA_BRIDGE_PORT', '8080' ); define( 'JAVA_BRIDGE_PORT', '8080' );
if (! defined( 'JAVA_BRIDGE_HOST' )) }
if (! defined( 'JAVA_BRIDGE_HOST' )) {
define( 'JAVA_BRIDGE_HOST', '127.0.0.1' ); define( 'JAVA_BRIDGE_HOST', '127.0.0.1' );
}
/** /**
* *
@@ -37,9 +40,9 @@ if (! defined( 'JAVA_BRIDGE_HOST' ))
*/ */
class JavaBridgePM class JavaBridgePM
{ {
var $JavaBridgeDir = JAVA_BRIDGE_PATH; public $JavaBridgeDir = JAVA_BRIDGE_PATH;
var $JavaBridgePort = JAVA_BRIDGE_PORT; public $JavaBridgePort = JAVA_BRIDGE_PORT;
var $JavaBridgeHost = JAVA_BRIDGE_HOST; public $JavaBridgeHost = JAVA_BRIDGE_HOST;
/** /**
* checkJavaExtension * checkJavaExtension
@@ -48,7 +51,7 @@ class JavaBridgePM
* *
* @return true or false * @return true or false
*/ */
function checkJavaExtension () public function checkJavaExtension ()
{ {
try { try {
if (! extension_loaded( 'java' )) { if (! extension_loaded( 'java' )) {
@@ -58,9 +61,10 @@ class JavaBridgePM
$includedFiles = get_included_files(); $includedFiles = get_included_files();
$found = false; $found = false;
foreach ($includedFiles as $filename) { foreach ($includedFiles as $filename) {
if ($urlJavaInc == $filename) if ($urlJavaInc == $filename) {
$found = true; $found = true;
} }
}
if (! $found) { if (! $found) {
throw new Exception( 'The PHP/Java Bridge is not defined' ); throw new Exception( 'The PHP/Java Bridge is not defined' );
} }
@@ -86,7 +90,7 @@ class JavaBridgePM
* @param string $className * @param string $className
* @return s boolean success * @return s boolean success
*/ */
function convertValue ($value, $className) public function convertValue ($value, $className)
{ {
// if we are a string, just use the normal conversion // if we are a string, just use the normal conversion
// methods from the java extension... // methods from the java extension...
@@ -94,10 +98,10 @@ class JavaBridgePM
if ($className == 'java.lang.String') { if ($className == 'java.lang.String') {
$temp = new Java( 'java.lang.String', $value ); $temp = new Java( 'java.lang.String', $value );
return $temp; return $temp;
} else if ($className == 'java.lang.Boolean' || $className == 'java.lang.Integer' || $className == 'java.lang.Long' || $className == 'java.lang.Short' || $className == 'java.lang.Double' || $className == 'java.math.BigDecimal') { } elseif ($className == 'java.lang.Boolean' || $className == 'java.lang.Integer' || $className == 'java.lang.Long' || $className == 'java.lang.Short' || $className == 'java.lang.Double' || $className == 'java.math.BigDecimal') {
$temp = new Java( $className, $value ); $temp = new Java( $className, $value );
return $temp; return $temp;
} else if ($className == 'java.sql.Timestamp' || $className == 'java.sql.Time') { } elseif ($className == 'java.sql.Timestamp' || $className == 'java.sql.Time') {
$temp = new Java( $className ); $temp = new Java( $className );
$javaObject = $temp->valueOf( $value ); $javaObject = $temp->valueOf( $value );
return $javaObject; return $javaObject;
@@ -119,7 +123,7 @@ class JavaBridgePM
* @param object $template * @param object $template
* @return void * @return void
*/ */
function generateJrxmlFromDynaform ($outDocUid, $dynaformUid, $template) public function generateJrxmlFromDynaform ($outDocUid, $dynaformUid, $template)
{ {
require_once 'classes/model/Dynaform.php'; require_once 'classes/model/Dynaform.php';
$dyn = new Dynaform(); $dyn = new Dynaform();
@@ -129,9 +133,10 @@ class JavaBridgePM
$reportTpl = PATH_TPL . 'javaBridgePM/classic.xml'; $reportTpl = PATH_TPL . 'javaBridgePM/classic.xml';
$reportFilename = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $outDocUid . '.jrxml'; $reportFilename = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $outDocUid . '.jrxml';
foreach ($xmlFields as $key => $val) { foreach ($xmlFields as $key => $val) {
if ($val->type == 'submit' || $val->type == 'button' || $val->type == 'title' || $val->type == 'subtitle') if ($val->type == 'submit' || $val->type == 'button' || $val->type == 'title' || $val->type == 'subtitle') {
unset( $xmlFields[$key] ); unset( $xmlFields[$key] );
} }
}
//$sqlSentence = 'SELECT * from ' . $tableName; //$sqlSentence = 'SELECT * from ' . $tableName;
$sqlSentence = 'dynaform/'; $sqlSentence = 'dynaform/';
@@ -168,6 +173,5 @@ class JavaBridgePM
$iSize = file_put_contents( $reportFilename, $content ); $iSize = file_put_contents( $reportFilename, $content );
printf( "saved %s bytes in file %s \n", $iSize, $reportFilename ); printf( "saved %s bytes in file %s \n", $iSize, $reportFilename );
} }
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@
/** /**
* class.pmTrSharepoint.php * class.pmTrSharepoint.php
*/ */
G::LoadSystem( "soapNtlm" ); G::LoadSystem("soapNtlm");
class wscaller class wscaller
{ {
@@ -14,33 +14,32 @@ class wscaller
private $auth; private $auth;
private $clientStream; private $clientStream;
function setAuthUser ($auth) public function setAuthUser($auth)
{ {
//print "<br>- auth Setup"; //print "<br>- auth Setup";
$this->auth = $auth; $this->auth = $auth;
} }
function setwsdlurl ($wsdl) public function setwsdlurl($wsdl)
{ {
//print "<br>- wsdl Setup"; //print "<br>- wsdl Setup";
$this->wsdlurl = $wsdl; $this->wsdlurl = $wsdl;
//var_dump($wsdl); //var_dump($wsdl);
} }
function loadSOAPClient () public function loadSOAPClient()
{ {
try { try {
// we unregister the current HTTP wrapper // we unregister the current HTTP wrapper
stream_wrapper_unregister( 'http' ); stream_wrapper_unregister('http');
// we register the new HTTP wrapper // we register the new HTTP wrapper
//$client = new PMServiceProviderNTLMStream($this->auth); //$client = new PMServiceProviderNTLMStream($this->auth);
PMServiceProviderNTLMStream::setAuthStream( $this->auth ); PMServiceProviderNTLMStream::setAuthStream($this->auth);
stream_wrapper_register( 'http', 'PMServiceProviderNTLMStream' ) or die( "Failed to register protocol" ); stream_wrapper_register('http', 'PMServiceProviderNTLMStream') or die("Failed to register protocol");
// $this->client = new PMServiceNTLMSoapClient($this->wsdlurl, array('trace' => 1, 'auth' => $this->auth));// Hugo's code // $this->client = new PMServiceNTLMSoapClient($this->wsdlurl, array('trace' => 1, 'auth' => $this->auth));// Hugo's code
$this->client = new PMServiceNTLMSoapClient( $this->wsdlurl, array ('trace' => 1 $this->client = new PMServiceNTLMSoapClient($this->wsdlurl, array('trace' => 1)); // Ankit's Code
) ); // Ankit's Code $this->client->setAuthClient($this->auth);
$this->client->setAuthClient( $this->auth );
return true; return true;
} catch (Exception $e) { } catch (Exception $e) {
echo $e; echo $e;
@@ -48,30 +47,29 @@ class wscaller
} }
} }
function callWsMethod ($methodName, $paramArray) public function callWsMethod($methodName, $paramArray)
{ {
try { try {
if ($methodName == 'DeleteDws' || $methodName == 'GetListCollection') { if ($methodName == 'DeleteDws' || $methodName == 'GetListCollection') {
$strResult = ""; $strResult = "";
$strResult = $this->client->$methodName( $paramArray = "" ); $strResult = $this->client->$methodName($paramArray = "");
return $strResult; return $strResult;
} else { } else {
$strResult = ""; $strResult = "";
$strResult = $this->client->$methodName( $paramArray ); $strResult = $this->client->$methodName($paramArray);
return $strResult; return $strResult;
} }
} catch (SoapFault $fault) { } catch (SoapFault $fault) {
echo 'Fault code: ' . $fault->faultcode; echo 'Fault code: ' . $fault->faultcode;
echo 'Fault string: ' . $fault->faultstring; echo 'Fault string: ' . $fault->faultstring;
} }
stream_wrapper_restore( 'http' ); stream_wrapper_restore('http');
} }
} }
class DestinationUrlCollection class DestinationUrlCollection
{ {
public $string; public $string;
} }
@@ -88,31 +86,31 @@ class FieldInformationCollection
class pmTrSharepointClass class pmTrSharepointClass
{ {
function __construct ($server, $auth)
public function __construct($server, $auth)
{ {
set_include_path( PATH_PLUGINS . 'pmTrSharepoint' . PATH_SEPARATOR . get_include_path() ); set_include_path(PATH_PLUGINS . 'pmTrSharepoint' . PATH_SEPARATOR . get_include_path());
$this->server = $server; $this->server = $server;
$this->auth = $auth; $this->auth = $auth;
$this->dwsObj = new wscaller(); $this->dwsObj = new wscaller();
$this->dwsObj->setAuthUser( $this->auth ); $this->dwsObj->setAuthUser($this->auth);
} }
function createDWS ($name, $users, $title, $documents) public function createDWS($name, $users, $title, $documents)
{ {
//print "<br>- Method createDWS"; //print "<br>- Method createDWS";
$this->dwsObj->setwsdlurl( $this->server . "/_vti_bin/Dws.asmx?WSDL" ); $this->dwsObj->setwsdlurl($this->server . "/_vti_bin/Dws.asmx?WSDL");
$this->dwsObj->loadSOAPClient(); $this->dwsObj->loadSOAPClient();
$paramArray = array ('name' => '','users' => '','title' => $name,'documents' => '' $paramArray = array('name' => '', 'users' => '', 'title' => $name, 'documents' => '');
);
$methodName = 'CreateDws'; $methodName = 'CreateDws';
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray ); $result = $this->dwsObj->callWsMethod($methodName, $paramArray);
$xml = $result->CreateDwsResult; // in Result we get string in Xml format $xml = $result->CreateDwsResult; // in Result we get string in Xml format
$xmlNew = simplexml_load_string( $xml ); // used to parse string to xml $xmlNew = simplexml_load_string($xml); // used to parse string to xml
$xmlArray = @G::json_decode( @G::json_encode( $xmlNew ), 1 ); // used to convert Objects to array $xmlArray = @G::json_decode(@G::json_encode($xmlNew), 1); // used to convert Objects to array
$dwsUrl = $xmlArray['Url']; $dwsUrl = $xmlArray['Url'];
return "Dws with following Url is created:$dwsUrl"; return "Dws with following Url is created:$dwsUrl";
@@ -127,107 +125,102 @@ class pmTrSharepointClass
return $result; */ return $result; */
} }
function deleteDWS ($dwsname) public function deleteDWS($dwsname)
{ {
//print "<br>- Method createDWS"; //print "<br>- Method createDWS";
$url = $this->server . "/" . $dwsname . "/_vti_bin/Dws.asmx?WSDL"; $url = $this->server . "/" . $dwsname . "/_vti_bin/Dws.asmx?WSDL";
$this->dwsObj->setwsdlurl( $url ); $this->dwsObj->setwsdlurl($url);
$this->dwsObj->loadSOAPClient(); $this->dwsObj->loadSOAPClient();
$paramArray = null; $paramArray = null;
$methodName = 'DeleteDws'; $methodName = 'DeleteDws';
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray = null ); $result = $this->dwsObj->callWsMethod($methodName, $paramArray = null);
var_dump( $result ); var_dump($result);
return $result; return $result;
} }
function createFolderDWS ($dwsname, $dwsFolderName) public function createFolderDWS($dwsname, $dwsFolderName)
{ {
//print "<br>- Method createDWS"; //print "<br>- Method createDWS";
$this->dwsObj->setwsdlurl( $this->server . "/" . $dwsname . "/_vti_bin/Dws.asmx?WSDL" ); $this->dwsObj->setwsdlurl($this->server . "/" . $dwsname . "/_vti_bin/Dws.asmx?WSDL");
$this->dwsObj->loadSOAPClient(); $this->dwsObj->loadSOAPClient();
$url = "Shared Documents/$dwsFolderName"; $url = "Shared Documents/$dwsFolderName";
$paramArray = array ('url' => $url $paramArray = array('url' => $url);
);
# $paramArray = array('name' => '', 'users' => '', 'title' => $name, 'documents' => ''); # $paramArray = array('name' => '', 'users' => '', 'title' => $name, 'documents' => '');
$methodName = 'CreateFolder'; $methodName = 'CreateFolder';
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray ); $result = $this->dwsObj->callWsMethod($methodName, $paramArray);
var_dump( $result ); var_dump($result);
return $result; return $result;
} }
function deleteFolderDWS ($dwsname, $folderName) public function deleteFolderDWS($dwsname, $folderName)
{ {
//print "<br>- Method createDWS"; //print "<br>- Method createDWS";
$this->dwsObj->setwsdlurl( $this->server . "/" . $dwsname . "/_vti_bin/Dws.asmx?WSDL" ); $this->dwsObj->setwsdlurl($this->server . "/" . $dwsname . "/_vti_bin/Dws.asmx?WSDL");
$this->dwsObj->loadSOAPClient(); $this->dwsObj->loadSOAPClient();
$url = "Shared Documents/$folderName"; $url = "Shared Documents/$folderName";
$paramArray = array ('url' => $url $paramArray = array('url' => $url);
);
# $paramArray = array('name' => '', 'users' => '', 'title' => $name, 'documents' => ''); # $paramArray = array('name' => '', 'users' => '', 'title' => $name, 'documents' => '');
$methodName = 'DeleteFolder'; $methodName = 'DeleteFolder';
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray ); $result = $this->dwsObj->callWsMethod($methodName, $paramArray);
var_dump( $result ); var_dump($result);
return $result; return $result;
} }
function findDWSdoc ($dwsname, $guid) public function findDWSdoc($dwsname, $guid)
{ {
//print "<br>- Method createDWS"; //print "<br>- Method createDWS";
$this->dwsObj->setwsdlurl( $this->server . $dwsName . "/_vti_bin/Dws.asmx?WSDL" ); $this->dwsObj->setwsdlurl($this->server . $dwsName . "/_vti_bin/Dws.asmx?WSDL");
$this->dwsObj->loadSOAPClient(); $this->dwsObj->loadSOAPClient();
$paramArray = array ('id' => '$guid' $paramArray = array('id' => '$guid');
);
$methodName = 'FindDwsDoc'; $methodName = 'FindDwsDoc';
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray ); $result = $this->dwsObj->callWsMethod($methodName, $paramArray);
var_dump( $result ); var_dump($result);
} }
function getDWSData ($newFileName, $dwsname, $lastUpdate) public function getDWSData($newFileName, $dwsname, $lastUpdate)
{ {
//print "<br>- Method getDWSData<br />"; //print "<br>- Method getDWSData<br />";
$url = $this->server . "/" . $dwsname . "/_vti_bin/Dws.asmx?WSDL"; $url = $this->server . "/" . $dwsname . "/_vti_bin/Dws.asmx?WSDL";
$this->dwsObj->setwsdlurl( $url ); $this->dwsObj->setwsdlurl($url);
if ($this->dwsObj->loadSOAPClient()) { if ($this->dwsObj->loadSOAPClient()) {
$doc = "Shared Documents"; $doc = "Shared Documents";
$paramArray = array ('document' => '','lastUpdate' => '' $paramArray = array('document' => '', 'lastUpdate' => '');
);
$methodName = 'GetDwsData'; $methodName = 'GetDwsData';
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray ); $result = $this->dwsObj->callWsMethod($methodName, $paramArray);
var_dump( $result ); var_dump($result);
$sResult = $result->GetDwsDataResult; $sResult = $result->GetDwsDataResult;
/* $xmlNew = simplexml_load_string($sResult);// used to parse string to xml /* $xmlNew = simplexml_load_string($sResult);// used to parse string to xml
$xmlArray = @G::json_decode(@G::json_encode($xmlNew),1);// used to convert Objects to array */ $xmlArray = @G::json_decode(@G::json_encode($xmlNew),1);// used to convert Objects to array */
$serializeResult = serialize( $sResult ); // serializing the Array for Returning. $serializeResult = serialize($sResult); // serializing the Array for Returning.
var_dump( $serializeResult ); var_dump($serializeResult);
return $serializeResult; return $serializeResult;
} else { } else {
return "The enter the Correct Dws Name"; return "The enter the Correct Dws Name";
} }
} }
function uploadDocumentDWS ($dwsname, $folderName, $sourceUrl, $filename) public function uploadDocumentDWS($dwsname, $folderName, $sourceUrl, $filename)
{ {
//print "<br>- Method createDWS"; //print "<br>- Method createDWS";
$url = $this->server . "/" . $dwsname . "/_vti_bin/Copy.asmx?WSDL"; $url = $this->server . "/" . $dwsname . "/_vti_bin/Copy.asmx?WSDL";
$this->dwsObj->setwsdlurl( $url ); $this->dwsObj->setwsdlurl($url);
$this->dwsObj->loadSOAPClient(); $this->dwsObj->loadSOAPClient();
$destUrlObj = new DestinationUrlCollection(); $destUrlObj = new DestinationUrlCollection();
@@ -244,17 +237,17 @@ class pmTrSharepointClass
$fieldInfoCollObj->FieldInformation = $fieldInfoObj; $fieldInfoCollObj->FieldInformation = $fieldInfoObj;
$imgfile = $sourceUrl . "/" . $filename; $imgfile = $sourceUrl . "/" . $filename;
$filep = fopen( $imgfile, "r" ); $filep = fopen($imgfile, "r");
$fileLength = filesize( $imgfile ); $fileLength = filesize($imgfile);
$content = fread( $filep, $fileLength ); $content = fread($filep, $fileLength);
//$content = base64_encode($content); //$content = base64_encode($content);
$paramArray = array ('SourceUrl' => $imgfile,'DestinationUrls' => $destUrlObj,'Fields' => $fieldInfoCollObj,'Stream' => $content $paramArray = array('SourceUrl' => $imgfile, 'DestinationUrls' => $destUrlObj, 'Fields' => $fieldInfoCollObj, 'Stream' => $content
); );
$methodName = 'CopyIntoItems'; $methodName = 'CopyIntoItems';
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray ); $result = $this->dwsObj->callWsMethod($methodName, $paramArray);
var_dump( $result ); var_dump($result);
$newResult = $result->Results->CopyResult->ErrorCode; $newResult = $result->Results->CopyResult->ErrorCode;
if ($newResult == 'Success') { if ($newResult == 'Success') {
return "The document has been uploaded Successfully"; return "The document has been uploaded Successfully";
@@ -263,104 +256,100 @@ class pmTrSharepointClass
} }
} }
function getDWSMetaData ($newFileName, $dwsname, $id) public function getDWSMetaData($newFileName, $dwsname, $id)
{ {
//print "<br>- Method createDWS"; //print "<br>- Method createDWS";
$url = $this->server . "/" . $dwsname . "/_vti_bin/Dws.asmx?WSDL"; $url = $this->server . "/" . $dwsname . "/_vti_bin/Dws.asmx?WSDL";
$this->dwsObj->setwsdlurl( $url ); $this->dwsObj->setwsdlurl($url);
$this->dwsObj->loadSOAPClient(); $this->dwsObj->loadSOAPClient();
$doc = "Shared Documents/$newFileName"; $doc = "Shared Documents/$newFileName";
$paramArray = array ('document' => $doc,'id' => '','minimal' => false $paramArray = array('document' => $doc, 'id' => '', 'minimal' => false);
);
$methodName = 'GetDwsMetaData'; $methodName = 'GetDwsMetaData';
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray ); $result = $this->dwsObj->callWsMethod($methodName, $paramArray);
$sResult = $result->GetDwsMetaDataResult; $sResult = $result->GetDwsMetaDataResult;
$errorReturn = strpos( $sResult, "Error" ); $errorReturn = strpos($sResult, "Error");
if (isset( $sResult ) && ! $errorReturn) { if (isset($sResult) && !$errorReturn) {
$serializeResult = serialize( $sResult ); // serializing the Array for Returning. $serializeResult = serialize($sResult); // serializing the Array for Returning.
var_dump( $serializeResult ); var_dump($serializeResult);
return $serializeResult; return $serializeResult;
} else { } else {
return $sResult; return $sResult;
} }
} }
function getDWSDocumentVersions ($newFileName, $dwsname) public function getDWSDocumentVersions($newFileName, $dwsname)
{ {
//print "<br>- Method createDWS"; //print "<br>- Method createDWS";
$this->dwsObj->setwsdlurl( $this->server . "/" . $dwsname . "/_vti_bin/Versions.asmx?WSDL" ); $this->dwsObj->setwsdlurl($this->server . "/" . $dwsname . "/_vti_bin/Versions.asmx?WSDL");
$this->dwsObj->loadSOAPClient(); $this->dwsObj->loadSOAPClient();
$doc = "Shared Documents/$newFileName"; $doc = "Shared Documents/$newFileName";
$paramArray = array ('fileName' => $doc $paramArray = array('fileName' => $doc);
);
$methodName = 'GetVersions'; $methodName = 'GetVersions';
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray ); $result = $this->dwsObj->callWsMethod($methodName, $paramArray);
var_dump( $result ); var_dump($result);
return $result; return $result;
} }
function deleteDWSDocVersion ($newFileName, $dwsname, $versionNum) public function deleteDWSDocVersion($newFileName, $dwsname, $versionNum)
{ {
//print "<br>- Method createDWS"; //print "<br>- Method createDWS";
$this->dwsObj->setwsdlurl( $this->server . "/" . $dwsname . "/_vti_bin/Versions.asmx?WSDL" ); $this->dwsObj->setwsdlurl($this->server . "/" . $dwsname . "/_vti_bin/Versions.asmx?WSDL");
$this->dwsObj->loadSOAPClient(); $this->dwsObj->loadSOAPClient();
$doc = "Shared Documents/$newFileName"; $doc = "Shared Documents/$newFileName";
$paramArray = array ('fileName' => $doc,'fileVersion' => $versionNum $paramArray = array('fileName' => $doc, 'fileVersion' => $versionNum);
);
$methodName = 'DeleteVersion'; $methodName = 'DeleteVersion';
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray ); $result = $this->dwsObj->callWsMethod($methodName, $paramArray);
if ($result) { if ($result) {
$sResult = $result->DeleteVersionResult->any; $sResult = $result->DeleteVersionResult->any;
$xmlNew = simplexml_load_string( $sResult ); // used to parse string to xml $xmlNew = simplexml_load_string($sResult); // used to parse string to xml
$xmlArray = @G::json_decode( @G::json_encode( $xmlNew ), 1 ); // used to convert Objects to array $xmlArray = @G::json_decode(@G::json_encode($xmlNew), 1); // used to convert Objects to array
$versionCount = count( $xmlArray['result'] ); $versionCount = count($xmlArray['result']);
if ($versionCount > 1) { if ($versionCount > 1) {
for ($i = 0; $i < $versionCount; $i ++) { for ($i = 0; $i < $versionCount; $i++) {
$version[] = $xmlArray['result'][$i]['@attributes']['version']; $version[] = $xmlArray['result'][$i]['@attributes']['version'];
} }
} else { } else {
$version[] = $xmlArray['result']['@attributes']['version']; $version[] = $xmlArray['result']['@attributes']['version'];
} }
$serializeResult = serialize( $version ); // serializing the Array for Returning. $serializeResult = serialize($version); // serializing the Array for Returning.
var_dump( $serializeResult ); var_dump($serializeResult);
return $serializeResult; return $serializeResult;
} else { } else {
return "The given Version could not be deleted."; return "The given Version could not be deleted.";
} }
} }
function deleteAllDWSDocVersion ($newFileName, $dwsname) public function deleteAllDWSDocVersion($newFileName, $dwsname)
{ {
//print "<br>- Method createDWS"; //print "<br>- Method createDWS";
$this->dwsObj->setwsdlurl( $this->server . "/" . $dwsname . "/_vti_bin/Versions.asmx?WSDL" ); $this->dwsObj->setwsdlurl($this->server . "/" . $dwsname . "/_vti_bin/Versions.asmx?WSDL");
$this->dwsObj->loadSOAPClient(); $this->dwsObj->loadSOAPClient();
$doc = "Shared Documents/$newFileName"; $doc = "Shared Documents/$newFileName";
$paramArray = array ('fileName' => $doc $paramArray = array('fileName' => $doc);
);
$methodName = 'DeleteAllVersions'; $methodName = 'DeleteAllVersions';
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray ); $result = $this->dwsObj->callWsMethod($methodName, $paramArray);
if ($result) { if ($result) {
$xml = $result->DeleteAllVersionsResult->any; // in Result we get string in Xml format $xml = $result->DeleteAllVersionsResult->any; // in Result we get string in Xml format
$xmlNew = simplexml_load_string( $xml ); // used to parse string to xml $xmlNew = simplexml_load_string($xml); // used to parse string to xml
$xmlArray = @G::json_decode( @G::json_encode( $xmlNew ), 1 ); // used to convert Objects to array $xmlArray = @G::json_decode(@G::json_encode($xmlNew), 1); // used to convert Objects to array
$latestVersion = $xmlArray['result']['@attributes']['version']; $latestVersion = $xmlArray['result']['@attributes']['version'];
return "All Versions are Deleted, except the latest i.e $latestVersion"; return "All Versions are Deleted, except the latest i.e $latestVersion";
} else { } else {
@@ -368,61 +357,59 @@ class pmTrSharepointClass
} }
} }
function getDWSFolderItems ($dwsname, $strFolderUrl) public function getDWSFolderItems($dwsname, $strFolderUrl)
{ {
$pmTrSharepointClassObj = new pmTrSharepointClass(); $pmTrSharepointClassObj = new pmTrSharepointClass();
//print "<br>- Method getDWSFolderItems"; //print "<br>- Method getDWSFolderItems";
$url = $this->server . "/" . $dwsname . "/_vti_bin/SiteData.asmx?WSDL"; $url = $this->server . "/" . $dwsname . "/_vti_bin/SiteData.asmx?WSDL";
$this->dwsObj->setwsdlurl( $this->server . "/" . $dwsname . "/_vti_bin/SiteData.asmx?WSDL" ); $this->dwsObj->setwsdlurl($this->server . "/" . $dwsname . "/_vti_bin/SiteData.asmx?WSDL");
$this->dwsObj->loadSOAPClient(); $this->dwsObj->loadSOAPClient();
#$doc = "Shared Documents/$newFileName"; #$doc = "Shared Documents/$newFileName";
$paramArray = array ('strFolderUrl' => $strFolderUrl $paramArray = array('strFolderUrl' => $strFolderUrl);
);
$methodName = 'EnumerateFolder'; $methodName = 'EnumerateFolder';
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray ); $result = $this->dwsObj->callWsMethod($methodName, $paramArray);
//$newResult = $result->vUrls->_sFPUrl->Url; //$newResult = $result->vUrls->_sFPUrl->Url;
if (isset( $result->vUrls->_sFPUrl->Url )) { if (isset($result->vUrls->_sFPUrl->Url)) {
$returnContent = $pmTrSharepointClassObj->getFolderUrlContent( $result->vUrls->_sFPUrl->Url ); $returnContent = $pmTrSharepointClassObj->getFolderUrlContent($result->vUrls->_sFPUrl->Url);
$serializeResult = serialize( $returnContent ); $serializeResult = serialize($returnContent);
return $serializeResult; return $serializeResult;
} elseif (isset( $result->vUrls->_sFPUrl )) { } elseif (isset($result->vUrls->_sFPUrl)) {
$itemCount = count( $result->vUrls->_sFPUrl ); $itemCount = count($result->vUrls->_sFPUrl);
for ($i = 0; $i < $itemCount; $i ++) { for ($i = 0; $i < $itemCount; $i++) {
$aObjects = $result->vUrls->_sFPUrl[$i]->IsFolder; $aObjects = $result->vUrls->_sFPUrl[$i]->IsFolder;
//$booleanStatus = $aObjects[$i]->IsFolder; //$booleanStatus = $aObjects[$i]->IsFolder;
if ($aObjects) { if ($aObjects) {
$listArr = $result->vUrls->_sFPUrl[$i]->Url; $listArr = $result->vUrls->_sFPUrl[$i]->Url;
$returnContent[] = $pmTrSharepointClassObj->getFolderUrlContent( $listArr ) . "(Is a Folder)"; $returnContent[] = $pmTrSharepointClassObj->getFolderUrlContent($listArr) . "(Is a Folder)";
} else { } else {
$listArr = $result->vUrls->_sFPUrl[$i]->Url; $listArr = $result->vUrls->_sFPUrl[$i]->Url;
$returnContent[] = $pmTrSharepointClassObj->getFolderUrlContent( $listArr ) . "(Is a File)"; $returnContent[] = $pmTrSharepointClassObj->getFolderUrlContent($listArr) . "(Is a File)";
} }
} }
$serializeResult = serialize( $returnContent ); $serializeResult = serialize($returnContent);
return $serializeResult; return $serializeResult;
} }
return "There is some error"; return "There is some error";
} }
function downloadDocumentDWS ($dwsname, $fileName, $fileLocation) public function downloadDocumentDWS($dwsname, $fileName, $fileLocation)
{ {
//print "<br>- Method createDWS"; //print "<br>- Method createDWS";
$url = $this->server . "/" . $dwsname . "/_vti_bin/Copy.asmx?WSDL"; $url = $this->server . "/" . $dwsname . "/_vti_bin/Copy.asmx?WSDL";
$this->dwsObj->setwsdlurl( $url ); $this->dwsObj->setwsdlurl($url);
$this->dwsObj->loadSOAPClient(); $this->dwsObj->loadSOAPClient();
$CompleteUrl = $this->server . "/" . $dwsname . "/Shared Documents/" . $fileName; $CompleteUrl = $this->server . "/" . $dwsname . "/Shared Documents/" . $fileName;
$paramArray = array ('Url' => $CompleteUrl $paramArray = array('Url' => $CompleteUrl);
);
$methodName = 'GetItem'; $methodName = 'GetItem';
$result = $this->dwsObj->callWsMethod( $methodName, $paramArray ); $result = $this->dwsObj->callWsMethod($methodName, $paramArray);
$newResult = $result->Stream; $newResult = $result->Stream;
//$latestResult = base64_decode($newResult); //$latestResult = base64_decode($newResult);
@@ -431,27 +418,27 @@ class pmTrSharepointClass
* In the Below line of code, we are coping the files at our local Directory using the php file methods. * In the Below line of code, we are coping the files at our local Directory using the php file methods.
*/ */
$imgfile = $fileLocation . "/" . $fileName; $imgfile = $fileLocation . "/" . $fileName;
$filep = fopen( $imgfile, 'w' ); $filep = fopen($imgfile, 'w');
//$content = fwrite($filep, $latestResult); //$content = fwrite($filep, $latestResult);
$content = fwrite( $filep, $newResult ); $content = fwrite($filep, $newResult);
return $content; return $content;
} }
function getFolderUrlContent ($newResult) public function getFolderUrlContent($newResult)
{ {
$needleStart = '/'; $needleStart = '/';
$needleCount = substr_count( $newResult, $needleStart ); $needleCount = substr_count($newResult, $needleStart);
$urlStartPos = strpos( $newResult, $needleStart ); $urlStartPos = strpos($newResult, $needleStart);
$urlStartPos ++; $urlStartPos++;
if ($needleCount == '2') { if ($needleCount == '2') {
$newResultPos = strpos( $newResult, $needleStart, $urlStartPos ); $newResultPos = strpos($newResult, $needleStart, $urlStartPos);
$newResultPos ++; $newResultPos++;
$actualResult = substr( $newResult, $newResultPos ); $actualResult = substr($newResult, $newResultPos);
return $actualResult; return $actualResult;
} else { } else {
$actualResult = substr( $newResult, $urlStartPos ); $actualResult = substr($newResult, $urlStartPos);
return $actualResult; return $actualResult;
} }
} }

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* clases_Test.php * clases_Test.php
* *
@@ -22,18 +23,17 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
G::LoadClass("derivation");
G::LoadClass( "derivation" ); $dbc = new DBConnection;
$obj = new Derivation;
$dbc = new DBConnection;
$obj = new Derivation;
/* derivando el primer caso */ /* derivando el primer caso */
$frm['APP_UID'] ='44706CAEA62AE0'; $frm['APP_UID'] = '44706CAEA62AE0';
$frm['DEL_INDEX'] ='1'; $frm['DEL_INDEX'] = '1';
$obj->executeDerivation($frm); $obj->executeDerivation($frm);
die; die;
/* derivando el primer caso */ /* derivando el primer caso */
@@ -44,57 +44,56 @@
$obj->startCase($frm); $obj->startCase($frm);
die; die;
*/ */
/* CREANDO UN NUEVO CASO END */ /* CREANDO UN NUEVO CASO END */
/** Application */ /** Application */
//$frm['PRO_UID'] ='ssddsfse32dd23s';
//$frm['PRO_UID'] ='ssddsfse32dd23s';
/* $frm['APP_PARENT'] ='135165FDS54654FD'; /* $frm['APP_PARENT'] ='135165FDS54654FD';
$frm['PRO_UID'] ='SSDDSFSE32DD23S'; $frm['PRO_UID'] ='SSDDSFSE32DD23S';
$frm['APP_STATUS'] ='DRAFT'; $frm['APP_STATUS'] ='DRAFT';
$frm['APP_PROC_STATUS']='TEST'; $frm['APP_PROC_STATUS']='TEST';
$frm['APP_PARALLEL']='NO'; $frm['APP_PARALLEL']='NO';
$frm['APP_TITLE']='MAUI'; $frm['APP_TITLE']='MAUI';
*/ */
/* $translation2 = $obj->generateFileTranslation(); /* $translation2 = $obj->generateFileTranslation();
print_r($translation2);*/ print_r($translation2); */
/*step */ /* step */
/*$frm['TAS_UID'] ='sss'; /* $frm['TAS_UID'] ='sss';
$frm['STEP_NAME_OBJ'] ='DYNA'; $frm['STEP_NAME_OBJ'] ='DYNA';
*/ */
/*ReqDynaform */ /* ReqDynaform */
/* $frm['REQ_DYN_TITLE'] ='sss'; /* $frm['REQ_DYN_TITLE'] ='sss';
$frm['REQ_DYN_DESCRIPTION'] ='eee'; $frm['REQ_DYN_DESCRIPTION'] ='eee';
$frm['REQ_DYN_FILENAME'] ='33'; $frm['REQ_DYN_FILENAME'] ='33';
$frm['REQ_DYN_UID']='346BB3D981FD9E';*/ $frm['REQ_DYN_UID']='346BB3D981FD9E'; */
/*ReqDocument */ /* ReqDocument */
/* $frm['REQ_DOC_TITLE'] ='titulosssss'; /* $frm['REQ_DOC_TITLE'] ='titulosssss';
$frm['REQ_DOC_DESCRIPTION'] ='descripcions'; $frm['REQ_DOC_DESCRIPTION'] ='descripcions';
//$frm['REQ_DOC_ORIGINAL'] ='1'; //$frm['REQ_DOC_ORIGINAL'] ='1';
$frm['REQ_DOC_UID']='646BB2F6BB2037'; $frm['REQ_DOC_UID']='646BB2F6BB2037';
*/ */
/*Task*/ /* Task */
/*$frm['TAS_UID']='846BB16A0D9C7A'; /* $frm['TAS_UID']='846BB16A0D9C7A';
$frm['PRO_UID']='746B67A9CC9A0E'; $frm['PRO_UID']='746B67A9CC9A0E';
//$frm['TAS_TYPE'] ='332'; //$frm['TAS_TYPE'] ='332';
$frm['TAS_TITLE'] ='titulito MAUI13ss'; $frm['TAS_TITLE'] ='titulito MAUI13ss';
$frm['TAS_DESCRIPTION'] ='Descripci<63>n MAUI13'; $frm['TAS_DESCRIPTION'] ='Descripci<63>n MAUI13';
$frm['TAS_DEF_TITLE'] = "13"; $frm['TAS_DEF_TITLE'] = "13";
$frm['TAS_DEF_DESCRIPTION'] = "23"; $frm['TAS_DEF_DESCRIPTION'] = "23";
$frm['TAS_DEF_PROC_CODE'] = "33"; $frm['TAS_DEF_PROC_CODE'] = "33";
$frm['TAS_DEF_MESSAGE'] = "43";*/ $frm['TAS_DEF_MESSAGE'] = "43"; */
/** SwimlanesElements*/ /** SwimlanesElements */
/* /*
$frm['PRO_UID'] ='ssddsfse32dd23s'; $frm['PRO_UID'] ='ssddsfse32dd23s';
$frm['SWI_TEXT'] ='maui'; $frm['SWI_TEXT'] ='maui';
@@ -102,48 +101,45 @@
$frm['SWI_X'] ='2'; $frm['SWI_X'] ='2';
$frm['SWI_UID']='746BB217D7805E'; $frm['SWI_UID']='746BB217D7805E';
*/ */
/** Route */ /** Route */
/* /*
$frm['PRO_UID'] ='ssddsfse32dd23s'; $frm['PRO_UID'] ='ssddsfse32dd23s';
$frm['TAS_UID'] ='cooo'; $frm['TAS_UID'] ='cooo';
$frm['ROU_NEXT_TASK'] ='654FD65S4F65SD'; $frm['ROU_NEXT_TASK'] ='654FD65S4F65SD';
$frm['ROU_SOURCEANCHOR'] ='2'; $frm['ROU_SOURCEANCHOR'] ='2';
$frm['ROU_UID']='746BB8411A9C14'; $frm['ROU_UID']='746BB8411A9C14';
*/ */
/*PROCESS*/ /* PROCESS */
/*$frm['PRO_UID'] = '446BB1B36E17FE'; /* $frm['PRO_UID'] = '446BB1B36E17FE';
$frm['PRO_TITLE'] = 'PERDERD'; $frm['PRO_TITLE'] = 'PERDERD';
$frm['PRO_PARENT']='746B67A9CC9ADDDDDDDD0E';*/ $frm['PRO_PARENT']='746B67A9CC9ADDDDDDDD0E'; */
/** END PROCESS*/ /** END PROCESS */
/* MESSAGE */
/*MESSAGE*/
/* /*
$frm['PRO_UID'] = '446BB1B36E17FE'; $frm['PRO_UID'] = '446BB1B36E17FE';
$frm['MESS_UID'] = '146CDAC097D35A'; $frm['MESS_UID'] = '146CDAC097D35A';
$frm['MESS_TYPE'] = 'HTMLS'; $frm['MESS_TYPE'] = 'HTMLS';
$frm['MESS_TITLE'] = 't<>tulo del mensaje'; $frm['MESS_TITLE'] = 't<>tulo del mensaje';
$frm['MESS_DESCRIPTION'] = 'estimado SrS.'; $frm['MESS_DESCRIPTION'] = 'estimado SrS.';
/** END MESSAGE*/ /** END MESSAGE */
/*STEP*/ /* STEP */
/* /*
$frm['PRO_UID'] = '446BB1B36E17FE'; $frm['PRO_UID'] = '446BB1B36E17FE';
$frm['TAS_UID'] = '146CDAC097D35A'; $frm['TAS_UID'] = '146CDAC097D35A';
$frm['STEP_NAME_OBJ'] = 'HTM'; $frm['STEP_NAME_OBJ'] = 'HTM';
$frm['STEP_TYPE_OBJ'] = 'OUTPUT_DOCUMENT'; $frm['STEP_TYPE_OBJ'] = 'OUTPUT_DOCUMENT';
$frm['STEP_UID_OBJ'] = 'estimado SrS.'; $frm['STEP_UID_OBJ'] = 'estimado SrS.';
*/ */
/** END MESSAGE*/ /** END MESSAGE */
/** Delegation */
/** Delegation */ //$frm['PRO_UID'] ='ssddsfse32dd23s';
/* $frm['APP_UID'] ='135165FDS54654FD';
//$frm['PRO_UID'] ='ssddsfse32dd23s';
/*$frm['APP_UID'] ='135165FDS54654FD';
$frm['APP_PARENT'] ='135165FDS54654FD'; $frm['APP_PARENT'] ='135165FDS54654FD';
$frm['PRO_UID'] ='SSDDSFSE32DD23S'; $frm['PRO_UID'] ='SSDDSFSE32DD23S';
$frm['APP_STATUS'] ='DRAFT'; $frm['APP_STATUS'] ='DRAFT';
@@ -158,6 +154,6 @@
$obj->delete('046E99A56954AE'); $obj->delete('046E99A56954AE');
die("eliminado YA - ".$prouid); die("eliminado YA - ".$prouid);
*/ */
?>

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* methodsPermissions.php * methodsPermissions.php
* *
@@ -21,9 +22,8 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'view', 'tools/methodsPermissions' ); $G_PUBLISH->AddContent('view', 'tools/methodsPermissions');
G::RenderPage( 'publish' ); G::RenderPage('publish');

View File

@@ -22,123 +22,119 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
G::LoadClass('tree'); G::LoadClass('tree');
/* /*
* Esto no deberias borrarlo * Esto no deberias borrarlo
*/ */
$tree = new Tree(); $tree = new Tree();
reView(PATH_TRUNK,$tree); reView(PATH_TRUNK, $tree);
print( $tree->render() ); print( $tree->render());
function reView($path,&$tree) function reView($path, &$tree)
{ {
$tree->name = $path; $tree->name = $path;
$tree->value = $path . '&nbsp;'. $tree->value = $path . '&nbsp;' .
setHeader('Set Header','setDirHeader("'.$path.'",this);'). setHeader('Set Header', 'setDirHeader("' . $path . '",this);') .
selectPermissions('Set Permission','setDirPermission("'.$path.'",this);'). selectPermissions('Set Permission', 'setDirPermission("' . $path . '",this);') .
selectPermissions('Remove Permission','removeDirPermission("'.$path.'",this);'); selectPermissions('Remove Permission', 'removeDirPermission("' . $path . '",this);');
$tree->contracted = true; $tree->contracted = true;
foreach(glob($path.'*',GLOB_MARK) as $file) foreach (glob($path . '*', GLOB_MARK) as $file) {
{ if (is_dir($file)) {
if (is_dir($file)) reView($file, $tree->addChild($file, $file));
{ } elseif (substr($file, -4, 4) === '.php') {
reView($file,$tree->addChild($file, $file )); $nodeFile = &$tree->addChild($file, $file . '&nbsp;' .
} selectPermissions('Set Permission', 'setPermission("' . $file . '",this);') .
elseif (substr($file,-4,4)==='.php') selectPermissions('Remove Permission', 'removePermission("' . $file . '",this);')
{
$nodeFile=&$tree->addChild
(
$file, $file . '&nbsp;'.
selectPermissions('Set Permission','setPermission("'.$file.'",this);').
selectPermissions('Remove Permission','removePermission("'.$file.'",this);')
); );
$nodeFile->addChild("View Permissions",'<div style="cursor:hand;" onclick="loadFile(&quot;'.htmlentities($file,ENT_QUOTES,'UTF-8').'&quot;,this.nextSibling);">View Permissions</div><div id="divPerms['.htmlentities($file,ENT_QUOTES,'UTF-8').']"></div>'); $nodeFile->addChild("View Permissions", '<div style="cursor:hand;" onclick="loadFile(&quot;' . htmlentities($file, ENT_QUOTES, 'UTF-8') . '&quot;,this.nextSibling);">View Permissions</div><div id="divPerms[' . htmlentities($file, ENT_QUOTES, 'UTF-8') . ']"></div>');
$nodeFile->addChild("Add Line",'<a href="#" onclick="addPermission(&quot;'.htmlentities($file,ENT_QUOTES,'UTF-8').'&quot;,this.nextSibling.nextSibling);return false;">Add Permission</a><br/><input style="width:100%;"/>'); $nodeFile->addChild("Add Line", '<a href="#" onclick="addPermission(&quot;' . htmlentities($file, ENT_QUOTES, 'UTF-8') . '&quot;,this.nextSibling.nextSibling);return false;">Add Permission</a><br/><input style="width:100%;"/>');
$nodeFile->contracted = true; $nodeFile->contracted = true;
} }
} }
} }
function selectPermissions($label,$onchange)
{ function selectPermissions($label, $onchange)
return '<select onchange="'.htmlentities($onchange,ENT_QUOTES,'UTF-8').'">'. {
'<option>'.$label.'</option>'. return '<select onchange="' . htmlentities($onchange, ENT_QUOTES, 'UTF-8') . '">' .
'<option value="PM_LOGIN">PM_LOGIN</option>'. '<option>' . $label . '</option>' .
'<option value="PM_USERS">PM_USERS</option>'. '<option value="PM_LOGIN">PM_LOGIN</option>' .
'<option value="PM_CASES">PM_CASES</option>'. '<option value="PM_USERS">PM_USERS</option>' .
'<option value="PM_FACTORY">PM_FACTORY</option>'. '<option value="PM_CASES">PM_CASES</option>' .
'<option value="PM_SETUP">PM_SETUP</option>'. '<option value="PM_FACTORY">PM_FACTORY</option>' .
'<option value="PM_SETUP">PM_SETUP</option>' .
'</select>'; '</select>';
} }
function setHeader($label,$onchange)
{ function setHeader($label, $onchange)
return '<input type="button" onclick="'.htmlentities($onchange,ENT_QUOTES,'UTF-8').'" value="set header"/>'; {
} return '<input type="button" onclick="' . htmlentities($onchange, ENT_QUOTES, 'UTF-8') . '" value="set header"/>';
}
?> ?>
<textarea id="headerText" cols="80" rows="25"></textarea> <textarea id="headerText" cols="80" rows="25"></textarea>
<script> <script>
var headerText=document.getElementById("headerText"); var headerText = document.getElementById("headerText");
var phpFile = WebResource('methodsPermissions_Ajax'); var phpFile = WebResource('methodsPermissions_Ajax');
function loadFile(file,div) function loadFile(file, div)
{ {
div.innerHTML=phpFile.get_permissions(file); div.innerHTML = phpFile.get_permissions(file);
} }
function switchViewEdit(txt,inp) function switchViewEdit(txt, inp)
{ {
showHideElement(txt); showHideElement(txt);
showHideElement(inp); showHideElement(inp);
inp.focus(); inp.focus();
var file=inp.name.split('?')[0]; var file = inp.name.split('?')[0];
var row=parseInt(inp.name.split('?')[1]); var row = parseInt(inp.name.split('?')[1]);
//phpFile.modify_line(file,row,inp.value); //phpFile.modify_line(file,row,inp.value);
} }
function switchEditView(txt,inp) function switchEditView(txt, inp)
{ {
showHideElement(txt); showHideElement(txt);
showHideElement(inp); showHideElement(inp);
var file=inp.name.split('?')[0]; var file = inp.name.split('?')[0];
var row=parseInt(inp.name.split('?')[1]); var row = parseInt(inp.name.split('?')[1]);
var res=phpFile.modify_line(file,row,inp.value); var res = phpFile.modify_line(file, row, inp.value);
txt.innerHTML=res[0]; txt.innerHTML = res[0];
inp.value=res[1]; inp.value = res[1];
} }
function addPermission(file,inp) function addPermission(file, inp)
{ {
var res=phpFile.add_permission(file,inp.value); var res = phpFile.add_permission(file, inp.value);
document.getElementById('divPerms['+file+']').innerHTML=res; document.getElementById('divPerms[' + file + ']').innerHTML = res;
} }
function removeLine(btn) function removeLine(btn)
{ {
var file=btn.name.split('?')[0]; var file = btn.name.split('?')[0];
var row=parseInt(btn.name.split('?')[1]); var row = parseInt(btn.name.split('?')[1]);
var res=phpFile.remove_line(file,row); var res = phpFile.remove_line(file, row);
document.getElementById('divPerms['+file+']').innerHTML=res; document.getElementById('divPerms[' + file + ']').innerHTML = res;
} }
function setDirPermission(file,inp) function setDirPermission(file, inp)
{ {
var res=phpFile.set_path_permission(file,inp.value); var res = phpFile.set_path_permission(file, inp.value);
inp.selectedIndex=0; inp.selectedIndex = 0;
} }
function setDirHeader(file,inp) function setDirHeader(file, inp)
{ {
var res=phpFile.set_path_header(file,headerText.value); var res = phpFile.set_path_header(file, headerText.value);
inp.selectedIndex=0; inp.selectedIndex = 0;
} }
function removeDirPermission(file,inp) function removeDirPermission(file, inp)
{ {
var res=phpFile.remove_path_permission(file,headerText.value); var res = phpFile.remove_path_permission(file, headerText.value);
inp.selectedIndex=0; inp.selectedIndex = 0;
} }
function setPermission(file,inp) function setPermission(file, inp)
{ {
var res=phpFile.set_permission(file,inp.value); var res = phpFile.set_permission(file, inp.value);
document.getElementById('divPerms['+file+']').innerHTML=res; document.getElementById('divPerms[' + file + ']').innerHTML = res;
inp.selectedIndex=0; inp.selectedIndex = 0;
} }
function removePermission(file,inp) function removePermission(file, inp)
{ {
var res=phpFile.remove_permission(file,inp.value); var res = phpFile.remove_permission(file, inp.value);
document.getElementById('divPerms['+file+']').innerHTML=res; document.getElementById('divPerms[' + file + ']').innerHTML = res;
inp.selectedIndex=0; inp.selectedIndex = 0;
} }
</script> </script>