Jump to content
Froxlor Forum
  • 0

[solved] admin_customers.php


Jeff

Question

When in the admin viewing the customers (admin_customers.php) page, I am getting the same bar graph results for both disk usage and traffic. It appears teh correct numbers are then when hovering but the correct number is not being inserted for the bard graph display. I am not sure where this is drawn in the code. I have cut the source from the page displaying to show what appears to be correct execpt for the bar graph display percentage. Any help on where is is at in the code would be great.

 

<tr>
<td>
	<strong>

		Uchtman Jeff


	 (<a href="admin_customers.php?amp;page=customers&action=su&id=1" rel="external">jfuchtm</a> | admin)
	</strong>
	<div>
		<span class="overviewcustomerextras">
			Webspace: 

				<span class="progressBar" title="30.4609 / 100 MB">

						<span>

					<em style="left: 60.92px;">30.46%</em></span>
				</span>

		</span>
		<span class="overviewcustomerextras">
			Traffic: 

				<span class="progressBar" title="0.0465 / 10 GB">

						<span>

					<em style="left: 60.92px;">30.46%</em></span>
				</span>

		</span>
		<span style="clear: both !important;">
			27.03.2011
		</span>
	</div>
</td>
<td>
	<a href="admin_customers.php?amp;page=customers&action=edit&id=1" style="text-decoration:none;">
		<img src="images/Froxlor/icons/edit.png" alt="edit" />
	</a> 
	<a href="admin_customers.php?amp;page=customers&action=delete&id=1" style="text-decoration:none;">
		<img src="images/Froxlor/icons/delete.png" alt="delete" />
	</a>
</td>
</tr>

 

froxlor.jpg

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

you pasted only the template, the calculation is made in admin_customers.php itself, please try to verify this is always true before opening a bug on the bugtracker

 

Thanks but I didn't open a bug in bugtracker. I have searchaed the admin_cusomers.php php and can't not find where this is being done at. That is the question I am asking. I don't see the line(s) for caculating the second (traffic) bar graph. Is it possible the template is grabbing the wrong information created in admin_customers.php? It appears by hovering over the traffic graph that the correct information is somewhat there.

Link to comment
Share on other sites

Thanks but I didn't open a bug in bugtracker. I have searchaed the admin_cusomers.php php and can't not find where this is being done at. That is the question I am asking. I don't see the line(s) for caculating the second (traffic) bar graph. Is it possible the template is grabbing the wrong information created in admin_customers.php? It appears by hovering over the traffic graph that the correct information is somewhat there.

 

 

This one can be marked solved. I found the error in the code and fixed it. I now have correct bars for disk space and traffic.

Link to comment
Share on other sites

I've attached your fix to some tickets, thanks for that!

 

http://redmine.froxlor.org/issues/696'>http://redmine.froxlor.org/issues/696

http://redmine.froxlor.org/issues/787'>http://redmine.froxlor.org/issues/787

 

But it would be better if you submit a ticket at http://redmine.froxlor.org/ or upload a patch because a lot of reports & requestes here don't transfered to the DEVs.

Link to comment
Share on other sites

maybe you can share your solution?

 

In admin_customer.php under root starting with line 117 from

				 * percent-values for progressbar
			 */
			if ($row['diskspace'] > 0) {
				$percent = round(($row['diskspace_used']*100)/$row['diskspace'], 2);
				$doublepercent = round($percent*2, 2);
			} else {
				$percent = 0;
				$doublepercent = 0;
			}

to

				 * percent-values for progressbar
			 */
			if ($row['diskspace'] > 0) {
				$diskspacepercent = round(($row['diskspace_used']*100)/$row['diskspace'], 2);
				$diskspacedoublepercent = round($diskspacepercent*2, 2);
			} else {
				$diskspacepercent = 0;
				$diskspacedoublepercent = 0;
			}

			if ($row['traffic'] > 0) {
				$trafficpercent = round(($row['traffic_used']*100)/$row['traffic'], 2);
				$trafficdoublepercent = round($trafficpercent*2, 2);
			} else {
				$trafficpercent = 0;
				$trafficdoublepercent = 0;
			}

 

In the template under root/templates/Froxlor/admin/customers change customers_customer.tpl starting at line 13 from

			<span class="overviewcustomerextras">
			Webspace: 
			<if $row['diskspace'] != 'UL'>
				<span class="progressBar" title="{$row['diskspace_used']} / {$row['diskspace']} MB">
					<if (($row['diskspace']/100)*(int)$settings['system']['report_webmax']) < $row['diskspace_used']>
						<span class="redbar">
					<else>
						<span>
					</if>
					<em style="left: {$doublepercent}px;">{$percent}%</em></span>
				</span>
			<else>
				<span class="progressBar" title="{$lng['customer']['unlimited']}">
					<span class="greybar"><em style="left: 200px;">100%</em></span>
				</span>
			</if>
		</span>
		<span class="overviewcustomerextras">
			Traffic: 
			<if $row['traffic'] != 'UL'>
				<span class="progressBar" title="{$row['traffic_used']} / {$row['traffic']} GB">
					<if (($row['traffic']/100)*(int)$settings['system']['report_trafficmax']) < $row['traffic_used']>
						<span class="redbar">
					<else>
						<span>
					</if>
					<em style="left: {$doublepercent}px;">{$percent}%</em></span>
				</span>
			<else>
				<span class="progressBar" title="{$lng['customer']['unlimited']}">
					<span class="greybar"><em style="left: 200px;">100%</em></span>
				</span>
			</if>
		</span>

to

		        <span class="overviewcustomerextras">
			Webspace: 
			<if $row['diskspace'] != 'UL'>
				<span class="progressBar" title="{$row['diskspace_used']} / {$row['diskspace']} MB">
					<if (($row['diskspace']/100)*(int)$settings['system']['report_webmax']) < $row['diskspace_used']>
						<span class="redbar">
					<else>
						<span>
					</if>
					<em style="left: {$diskspacedoublepercent}px;">{$diskspacepercent}%</em></span>
				</span>
			<else>
				<span class="progressBar" title="{$lng['customer']['unlimited']}">
					<span class="greybar"><em style="left: 200px;">100%</em></span>
				</span>
			</if>
		</span>
		<span class="overviewcustomerextras">
			Traffic: 
			<if $row['traffic'] != 'UL'>
				<span class="progressBar" title="{$row['traffic_used']} / {$row['traffic']} GB">
					<if (($row['traffic']/100)*(int)$settings['system']['report_trafficmax']) < $row['traffic_used']>
						<span class="redbar">
					<else>
						<span>
					</if>
					<em style="left: {$trafficdoublepercent}px;">{$trafficpercent}%</em></span>
				</span>
			<else>
				<span class="progressBar" title="{$lng['customer']['unlimited']}">
					<span class="greybar"><em style="left: 200px;">100%</em></span>
				</span>
			</if>
		 </span>

 

Both progress bars now work independently and accurately.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...