owner patch

This commit is contained in:
Roland Gruber 2012-01-14 18:34:54 +00:00
parent 0301a9bec8
commit 39861f1b86
1 changed files with 20 additions and 12 deletions

View File

@ -170,6 +170,11 @@ class asteriskExtensionNewUI extends baseModule {
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
//Set default owner as logged in user if flag is set and no other owner is set
if ( $this->isBooleanConfigOptionSet('asteriskExtension_UseCreatorAsOwner') && ! $this->isExtensionOwnerSet()){
$this->setDefaultExtensionOwner();
}
$return = new htmlTable(); $return = new htmlTable();
$extName = ''; $extName = '';
@ -183,9 +188,7 @@ class asteriskExtensionNewUI extends baseModule {
$this->render_extensions_by_priority($extName, $return); $this->render_extensions_by_priority($extName, $return);
// owners // owners
if (!$this->isBooleanConfigOptionSet('asteriskExtension_UseCreatorAsOwner')) {
$this->render_exten_owners_set_controls($return); $this->render_exten_owners_set_controls($return);
}
return $return; return $return;
} }
@ -477,6 +480,16 @@ class asteriskExtensionNewUI extends baseModule {
} }
} }
/**
* Return true if even one owner is set and false otherwise
*/
function isExtensionOwnerSet(){
if(sizeof($this->extensionOwners) > 0){
return true;
}
return false;
}
/** /**
* Write variables into object and do some regex checks * Write variables into object and do some regex checks
* *
@ -531,11 +544,6 @@ class asteriskExtensionNewUI extends baseModule {
$errors = array(); $errors = array();
if (isset($_POST['extension_rows']) && get_preg($_POST['extension_rows'], 'digit')) { if (isset($_POST['extension_rows']) && get_preg($_POST['extension_rows'], 'digit')) {
//handle situation where we mast add current loged user as extension owner
if ($this->isBooleanConfigOptionSet('asteriskExtension_UseCreatorAsOwner')){
$this->setDefaultExtensionOwner();
}
$extensionPriorityCntr = 1; $extensionPriorityCntr = 1;
$this->extensionRows = array(); $this->extensionRows = array();
for ($entryCounter = 0; $entryCounter < $_POST['extension_rows']; $entryCounter++) { for ($entryCounter = 0; $entryCounter < $_POST['extension_rows']; $entryCounter++) {