Skip to content

Commit

Permalink
Merge branch 'hotfix/9/5' into 'release_9'
Browse files Browse the repository at this point in the history
Merge Release 9.3

See merge request ilias-hosting/ilias!5
  • Loading branch information
fneumann committed Jul 31, 2024
2 parents b55fddd + 6e8fef5 commit 354aa3a
Show file tree
Hide file tree
Showing 142 changed files with 1,128 additions and 1,768 deletions.
50 changes: 31 additions & 19 deletions CI/Copyright-Checker/copyright-checker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,35 @@ function is_copyright_valid() {
local file_extension="${file##*.}"
local offset=1

# since PSR-12 the php files will contain the copyright license as
# document-level comment, which starts on line 3.
if [ "php" = "${file_extension}" ]; then
offset=3
fi
is_ui_example "${file}"
local is_example=${?}

for copyright_line in "${COPYRIGHT_LINES[@]}"; do
local line_to_check="$(sed "${offset}q;d" "${file}")"
if ! [ "${copyright_line}" = "${line_to_check}" ]; then
return 1
if [ 1 -eq ${is_example} ]; then
if [ "php" = ${file_extension} ]; then
offset=3
fi

offset=$((1 + ${offset}))
done
for copyright_line in "${COPYRIGHT_LINES[@]}"; do
local line_to_check="$(sed "${offset}q;d" "${file}")"
if ! [ "${copyright_line}" = "${line_to_check}" ]; then
return 1
fi

offset=$((1 + ${offset}))
done
else
local lines=$(wc -l < "${file}");
while [ ${offset} -lt ${lines} ]
do
local line_to_check="$(echo "$(sed "${offset}q;d" ${file})" | xargs)"
if echo "$line_to_check" | grep -q "^namespace "; then
return 0
fi
if echo "$line_to_check" | grep -q -e '^/\*' -e '^//' -e '^#'; then
return 2
fi
offset=$((1 + ${offset}))
done
fi

return 0
}
Expand Down Expand Up @@ -156,15 +171,12 @@ function perform_copyright_check() {
is_copyright_valid "${file}"
local is_valid="${?}"

is_ui_example "${file}"
local is_example="${?}"

# invert the copyright-check for UI examples, because we
# don't want them to have too much content.
if ([ 0 -eq ${is_example} ] && [ 0 -eq ${is_valid} ]) ||
([ 1 -eq ${is_example} ] && [ 1 -eq ${is_valid} ]); then
if [ 1 -eq ${is_valid} ]; then
printf "copyright is not as expected in %s\n" "${file}"
exit_status=1
elif [ 2 -eq ${is_valid} ]; then
printf "copyright is not allowed in %s\n" "${file}"
exit_status=2
fi
done

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,6 @@ public function saveTable(): void
}
}

// Set Workflow flag to true
$view = ilDclTableView::getCollection()->where(["id" => filter_input(INPUT_GET, "tableview_id")])->first();
if (!is_null($view)) {
$view->setStepC(true);
$view->save();
}

$this->tpl->setOnScreenMessage('success', $this->lng->txt('dcl_msg_tableview_updated'), true);
$this->ctrl->saveParameter($this, 'tableview_id');
$this->ctrl->redirect($this, 'presentation');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,6 @@ public function saveTable(): void
}
}

// Set Workflow flag to true
$view = ilDclTableView::getCollection()->where(["id" => filter_input(INPUT_GET, "tableview_id")])->first();
if (!is_null($view)) {
$view->setStepE(true);
$view->save();
}

$this->tpl->setOnScreenMessage('success', $this->lng->txt('dcl_msg_tableview_updated'), true);
$this->ctrl->saveParameter($this, 'tableview_id');
$this->ctrl->redirect($this, 'presentation');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected function getLinkHTML(ilDclBaseRecordModel $record, int $view): string
$this->ctrl->setParameterByClass(ilDclDetailedViewGUI::class, "record_id", $record->getId());
$this->ctrl->setParameterByClass(ilDclDetailedViewGUI::class, "tableview_id", $view);
$html = $this->factory->link()->standard(
$record->getRecordFieldValue($this->getField()->getProperty(ilDclBaseFieldModel::PROP_REFERENCE)),
$record->getRecordFieldHTML($this->getField()->getProperty(ilDclBaseFieldModel::PROP_REFERENCE)),
$this->ctrl->getLinkTargetByClass(
ilDclDetailedViewGUI::class,
"renderRecord"
Expand Down
24 changes: 10 additions & 14 deletions Modules/DataCollection/classes/Fields/class.ilDclFieldEditGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,23 +250,19 @@ public function initForm(string $a_mode = "create"): void

$edit_datatype = new ilRadioGroupInputGUI($lng->txt('dcl_datatype'), 'datatype');

foreach (ilDclDatatype::getAllDatatype() as $datatype) {
$model = new ilDclBaseFieldModel();
$model->setDatatypeId($datatype->getId());

if ($a_mode == 'edit' && $datatype->getId() == $this->field_obj->getDatatypeId()) {
$model = $this->field_obj;
}

$field_representation = ilDclFieldFactory::getFieldRepresentationInstance($model);
if ($a_mode === 'edit') {
$field_representation = ilDclFieldFactory::getFieldRepresentationInstance($this->field_obj);
$field_representation->addFieldCreationForm($edit_datatype, $this->getDataCollectionObject(), $a_mode);
}
$edit_datatype->setRequired(true);

//you can't change type but we still need it in POST
if ($a_mode == "edit") {
$edit_datatype->setDisabled(true);
} else {
foreach (ilDclDatatype::getAllDatatype() as $datatype) {
$model = new ilDclBaseFieldModel();
$model->setDatatypeId($datatype->getId());
$field_representation = ilDclFieldFactory::getFieldRepresentationInstance($model);
$field_representation->addFieldCreationForm($edit_datatype, $this->getDataCollectionObject());
}
}
$edit_datatype->setRequired(true);
$this->form->addItem($edit_datatype);

//Unique
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,23 @@ public function step_12(): void
[ilDclDatatype::INPUTFORMAT_TEXT]
);
}

public function step_13(): void
{
if ($this->db->tableColumnExists('il_dcl_tableview', 'step_vs')) {
$this->db->dropTableColumn('il_dcl_tableview', 'step_vs');
}
if ($this->db->tableColumnExists('il_dcl_tableview', 'step_c')) {
$this->db->dropTableColumn('il_dcl_tableview', 'step_c');
}
if ($this->db->tableColumnExists('il_dcl_tableview', 'step_e')) {
$this->db->dropTableColumn('il_dcl_tableview', 'step_e');
}
if ($this->db->tableColumnExists('il_dcl_tableview', 'step_o')) {
$this->db->dropTableColumn('il_dcl_tableview', 'step_o');
}
if ($this->db->tableColumnExists('il_dcl_tableview', 'step_s')) {
$this->db->dropTableColumn('il_dcl_tableview', 'step_s');
}
}
}
104 changes: 0 additions & 104 deletions Modules/DataCollection/classes/TableView/class.ilDclTableView.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,41 +68,6 @@ class ilDclTableView extends ActiveRecord
* @db_length 8
*/
protected int $tableview_order = 0;
/**
* @var bool
* @db_has_field true
* @db_fieldtype integer
* @db_length 1
*/
protected bool $step_vs = false;
/**
* @var bool
* @db_has_field true
* @db_fieldtype integer
* @db_length 1
*/
protected bool $step_c = false;
/**
* @var bool
* @db_has_field true
* @db_fieldtype integer
* @db_length 1
*/
protected bool $step_e = false;
/**
* @var bool
* @db_has_field true
* @db_fieldtype integer
* @db_length 1
*/
protected bool $step_o = false;
/**
* @var bool
* @db_has_field true
* @db_fieldtype integer
* @db_length 1
*/
protected bool $step_s = false;
/**
* @var ilDclBaseFieldModel[]
*/
Expand Down Expand Up @@ -177,56 +142,6 @@ public function setTableviewOrder(int $tableview_order): void
$this->tableview_order = $tableview_order;
}

public function isStepVs(): bool
{
return $this->step_vs;
}

public function setStepVs(bool $step_vs): void
{
$this->step_vs = $step_vs;
}

public function isStepC(): bool
{
return $this->step_c;
}

public function setStepC(bool $step_c): void
{
$this->step_c = $step_c;
}

public function isStepE(): bool
{
return $this->step_e;
}

public function setStepE(bool $step_e): void
{
$this->step_e = $step_e;
}

public function isStepO(): bool
{
return $this->step_o;
}

public function setStepO(bool $step_o): void
{
$this->step_o = $step_o;
}

public function isStepS(): bool
{
return $this->step_s;
}

public function setStepS(bool $step_s): void
{
$this->step_s = $step_s;
}

public function getRoles(): array
{
return $this->roles;
Expand Down Expand Up @@ -423,11 +338,6 @@ public function cloneStructure(ilDclTableView $orig, array $new_fields): void
$this->setOrder($orig->getOrder());
$this->setDescription($orig->getDescription());
$this->setRoles($orig->getRoles());
$this->setStepVs($orig->isStepVs());
$this->setStepC($orig->isStepC());
$this->setStepE($orig->isStepE());
$this->setStepO($orig->isStepO());
$this->setStepS($orig->isStepS());
$this->create(false); //create default setting, adjust them later

//clone default values
Expand Down Expand Up @@ -525,22 +435,8 @@ public static function createOrGetStandardView(int $table_id, bool $create_defau
$lng = $DIC['lng'];
$view->setTitle($lng->txt('dcl_title_standardview'));
$view->setTableviewOrder(10);
$view->setStepVs(true);
$view->setStepC(false);
$view->setStepE(false);
$view->setStepO(false);
$view->setStepS(false);
$view->create($create_default_settings);

return $view;
}

/**
* Check if the configuration of the view is complete. The step "single" is
* optional and therefore omitted.
*/
public function validateConfigCompletion(): bool
{
return $this->step_vs && $this->step_c && $this->step_e && $this->step_o;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@ public function createTableView(): void
$this->tableview->setDescription($this->getInput('description'));
$this->tableview->setRoles((array) $this->getInput('roles'));
$this->tableview->setTableId($this->table->getId());
$this->tableview->setStepVs(true);
$this->tableview->setStepE(false);
$this->tableview->setStepC(false);
$this->tableview->setStepO(false);
$this->tableview->setStepS(false);
$this->tableview->setOrder($this->table->getNewTableviewOrder());
$this->tableview->create();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,45 +134,9 @@ public function executeCommand(): void
$this->tpl->setContent($ilDclTableViewEditFormGUI->getHTML());
break;
case 'editGeneralSettings':
$settings_tpl = new ilTemplate("tpl.dcl_settings.html", true, true, 'Modules/DataCollection');

$this->setTabs('general_settings');
$ilDclTableViewEditFormGUI = new ilDclTableViewEditFormGUI($this, $this->tableview);

global $DIC;
$f = $DIC->ui()->factory()->listing()->workflow();
$renderer = $DIC->ui()->renderer();

// Set Workflow flag to true
$view = ilDclTableView::getCollection()->where(["id" => filter_input(
INPUT_GET,
"tableview_id"
)
])->first();
if (!is_null($view)) {
//setup steps
$step = $f->step('');
$steps = [
$f->step($this->lng->txt('dcl_view_settings'))
->withAvailability($step::AVAILABLE)->withStatus(4), //$view->getStepVs() ? 3 : 4
$f->step($this->lng->txt('dcl_create_entry_rules'))
->withAvailability($step::AVAILABLE)->withStatus(4), //$view->getStepC() ? 3 : 4
$f->step($this->lng->txt('dcl_edit_entry_rules'))
->withAvailability($step::AVAILABLE)->withStatus(4), //$view->getStepE() ? 3 : 4
$f->step($this->lng->txt('dcl_list_visibility_and_filter'))
->withAvailability($step::AVAILABLE)->withStatus(4), //$view->getStepO() ? 3 : 4
$f->step($this->lng->txt('dcl_detailed_view'))
->withAvailability($step::AVAILABLE)->withStatus(1), //$view->getStepS() ? 3 : 1
];

//setup linear workflow
$wf = $f->linear($this->lng->txt('dcl_view_configuration'), $steps);
$settings_tpl->setVariable("WORKFLOW", $renderer->render($wf));
}

$settings_tpl->setVariable("SETTINGS", $ilDclTableViewEditFormGUI->getHTML());

$this->tpl->setContent($settings_tpl->get());
$this->tpl->setContent($ilDclTableViewEditFormGUI->getHTML());
break;
case 'editFieldSettings':
$this->setTabs('field_settings');
Expand Down Expand Up @@ -286,12 +250,6 @@ public function saveTable(): void
$setting->update();
}

// Set Workflow flag to true
$view = ilDclTableView::getCollection()->where(["id" => filter_input(INPUT_GET, "tableview_id")])->first();
if (!is_null($view)) {
$view->setStepO(true);
$view->save();
}

$this->tpl->setOnScreenMessage('success', $this->lng->txt('dcl_msg_tableview_updated'), true);
$this->ctrl->saveParameter($this->parent_obj, 'tableview_id');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public function __construct(object $a_parent_obj, string $a_parent_cmd, ilDclTab

$this->addColumn($this->lng->txt('title'), '', 'auto');
$this->addColumn($this->lng->txt('description'), '', 'auto');
$this->addColumn($this->lng->txt('dcl_configuration_complete'), '', 'auto');
$this->addColumn($this->lng->txt('actions'), '', '30px');

$this->setTopCommands(true);
Expand Down Expand Up @@ -217,12 +216,6 @@ public function fillRowFromObject(ilDclTableView $a_set): void
$this->ctrl->setParameterByClass(ilDclTableViewEditGUI::class, 'tableview_id', $a_set->getId());
$this->tpl->setVariable("TITLE_LINK", $this->ctrl->getLinkTargetByClass('ildcltablevieweditgui'));
$this->tpl->setVariable("DESCRIPTION", $a_set->getDescription());

$icon = $this->ui_factory->symbol()->icon()->custom(ilUtil::getImagePath('standard/icon_not_ok_monochrome.svg'), $this->lng->txt("yes"));
if ($a_set->validateConfigCompletion()) {
$icon = $this->ui_factory->symbol()->icon()->custom(ilUtil::getImagePath('standard/icon_ok_monochrome.svg'), $this->lng->txt("no"));
}
$this->tpl->setVariable("ICON_CONFIG", $this->renderer->render($icon));
$this->tpl->setVariable('ACTIONS', $this->buildAction($a_set->getId()));
}

Expand Down
Loading

0 comments on commit 354aa3a

Please sign in to comment.