mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°3905 - Polishing: CSV Import
This commit is contained in:
35
css/backoffice/pages/_csv-import.scss
vendored
35
css/backoffice/pages/_csv-import.scss
vendored
@@ -3,43 +3,44 @@
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
$ibo-csv-import--cell-message-padding:3px;
|
||||
|
||||
#tabs1-import .ibo-field--label {
|
||||
max-width: 50%;
|
||||
}
|
||||
|
||||
div.cell_modified {
|
||||
div.ibo-csv-import--cell-modified {
|
||||
font-weight: bold;
|
||||
color: #004e91;
|
||||
color: $ibo-color-blue-700;
|
||||
}
|
||||
|
||||
div.cell_error {
|
||||
div.ibo-csv-import--cell-error {
|
||||
font-weight: bold;
|
||||
color: #D81515;
|
||||
color: $ibo-color-red-700;
|
||||
}
|
||||
|
||||
div.cell_error > p {
|
||||
font-weight: bold;
|
||||
color: #D81515;
|
||||
div.ibo-csv-import--cell-message {
|
||||
padding-top: $ibo-csv-import--cell-message-padding;
|
||||
}
|
||||
|
||||
tr.row_unchanged td {
|
||||
border-bottom: 1px #ccc solid;
|
||||
tr.ibo-csv-import--row-unchanged td {
|
||||
border-bottom: 1px $ibo-color-grey-400 solid;
|
||||
}
|
||||
|
||||
.wizContainer table tr.row_error td {
|
||||
border-bottom: 1px #ccc solid;
|
||||
background-color: #fdd;
|
||||
.wizContainer table tr.ibo-csv-import--row-error td {
|
||||
border-bottom: 1px $ibo-color-grey-400 solid;
|
||||
background-color: $ibo-color-red-200;
|
||||
}
|
||||
|
||||
tr.row_modified td {
|
||||
border-bottom: 1px #ccc solid;
|
||||
tr.ibo-csv-import--row-modified td {
|
||||
border-bottom: 1px $ibo-color-grey-400 solid;
|
||||
}
|
||||
|
||||
tr.row_added td {
|
||||
border-bottom: 1px #ccc solid;
|
||||
tr.ibo-csv-import--row-added td {
|
||||
border-bottom: 1px $ibo-color-grey-400 solid;
|
||||
}
|
||||
|
||||
.ibo-import-csv--download-file {
|
||||
.ibo-csv-import--download-file {
|
||||
font-size: 4em;
|
||||
color: $ibo-color-primary-400;
|
||||
margin: 20px;
|
||||
|
||||
@@ -424,9 +424,9 @@ EOF
|
||||
}
|
||||
} else {
|
||||
$oPage = new AjaxPage("");
|
||||
$oButtonXls = ButtonUIBlockFactory::MakeIconLink('ibo-import-csv--download-file fas fa-file-csv', $sClassDisplayName.'.csv', utils::GetAbsoluteUrlAppRoot().'pages/ajax.csvimport.php?operation=get_csv_template&disposition=attachment&class_name='.$sClassName);
|
||||
$oButtonXls = ButtonUIBlockFactory::MakeIconLink('ibo-csv-import--download-file fas fa-file-csv', $sClassDisplayName.'.csv', utils::GetAbsoluteUrlAppRoot().'pages/ajax.csvimport.php?operation=get_csv_template&disposition=attachment&class_name='.$sClassName);
|
||||
$oPage->AddSubBlock($oButtonXls);
|
||||
$oButtonCsv = ButtonUIBlockFactory::MakeIconLink('ibo-import-csv--download-file fas fa-file-excel', $sClassDisplayName.'.xlsx', utils::GetAbsoluteUrlAppRoot().'pages/ajax.csvimport.php?operation=get_csv_template&disposition=attachment&format=xlsx&class_name='.$sClassName);
|
||||
$oButtonCsv = ButtonUIBlockFactory::MakeIconLink('ibo-csv-import--download-file fas fa-file-excel', $sClassDisplayName.'.xlsx', utils::GetAbsoluteUrlAppRoot().'pages/ajax.csvimport.php?operation=get_csv_template&disposition=attachment&format=xlsx&class_name='.$sClassName);
|
||||
$oPage->AddSubBlock($oButtonCsv);
|
||||
$oTextArea = new TextArea("", $sResult, "", 100, 5);
|
||||
$oPage->AddSubBlock($oTextArea);
|
||||
|
||||
@@ -212,6 +212,17 @@ try {
|
||||
$oP->AddSubBlock(AlertUIBlockFactory::MakeForInformation(MetaModel::GetClassIcon($sClass)." ".Dict::Format('UI:Title:BulkSynchro_nbItem_ofClass_class', $iCount, MetaModel::GetName($sClass))));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a paragraph to the body of the page
|
||||
*
|
||||
* @param string $s_html
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function GetDivAlert($s_html)
|
||||
{
|
||||
return "<div class=\"ibo-csv-import--cell-error ibo-csv-import--cell-message\">$s_html</div>\n";
|
||||
}
|
||||
/**
|
||||
* Process the CSV data, for real or as a simulation
|
||||
* @param WebPage $oPage The page used to display the wizard
|
||||
@@ -398,7 +409,7 @@ try {
|
||||
$oObj = MetaModel::GetObject($sFinalClass, $aResRow['id']->GetPureValue());
|
||||
$sUrl = $oObj->GetHyperlink();
|
||||
$sStatus = '<img src="../images/unchanged.png" title="'.Dict::S('UI:CSVReport-Icon-Unchanged').'">';
|
||||
$sCSSRowClass = 'row_unchanged';
|
||||
$sCSSRowClass = 'ibo-csv-import--row-unchanged';
|
||||
break;
|
||||
|
||||
case 'RowStatus_Modify':
|
||||
@@ -407,7 +418,7 @@ try {
|
||||
$oObj = MetaModel::GetObject($sFinalClass, $aResRow['id']->GetPureValue());
|
||||
$sUrl = $oObj->GetHyperlink();
|
||||
$sStatus = '<img src="../images/modified.png" title="'.Dict::S('UI:CSVReport-Icon-Modified').'">';
|
||||
$sCSSRowClass = 'row_modified';
|
||||
$sCSSRowClass = 'ibo-csv-import--row-modified';
|
||||
break;
|
||||
|
||||
case 'RowStatus_Disappeared':
|
||||
@@ -416,7 +427,7 @@ try {
|
||||
$oObj = MetaModel::GetObject($sFinalClass, $aResRow['id']->GetPureValue());
|
||||
$sUrl = $oObj->GetHyperlink();
|
||||
$sStatus = '<img src="../images/delete.png" title="'.Dict::S('UI:CSVReport-Icon-Missing').'">';
|
||||
$sCSSRowClass = 'row_modified';
|
||||
$sCSSRowClass = 'ibo-csv-import--row-modified';
|
||||
if ($bSimulate) {
|
||||
$sMessage = Dict::S('UI:CSVReport-Object-MissingToUpdate');
|
||||
} else {
|
||||
@@ -428,7 +439,7 @@ try {
|
||||
$iCreated++;
|
||||
$sFinalClass = $aResRow['finalclass'];
|
||||
$sStatus = '<img src="../images/added.png" title="'.Dict::S('UI:CSVReport-Icon-Created').'">';
|
||||
$sCSSRowClass = 'row_added';
|
||||
$sCSSRowClass = 'ibo-csv-import--row-added';
|
||||
if ($bSimulate) {
|
||||
$sMessage = Dict::S('UI:CSVReport-Object-ToCreate');
|
||||
} else {
|
||||
@@ -441,10 +452,10 @@ try {
|
||||
|
||||
case 'RowStatus_Issue':
|
||||
$iErrors++;
|
||||
$sMessage .= $oPage->GetP($oStatus->GetDescription());
|
||||
$sMessage .= GetDivAlert($oStatus->GetDescription());
|
||||
$sStatus = '<img src="../images/error.png" title="'.Dict::S('UI:CSVReport-Icon-Error').'">';//translate
|
||||
$sCSSMessageClass = 'cell_error';
|
||||
$sCSSRowClass = 'row_error';
|
||||
$sCSSMessageClass = 'ibo-csv-import--cell-error';
|
||||
$sCSSRowClass = 'ibo-csv-import--row-error';
|
||||
if (array_key_exists($iLine, $aData)) {
|
||||
$aRow = $aData[$iLine];
|
||||
$aResult[] = $sTextQualifier.implode($sTextQualifier.$sSeparator.$sTextQualifier, $aRow).$sTextQualifier; // Remove the first line and store it in case of error
|
||||
@@ -468,7 +479,7 @@ try {
|
||||
case 'CellStatus_SearchIssue':
|
||||
case 'CellStatus_NullIssue':
|
||||
case 'CellStatus_Ambiguous':
|
||||
$sCellMessage .= $oPage->GetP($oExtKeyCellStatus->GetDescription());
|
||||
$sCellMessage .= GetDivAlert($oExtKeyCellStatus->GetDescription());
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -478,22 +489,22 @@ try {
|
||||
$sHtmlValue = $oCellStatus->GetDisplayableValue();
|
||||
switch (get_class($oCellStatus)) {
|
||||
case 'CellStatus_Issue':
|
||||
$sCellMessage .= $oPage->GetP($oCellStatus->GetDescription());
|
||||
$aTableRow[$sClassName.'/'.$sAttCode] = '<div class="cell_error">'.Dict::Format('UI:CSVReport-Object-Error', $sHtmlValue).$sCellMessage.'</div>';
|
||||
$sCellMessage .= GetDivAlert($oCellStatus->GetDescription());
|
||||
$aTableRow[$sClassName.'/'.$sAttCode] = '<div class="ibo-csv-import--cell-error">'.Dict::Format('UI:CSVReport-Object-Error', $sHtmlValue).$sCellMessage.'</div>';
|
||||
break;
|
||||
|
||||
case 'CellStatus_SearchIssue':
|
||||
$sCellMessage .= $oPage->GetP($oCellStatus->GetDescription());
|
||||
$aTableRow[$sClassName.'/'.$sAttCode] = '<div class="cell_error">ERROR: '.$sHtmlValue.$sCellMessage.'</div>';
|
||||
$sCellMessage .= GetDivAlert($oCellStatus->GetDescription());
|
||||
$aTableRow[$sClassName.'/'.$sAttCode] = '<div class="ibo-csv-import--cell-error">ERROR: '.$sHtmlValue.$sCellMessage.'</div>';
|
||||
break;
|
||||
|
||||
case 'CellStatus_Ambiguous':
|
||||
$sCellMessage .= $oPage->GetP($oCellStatus->GetDescription());
|
||||
$aTableRow[$sClassName.'/'.$sAttCode] = '<div class="cell_error" >'.Dict::Format('UI:CSVReport-Object-Ambiguous', $sHtmlValue).$sCellMessage.'</div>';
|
||||
$sCellMessage .= GetDivAlert($oCellStatus->GetDescription());
|
||||
$aTableRow[$sClassName.'/'.$sAttCode] = '<div class="ibo-csv-import--cell-error" >'.Dict::Format('UI:CSVReport-Object-Ambiguous', $sHtmlValue).$sCellMessage.'</div>';
|
||||
break;
|
||||
|
||||
case 'CellStatus_Modify':
|
||||
$aTableRow[$sClassName.'/'.$sAttCode] = '<div class="cell_modified"><b>'.$sHtmlValue.'</b></div>';
|
||||
$aTableRow[$sClassName.'/'.$sAttCode] = '<div class="ibo-csv-import--cell-modified"><b>'.$sHtmlValue.'</b></div>';
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -561,28 +572,28 @@ try {
|
||||
$oCheckBoxUnchanged->SetBeforeInput(false);
|
||||
$oCheckBoxUnchanged->GetInput()->AddCSSClass('ibo-input-checkbox');
|
||||
$oMulticolumn->AddColumn(ColumnUIBlockFactory::MakeForBlock($oCheckBoxUnchanged));
|
||||
$oPage->add_ready_script("$('#show_unchanged').on('click', function(){ToggleRows('row_unchanged')})");
|
||||
$oPage->add_ready_script("$('#show_unchanged').on('click', function(){ToggleRows('ibo-csv-import--row-unchanged')})");
|
||||
|
||||
$oCheckBoxUnchanged = InputUIBlockFactory::MakeForInputWithLabel('<img src="../images/modified.png"> '.sprintf($aDisplayFilters['modified'], $iModified), '', "1", "show_modified", "checkbox");
|
||||
$oCheckBoxUnchanged->GetInput()->SetIsChecked(true);
|
||||
$oCheckBoxUnchanged->SetBeforeInput(false);
|
||||
$oCheckBoxUnchanged->GetInput()->AddCSSClass('ibo-input-checkbox');
|
||||
$oMulticolumn->AddColumn(ColumnUIBlockFactory::MakeForBlock($oCheckBoxUnchanged));
|
||||
$oPage->add_ready_script("$('#show_modified').on('click', function(){ToggleRows('row_modified')})");
|
||||
$oPage->add_ready_script("$('#show_modified').on('click', function(){ToggleRows('ibo-csv-import--row-modified')})");
|
||||
|
||||
$oCheckBoxUnchanged = InputUIBlockFactory::MakeForInputWithLabel('<img src="../images/added.png"> '.sprintf($aDisplayFilters['added'], $iCreated), '', "1", "show_created", "checkbox");
|
||||
$oCheckBoxUnchanged->GetInput()->SetIsChecked(true);
|
||||
$oCheckBoxUnchanged->SetBeforeInput(false);
|
||||
$oCheckBoxUnchanged->GetInput()->AddCSSClass('ibo-input-checkbox');
|
||||
$oMulticolumn->AddColumn(ColumnUIBlockFactory::MakeForBlock($oCheckBoxUnchanged));
|
||||
$oPage->add_ready_script("$('#show_created').on('click', function(){ToggleRows('row_added')})");
|
||||
$oPage->add_ready_script("$('#show_created').on('click', function(){ToggleRows('ibo-csv-import--row-added')})");
|
||||
|
||||
$oCheckBoxUnchanged = InputUIBlockFactory::MakeForInputWithLabel('<img src="../images/error.png"> '.sprintf($aDisplayFilters['errors'], $iErrors), '', "1", "show_errors", "checkbox");
|
||||
$oCheckBoxUnchanged->GetInput()->SetIsChecked(true);
|
||||
$oCheckBoxUnchanged->SetBeforeInput(false);
|
||||
$oCheckBoxUnchanged->GetInput()->AddCSSClass('ibo-input-checkbox');
|
||||
$oMulticolumn->AddColumn(ColumnUIBlockFactory::MakeForBlock($oCheckBoxUnchanged));
|
||||
$oPage->add_ready_script("$('#show_errors').on('click', function(){ToggleRows('row_error')})");
|
||||
$oPage->add_ready_script("$('#show_errors').on('click', function(){ToggleRows('ibo-csv-import--row-error')})");
|
||||
|
||||
$oPanel = PanelUIBlockFactory::MakeNeutral('');
|
||||
$oPanel->AddCSSClasses(['ibo-datatable-panel', 'mb-5']);
|
||||
|
||||
Reference in New Issue
Block a user