Commit 3e3d4424 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

provide a wait to user if too long to calculate the size of projects/runs

parent 0d75b4b9
...@@ -131,14 +131,14 @@ class tx_nG6_pi1 extends tslib_pibase { ...@@ -131,14 +131,14 @@ class tx_nG6_pi1 extends tslib_pibase {
$smarty->security_settings['MODIFIER_FUNCS'] = array('count'); $smarty->security_settings['MODIFIER_FUNCS'] = array('count');
// Add some information to the table // Add some information to the table
$project_size = 0; $project_ids = "";
foreach($projects as $project_id => $project_values) { foreach($projects as $project_id => $project_values) {
if (tx_nG6_db::is_super_user($GLOBALS['TSFE']->fe_user->user['usergroup'], 'project', $project_values['id']) ) { if (tx_nG6_db::is_super_user($GLOBALS['TSFE']->fe_user->user['usergroup'], 'project', $project_values['id']) ) {
$projects[$project_id]['superuser'] = true; $projects[$project_id]['superuser'] = true;
} else { } else {
$projects[$project_id]['superuser'] = false; $projects[$project_id]['superuser'] = false;
} }
$project_size += tx_nG6_db::get_project_size($project_values['id'], $this->conf["data"], $GLOBALS['TSFE']->fe_user->user['usergroup']); $project_ids .= $project_values['id'].",";
$projects[$project_id]['href'] = $this->pi_list_linkSingle($project_values['name'],$project_values['id'],1, array('project_id'=>$project_values['id'])); $projects[$project_id]['href'] = $this->pi_list_linkSingle($project_values['name'],$project_values['id'],1, array('project_id'=>$project_values['id']));
} }
$smarty->assign('projects', $projects); $smarty->assign('projects', $projects);
...@@ -146,7 +146,7 @@ class tx_nG6_pi1 extends tslib_pibase { ...@@ -146,7 +146,7 @@ class tx_nG6_pi1 extends tslib_pibase {
$smarty->assign('user_group', $GLOBALS['TSFE']->fe_user->user['usergroup']); $smarty->assign('user_group', $GLOBALS['TSFE']->fe_user->user['usergroup']);
$smarty->assign('data_folder', $this->conf["data"]); $smarty->assign('data_folder', $this->conf["data"]);
$smarty->assign('server_name', $this->conf["server_name"]); $smarty->assign('server_name', $this->conf["server_name"]);
$smarty->assign('project_size', tx_nG6_utils::get_octet_string_representation($project_size)); $smarty->assign('project_ids', substr($project_ids,0,-1));
// If it's a single project, add runs and analysis information // If it's a single project, add runs and analysis information
if (count($projects) == 1) { if (count($projects) == 1) {
...@@ -204,19 +204,19 @@ class tx_nG6_pi1 extends tslib_pibase { ...@@ -204,19 +204,19 @@ class tx_nG6_pi1 extends tslib_pibase {
$smarty->security_settings['MODIFIER_FUNCS'] = array('count'); $smarty->security_settings['MODIFIER_FUNCS'] = array('count');
// Add some information to the table // Add some information to the table
$run_size = 0; $run_ids = "";
foreach($runs as $run_id => $run_values) { foreach($runs as $run_id => $run_values) {
if (tx_nG6_db::is_super_user($GLOBALS['TSFE']->fe_user->user['usergroup'], 'run', $run_values['id']) ) { if (tx_nG6_db::is_super_user($GLOBALS['TSFE']->fe_user->user['usergroup'], 'run', $run_values['id']) ) {
$runs[$run_id]['superuser'] = true; $runs[$run_id]['superuser'] = true;
} else { } else {
$runs[$run_id]['superuser'] = false; $runs[$run_id]['superuser'] = false;
} }
$run_ids .= $run_values['id'].",";
if ($this->piVars['project_id']) { if ($this->piVars['project_id']) {
$runs[$run_id]['href'] = $this->pi_list_linkSingle($run_values['name'],$run_values['id'],1, array('run_id'=>$run_values['id'], 'project_id'=>$run_values['project_id'])); $runs[$run_id]['href'] = $this->pi_list_linkSingle($run_values['name'],$run_values['id'],1, array('run_id'=>$run_values['id'], 'project_id'=>$run_values['project_id']));
} else { } else {
$runs[$run_id]['href'] = $this->pi_list_linkSingle($run_values['name'],$run_values['id'],1, array('run_id'=>$run_values['id'])); $runs[$run_id]['href'] = $this->pi_list_linkSingle($run_values['name'],$run_values['id'],1, array('run_id'=>$run_values['id']));
} }
$run_size += tx_nG6_db::get_run_size($run_values['id'], $this->conf["data"], $GLOBALS['TSFE']->fe_user->user['usergroup']);
} }
$smarty->assign('runs', $runs); $smarty->assign('runs', $runs);
$smarty->assign('first_id', key($runs)); $smarty->assign('first_id', key($runs));
...@@ -224,7 +224,7 @@ class tx_nG6_pi1 extends tslib_pibase { ...@@ -224,7 +224,7 @@ class tx_nG6_pi1 extends tslib_pibase {
$smarty->assign('user_group', $GLOBALS['TSFE']->fe_user->user['usergroup']); $smarty->assign('user_group', $GLOBALS['TSFE']->fe_user->user['usergroup']);
$smarty->assign('data_folder', $this->conf["data"]); $smarty->assign('data_folder', $this->conf["data"]);
$smarty->assign('server_name', $this->conf["server_name"]); $smarty->assign('server_name', $this->conf["server_name"]);
$smarty->assign('run_size', tx_nG6_utils::get_octet_string_representation($run_size)); $smarty->assign('run_ids', substr($run_ids,0,-1));
// If it's a single run, add analysis information // If it's a single run, add analysis information
if (count($runs) == 1) { if (count($runs) == 1) {
......
...@@ -61,7 +61,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ...@@ -61,7 +61,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<input type="hidden" id="DataTables_pagination_next" value="{$llang.DataTables_pagination_next}" /> <input type="hidden" id="DataTables_pagination_next" value="{$llang.DataTables_pagination_next}" />
<input type="hidden" id="DataTables_pagination_previous" value="{$llang.DataTables_pagination_previous}" /> <input type="hidden" id="DataTables_pagination_previous" value="{$llang.DataTables_pagination_previous}" />
<input type="hidden" id="data_folder" value="{$data_folder}" /> <input type="hidden" id="data_folder" value="{$data_folder}" />
<input type="hidden" id="view" value="project" />
<input type="hidden" id="ids" value="{$project_ids}" />
{* If no project can be displayed *} {* If no project can be displayed *}
{if $projects|@count == 0 } {if $projects|@count == 0 }
...@@ -74,6 +76,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ...@@ -74,6 +76,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<p><strong>{$projects[key($projects)].description}</strong> <br /> <p><strong>{$projects[key($projects)].description}</strong> <br />
{(($llang.run_analysis_project_desc|replace:"###PROJECT_NAME###":$projects[key($projects)].name)|replace:"###NB_RUN###":($project_runs|@count))|replace:"###NB_ANALYSIS###":($project_analysis|@count)} {(($llang.run_analysis_project_desc|replace:"###PROJECT_NAME###":$projects[key($projects)].name)|replace:"###NB_RUN###":($project_runs|@count))|replace:"###NB_ANALYSIS###":($project_analysis|@count)}
<br /> <br />
{assign var="project_size" value="<span id='size' class='tx-nG6-mini-wait'></span>"}
{($llang.project_desc|replace:"###PROJECT_SIZE###":"<strong>###PROJECT_SIZE###</strong>")|replace:"###PROJECT_SIZE###":$project_size} {($llang.project_desc|replace:"###PROJECT_SIZE###":"<strong>###PROJECT_SIZE###</strong>")|replace:"###PROJECT_SIZE###":$project_size}
</p> </p>
</div> </div>
...@@ -207,6 +210,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ...@@ -207,6 +210,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<p> <p>
{$llang.list_project_desc|replace:"###NB_PROJECT###":($projects|@count)} {$llang.list_project_desc|replace:"###NB_PROJECT###":($projects|@count)}
<br /> <br />
{assign var="project_size" value="<span id='size' class='tx-nG6-mini-wait'></span>"}
{($llang.list_project_size_desc|replace:"###PROJECT_SIZE###":"<strong>###PROJECT_SIZE###</strong>")|replace:"###PROJECT_SIZE###":$project_size} {($llang.list_project_size_desc|replace:"###PROJECT_SIZE###":"<strong>###PROJECT_SIZE###</strong>")|replace:"###PROJECT_SIZE###":$project_size}
</p> </p>
</div> </div>
......
...@@ -57,6 +57,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ...@@ -57,6 +57,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<input type="hidden" id="DataTables_pagination_previous" value="{$llang.DataTables_pagination_previous}" /> <input type="hidden" id="DataTables_pagination_previous" value="{$llang.DataTables_pagination_previous}" />
<input type="hidden" id="data_folder" value="{$data_folder}" /> <input type="hidden" id="data_folder" value="{$data_folder}" />
<input type="hidden" id="view" value="run" />
<input type="hidden" id="ids" value="{$run_ids}" />
{* If no runs can be displayed *} {* If no runs can be displayed *}
{if $runs|@count == 0 } {if $runs|@count == 0 }
...@@ -73,6 +75,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ...@@ -73,6 +75,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{($llang.single_analysis_run_desc|replace:"###RUN_NAME###":$runs[$first_id].name)|replace:"###NB_ANALYSIS###":($run_analysis|@count)} {($llang.single_analysis_run_desc|replace:"###RUN_NAME###":$runs[$first_id].name)|replace:"###NB_ANALYSIS###":($run_analysis|@count)}
{/if} {/if}
<br /> <br />
{assign var="run_size" value="<span id='size' class='tx-nG6-mini-wait'></span>"}
{($llang.run_desc|replace:"###RUN_SIZE###":"<strong>###RUN_SIZE###</strong>")|replace:"###RUN_SIZE###":$run_size} {($llang.run_desc|replace:"###RUN_SIZE###":"<strong>###RUN_SIZE###</strong>")|replace:"###RUN_SIZE###":$run_size}
</p> </p>
</div> </div>
...@@ -175,6 +178,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ...@@ -175,6 +178,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<p> <p>
{$llang.list_run_desc|replace:"###NB_RUN###":($runs|@count)} {$llang.list_run_desc|replace:"###NB_RUN###":($runs|@count)}
<br /> <br />
{assign var="run_size" value="<span id='size' class='tx-nG6-mini-wait'></span>"}
{($llang.run_desc|replace:"###RUN_SIZE###":"<strong>###RUN_SIZE###</strong>")|replace:"###RUN_SIZE###":$run_size} {($llang.run_desc|replace:"###RUN_SIZE###":"<strong>###RUN_SIZE###</strong>")|replace:"###RUN_SIZE###":$run_size}
</p> </p>
</div> </div>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment