Skip to content

Commit

Permalink
Merge pull request #112 from infonova/develop
Browse files Browse the repository at this point in the history
Prepare release v4.1.0
  • Loading branch information
mmitteregger-bearingpoint authored Mar 12, 2020
2 parents babbbef + 00b9e83 commit f1e6769
Show file tree
Hide file tree
Showing 15 changed files with 343 additions and 104 deletions.
66 changes: 37 additions & 29 deletions _dist/data/languages/de/attribute_de.csv
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ uniqueConstraint; "Unique-Beschränkung"
unique_desc; "Attributwert darf nur einmal vorkommen"
attributeValue; "Attribut Wert"
highlightAttribute; "Attribute hervorheben"
inputLength; "Eingabelänge"
inputLength; "Eingabelänge"
textfieldHeight; "Feldhöhe"
textfieldWidth; "Feldbreite"
createXML; "XML Tag"
Expand Down Expand Up @@ -212,37 +212,45 @@ attributeInsertFailed; "Attribut konnte nicht angelegt werden!"
#Form titles

#Hilfetext
attributeNameTitle; "Name des Attributes auf Englisch, kleingeschrieben, z.B.: attribute_name"
attributeDescriptionTitle; "Name des Attributes auf Deutsch"
attributeNoteTitle; "Hilfetext der durch Berührung mit dem Mauszeiger angezeigt wird"
attributeHintTitle; "Hilfetext"
attributeAttributeTypeTitle; "Festlegung des Eingabetyps"
attributeCiTypeTitle; "Ci Typ"
attributedisplayTypeTitle; "Auswahl der Attributgruppe"
attributeColumnTitle; "Spaltenausrichtung des Attributes im Formular"
attributeSortingTitle; "Gibt die Reihung des Attributes an"
attributeInputLengthTitle; "Maximale Eingabelaenge"
attributeTextfieldHeightTitle; "Hoehe des Eingabefeldes"
attributeTextfieldWidthTitle; "Breite des Eingabefeldes"
attributeAttributeInfoTitle; "Attributinfo"
attributeScriptUploadTitle; "Script Upload"
attributeHighlightAttributeTitle; "Attribut hervorheben, indem es fett dargestellt wird"
attributeCiTypeHierarchyTitle; "Ci Typ Hierarchie"
attributeCiTypeAutocompleteTitle; "Autocomplete"
attributeDateEventTitle; "Date event"
attributeUniqueConstraintTitle; "Eingegebene Daten in diesem Attribut dürfen nur einmal vorkommen"
attributeMailEnabledTitle; "Mailversand aktivieren"
attributeXMLTitle; "XML Tag-Name"
attributeRegexTitle; "Hier kann ein Regulärer Ausdruck für die Eingabe verwendet werden"
optional; "Optional"
summary; "Zusammenfassung"
attributeUpdateSuccess; "Attribut erfolgreich bearbeitet!"
ciId; "CIID"
attributeHintIndividualQueryHelp; "mögliche Platzhalter:"
attributeNameTitle; "Name des Attributes auf Englisch, kleingeschrieben, z.B.: attribute_name"
attributeDescriptionTitle; "Name des Attributes auf Deutsch"
attributeNoteTitle; "Hilfetext der durch Berührung mit dem Mauszeiger angezeigt wird"
attributeHintTitle; "Hilfetext"
attributeAttributeTypeTitle; "Festlegung des Eingabetyps"
attributeCiTypeTitle; "Ci Typ"
attributedisplayTypeTitle; "Auswahl der Attributgruppe"
attributeColumnTitle; "Spaltenausrichtung des Attributes im Formular"
attributeSortingTitle; "Gibt die Reihung des Attributes an"
attributeInputLengthTitle; "Maximale Eingabelaenge"
attributeTextfieldHeightTitle; "Hoehe des Eingabefeldes"
attributeTextfieldWidthTitle; "Breite des Eingabefeldes"
attributeAttributeInfoTitle; "Attributinfo"
attributeScriptUploadTitle; "Script Upload"
attributeHighlightAttributeTitle; "Attribut hervorheben, indem es fett dargestellt wird"
attributeCiTypeHierarchyTitle; "Ci Typ Hierarchie"
attributeCiTypeAutocompleteTitle; "Autocomplete"
attributeDateEventTitle; "Date event"
attributeUniqueConstraintTitle; "Eingegebene Daten in diesem Attribut dürfen nur einmal vorkommen"
attributeMailEnabledTitle; "Mailversand aktivieren"
attributeXMLTitle; "XML Tag-Name"
attributeRegexTitle; "Hier kann ein Regulärer Ausdruck für die Eingabe verwendet werden"
optional; "Optional"
summary; "Zusammenfassung"
attributeUpdateSuccess; "Attribut erfolgreich bearbeitet!"
ciId; "CIID"
attributeHintIndividualQueryHelp; "mögliche Platzhalter:"
attributeHintIndividualQueryCurrentCiId; "Aktuelle CI-ID"
attributeHintIndividualQueryCurrentValue; "Aktueller Wert"

editQuery; "SQL Query für Bearbeitung"
attributeHintIndividualSelectQueryEditHelp; "Wird für die Bearbeitung des Attributs ausgeführt.<br>Mögliche Platzhalter:"
attributeHintIndividualSelectQueryEditCurrentCiId; "Aktuelle CI-ID"
attributeHintIndividualSelectQueryEditCurrentValue; "Aktueller Wert"

listQuery; "SQL Query für Listenanzeige"
attributeHintIndividualSelectQueryListHelp; "Wird nur einmal für alle Attribute in der Listenanzeige ausgeführt, nicht für jedes Attribut extra.<br>Wenn die Query leer ist, wird die Bearbeitungsquery verwendet.<br>Keine Platzhaler möglich."

formInvalid; "Folgende Felder des Formulars wurden nicht richtig befüllt: "


formFilterDescription;"Hallo! <br> Das ist die Beschreibung, die noch befüllt werden muss!"
formFilterDescription;"Hallo! <br> Das ist die Beschreibung, die noch befüllt werden muss!"
12 changes: 10 additions & 2 deletions _dist/data/languages/en/attribute_en.csv
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ sorting; "Sorting"
uniqueConstraint; "Unique Constraint"
attributeValue; "Attribute Value"
highlightAttribute; "Highlight Attribute"
inputLength; "Input length"
inputLength; "Input length"
textfieldHeight; "Textheight"
textfieldWidth; "Textwidth"
createXML; "XML Tag"
Expand Down Expand Up @@ -92,6 +92,14 @@ attributeHintIndividualQueryHelp; "possible placeholder:"
attributeHintIndividualQueryCurrentCiId; "current CI-ID"
attributeHintIndividualQueryCurrentValue; "current value"

editQuery; "SQL Query for edit"
attributeHintIndividualSelectQueryEditHelp; "Executed for attribute edit.<br>Possible placeholder:"
attributeHintIndividualSelectQueryEditCurrentCiId; "current CI-ID"
attributeHintIndividualSelectQueryEditCurrentValue; "current value"

listQuery; "SQL Query for list display"
attributeHintIndividualSelectQueryListHelp; "Only executed once for all attributes in list display, not separately for every attribute.<br>If the query is empty, the edit query will be used.<br>No placeholders."

ProjectRestriction; "Only show CI's from user's projects"
attributeProjectRestrictionTitle; "Only CI's of the projects the user is member of can be selected"

Expand Down Expand Up @@ -233,4 +241,4 @@ formInvalid; "Some fields are not valid: "



formFilterDescription;"Hallo! <br> Das ist die Beschreibung, die noch befüllt werden muss!"
formFilterDescription;"Hallo! <br> Das ist die Beschreibung, die noch befüllt werden muss!"
41 changes: 17 additions & 24 deletions application/forms/Attribute/IndividualQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,30 @@ public function __construct($translator, $options = null)
$this->setName('query');

// set form description
if(isset($options['placeholders']) && !empty($options['placeholders'])) {
$definitionGroups = array(
'query' => array(
'name' => $translator->translate('query'),
'description' => $translator->translate('attributeHintIndividualQueryHelp'),
'list' => $options['placeholders'],
$view = new Zend_View();
$view->addScriptPath(APPLICATION_PATH . '/modules/cmdb/views/scripts/templates/');
$view->groups = array(
'query' => array(
'name' => $translator->translate('query'),
'description' => $translator->translate('attributeHintIndividualQueryHelp'),
'list' => array(
':id:' => $translator->translate('attributeHintIndividualQueryCurrentCiId'),
),
);

$view = new Zend_View();
$view->addScriptPath(APPLICATION_PATH . '/modules/cmdb/views/scripts/templates/');
$view->groups = $definitionGroups;
$queryDesc = $view->render('_definition_groups.phtml');

$this->setDescription($queryDesc);
}
),
);
$queryDesc = $view->render('_definition_groups.phtml');
$this->setDescription($queryDesc);

// Query
$query = new Zend_Form_Element_Textarea('query');
$query->setLabel('cqlQuery');
$query->addValidator(new Form_Validator_SqlQuery());
$this->addElement($query);

if ($options['onlyQuery'] !== true) {
$is_light = new Zend_Form_Element_Checkbox('isLight');
$is_light->setLabel('isLight');
$is_light->setAttrib('title', $translator->translate('isLight_query'));
$this->addElement($is_light);
}

$is_light = new Zend_Form_Element_Checkbox('isLight');
$is_light->setLabel('isLight');
$is_light->setAttrib('title', $translator->translate('isLight_query'));
$this->addElement($is_light);

$this->setElementDecorators(array(
'ViewHelper',
Expand All @@ -48,11 +42,10 @@ public function __construct($translator, $options = null)
array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
));


$this->addDecorators(array(
'FormElements',
array('HtmlTag', array('tag' => 'table', 'class' => 'create_form')),
'Form',
));
}
}
}
61 changes: 61 additions & 0 deletions application/forms/Attribute/IndividualSelectQuery.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php

class Form_Attribute_IndividualSelectQuery extends Zend_Form_SubForm
{

public function __construct($translator, $options = null)
{
parent::__construct($translator, $options);

$this->setName('query');

// set form description
$definitionGroups = array(
'query' => array(
'name' => $translator->translate('editQuery'),
'description' => $translator->translate("attributeHintIndividualSelectQueryEditHelp"),
'list' => array(
':id:' => $translator->translate('attributeHintIndividualSelectQueryEditCurrentCiId'),
':value:' => $translator->translate('attributeHintIndividualSelectQueryEditCurrentValue'),
),
),
'listQuery' => array(
'name' => $translator->translate('listQuery'),
'description' => $translator->translate("attributeHintIndividualSelectQueryListHelp"),
),
);
$view = new Zend_View();
$view->addScriptPath(APPLICATION_PATH . '/modules/cmdb/views/scripts/templates/');
$view->groups = $definitionGroups;
$queryDesc = $view->render('_definition_groups.phtml');
$this->setDescription($queryDesc);

$query = new Zend_Form_Element_Textarea('query');
$query->setLabel('editQuery');
$query->addValidator(new Form_Validator_SqlQuery());
$this->addElement($query);

$listQuery = new Zend_Form_Element_Textarea('listQuery');
$listQuery->setLabel('listQuery');
$listQuery->addValidator(new Form_Validator_SqlQuery());
$this->addElement($listQuery);

$multiselectForm = new Form_Attribute_IndividualMultiselect($translator);
$this->addElements($multiselectForm->getElements());

$this->setElementDecorators(array(
'ViewHelper',
'Errors',
array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')),
array('Label', array('tag' => 'td')),
array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
));


$this->addDecorators(array(
'FormElements',
array('HtmlTag', array('tag' => 'table', 'class' => 'create_form')),
'Form',
));
}
}
3 changes: 2 additions & 1 deletion application/models/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -1190,11 +1190,12 @@ public function getDefaultCiTypeAttributes(int $defaultCiTypeId)
}


public function insertDefaultQuery(int $attributeId, string $query)
public function insertDefaultQuery(int $attributeId, string $query, string $listQuery = null)
{
$data = array();
$data[Db_AttributeDefaultQueries::ATTRIBUTE_ID] = $attributeId;
$data[Db_AttributeDefaultQueries::QUERY] = $query;
$data[Db_AttributeDefaultQueries::LIST_QUERY] = $listQuery;

$table = new Db_AttributeDefaultQueries();
return $table->insert($data);
Expand Down
3 changes: 2 additions & 1 deletion application/models/mapping/AttributeDefaultQueries.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ class Db_AttributeDefaultQueries extends Zend_Db_Table_Abstract
const ID = 'id';
const ATTRIBUTE_ID = 'attribute_id';
const QUERY = 'query';
const LIST_QUERY = 'list_query';

}
}
22 changes: 11 additions & 11 deletions application/modules/cmdb/views/scripts/attribute/edit.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
$(function () {

$("#tabs").tabs({active: <?php echo $this->tab; ?> , activate: hideUselessButtons});
})
});

function getContent(id) {
$.post("<?php echo $this->url(array('action' => 'assigncitypeattribute')); ?>/id/" + id,
Expand Down Expand Up @@ -146,25 +146,25 @@
});

hideUselessButtons();
getAttributeTypeHint($("select#attributeType").get(0).value);
var $selectAttributeType = $("select#attributeType");
getAttributeTypeHint($selectAttributeType.get(0).value);

<?php if (!$this->individualform) { ?>
getOptionWizard();
<?php } ?>

//editor for script
var scriptEditor = initAceEditor('#script-script_text', 'perl');

initAceEditor('#script-script_text', 'perl');
//editor for sql
var queryEditor = initAceEditor('#query-query', 'mysql');

initAceEditor('#query-query', 'mysql');
initAceEditor('#query-listQuery', 'mysql');
//editor for sql persistent
var queryPersistentEditor = initAceEditor('#queryPersist-query', 'mysql');
initAceEditor('#queryPersist-query', 'mysql');

$("select#attributeType").change(function () {
getAttributeTypeHint($("select#attributeType").get(0).value);
var type = $("select#attributeType").get(0).value;
if (type == 4 || type == 5 || type == 6) {
$selectAttributeType.change(function () {
getAttributeTypeHint($selectAttributeType.get(0).value);
var type = parseInt($selectAttributeType.get(0).value, 10);
if (type === 4 || type === 5 || type === 6) {
getOptionWizard();
} else {
$.post("<?php echo $this->url(array('action' => 'individualwizardtab')); ?>/attributeTypeId/" + $(this).get(0).value,
Expand Down
4 changes: 3 additions & 1 deletion application/modules/cmdb/views/scripts/query/detail.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ if ($config->ci->detail->buttons->button) {
<tr>
<td><strong><?php echo $this->translate('queryDescription'); ?></strong></td>
<td>
<div style="border: 1px dotted black; width: 382px; min-height: 50px;"><?php echo $this->query[Db_StoredQuery::NOTE] ?></div>
<div style="border: 1px dotted black; width: 382px; min-height: 50px;">
<?php echo nl2br($this->query[Db_StoredQuery::NOTE]); ?>
</div>
</td>
<td width="50%"></td>
</tr>
Expand Down
4 changes: 2 additions & 2 deletions application/services/Attribute/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ public function createAttribute($formData, $userId)
$attributeId);
}

if ($formData['query']['query']) {
if ($formData['query']['query'] || $formData['query']['listQuery']) {
$attributeDaoImpl->insertDefaultQuery($attributeId,
$formData['query']['query']);
$formData['query']['query'], $formData['query']['listQuery']);
}

if ($formData['filter']['filter']) {
Expand Down
7 changes: 4 additions & 3 deletions application/services/Attribute/Get.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ public function getAttibuteData($attributeId)
$query = $attributeDaoImpl->getDefaultQuery($attributeId);
$dbFormData['filter']['filter'] = $query[Db_AttributeDefaultQueries::QUERY];
} elseif ($attribute[Db_Attribute::ATTRIBUTE_TYPE_ID] == Util_AttributeType_Type_SelectQuery::ATTRIBUTE_TYPE_ID) {
$query = $attributeDaoImpl->getDefaultQuery($attributeId);
$dbFormData['query']['query'] = $query[Db_AttributeDefaultQueries::QUERY];
$query = $attributeDaoImpl->getDefaultQuery($attributeId);
$dbFormData['query']['query'] = $query[Db_AttributeDefaultQueries::QUERY];
$dbFormData['query']['listQuery'] = $query[Db_AttributeDefaultQueries::LIST_QUERY];
} elseif ($attribute[Db_Attribute::ATTRIBUTE_TYPE_ID] == Util_AttributeType_Type_SelectPopup::ATTRIBUTE_TYPE_ID) {
$query = $attributeDaoImpl->getDefaultQuery($attributeId);
$dbFormData['filter']['filter'] = $query[Db_AttributeDefaultQueries::QUERY];
Expand Down Expand Up @@ -281,4 +282,4 @@ public function getAttributeList($page = null, $orderBy = null, $direction = nul
return $result;
}

}
}
9 changes: 4 additions & 5 deletions application/services/Attribute/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,10 @@ public function updateAttribute($attributeId, $formData, $dbData)
$dbUpdate = true;
}

if ($updateData['query']['query']) {
$attributeDaoImpl->deleteDefaultQueryByAttributeId(
$attributeId);
if ($updateData['query']['query'] || $updateData['query']['listQuery']) {
$attributeDaoImpl->deleteDefaultQueryByAttributeId($attributeId);
$attributeDaoImpl->insertDefaultQuery($attributeId,
$updateData['query']['query']);
$updateData['query']['query'], $updateData['query']['listQuery']);
$dbUpdate = true;
}

Expand Down Expand Up @@ -378,4 +377,4 @@ public function activateAttribute($attributeId)
throw new Exception_Attribute_ActivationFailed($e);
}
}
}
}
10 changes: 2 additions & 8 deletions application/utils/attributeType/Type/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,14 @@ class Util_AttributeType_Type_Query extends Util_AttributeType_Type_Abstract


const ATTRIBUTE_TYPE_ID = 15;
const ALLOW_EMPTY = true;
const ALLOW_EMPTY = true;

/**
* returns individual parts for create and update attribute wizard
*/
public static function getIndividualWizardFormParts($translator, $options = null)
{
$placeholders = array(
':id:' => $translator->translate('attributeHintIndividualQueryCurrentCiId'),
);

$form = new Form_Attribute_IndividualQuery($translator, array(
'placeholders' => $placeholders,
));
$form = new Form_Attribute_IndividualQuery($translator);

return $form;
}
Expand Down
Loading

0 comments on commit f1e6769

Please sign in to comment.