diff --git a/gulliver/thirdparty/html2ps_pdf/media.layout.inc.php b/gulliver/thirdparty/html2ps_pdf/media.layout.inc.php index f4c9c64c2..cc6b6d784 100755 --- a/gulliver/thirdparty/html2ps_pdf/media.layout.inc.php +++ b/gulliver/thirdparty/html2ps_pdf/media.layout.inc.php @@ -15,6 +15,7 @@ class Media { var $size; var $pixels; var $is_landscape; + var $security; function width() { return $this->is_landscape ? $this->size['height'] : $this->size['width'] ; @@ -32,6 +33,20 @@ class Media { return $this->height() - $this->margins['bottom'] - $this->margins['top']; } + function getSecurityOpenPassword(){ + return $this->security['openPassword']; + } + function getSecurityOwnerPassword(){ + return $this->security['ownerPassword']; + } + function getSecurityPermissions(){ + $permissions=explode("|",$this->security['permissions']); + foreach($permissions as $key => $permName){ + if($permName=="") unset($permissions[$key]); + } + return $this->security['permissions']; + } + function set_landscape($state) { $this->is_landscape = (bool)$state; } @@ -44,6 +59,10 @@ class Media { function set_pixels($pixels) { $this->pixels = $pixels; } + + function set_security($security) { + $this->security = $security; + } // TODO: validity checking function &predefined($name) { diff --git a/gulliver/thirdparty/html2ps_pdf/output.fpdf.class.php b/gulliver/thirdparty/html2ps_pdf/output.fpdf.class.php index 72324dd41..5e8f7cd03 100755 --- a/gulliver/thirdparty/html2ps_pdf/output.fpdf.class.php +++ b/gulliver/thirdparty/html2ps_pdf/output.fpdf.class.php @@ -3,6 +3,7 @@ require_once(HTML2PS_DIR.'pdf.fpdf.php'); require_once(HTML2PS_DIR.'pdf.fpdf.makefont.php'); +require_once(HTML2PS_DIR.'pdf.fpdf.encryption.php'); // require_once(HTML2PS_DIR.'fpdf/font/makefont/makefont.php'); class OutputDriverFPDF extends OutputDriverGenericPDF { @@ -333,8 +334,13 @@ class OutputDriverFPDF extends OutputDriverGenericPDF { function reset(&$media) { parent::reset($media); - - $this->pdf =& new FPDF("P","pt",array(mm2pt($media->width()), mm2pt($media->height()))); + if (is_array($media->security)){ + $this->pdf =& new FPDF_Protection('P','pt',array(mm2pt($media->width()), mm2pt($media->height()))); + //Set Protection + $this->pdf->SetProtection($media->getSecurityPermissions(),$media->getSecurityOpenPassword(),$media->getSecurityOwnerPassword()); + }else{ + $this->pdf =& new FPDF('P','pt',array(mm2pt($media->width()), mm2pt($media->height()))); + } if (defined('DEBUG_MODE')) { $this->pdf->SetCompression(false); diff --git a/gulliver/thirdparty/html2ps_pdf/output.pcl.class.php b/gulliver/thirdparty/html2ps_pdf/output.pcl.class.php index c703037c8..37b7f8392 100755 --- a/gulliver/thirdparty/html2ps_pdf/output.pcl.class.php +++ b/gulliver/thirdparty/html2ps_pdf/output.pcl.class.php @@ -227,7 +227,7 @@ class PCLPrintJobPreamble { } class PCLPrintJobPage { - var $_control + var $_control; var $_data; function output(&$stream) { diff --git a/gulliver/thirdparty/html2ps_pdf/pdf.fpdf.encryption.php b/gulliver/thirdparty/html2ps_pdf/pdf.fpdf.encryption.php new file mode 100644 index 000000000..033c1abab --- /dev/null +++ b/gulliver/thirdparty/html2ps_pdf/pdf.fpdf.encryption.php @@ -0,0 +1,222 @@ +encrypted=false; + $this->last_rc4_key=''; + $this->padding="\x28\xBF\x4E\x5E\x4E\x75\x8A\x41\x64\x00\x4E\x56\xFF\xFA\x01\x08". + "\x2E\x2E\x00\xB6\xD0\x68\x3E\x80\x2F\x0C\xA9\xFE\x64\x53\x69\x7A"; + } + + /** + * Function to set permissions as well as user and owner passwords + * + * - permissions is an array with values taken from the following list: + * copy, print, modify, annot-forms + * If a value is present it means that the permission is granted + * - If a user password is set, user will be prompted before document is opened + * - If an owner password is set, document can be opened in privilege mode with no + * restriction if that password is entered + */ + function SetProtection($permissions=array(), $user_pass='', $owner_pass=null) + { + $options = array('print' => 4, 'modify' => 8, 'copy' => 16, 'annot-forms' => 32 ); + $protection = 192; + foreach($permissions as $permission){ + if (!isset($options[$permission])) + $this->Error('Incorrect permission: '.$permission); + $protection += $options[$permission]; + } + if ($owner_pass === null) + $owner_pass = uniqid(rand()); + $this->encrypted = true; + $this->_generateencryptionkey($user_pass, $owner_pass, $protection); + } + +/**************************************************************************** +* * +* Private methods * +* * +****************************************************************************/ + + function _putstream($s) + { + if ($this->encrypted) { + $s = $this->_RC4($this->_objectkey($this->n), $s); + } + parent::_putstream($s); + } + + function _textstring($s) + { + if ($this->encrypted) { + $s = $this->_RC4($this->_objectkey($this->n), $s); + } + return parent::_textstring($s); + } + + /** + * Compute key depending on object number where the encrypted data is stored + */ + function _objectkey($n) + { + return substr($this->_md5_16($this->encryption_key.pack('VXxx', $n)), 0, 10); + } + + /** + * Escape special characters + */ + function _escape($s) + { + $s=str_replace('\\', '\\\\', $s); + $s=str_replace(')', '\\)', $s); + $s=str_replace('(', '\\(', $s); + $s=str_replace("\r", '\\r', $s); + return $s; + } + + function _putresources() + { + parent::_putresources(); + if ($this->encrypted) { + $this->_newobj(); + $this->enc_obj_id = $this->n; + $this->_out('<<'); + $this->_putencryption(); + $this->_out('>>'); + $this->_out('endobj'); + } + } + + function _putencryption() + { + $this->_out('/Filter /Standard'); + $this->_out('/V 1'); + $this->_out('/R 2'); + $this->_out('/O ('.$this->_escape($this->Ovalue).')'); + $this->_out('/U ('.$this->_escape($this->Uvalue).')'); + $this->_out('/P '.$this->Pvalue); + } + + function _puttrailer() + { + parent::_puttrailer(); + if ($this->encrypted) { + $this->_out('/Encrypt '.$this->enc_obj_id.' 0 R'); + $this->_out('/ID [()()]'); + } + } + + /** + * RC4 is the standard encryption algorithm used in PDF format + */ + function _RC4($key, $text) + { + if ($this->last_rc4_key != $key) { + $k = str_repeat($key, 256/strlen($key)+1); + $rc4 = range(0, 255); + $j = 0; + for ($i=0; $i<256; $i++){ + $t = $rc4[$i]; + $j = ($j + $t + ord($k{$i})) % 256; + $rc4[$i] = $rc4[$j]; + $rc4[$j] = $t; + } + $this->last_rc4_key = $key; + $this->last_rc4_key_c = $rc4; + } else { + $rc4 = $this->last_rc4_key_c; + } + + $len = strlen($text); + $a = 0; + $b = 0; + $out = ''; + for ($i=0; $i<$len; $i++){ + $a = ($a+1)%256; + $t= $rc4[$a]; + $b = ($b+$t)%256; + $rc4[$a] = $rc4[$b]; + $rc4[$b] = $t; + $k = $rc4[($rc4[$a]+$rc4[$b])%256]; + $out.=chr(ord($text{$i}) ^ $k); + } + + return $out; + } + + /** + * Get MD5 as binary string + */ + function _md5_16($string) + { + return pack('H*', md5($string)); + } + + /** + * Compute O value + */ + function _Ovalue($user_pass, $owner_pass) + { + $tmp = $this->_md5_16($owner_pass); + $owner_RC4_key = substr($tmp, 0, 5); + return $this->_RC4($owner_RC4_key, $user_pass); + } + + /** + * Compute U value + */ + function _Uvalue() + { + return $this->_RC4($this->encryption_key, $this->padding); + } + + /** + * Compute encryption key + */ + function _generateencryptionkey($user_pass, $owner_pass, $protection) + { + // Pad passwords + $user_pass = substr($user_pass.$this->padding, 0, 32); + $owner_pass = substr($owner_pass.$this->padding, 0, 32); + // Compute O value + $this->Ovalue = $this->_Ovalue($user_pass, $owner_pass); + // Compute encyption key + $tmp = $this->_md5_16($user_pass.$this->Ovalue.chr($protection)."\xFF\xFF\xFF"); + $this->encryption_key = substr($tmp, 0, 5); + // Compute U value + $this->Uvalue = $this->_Uvalue(); + // Compute P value + $this->Pvalue = -(($protection^255)+1); + } +} + +?> \ No newline at end of file diff --git a/workflow/engine/classes/model/OutputDocument.php b/workflow/engine/classes/model/OutputDocument.php index 8dc6a9648..cb7d82fd7 100644 --- a/workflow/engine/classes/model/OutputDocument.php +++ b/workflow/engine/classes/model/OutputDocument.php @@ -618,6 +618,20 @@ class OutputDocument extends BaseOutputDocument { $g_media->set_landscape($GLOBALS['g_config']['landscape']); $g_media->set_margins($GLOBALS['g_config']['margins']); $g_media->set_pixels($GLOBALS['g_config']['pagewidth']); + + + if(isset($GLOBALS['g_config']['pdfSecurity'])){ + if (isset($GLOBALS['g_config']['pdfSecurity']['openPassword']) && $GLOBALS['g_config']['pdfSecurity']['openPassword'] != "") { + $GLOBALS['g_config']['pdfSecurity']['openPassword'] = G::decrypt($GLOBALS['g_config']['pdfSecurity']['openPassword'], $sUID); + } + if (isset($GLOBALS['g_config']['pdfSecurity']['ownerPassword']) && $GLOBALS['g_config']['pdfSecurity']['ownerPassword'] != "") { + $GLOBALS['g_config']['pdfSecurity']['ownerPassword'] = G::decrypt($GLOBALS['g_config']['pdfSecurity']['ownerPassword'], $sUID); + } + $g_media->set_security($GLOBALS['g_config']['pdfSecurity']); + + require_once(HTML2PS_DIR . 'pdf.fpdf.encryption.php'); + } + $pipeline = new Pipeline(); if (extension_loaded('curl')) { diff --git a/workflow/engine/classes/model/map/OutputDocumentMapBuilder.php b/workflow/engine/classes/model/map/OutputDocumentMapBuilder.php index 06ddd22df..36cd98402 100644 --- a/workflow/engine/classes/model/map/OutputDocumentMapBuilder.php +++ b/workflow/engine/classes/model/map/OutputDocumentMapBuilder.php @@ -94,6 +94,14 @@ class OutputDocumentMapBuilder { $tMap->addColumn('OUT_DOC_TAGS', 'OutDocTags', 'string', CreoleTypes::LONGVARCHAR, false, null); + $tMap->addColumn('OUT_DOC_PDF_SECURITY_ENABLED', 'OutDocPdfSecurityEnabled', 'int', CreoleTypes::TINYINT, false, null); + + $tMap->addColumn('OUT_DOC_PDF_SECURITY_OPEN_PASSWORD', 'OutDocPdfSecurityOpenPassword', 'string', CreoleTypes::VARCHAR, false, 32); + + $tMap->addColumn('OUT_DOC_PDF_SECURITY_OWNER_PASSWORD', 'OutDocPdfSecurityOwnerPassword', 'string', CreoleTypes::VARCHAR, false, 32); + + $tMap->addColumn('OUT_DOC_PDF_SECURITY_PERMISSIONS', 'OutDocPdfSecurityPermissions', 'string', CreoleTypes::VARCHAR, false, 150); + $tMap->addValidator('OUT_DOC_UID', 'maxLength', 'propel.validator.MaxLengthValidator', '32', 'Output Document UID can be no larger than 32 in size'); $tMap->addValidator('OUT_DOC_UID', 'required', 'propel.validator.RequiredValidator', '', 'Output Document UID is required.'); diff --git a/workflow/engine/classes/model/om/BaseAppNotes.php b/workflow/engine/classes/model/om/BaseAppNotes.php index 21fdfdd5a..97c18c058 100644 --- a/workflow/engine/classes/model/om/BaseAppNotes.php +++ b/workflow/engine/classes/model/om/BaseAppNotes.php @@ -541,7 +541,7 @@ abstract class BaseAppNotes extends BaseObject implements Persistent { throw $e; } } - + /** * Stores the object in the database. If the object is new, * it inserts it; otherwise an update is performed. This method @@ -572,44 +572,7 @@ abstract class BaseAppNotes extends BaseObject implements Persistent { throw $e; } } - - /** - * @todo This function must be moved to Propel Generator in the correct syntax. - */ - - - public function createFromArray($aData, $con = null, $sw=true) - { - if ($con === null) { - $con = Propel::getConnection(AppNotesPeer::DATABASE_NAME); - } - if ($sw) $con->begin(); - try { - $this->fromArray ( $aData, BasePeer::TYPE_FIELDNAME ); - if ($this->validate ()) { - $result = $this->save ($con, $sw); - } else { - if ($sw) $con->rollback (); - $e = new Exception ( "Failed Validation in class " . get_class ( $this ) . "." ); - $e->aValidationFailures = $this->getValidationFailures (); - throw ($e); - } - if ($sw) $con->commit (); - return $result; - } catch ( Exception $e ) { - if ($sw) $con->rollback (); - throw ($e); - } - } - - /** - * @todo This function must be moved to Propel Generator in the correct syntax. - */ - public function updateFromArray($aData, $con = null, $sw = true) - { - return 0; - } - + /** * Stores the object in the database. * diff --git a/workflow/engine/classes/model/om/BaseOutputDocument.php b/workflow/engine/classes/model/om/BaseOutputDocument.php index 75e8796ff..3d48c3b10 100644 --- a/workflow/engine/classes/model/om/BaseOutputDocument.php +++ b/workflow/engine/classes/model/om/BaseOutputDocument.php @@ -132,6 +132,34 @@ abstract class BaseOutputDocument extends BaseObject implements Persistent { */ protected $out_doc_tags; + + /** + * The value for the out_doc_pdf_security_enabled field. + * @var int + */ + protected $out_doc_pdf_security_enabled = 0; + + + /** + * The value for the out_doc_pdf_security_open_password field. + * @var string + */ + protected $out_doc_pdf_security_open_password = ''; + + + /** + * The value for the out_doc_pdf_security_owner_password field. + * @var string + */ + protected $out_doc_pdf_security_owner_password = ''; + + + /** + * The value for the out_doc_pdf_security_permissions field. + * @var string + */ + protected $out_doc_pdf_security_permissions = ''; + /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -311,6 +339,50 @@ abstract class BaseOutputDocument extends BaseObject implements Persistent { return $this->out_doc_tags; } + /** + * Get the [out_doc_pdf_security_enabled] column value. + * + * @return int + */ + public function getOutDocPdfSecurityEnabled() + { + + return $this->out_doc_pdf_security_enabled; + } + + /** + * Get the [out_doc_pdf_security_open_password] column value. + * + * @return string + */ + public function getOutDocPdfSecurityOpenPassword() + { + + return $this->out_doc_pdf_security_open_password; + } + + /** + * Get the [out_doc_pdf_security_owner_password] column value. + * + * @return string + */ + public function getOutDocPdfSecurityOwnerPassword() + { + + return $this->out_doc_pdf_security_owner_password; + } + + /** + * Get the [out_doc_pdf_security_permissions] column value. + * + * @return string + */ + public function getOutDocPdfSecurityPermissions() + { + + return $this->out_doc_pdf_security_permissions; + } + /** * Set the value of [out_doc_uid] column. * @@ -641,6 +713,94 @@ abstract class BaseOutputDocument extends BaseObject implements Persistent { } // setOutDocTags() + /** + * Set the value of [out_doc_pdf_security_enabled] column. + * + * @param int $v new value + * @return void + */ + public function setOutDocPdfSecurityEnabled($v) + { + + // Since the native PHP type for this column is integer, + // we will cast the input value to an int (if it is not). + if ($v !== null && !is_int($v) && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->out_doc_pdf_security_enabled !== $v || $v === 0) { + $this->out_doc_pdf_security_enabled = $v; + $this->modifiedColumns[] = OutputDocumentPeer::OUT_DOC_PDF_SECURITY_ENABLED; + } + + } // setOutDocPdfSecurityEnabled() + + /** + * Set the value of [out_doc_pdf_security_open_password] column. + * + * @param string $v new value + * @return void + */ + public function setOutDocPdfSecurityOpenPassword($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->out_doc_pdf_security_open_password !== $v || $v === '') { + $this->out_doc_pdf_security_open_password = $v; + $this->modifiedColumns[] = OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OPEN_PASSWORD; + } + + } // setOutDocPdfSecurityOpenPassword() + + /** + * Set the value of [out_doc_pdf_security_owner_password] column. + * + * @param string $v new value + * @return void + */ + public function setOutDocPdfSecurityOwnerPassword($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->out_doc_pdf_security_owner_password !== $v || $v === '') { + $this->out_doc_pdf_security_owner_password = $v; + $this->modifiedColumns[] = OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OWNER_PASSWORD; + } + + } // setOutDocPdfSecurityOwnerPassword() + + /** + * Set the value of [out_doc_pdf_security_permissions] column. + * + * @param string $v new value + * @return void + */ + public function setOutDocPdfSecurityPermissions($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->out_doc_pdf_security_permissions !== $v || $v === '') { + $this->out_doc_pdf_security_permissions = $v; + $this->modifiedColumns[] = OutputDocumentPeer::OUT_DOC_PDF_SECURITY_PERMISSIONS; + } + + } // setOutDocPdfSecurityPermissions() + /** * Hydrates (populates) the object variables with values from the database resultset. * @@ -688,12 +848,20 @@ abstract class BaseOutputDocument extends BaseObject implements Persistent { $this->out_doc_tags = $rs->getString($startcol + 14); + $this->out_doc_pdf_security_enabled = $rs->getInt($startcol + 15); + + $this->out_doc_pdf_security_open_password = $rs->getString($startcol + 16); + + $this->out_doc_pdf_security_owner_password = $rs->getString($startcol + 17); + + $this->out_doc_pdf_security_permissions = $rs->getString($startcol + 18); + $this->resetModified(); $this->setNew(false); // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 15; // 15 = OutputDocumentPeer::NUM_COLUMNS - OutputDocumentPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 19; // 19 = OutputDocumentPeer::NUM_COLUMNS - OutputDocumentPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating OutputDocument object", $e); @@ -941,6 +1109,18 @@ abstract class BaseOutputDocument extends BaseObject implements Persistent { case 14: return $this->getOutDocTags(); break; + case 15: + return $this->getOutDocPdfSecurityEnabled(); + break; + case 16: + return $this->getOutDocPdfSecurityOpenPassword(); + break; + case 17: + return $this->getOutDocPdfSecurityOwnerPassword(); + break; + case 18: + return $this->getOutDocPdfSecurityPermissions(); + break; default: return null; break; @@ -976,6 +1156,10 @@ abstract class BaseOutputDocument extends BaseObject implements Persistent { $keys[12] => $this->getOutDocVersioning(), $keys[13] => $this->getOutDocDestinationPath(), $keys[14] => $this->getOutDocTags(), + $keys[15] => $this->getOutDocPdfSecurityEnabled(), + $keys[16] => $this->getOutDocPdfSecurityOpenPassword(), + $keys[17] => $this->getOutDocPdfSecurityOwnerPassword(), + $keys[18] => $this->getOutDocPdfSecurityPermissions(), ); return $result; } @@ -1052,6 +1236,18 @@ abstract class BaseOutputDocument extends BaseObject implements Persistent { case 14: $this->setOutDocTags($value); break; + case 15: + $this->setOutDocPdfSecurityEnabled($value); + break; + case 16: + $this->setOutDocPdfSecurityOpenPassword($value); + break; + case 17: + $this->setOutDocPdfSecurityOwnerPassword($value); + break; + case 18: + $this->setOutDocPdfSecurityPermissions($value); + break; } // switch() } @@ -1090,6 +1286,10 @@ abstract class BaseOutputDocument extends BaseObject implements Persistent { if (array_key_exists($keys[12], $arr)) $this->setOutDocVersioning($arr[$keys[12]]); if (array_key_exists($keys[13], $arr)) $this->setOutDocDestinationPath($arr[$keys[13]]); if (array_key_exists($keys[14], $arr)) $this->setOutDocTags($arr[$keys[14]]); + if (array_key_exists($keys[15], $arr)) $this->setOutDocPdfSecurityEnabled($arr[$keys[15]]); + if (array_key_exists($keys[16], $arr)) $this->setOutDocPdfSecurityOpenPassword($arr[$keys[16]]); + if (array_key_exists($keys[17], $arr)) $this->setOutDocPdfSecurityOwnerPassword($arr[$keys[17]]); + if (array_key_exists($keys[18], $arr)) $this->setOutDocPdfSecurityPermissions($arr[$keys[18]]); } /** @@ -1116,6 +1316,10 @@ abstract class BaseOutputDocument extends BaseObject implements Persistent { if ($this->isColumnModified(OutputDocumentPeer::OUT_DOC_VERSIONING)) $criteria->add(OutputDocumentPeer::OUT_DOC_VERSIONING, $this->out_doc_versioning); if ($this->isColumnModified(OutputDocumentPeer::OUT_DOC_DESTINATION_PATH)) $criteria->add(OutputDocumentPeer::OUT_DOC_DESTINATION_PATH, $this->out_doc_destination_path); if ($this->isColumnModified(OutputDocumentPeer::OUT_DOC_TAGS)) $criteria->add(OutputDocumentPeer::OUT_DOC_TAGS, $this->out_doc_tags); + if ($this->isColumnModified(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_ENABLED)) $criteria->add(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_ENABLED, $this->out_doc_pdf_security_enabled); + if ($this->isColumnModified(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OPEN_PASSWORD)) $criteria->add(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OPEN_PASSWORD, $this->out_doc_pdf_security_open_password); + if ($this->isColumnModified(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OWNER_PASSWORD)) $criteria->add(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OWNER_PASSWORD, $this->out_doc_pdf_security_owner_password); + if ($this->isColumnModified(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_PERMISSIONS)) $criteria->add(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_PERMISSIONS, $this->out_doc_pdf_security_permissions); return $criteria; } @@ -1198,6 +1402,14 @@ abstract class BaseOutputDocument extends BaseObject implements Persistent { $copyObj->setOutDocTags($this->out_doc_tags); + $copyObj->setOutDocPdfSecurityEnabled($this->out_doc_pdf_security_enabled); + + $copyObj->setOutDocPdfSecurityOpenPassword($this->out_doc_pdf_security_open_password); + + $copyObj->setOutDocPdfSecurityOwnerPassword($this->out_doc_pdf_security_owner_password); + + $copyObj->setOutDocPdfSecurityPermissions($this->out_doc_pdf_security_permissions); + $copyObj->setNew(true); diff --git a/workflow/engine/classes/model/om/BaseOutputDocumentPeer.php b/workflow/engine/classes/model/om/BaseOutputDocumentPeer.php index feb23c113..deeba3c93 100644 --- a/workflow/engine/classes/model/om/BaseOutputDocumentPeer.php +++ b/workflow/engine/classes/model/om/BaseOutputDocumentPeer.php @@ -24,7 +24,7 @@ abstract class BaseOutputDocumentPeer { const CLASS_DEFAULT = 'classes.model.OutputDocument'; /** The total number of columns. */ - const NUM_COLUMNS = 15; + const NUM_COLUMNS = 19; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -75,6 +75,18 @@ abstract class BaseOutputDocumentPeer { /** the column name for the OUT_DOC_TAGS field */ const OUT_DOC_TAGS = 'OUTPUT_DOCUMENT.OUT_DOC_TAGS'; + /** the column name for the OUT_DOC_PDF_SECURITY_ENABLED field */ + const OUT_DOC_PDF_SECURITY_ENABLED = 'OUTPUT_DOCUMENT.OUT_DOC_PDF_SECURITY_ENABLED'; + + /** the column name for the OUT_DOC_PDF_SECURITY_OPEN_PASSWORD field */ + const OUT_DOC_PDF_SECURITY_OPEN_PASSWORD = 'OUTPUT_DOCUMENT.OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'; + + /** the column name for the OUT_DOC_PDF_SECURITY_OWNER_PASSWORD field */ + const OUT_DOC_PDF_SECURITY_OWNER_PASSWORD = 'OUTPUT_DOCUMENT.OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'; + + /** the column name for the OUT_DOC_PDF_SECURITY_PERMISSIONS field */ + const OUT_DOC_PDF_SECURITY_PERMISSIONS = 'OUTPUT_DOCUMENT.OUT_DOC_PDF_SECURITY_PERMISSIONS'; + /** The PHP to DB Name Mapping */ private static $phpNameMap = null; @@ -86,10 +98,10 @@ abstract class BaseOutputDocumentPeer { * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('OutDocUid', 'ProUid', 'OutDocLandscape', 'OutDocMedia', 'OutDocLeftMargin', 'OutDocRightMargin', 'OutDocTopMargin', 'OutDocBottomMargin', 'OutDocGenerate', 'OutDocType', 'OutDocCurrentRevision', 'OutDocFieldMapping', 'OutDocVersioning', 'OutDocDestinationPath', 'OutDocTags', ), - BasePeer::TYPE_COLNAME => array (OutputDocumentPeer::OUT_DOC_UID, OutputDocumentPeer::PRO_UID, OutputDocumentPeer::OUT_DOC_LANDSCAPE, OutputDocumentPeer::OUT_DOC_MEDIA, OutputDocumentPeer::OUT_DOC_LEFT_MARGIN, OutputDocumentPeer::OUT_DOC_RIGHT_MARGIN, OutputDocumentPeer::OUT_DOC_TOP_MARGIN, OutputDocumentPeer::OUT_DOC_BOTTOM_MARGIN, OutputDocumentPeer::OUT_DOC_GENERATE, OutputDocumentPeer::OUT_DOC_TYPE, OutputDocumentPeer::OUT_DOC_CURRENT_REVISION, OutputDocumentPeer::OUT_DOC_FIELD_MAPPING, OutputDocumentPeer::OUT_DOC_VERSIONING, OutputDocumentPeer::OUT_DOC_DESTINATION_PATH, OutputDocumentPeer::OUT_DOC_TAGS, ), - BasePeer::TYPE_FIELDNAME => array ('OUT_DOC_UID', 'PRO_UID', 'OUT_DOC_LANDSCAPE', 'OUT_DOC_MEDIA', 'OUT_DOC_LEFT_MARGIN', 'OUT_DOC_RIGHT_MARGIN', 'OUT_DOC_TOP_MARGIN', 'OUT_DOC_BOTTOM_MARGIN', 'OUT_DOC_GENERATE', 'OUT_DOC_TYPE', 'OUT_DOC_CURRENT_REVISION', 'OUT_DOC_FIELD_MAPPING', 'OUT_DOC_VERSIONING', 'OUT_DOC_DESTINATION_PATH', 'OUT_DOC_TAGS', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) + BasePeer::TYPE_PHPNAME => array ('OutDocUid', 'ProUid', 'OutDocLandscape', 'OutDocMedia', 'OutDocLeftMargin', 'OutDocRightMargin', 'OutDocTopMargin', 'OutDocBottomMargin', 'OutDocGenerate', 'OutDocType', 'OutDocCurrentRevision', 'OutDocFieldMapping', 'OutDocVersioning', 'OutDocDestinationPath', 'OutDocTags', 'OutDocPdfSecurityEnabled', 'OutDocPdfSecurityOpenPassword', 'OutDocPdfSecurityOwnerPassword', 'OutDocPdfSecurityPermissions', ), + BasePeer::TYPE_COLNAME => array (OutputDocumentPeer::OUT_DOC_UID, OutputDocumentPeer::PRO_UID, OutputDocumentPeer::OUT_DOC_LANDSCAPE, OutputDocumentPeer::OUT_DOC_MEDIA, OutputDocumentPeer::OUT_DOC_LEFT_MARGIN, OutputDocumentPeer::OUT_DOC_RIGHT_MARGIN, OutputDocumentPeer::OUT_DOC_TOP_MARGIN, OutputDocumentPeer::OUT_DOC_BOTTOM_MARGIN, OutputDocumentPeer::OUT_DOC_GENERATE, OutputDocumentPeer::OUT_DOC_TYPE, OutputDocumentPeer::OUT_DOC_CURRENT_REVISION, OutputDocumentPeer::OUT_DOC_FIELD_MAPPING, OutputDocumentPeer::OUT_DOC_VERSIONING, OutputDocumentPeer::OUT_DOC_DESTINATION_PATH, OutputDocumentPeer::OUT_DOC_TAGS, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_ENABLED, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OPEN_PASSWORD, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OWNER_PASSWORD, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_PERMISSIONS, ), + BasePeer::TYPE_FIELDNAME => array ('OUT_DOC_UID', 'PRO_UID', 'OUT_DOC_LANDSCAPE', 'OUT_DOC_MEDIA', 'OUT_DOC_LEFT_MARGIN', 'OUT_DOC_RIGHT_MARGIN', 'OUT_DOC_TOP_MARGIN', 'OUT_DOC_BOTTOM_MARGIN', 'OUT_DOC_GENERATE', 'OUT_DOC_TYPE', 'OUT_DOC_CURRENT_REVISION', 'OUT_DOC_FIELD_MAPPING', 'OUT_DOC_VERSIONING', 'OUT_DOC_DESTINATION_PATH', 'OUT_DOC_TAGS', 'OUT_DOC_PDF_SECURITY_ENABLED', 'OUT_DOC_PDF_SECURITY_OPEN_PASSWORD', 'OUT_DOC_PDF_SECURITY_OWNER_PASSWORD', 'OUT_DOC_PDF_SECURITY_PERMISSIONS', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, ) ); /** @@ -99,10 +111,10 @@ abstract class BaseOutputDocumentPeer { * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('OutDocUid' => 0, 'ProUid' => 1, 'OutDocLandscape' => 2, 'OutDocMedia' => 3, 'OutDocLeftMargin' => 4, 'OutDocRightMargin' => 5, 'OutDocTopMargin' => 6, 'OutDocBottomMargin' => 7, 'OutDocGenerate' => 8, 'OutDocType' => 9, 'OutDocCurrentRevision' => 10, 'OutDocFieldMapping' => 11, 'OutDocVersioning' => 12, 'OutDocDestinationPath' => 13, 'OutDocTags' => 14, ), - BasePeer::TYPE_COLNAME => array (OutputDocumentPeer::OUT_DOC_UID => 0, OutputDocumentPeer::PRO_UID => 1, OutputDocumentPeer::OUT_DOC_LANDSCAPE => 2, OutputDocumentPeer::OUT_DOC_MEDIA => 3, OutputDocumentPeer::OUT_DOC_LEFT_MARGIN => 4, OutputDocumentPeer::OUT_DOC_RIGHT_MARGIN => 5, OutputDocumentPeer::OUT_DOC_TOP_MARGIN => 6, OutputDocumentPeer::OUT_DOC_BOTTOM_MARGIN => 7, OutputDocumentPeer::OUT_DOC_GENERATE => 8, OutputDocumentPeer::OUT_DOC_TYPE => 9, OutputDocumentPeer::OUT_DOC_CURRENT_REVISION => 10, OutputDocumentPeer::OUT_DOC_FIELD_MAPPING => 11, OutputDocumentPeer::OUT_DOC_VERSIONING => 12, OutputDocumentPeer::OUT_DOC_DESTINATION_PATH => 13, OutputDocumentPeer::OUT_DOC_TAGS => 14, ), - BasePeer::TYPE_FIELDNAME => array ('OUT_DOC_UID' => 0, 'PRO_UID' => 1, 'OUT_DOC_LANDSCAPE' => 2, 'OUT_DOC_MEDIA' => 3, 'OUT_DOC_LEFT_MARGIN' => 4, 'OUT_DOC_RIGHT_MARGIN' => 5, 'OUT_DOC_TOP_MARGIN' => 6, 'OUT_DOC_BOTTOM_MARGIN' => 7, 'OUT_DOC_GENERATE' => 8, 'OUT_DOC_TYPE' => 9, 'OUT_DOC_CURRENT_REVISION' => 10, 'OUT_DOC_FIELD_MAPPING' => 11, 'OUT_DOC_VERSIONING' => 12, 'OUT_DOC_DESTINATION_PATH' => 13, 'OUT_DOC_TAGS' => 14, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) + BasePeer::TYPE_PHPNAME => array ('OutDocUid' => 0, 'ProUid' => 1, 'OutDocLandscape' => 2, 'OutDocMedia' => 3, 'OutDocLeftMargin' => 4, 'OutDocRightMargin' => 5, 'OutDocTopMargin' => 6, 'OutDocBottomMargin' => 7, 'OutDocGenerate' => 8, 'OutDocType' => 9, 'OutDocCurrentRevision' => 10, 'OutDocFieldMapping' => 11, 'OutDocVersioning' => 12, 'OutDocDestinationPath' => 13, 'OutDocTags' => 14, 'OutDocPdfSecurityEnabled' => 15, 'OutDocPdfSecurityOpenPassword' => 16, 'OutDocPdfSecurityOwnerPassword' => 17, 'OutDocPdfSecurityPermissions' => 18, ), + BasePeer::TYPE_COLNAME => array (OutputDocumentPeer::OUT_DOC_UID => 0, OutputDocumentPeer::PRO_UID => 1, OutputDocumentPeer::OUT_DOC_LANDSCAPE => 2, OutputDocumentPeer::OUT_DOC_MEDIA => 3, OutputDocumentPeer::OUT_DOC_LEFT_MARGIN => 4, OutputDocumentPeer::OUT_DOC_RIGHT_MARGIN => 5, OutputDocumentPeer::OUT_DOC_TOP_MARGIN => 6, OutputDocumentPeer::OUT_DOC_BOTTOM_MARGIN => 7, OutputDocumentPeer::OUT_DOC_GENERATE => 8, OutputDocumentPeer::OUT_DOC_TYPE => 9, OutputDocumentPeer::OUT_DOC_CURRENT_REVISION => 10, OutputDocumentPeer::OUT_DOC_FIELD_MAPPING => 11, OutputDocumentPeer::OUT_DOC_VERSIONING => 12, OutputDocumentPeer::OUT_DOC_DESTINATION_PATH => 13, OutputDocumentPeer::OUT_DOC_TAGS => 14, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_ENABLED => 15, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OPEN_PASSWORD => 16, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OWNER_PASSWORD => 17, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_PERMISSIONS => 18, ), + BasePeer::TYPE_FIELDNAME => array ('OUT_DOC_UID' => 0, 'PRO_UID' => 1, 'OUT_DOC_LANDSCAPE' => 2, 'OUT_DOC_MEDIA' => 3, 'OUT_DOC_LEFT_MARGIN' => 4, 'OUT_DOC_RIGHT_MARGIN' => 5, 'OUT_DOC_TOP_MARGIN' => 6, 'OUT_DOC_BOTTOM_MARGIN' => 7, 'OUT_DOC_GENERATE' => 8, 'OUT_DOC_TYPE' => 9, 'OUT_DOC_CURRENT_REVISION' => 10, 'OUT_DOC_FIELD_MAPPING' => 11, 'OUT_DOC_VERSIONING' => 12, 'OUT_DOC_DESTINATION_PATH' => 13, 'OUT_DOC_TAGS' => 14, 'OUT_DOC_PDF_SECURITY_ENABLED' => 15, 'OUT_DOC_PDF_SECURITY_OPEN_PASSWORD' => 16, 'OUT_DOC_PDF_SECURITY_OWNER_PASSWORD' => 17, 'OUT_DOC_PDF_SECURITY_PERMISSIONS' => 18, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, ) ); /** @@ -233,6 +245,14 @@ abstract class BaseOutputDocumentPeer { $criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_TAGS); + $criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_ENABLED); + + $criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OPEN_PASSWORD); + + $criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OWNER_PASSWORD); + + $criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_PERMISSIONS); + } const COUNT = 'COUNT(OUTPUT_DOCUMENT.OUT_DOC_UID)'; diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index dcecc522a..e90c82e96 100644 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -724,6 +724,10 @@ + + + + diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index 12b31f77c..63db2a3ba 100644 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -359,6 +359,10 @@ CREATE TABLE `OUTPUT_DOCUMENT` `OUT_DOC_VERSIONING` TINYINT default 0 NOT NULL, `OUT_DOC_DESTINATION_PATH` MEDIUMTEXT, `OUT_DOC_TAGS` MEDIUMTEXT, + `OUT_DOC_PDF_SECURITY_ENABLED` TINYINT default 0, + `OUT_DOC_PDF_SECURITY_OPEN_PASSWORD` VARCHAR(32) default '', + `OUT_DOC_PDF_SECURITY_OWNER_PASSWORD` VARCHAR(32) default '', + `OUT_DOC_PDF_SECURITY_PERMISSIONS` VARCHAR(150) default '', PRIMARY KEY (`OUT_DOC_UID`) )ENGINE=MyISAM DEFAULT CHARSET='utf8'; #----------------------------------------------------------------------------- diff --git a/workflow/engine/methods/cases/cases_Step.php b/workflow/engine/methods/cases/cases_Step.php index fc6ddef6d..9a7b18d8a 100644 --- a/workflow/engine/methods/cases/cases_Step.php +++ b/workflow/engine/methods/cases/cases_Step.php @@ -429,10 +429,13 @@ $aOD['OUT_DOC_BOTTOM_MARGIN'] = '15'; $aProperties['media']=$aOD['OUT_DOC_MEDIA']; - $aProperties['margins']=array('left' => $aOD['OUT_DOC_LEFT_MARGIN'], 'right' => $aOD['OUT_DOC_RIGHT_MARGIN'], 'top' => $aOD['OUT_DOC_TOP_MARGIN'], 'bottom' => $aOD['OUT_DOC_BOTTOM_MARGIN'],); + $aProperties['margins']=array('left' => $aOD['OUT_DOC_LEFT_MARGIN'], 'right' => $aOD['OUT_DOC_RIGHT_MARGIN'], 'top' => $aOD['OUT_DOC_TOP_MARGIN'], 'bottom' => $aOD['OUT_DOC_BOTTOM_MARGIN']); + if($aOD['OUT_DOC_PDF_SECURITY_ENABLED']=='1'){ + $aProperties['pdfSecurity']=array('openPassword'=>$aOD['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'],'ownerPassword'=>$aOD['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'],'permissions'=>$aOD['OUT_DOC_PDF_SECURITY_PERMISSIONS']); + } $oOutputDocument->generate( $_GET['UID'], $Fields['APP_DATA'], $pathOutput, - //$sFilename, $aOD['OUT_DOC_TEMPLATE'], (boolean)$aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'],$aProperties ); - $sFilename, $aOD['OUT_DOC_TEMPLATE'], (boolean)$aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'] ); + $sFilename, $aOD['OUT_DOC_TEMPLATE'], (boolean)$aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'],$aProperties ); + //$sFilename, $aOD['OUT_DOC_TEMPLATE'], (boolean)$aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'] ); break; case 'JRXML' : //creating the xml with the application data; diff --git a/workflow/engine/methods/outputdocs/outputdocs_Properties.php b/workflow/engine/methods/outputdocs/outputdocs_Properties.php index 7bac49142..30b0c833f 100644 --- a/workflow/engine/methods/outputdocs/outputdocs_Properties.php +++ b/workflow/engine/methods/outputdocs/outputdocs_Properties.php @@ -1,4 +1,5 @@ userCanAccess('PM_FACTORY')) { - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; + case -2: + G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); + G::header('location: ../login/login'); + die; + break; + case -1: + G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); + G::header('location: ../login/login'); + die; + break; } - + require_once 'classes/model/OutputDocument.php'; $ooutputDocument = new OutputDocument(); if (isset($_GET['OUT_DOC_UID'])) { $aFields = $ooutputDocument->load($_GET['OUT_DOC_UID']); - } - else { - $aFields = array(); - $aFields['PRO_UID'] = $_GET['PRO_UID']; + } else { + $aFields = array(); + $aFields['PRO_UID'] = $_GET['PRO_UID']; } - $type = isset ( $aFields['OUT_DOC_TYPE']) ? $aFields['OUT_DOC_TYPE'] : 'HTML'; - - $aFields['OUT_DOC_TAGS'] = isset ( $aFields['OUT_DOC_TAGS']) ? $aFields['OUT_DOC_TAGS'] : 'OUTPUT'; + $type = isset($aFields['OUT_DOC_TYPE']) ? $aFields['OUT_DOC_TYPE'] : 'HTML'; + + $aFields['OUT_DOC_TAGS'] = isset($aFields['OUT_DOC_TAGS']) ? $aFields['OUT_DOC_TAGS'] : 'OUTPUT'; $aFields['OUT_DOC_VERSIONING'] = strval($aFields['OUT_DOC_VERSIONING']); $aFields['OUT_DOC_LANDSCAPE'] = strval($aFields['OUT_DOC_LANDSCAPE']); + if(isset($aFields['OUT_DOC_PDF_SECURITY_ENABLED'])){ + $aFields['OUT_DOC_PDF_SECURITY_ENABLED'] = strval($aFields['OUT_DOC_PDF_SECURITY_ENABLED']); + } + + + if (isset($aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD']) && $aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] != "") { + $aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] = G::decrypt($aFields['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'], $_GET['OUT_DOC_UID']); + $aFields['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] = G::decrypt($aFields['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'], $_GET['OUT_DOC_UID']); + } + G::LoadClass('xmlfield_InputPM'); $G_PUBLISH = new Publisher(); - switch ( $type ) { - case 'HTML' : - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields , '../outputdocs/outputdocs_Save'); - break; - case 'JRXML' : - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields , '../outputdocs/outputdocs_Save'); -/* -// $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocsDynaformList', '', $aFields , '../outputdocs/outputdocs_Save'); - require_once 'classes/model/Process.php'; - G::LoadClass( 'processMap'); - $sProcessUID = $aFields['PRO_UID']; - $oProcess = new Process(); - $oProcessMap = new ProcessMap(); - $aFields = $oProcess->load($sProcessUID); - $G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/dynaforms_ShortList', $oProcessMap->getDynaformsCriteria($sProcessUID), $aFields); -*/ - break; - case 'ACROFORM' : - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields , '../outputdocs/outputdocs_Save'); - break; + switch ($type) { + case 'HTML' : + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save'); + break; + case 'JRXML' : + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save'); + /* + // $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocsDynaformList', '', $aFields , '../outputdocs/outputdocs_Save'); + require_once 'classes/model/Process.php'; + G::LoadClass( 'processMap'); + $sProcessUID = $aFields['PRO_UID']; + $oProcess = new Process(); + $oProcessMap = new ProcessMap(); + $aFields = $oProcess->load($sProcessUID); + $G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/dynaforms_ShortList', $oProcessMap->getDynaformsCriteria($sProcessUID), $aFields); + */ + break; + case 'ACROFORM' : + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'outputdocs/outputdocs_Properties', '', $aFields, '../outputdocs/outputdocs_Save'); + break; } G::RenderPage('publish', 'raw'); -} -catch (Exception $oException) { - die($oException->getMessage()); +} catch (Exception $oException) { + die($oException->getMessage()); } diff --git a/workflow/engine/methods/outputdocs/outputdocs_Save.php b/workflow/engine/methods/outputdocs/outputdocs_Save.php index beff06a7d..b984e9f5f 100644 --- a/workflow/engine/methods/outputdocs/outputdocs_Save.php +++ b/workflow/engine/methods/outputdocs/outputdocs_Save.php @@ -1,4 +1,5 @@ userCanAccess('PM_FACTORY')) { - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; + case -2: + G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); + G::header('location: ../login/login'); + die; + break; + case -1: + G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); + G::header('location: ../login/login'); + die; + break; } - if(isset($_POST['function'])) - $sfunction =$_POST['function']; + if (isset($_POST['function'])) + $sfunction = $_POST['function']; else - $sfunction =$_POST['functions']; - + $sfunction = $_POST['functions']; + //if(isset($_POST['function']) && $_POST['function']=='lookForNameOutput'){ - if($sfunction=='lookForNameOutput'){ - - require_once('classes/model/Content.php'); - require_once ( "classes/model/OutputDocument.php" ); - - $snameInput=urldecode($_POST['NAMEOUTPUT']); - $sPRO_UID=urldecode($_POST['proUid']); - + if ($sfunction == 'lookForNameOutput') { + + require_once('classes/model/Content.php'); + require_once ( "classes/model/OutputDocument.php" ); + + $snameInput = urldecode($_POST['NAMEOUTPUT']); + $sPRO_UID = urldecode($_POST['proUid']); + $oCriteria = new Criteria('workflow'); - $oCriteria->addSelectColumn ( OutputDocumentPeer::OUT_DOC_UID ); + $oCriteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_UID); $oCriteria->add(OutputDocumentPeer::PRO_UID, $sPRO_UID); $oDataset = OutputDocumentPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $flag=true; + $flag = true; while ($oDataset->next() && $flag) { $aRow = $oDataset->getRow(); - - $oCriteria1 = new Criteria('workflow'); - $oCriteria1->addSelectColumn('COUNT(*) AS OUTPUTS'); - $oCriteria1->add(ContentPeer::CON_CATEGORY, 'OUT_DOC_TITLE'); - $oCriteria1->add(ContentPeer::CON_ID, $aRow['OUT_DOC_UID']); - $oCriteria1->add(ContentPeer::CON_VALUE, $snameInput); - $oCriteria1->add(ContentPeer::CON_LANG, SYS_LANG); - $oDataset1 = ContentPeer::doSelectRS($oCriteria1); - $oDataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset1->next(); - $aRow1 = $oDataset1->getRow(); - if($aRow1['OUTPUTS'])$flag=false; - } - print $flag; - - } else { + $oCriteria1 = new Criteria('workflow'); + $oCriteria1->addSelectColumn('COUNT(*) AS OUTPUTS'); + $oCriteria1->add(ContentPeer::CON_CATEGORY, 'OUT_DOC_TITLE'); + $oCriteria1->add(ContentPeer::CON_ID, $aRow['OUT_DOC_UID']); + $oCriteria1->add(ContentPeer::CON_VALUE, $snameInput); + $oCriteria1->add(ContentPeer::CON_LANG, SYS_LANG); + $oDataset1 = ContentPeer::doSelectRS($oCriteria1); + $oDataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $oDataset1->next(); + $aRow1 = $oDataset1->getRow(); + + if ($aRow1['OUTPUTS'] + )$flag = false; + } + print $flag; + } else { //default: - + require_once 'classes/model/OutputDocument.php'; - G::LoadClass( 'processMap' ); - + G::LoadClass('processMap'); + $oOutputDocument = new OutputDocument(); - if(isset($_POST['form'])) + + if (isset($_POST['form'])) $aData = $_POST['form']; //For old process map form - else + else $aData = $_POST; //For Extjs (Since we are not using form in ExtJS) + + $oForm = new Form('outputdocs/outputdocs_Properties', PATH_XMLFORM); + $aData = $oForm->validatePost(); + + if(isset($aData['OUT_DOC_PDF_SECURITY_ENABLED'])&&$aData['OUT_DOC_PDF_SECURITY_ENABLED']=="0"){ + $aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD']=""; + $aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD']=""; + $aData['OUT_DOC_PDF_SECURITY_PERMISSIONS']=""; + } + + if(isset($aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'])&&$aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD']!=""){ + $aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD']=G::encrypt($aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'],$aData['OUT_DOC_UID']); + $aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD']=G::encrypt($aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'],$aData['OUT_DOC_UID']); + } + + if ($aData['OUT_DOC_UID'] == '') { - if ((isset($aData['OUT_DOC_TYPE']))&&( $aData['OUT_DOC_TYPE'] == 'JRXML' )) { + + if ((isset($aData['OUT_DOC_TYPE'])) && ( $aData['OUT_DOC_TYPE'] == 'JRXML' )) { $dynaformUid = $aData['DYN_UID']; $outDocUid = $oOutputDocument->create($aData); - G::LoadClass ('javaBridgePM'); + G::LoadClass('javaBridgePM'); $jbpm = new JavaBridgePM (); - print $jbpm->generateJrxmlFromDynaform ( $outDocUid, $dynaformUid, 'classic' ); - - } - else { + print $jbpm->generateJrxmlFromDynaform($outDocUid, $dynaformUid, 'classic'); + } else { $outDocUid = $oOutputDocument->create($aData); } - } - else { + } else { $oOutputDocument->update($aData); } - - if( isset($aData['PRO_UID']) ){ + + if (isset($aData['PRO_UID'])) { //refresh dbarray with the last change in outputDocument $oMap = new processMap(); $oCriteria = $oMap->getOutputDocumentsCriteria($aData['PRO_UID']); } } -} -catch (Exception $oException) { - die($oException->getMessage()); +} catch (Exception $oException) { + die($oException->getMessage()); } diff --git a/workflow/engine/xmlform/outputdocs/outputdocs_Properties.html b/workflow/engine/xmlform/outputdocs/outputdocs_Properties.html index cb0660865..2576961e9 100644 --- a/workflow/engine/xmlform/outputdocs/outputdocs_Properties.html +++ b/workflow/engine/xmlform/outputdocs/outputdocs_Properties.html @@ -1,106 +1,142 @@
-
-
-
- - - + + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
+
+
+
{$form.PRO_UID}
{$form.OUT_DOC_UID}
{$form.TITLE}
* {$OUT_DOC_TITLE}{$form.OUT_DOC_TITLE}
* {$OUT_DOC_FILENAME}{$form.OUT_DOC_FILENAME}
{$OUT_DOC_DESCRIPTION}{$form.OUT_DOC_DESCRIPTION}
{$OUT_DOC_LANDSCAPE}{$form.OUT_DOC_LANDSCAPE}
+ + - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{$form.PRO_UID}
{$form.OUT_DOC_UID}
{$form.TITLE}
* {$OUT_DOC_TITLE}{$form.OUT_DOC_TITLE}
* {$OUT_DOC_FILENAME}{$form.OUT_DOC_FILENAME}
{$OUT_DOC_DESCRIPTION}{$form.OUT_DOC_DESCRIPTION}
{$OUT_DOC_MEDIA}/ {$OUT_DOC_LANDSCAPE}{$form.OUT_DOC_MEDIA} {$form.OUT_DOC_LANDSCAPE}
{$form.OUT_DOC_MEDIA}
{$OUT_DOC_LEFT_MARGIN}{$form.OUT_DOC_LEFT_MARGIN}
{$OUT_DOC_RIGHT_MARGIN}{$form.OUT_DOC_RIGHT_MARGIN}
{$OUT_DOC_TOP_MARGIN}{$form.OUT_DOC_TOP_MARGIN}
{$OUT_DOC_BOTTOM_MARGIN}{$form.OUT_DOC_BOTTOM_MARGIN}
{$OUT_DOC_GENERATE}{$form.OUT_DOC_GENERATE}
{$OUT_DOC_VERSIONING}{$form.OUT_DOC_VERSIONING}
{$OUT_DOC_DESTINATION_PATH}{$form.OUT_DOC_DESTINATION_PATH}
{$OUT_DOC_TAGS}{$form.OUT_DOC_TAGS}

{$form.ACCEPT}   {$form.BTN_CANCEL}
-
- -
* {php}echo (G::LoadTranslation('ID_REQUIRED_FIELD'));{/php}
-
+
{$form.OUT_DOC_MEDIA}
  +
+ Margin + {$OUT_DOC_LEFT_MARGIN} {$form.OUT_DOC_LEFT_MARGIN}    {$OUT_DOC_RIGHT_MARGIN}   {$form.OUT_DOC_RIGHT_MARGIN}
+ {$OUT_DOC_TOP_MARGIN} {$form.OUT_DOC_TOP_MARGIN}    {$OUT_DOC_BOTTOM_MARGIN} {$form.OUT_DOC_BOTTOM_MARGIN}
+
+
{$OUT_DOC_GENERATE}{$form.OUT_DOC_GENERATE}
{$OUT_DOC_PDF_SECURITY_ENABLED}{$form.OUT_DOC_PDF_SECURITY_ENABLED}
  +
+ + + + +
+ {$OUT_DOC_PDF_SECURITY_OPEN_PASSWORD}  {$form.OUT_DOC_PDF_SECURITY_OPEN_PASSWORD} + {$OUT_DOC_PDF_SECURITY_PERMISSIONS}
{$form.OUT_DOC_PDF_SECURITY_PERMISSIONS}
+ {$OUT_DOC_PDF_SECURITY_OWNER_PASSWORD} {$form.OUT_DOC_PDF_SECURITY_OWNER_PASSWORD} + {$form.test} +
+ +
+ +
{$OUT_DOC_VERSIONING}{$form.OUT_DOC_VERSIONING}
{$OUT_DOC_DESTINATION_PATH}{$form.OUT_DOC_DESTINATION_PATH}
{$OUT_DOC_TAGS}{$form.OUT_DOC_TAGS}

{$form.ACCEPT}   {$form.BTN_CANCEL}
+ + + +
+
* {php}echo (G::LoadTranslation('ID_REQUIRED_FIELD'));{/php}
+ +
- - +
\ No newline at end of file diff --git a/workflow/engine/xmlform/outputdocs/outputdocs_Properties.xml b/workflow/engine/xmlform/outputdocs/outputdocs_Properties.xml index 792d69498..43c3ee19f 100644 --- a/workflow/engine/xmlform/outputdocs/outputdocs_Properties.xml +++ b/workflow/engine/xmlform/outputdocs/outputdocs_Properties.xml @@ -59,16 +59,16 @@ - Left Margin + Left - Right Margin + Right - Top Margin + Top - Bottom Margin + Bottom Destination Path @@ -77,6 +77,26 @@ Tags + + PDF Security + + + + Open Password + + + Owner Password + + + Allowed Permissions + + + + + + + + Cancel @@ -172,5 +192,36 @@ function cancel(){ currentPopupWindow.remove(); } +function showPdfSecuritySwitch(){ +if ((getField('OUT_DOC_GENERATE').value == 'PDF')||(getField('OUT_DOC_GENERATE').value == 'BOTH')) { + showRow('OUT_DOC_PDF_SECURITY_ENABLED'); + } + else { + hideRow('OUT_DOC_PDF_SECURITY_ENABLED'); + getField('OUT_DOC_PDF_SECURITY_ENABLED').value=0; + } + togglePDFSecurity(); +} +function togglePDFSecurity(){ +if ((getField('OUT_DOC_PDF_SECURITY_ENABLED').value == '0')) { + hideRow('PDF_SECURITY_SETTINGS'); + } + else { + showRow('PDF_SECURITY_SETTINGS'); + } +} + +leimnud.event.add(getField('OUT_DOC_GENERATE'), 'change', function() { + showPdfSecuritySwitch(); +}); + + + leimnud.event.add(getField('OUT_DOC_PDF_SECURITY_ENABLED'), 'change', function() { + togglePDFSecurity(); +}); + +showPdfSecuritySwitch(); +togglePDFSecurity(); + ]]> \ No newline at end of file