2 /*********************************************************************************
3 * SugarCRM Community Edition is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
6 * This program is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU Affero General Public License version 3 as published by the
8 * Free Software Foundation with the addition of the following permission added
9 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
11 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
18 * You should have received a copy of the GNU Affero General Public License along with
19 * this program; if not, see http://www.gnu.org/licenses or write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
24 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26 * The interactive user interfaces in modified source and object code versions
27 * of this program must display Appropriate Legal Notices, as required under
28 * Section 5 of the GNU Affero General Public License version 3.
30 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31 * these Appropriate Legal Notices must retain the display of the "Powered by
32 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
33 * technical reasons, the Appropriate Legal Notices must display the words
34 * "Powered by SugarCRM".
35 ********************************************************************************/
39 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
41 function progress_bar_flush()
50 function display_flow_bar($name,$delay, $size=200)
53 echo "<div id='{$name}_flow_bar'><table class='list view' cellpading=0 cellspacing=0><tr><td id='{$name}_flow_bar0' width='{$chunk}px' bgcolor='#cccccc' align='center'> </td><td id='{$name}_flow_bar1' width='{$chunk}px' bgcolor='#ffffff' align='center'> </td><td id='{$name}_flow_bar2' width='{$chunk}px' bgcolor='#ffffff' align='center'> </td><td id='{$name}_flow_bar3' width='{$chunk}px' bgcolor='#ffffff' align='center'> </td><td id='{$name}_flow_bar4' width='{$chunk}px' bgcolor='#ffffff' align='center'> </td></tr></table></div><br>";
55 echo str_repeat(' ',256);
58 start_flow_bar($name, $delay);
61 function start_flow_bar($name, $delay)
64 $timer_id = $name . '_id';
66 function update_flow_bar(name, count){
67 var last = (count - 1) % 5;
70 eval(\"document.getElementById('\" + name+\"_flow_bar\" + last+\"').style.backgroundColor='#ffffff';\");
71 eval(\"document.getElementById('\" + name+\"_flow_bar\" + cur+\"').style.backgroundColor='#cccccc';\");
72 $timer_id = setTimeout(\"update_flow_bar('$name', \" + next + \")\", $delay);
74 var $timer_id = setTimeout(\"update_flow_bar('$name', 1)\", $delay);
78 echo str_repeat(' ',256);
83 function destroy_flow_bar($name)
85 $timer_id = $name . '_id';
86 echo "<script>clearTimeout($timer_id);document.getElementById('{$name}_flow_bar').innerHTML = '';</script>";
87 echo str_repeat(' ',256);
92 function display_progress_bar($name,$current, $total)
94 $percent = $current/$total * 100;
95 $remain = 100 - $percent;
96 $status = floor($percent);
97 //scale to a larger size
106 echo "<div id='{$name}_progress_bar' style='width: 50%;'><table class='list view' cellpading=0 cellspacing=0><tr><td id='{$name}_complete_bar' width='{$percent}px' bgcolor='#cccccc' align='center'>$status% </td><td id='{$name}_remain_bar' width={$remain}px' bgcolor='#ffffff'> </td></tr></table></div><br>";
108 echo "<script>document.getElementById('{$name}_complete_bar').style.backgroundColor='#ffffff';</script>";
110 echo str_repeat(' ',256);
112 progress_bar_flush();
115 function update_progress_bar($name,$current, $total)
117 $percent = $current/$total * 100;
118 $remain = 100 - $percent;
119 $status = floor($percent);
120 //scale to a larger size
127 echo "<script>document.getElementById('{$name}_remain_bar').style.backgroundColor='#cccccc';</script>";
130 echo "<script>document.getElementById('{$name}_remain_bar').style.backgroundColor='#ffffff';</script>";
131 echo "<script>document.getElementById('{$name}_complete_bar').style.backgroundColor='#ffffff';</script>";
134 echo "<script>document.getElementById('{$name}_complete_bar').style.backgroundColor='#cccccc';</script>";
143 document.getElementById('{$name}_complete_bar').width='{$percent}px';
144 document.getElementById('{$name}_complete_bar').innerHTML = '$status%';
145 document.getElementById('{$name}_remain_bar').width='{$remain}px';
147 progress_bar_flush();