Skip to content
Snippets Groups Projects
Verified Commit 8727da3d authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #6629 merge from 17_06_project_develop

parent c989cb50
No related branches found
No related tags found
No related merge requests found
<?php <?php
# Display list /**
/* Requires * Copyright Maarch since 2008 under licence GPLv3.
$difflist = diffusion list array * See LICENCE.txt file at the root folder for more details.
$_SESSION[m_admin]['entities'][listmodel] * This file is part of Maarch software.
$_SESSION[$origin][listinstance]
$roles = list of available roles *
$onlyCC = hide 'dest'; * @brief difflist_display
*
* @author dev <dev@maarch.org>
* @ingroup entities
*/ */
echo '<div style="max-height:490px;overflow:auto;">'; $contentDiffList = '';
$empty = 0;
$nb_roles = 0; $contentDiffList .= '<div style="max-height:490px;overflow:auto;">';
if($origin == 'indexing' && $category == 'outgoing'){
//$difflist['copy'] = array(); $empty = 0;
$nb_roles = 0;
foreach ($roles as $role_id => $role_label) {
++$nb_role;
if ($category == 'outgoing' && $role_label == 'Destinataire') {
$role_label = _SHIPPER;
} }
if (($specific_role != $role_id && $specific_role.'_copy' != $role_id && $specific_role.'_info' != $role_id) && isset($specific_role) && $specific_role != '') {
continue;
}
if (count($difflist[$role_id]['users']) > 0
|| count($difflist[$role_id]['entities']) > 0
) {
++$empty;
$contentDiffList .= '<h3 class="sstit" style="font-size: 1.2em;">'.$role_label.'</h3>';
if (count($difflist[$role_id]['users']) > 0) {
$contentDiffList .= '<table id="diffListUser_'.$role_id.'" cellpadding="0" cellspacing="0" border="0" class="listingsmall liste_diff spec" style="width:100%;margin:0;">';
foreach($roles as $role_id => $role_label) {
$nb_role++;
if($category == 'outgoing' && $role_label == 'Destinataire'){
$role_label = _SHIPPER;
}
if(($specific_role != $role_id && $specific_role.'_copy' != $role_id && $specific_role.'_info' != $role_id) && isset($specific_role) && $specific_role <> '')
continue;
if(count($difflist[$role_id]['users']) > 0
|| count($difflist[$role_id]['entities']) > 0
) {
$empty++;
?>
<h3 class="sstit" style="font-size: 1.2em;"><?php functions::xecho($role_label);?></h3><?php
if(count($difflist[$role_id]['users']) > 0) { ?>
<table cellpadding="0" cellspacing="0" border="0" class="listingsmall liste_diff spec" style="width:100%;margin:0;"><?php
$color = ' class="col"'; $color = ' class="col"';
for($i=0, $l=count($difflist[$role_id]['users']);
$i<$l; for ($i = 0, $l = count($difflist[$role_id]['users']); $i < $l; ++$i) {
$i++
) {
$user = $difflist[$role_id]['users'][$i]; $user = $difflist[$role_id]['users'][$i];
if ($color == ' class="col"') $color = ' '; if ($color == ' class="col"') {
else $color = ' class="col"'; $color = ' ';
} else {
$color = ' class="col"';
}
if (preg_match("/\[DEL\]/", $difflist[$role_id]['users'][$i]['process_comment'])) { if (preg_match("/\[DEL\]/", $difflist[$role_id]['users'][$i]['process_comment'])) {
$styleMoved=" style='text-decoration: line-through;opacity:0.5;' "; $styleMoved = " style='text-decoration: line-through;opacity:0.5;' ";
$descMoved=$difflist[$role_id]['users'][$i]['process_comment']; $descMoved = $difflist[$role_id]['users'][$i]['process_comment'];
} else { } else {
$styleMoved=""; $styleMoved = '';
$descMoved=""; $descMoved = '';
} }
?>
<tr <?php echo $color.$styleMoved;?> title="<?php echo $descMoved;?>"> $contentDiffList .= '<tr id="'.$user['user_id'].'_'.$role_id.'" '.$color.$styleMoved.' title="'.$descMoved.'">';
<td style="width:15%;text-align:center;"> $contentDiffList .= '<td style="width:15%;text-align:center;">';
<i class="fa fa-user fa-2x" title="<?php echo _USER;?>"></i> $contentDiffList .= '<i class="fa fa-user fa-2x" title="'._USER.'"></i>';
</td> $contentDiffList .= '</td>';
<td style="width:10%;"><?php $contentDiffList .= '<td style="width:37%;">'.$user['lastname'].' '.$user['firstname'].'</td>';
/* if($user['visible'] == 'Y') { ?> $contentDiffList .= '<td style="width:43%;">'.$user['entity_label'].'</td>';
<i class="fa fa-check fa-2x" title="<?php echo _VISIBLE;?>"></i> <?php $contentDiffList .= '<td class="movedest" style="width:5%;">';
} else {?>
<i class="fa fa-times fa-2x" title="<?php echo _NOT_VISIBLE;?>"></i><?php if (!empty($difflist['dest']['users'][0]) && $role_id != 'dest' && $origin != null && !$core->test_service('add_copy_in_indexing_validation', 'entities', false)) {
} */?> $contentDiffList .= '<i class="fa fa-arrow-up" style="cursor:pointer;" title="'._DEST.'" onclick="moveToDest(\''.$user['user_id'].'\',\''.$role_id.'\',\''.$origin.'\');"></i>';
</td> }
<td style="width:37%;"><?php functions::xecho($user['lastname'] . " " . $user['firstname']);?></td> $contentDiffList .= '</td>';
<td style="width:38%;"><?php functions::xecho($user['entity_label']);?></td>
<?php if ($showStatus == true) {
if($showStatus == true){ if (!empty($difflist[$role_id]['users'][$i]['process_date'])) {
if(!empty($difflist[$role_id]['users'][$i]['process_date'])){ $contentDiffList .= '<td style="width:5%;"><i class="fa fa-check" aria-hidden="true" style="color:green;"></i></td>';
echo '<td style="width:5%;"><i class="fa fa-check" aria-hidden="true" style="color:green;"></i></td>'; } else {
}else{ $contentDiffList .= '<td style="width:5%;"><i class="fa fa-hourglass-half" aria-hidden="true"></i></td>';
echo '<td style="width:5%;"><i class="fa fa-hourglass-half" aria-hidden="true"></i></td>';
}
} }
}
?> $contentDiffList .= '</tr>';
</tr><?php }
} ?> $contentDiffList .= '</table>';
</table><?php }
} if (count($difflist[$role_id]['entities']) > 0) {
if(count($difflist[$role_id]['entities']) > 0) { ?> $contentDiffList .= '<table cellpadding="0" cellspacing="0" border="0" class="listingsmall liste_diff spec" style="width:100%;margin:0;">';
<table cellpadding="0" cellspacing="0" border="0" class="listingsmall liste_diff spec" style="width:100%;margin:0;"><?php
$color = ' class="col"'; $color = ' class="col"';
for ($i=0, $l=count($difflist[$role_id]['entities']);
$i<$l; for ($i = 0, $l = count($difflist[$role_id]['entities']); $i < $l; ++$i) {
$i++
) {
$entity = $difflist[$role_id]['entities'][$i]; $entity = $difflist[$role_id]['entities'][$i];
if ($color == ' class="col"') $color = ''; if ($color == ' class="col"') {
else $color = ' class="col"';?> $color = '';
<tr <?php echo $color;?> > } else {
<td style="width:15%;text-align:center;"> $color = ' class="col"';
<i class="fa fa-sitemap fa-2x" title="<?php echo _ENTITY . " " . $role_label ;?>" ></i> }
</td>
<td style="width:10%;"><?php $contentDiffList .= '<tr '.$color.'>';
/*if($entity['visible'] == 'Y') { ?> $contentDiffList .= '<td style="width:15%;text-align:center;">';
<i class="fa fa-check fa-2x" title="<?php echo _VISIBLE;?>"></i><?php $contentDiffList .= '<i class="fa fa-sitemap fa-2x" title="'._ENTITY.' '.$role_label.'"></i>';
} else {?> $contentDiffList .= '</td>';
<i class="fa fa-times fa-2x" title="<?php echo _NOT_VISIBLE;?>"></i><?php $contentDiffList .= '<td style="width:37%;">'.$entity['entity_id'].'</td>';
}*/ ?> $contentDiffList .= '<td style="width:38%;">'.$entity['entity_label'].'</td>';
</td> $contentDiffList .= '<td style="width:10%;">';
<td style="width:37%;"><?php functions::xecho($entity['entity_id']);?></td> $contentDiffList .= '</td>';
<td style="width:38%;"><?php functions::xecho($entity['entity_label']);?></td> $contentDiffList .= '</tr>';
</tr> <?php }
} ?> $contentDiffList .= '</table>';
</table><?php
} ?>
<br/><?php
} }
$contentDiffList .= '<br/>';
} }
}
if ($empty == $nb_roles) {
$contentDiffList .= '<div style="font-style:italic;text-align:center;color:#ea0000;margin:10px;">'._DIFF_LIST.' '._IS_EMPTY.'</div>';
}
$contentDiffList .= '</div>';
if($empty == $nb_roles){ echo $contentDiffList;
echo '<div style="font-style:italic;text-align:center;color:#ea0000;margin:10px;">'._DIFF_LIST.' '._IS_EMPTY.'</div>';
}
echo '</div>';
?>
...@@ -167,7 +167,6 @@ function load_listmodel( ...@@ -167,7 +167,6 @@ function load_listmodel(
}); });
} }
function change_diff_list( function change_diff_list(
origin, origin,
display_value_tr, display_value_tr,
...@@ -176,7 +175,6 @@ function change_diff_list( ...@@ -176,7 +175,6 @@ function change_diff_list(
category, category,
specific_role specific_role
) { ) {
if(category === undefined){ if(category === undefined){
category = ''; category = '';
} }
...@@ -364,4 +362,66 @@ function loadToolbarEntities(where) ...@@ -364,4 +362,66 @@ function loadToolbarEntities(where)
//alert('erreur'); //alert('erreur');
} }
}); });
}
function moveToDest(user_id,role_id,origin) {
var pos = $j('#'+user_id+'_'+role_id)[0].rowIndex;
$j('tr[id$=_dest]').after($j('#'+user_id+'_'+role_id)[0]);
console.log($j('#diffListUser_'+role_id+' tr:eq('+pos+')'));
if ($j('#diffListUser_'+role_id+' tr:eq('+pos+')').length) {
$j('#diffListUser_'+role_id+' tr:eq('+pos+')')[0].before($j('tr[id$=_dest]')[0]);
}else{
$j('#diffListUser_'+role_id)[0].append($j('tr[id$=_dest]')[0]);
}
var destUserId = $j('tr[id$=_dest]')[0].id.replace("_dest","");
$j('#'+destUserId+'_dest .movedest').append('<i class="fa fa-arrow-up" style="cursor:pointer;" title="" onclick="moveToDest(\''+destUserId+'\',\''+role_id+'\');"></i>');
$j('tr[id$=_dest]')[0].id = destUserId+'_'+role_id;
$j('#'+user_id+'_'+role_id).removeClass('col');
$j('#'+user_id+'_'+role_id+' .movedest i').remove();
$j('#'+user_id+'_'+role_id).prop('onclick',null).off('click');
$j('#'+user_id+'_'+role_id)[0].id = user_id+'_dest';
i=0;
$j("#diffListUser_"+role_id+' tr').each(function() {
$j('#'+this.id).removeClass('col');
if (i%2) {
$j('#'+this.id).addClass('col');
}
i++
});
$j.ajax({
url : 'index.php?display=true&module=entities&page=reloadListDiff',
type : 'POST',
dataType : 'JSON',
data: {
rank: pos,
origin: origin,
role_id: role_id
},
success : function(response){
if (response.status == 0) {
var userList = response.result;
} else {
alert('ERROR!');
}
},
error : function(error){
console.log('ERROR!');
}
});
} }
\ No newline at end of file
<?php
/**
* Copyright Maarch since 2008 under licence GPLv3.
* See LICENCE.txt file at the root folder for more details.
* This file is part of Maarch software.
* @brief reloadListDiff
* @author dev <dev@maarch.org>
* @ingroup entities
*/
$origin = $_REQUEST['origin'];
$role_id = $_REQUEST['role_id'];
$rank = $_REQUEST['rank'];
$oldDest = $_SESSION[$origin]['diff_list']['dest']['users'][0];
$_SESSION[$origin]['diff_list']['dest']['users'][0] = $_SESSION[$origin]['diff_list'][$role_id]['users'][$rank];
$_SESSION[$origin]['diff_list'][$role_id]['users'][$rank] = $oldDest;
echo "{\"status\" : 0}";
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment