added PDFTable
This commit is contained in:
		
							parent
							
								
									451c1c5e4c
								
							
						
					
					
						commit
						cf9c5c9f70
					
				| 
						 | 
					@ -37,10 +37,10 @@ class ldapPublicKey extends baseModule {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/** session variable for existing keys in self service */
 | 
						/** session variable for existing keys in self service */
 | 
				
			||||||
	const SESS_KEY_LIST = 'ldapPublicKey_keyList';
 | 
						const SESS_KEY_LIST = 'ldapPublicKey_keyList';
 | 
				
			||||||
	
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	* Returns true if this module can manage accounts of the current type, otherwise false.
 | 
						* Returns true if this module can manage accounts of the current type, otherwise false.
 | 
				
			||||||
	* 
 | 
						*
 | 
				
			||||||
	* @return boolean true if module fits
 | 
						* @return boolean true if module fits
 | 
				
			||||||
	*/
 | 
						*/
 | 
				
			||||||
	public function can_manage() {
 | 
						public function can_manage() {
 | 
				
			||||||
| 
						 | 
					@ -51,7 +51,7 @@ class ldapPublicKey extends baseModule {
 | 
				
			||||||
	* Returns meta data that is interpreted by parent class
 | 
						* Returns meta data that is interpreted by parent class
 | 
				
			||||||
	*
 | 
						*
 | 
				
			||||||
	* @return array array with meta data
 | 
						* @return array array with meta data
 | 
				
			||||||
	* 
 | 
						*
 | 
				
			||||||
	* @see baseModule::get_metaData()
 | 
						* @see baseModule::get_metaData()
 | 
				
			||||||
	*/
 | 
						*/
 | 
				
			||||||
	function get_metaData() {
 | 
						function get_metaData() {
 | 
				
			||||||
| 
						 | 
					@ -111,7 +111,7 @@ class ldapPublicKey extends baseModule {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Returns the HTML meta data for the main account page.
 | 
						 * Returns the HTML meta data for the main account page.
 | 
				
			||||||
	 * 
 | 
						 *
 | 
				
			||||||
	 * @return htmlElement HTML meta data
 | 
						 * @return htmlElement HTML meta data
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	function display_html_attributes() {
 | 
						function display_html_attributes() {
 | 
				
			||||||
| 
						 | 
					@ -197,10 +197,13 @@ class ldapPublicKey extends baseModule {
 | 
				
			||||||
	function get_pdfEntries($pdfKeys) {
 | 
						function get_pdfEntries($pdfKeys) {
 | 
				
			||||||
		$return = array();
 | 
							$return = array();
 | 
				
			||||||
		if (sizeof($this->attributes['sshPublicKey']) > 0) {
 | 
							if (sizeof($this->attributes['sshPublicKey']) > 0) {
 | 
				
			||||||
			$return['ldapPublicKey_sshPublicKey'][0] = '<block><key>' . _('SSH public keys') . '</key><tr><td align=\"L\">' . $this->attributes['sshPublicKey'][0] . '</td></tr></block>';
 | 
								$pdfTable = new PDFTable(_('SSH public keys'));
 | 
				
			||||||
			for ($i = 1; $i < sizeof($this->attributes['sshPublicKey']); $i++) {
 | 
								for ($i = 0; $i < sizeof($this->attributes['sshPublicKey']); $i++) {
 | 
				
			||||||
				$return['ldapPublicKey_sshPublicKey'][] = '<block><tr><td align=\"L\">' . $this->attributes['sshPublicKey'][$i] . '</td></tr></block>';
 | 
									$pdfRow = new PDFTableRow();
 | 
				
			||||||
 | 
									$pdfRow->cells[] = new PDFTableCell($this->attributes['sshPublicKey'][$i]);
 | 
				
			||||||
 | 
									$pdfTable->rows[] = $pdfRow;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								$this->addPDFTable($return, 'sshPublicKey', $pdfTable);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return $return;
 | 
							return $return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -249,7 +252,7 @@ class ldapPublicKey extends baseModule {
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Returns the meta HTML code to display the key area.
 | 
						 * Returns the meta HTML code to display the key area.
 | 
				
			||||||
	 * This also includes the file upload.
 | 
						 * This also includes the file upload.
 | 
				
			||||||
	 * 
 | 
						 *
 | 
				
			||||||
	 * @return htmlTable key content
 | 
						 * @return htmlTable key content
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	private function getSelfServiceKeys() {
 | 
						private function getSelfServiceKeys() {
 | 
				
			||||||
| 
						 | 
					@ -289,10 +292,10 @@ class ldapPublicKey extends baseModule {
 | 
				
			||||||
		$content->addElement($uploadButtons, true);
 | 
							$content->addElement($uploadButtons, true);
 | 
				
			||||||
		return $content;
 | 
							return $content;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Returns the Java Script functions to manage the keys.
 | 
						 * Returns the Java Script functions to manage the keys.
 | 
				
			||||||
	 * 
 | 
						 *
 | 
				
			||||||
	 * @return htmlJavaScript JS block
 | 
						 * @return htmlJavaScript JS block
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	private static function getSelfServiceKeysJSBlock() {
 | 
						private static function getSelfServiceKeysJSBlock() {
 | 
				
			||||||
| 
						 | 
					@ -309,7 +312,7 @@ class ldapPublicKey extends baseModule {
 | 
				
			||||||
					. '&' . getSecurityTokenName() . '=' . getSecurityTokenValue()
 | 
										. '&' . getSecurityTokenName() . '=' . getSecurityTokenValue()
 | 
				
			||||||
					. '\', {jsonInput: actionJSON}, function(data) {ldapPublicKeyDeleteKeyHandleReply(data);}, \'json\');
 | 
										. '\', {jsonInput: actionJSON}, function(data) {ldapPublicKeyDeleteKeyHandleReply(data);}, \'json\');
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			
 | 
					
 | 
				
			||||||
			function ldapPublicKeyDeleteKeyHandleReply(data) {
 | 
								function ldapPublicKeyDeleteKeyHandleReply(data) {
 | 
				
			||||||
				if (data.errorsOccured == "false") {
 | 
									if (data.errorsOccured == "false") {
 | 
				
			||||||
					jQuery(\'#sshPublicKeyDiv\').html(data.html);
 | 
										jQuery(\'#sshPublicKeyDiv\').html(data.html);
 | 
				
			||||||
| 
						 | 
					@ -318,7 +321,7 @@ class ldapPublicKey extends baseModule {
 | 
				
			||||||
					alert(data.errormessage);
 | 
										alert(data.errormessage);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			
 | 
					
 | 
				
			||||||
			function ldapPublicKeyAddKey(count) {
 | 
								function ldapPublicKeyAddKey(count) {
 | 
				
			||||||
				var actionJSON = {
 | 
									var actionJSON = {
 | 
				
			||||||
					"action": "addKey"
 | 
										"action": "addKey"
 | 
				
			||||||
| 
						 | 
					@ -330,7 +333,7 @@ class ldapPublicKey extends baseModule {
 | 
				
			||||||
					. '&' . getSecurityTokenName() . '=' . getSecurityTokenValue()
 | 
										. '&' . getSecurityTokenName() . '=' . getSecurityTokenValue()
 | 
				
			||||||
					. '\', {jsonInput: actionJSON}, function(data) {ldapPublicKeyAddKeyHandleReply(data);}, \'json\');
 | 
										. '\', {jsonInput: actionJSON}, function(data) {ldapPublicKeyAddKeyHandleReply(data);}, \'json\');
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			
 | 
					
 | 
				
			||||||
			function ldapPublicKeyAddKeyHandleReply(data) {
 | 
								function ldapPublicKeyAddKeyHandleReply(data) {
 | 
				
			||||||
				if (data.errorsOccured == "false") {
 | 
									if (data.errorsOccured == "false") {
 | 
				
			||||||
					jQuery(\'#sshPublicKeyDiv\').html(data.html);
 | 
										jQuery(\'#sshPublicKeyDiv\').html(data.html);
 | 
				
			||||||
| 
						 | 
					@ -339,7 +342,7 @@ class ldapPublicKey extends baseModule {
 | 
				
			||||||
					alert(data.errormessage);
 | 
										alert(data.errormessage);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			
 | 
					
 | 
				
			||||||
			function ldapPublicKeyUploadKey(elementID, count) {
 | 
								function ldapPublicKeyUploadKey(elementID, count) {
 | 
				
			||||||
				var uploadStatus = document.getElementById(\'ldapPublicKey_upload_status_key\');
 | 
									var uploadStatus = document.getElementById(\'ldapPublicKey_upload_status_key\');
 | 
				
			||||||
				var parameters = {
 | 
									var parameters = {
 | 
				
			||||||
| 
						 | 
					@ -371,9 +374,9 @@ class ldapPublicKey extends baseModule {
 | 
				
			||||||
							}
 | 
												}
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				});		
 | 
									});
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			
 | 
					
 | 
				
			||||||
			';
 | 
								';
 | 
				
			||||||
		return new htmlJavaScript($content);
 | 
							return new htmlJavaScript($content);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -386,7 +389,7 @@ class ldapPublicKey extends baseModule {
 | 
				
			||||||
	 * <br>del: array of attributes to remove
 | 
						 * <br>del: array of attributes to remove
 | 
				
			||||||
	 * <br>mod: array of attributes to modify
 | 
						 * <br>mod: array of attributes to modify
 | 
				
			||||||
	 * <br>info: array of values with informational value (e.g. to be used later by pre/postModify actions)
 | 
						 * <br>info: array of values with informational value (e.g. to be used later by pre/postModify actions)
 | 
				
			||||||
	 * 
 | 
						 *
 | 
				
			||||||
	 * Calling this method does not require the existence of an enclosing {@link accountContainer}.
 | 
						 * Calling this method does not require the existence of an enclosing {@link accountContainer}.
 | 
				
			||||||
	 *
 | 
						 *
 | 
				
			||||||
	 * @param string $fields input fields
 | 
						 * @param string $fields input fields
 | 
				
			||||||
| 
						 | 
					@ -479,7 +482,7 @@ class ldapPublicKey extends baseModule {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		echo json_encode($jsonReturn);
 | 
							echo json_encode($jsonReturn);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Handles an AJAX file upload and prints the JSON result.
 | 
						 * Handles an AJAX file upload and prints the JSON result.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
| 
						 | 
					@ -518,7 +521,7 @@ class ldapPublicKey extends baseModule {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Manages the deletion of a key.
 | 
						 * Manages the deletion of a key.
 | 
				
			||||||
	 * 
 | 
						 *
 | 
				
			||||||
	 * @param array $data JSON data
 | 
						 * @param array $data JSON data
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	private function ajaxDeleteSelfServiceKey($data) {
 | 
						private function ajaxDeleteSelfServiceKey($data) {
 | 
				
			||||||
| 
						 | 
					@ -543,10 +546,10 @@ class ldapPublicKey extends baseModule {
 | 
				
			||||||
			'html' => $content,
 | 
								'html' => $content,
 | 
				
			||||||
		);
 | 
							);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Invalid AJAX request received.
 | 
						 * Invalid AJAX request received.
 | 
				
			||||||
	 * 
 | 
						 *
 | 
				
			||||||
	 * @param String $message error message
 | 
						 * @param String $message error message
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public static function invalidAjaxRequest($message = null) {
 | 
						public static function invalidAjaxRequest($message = null) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue