cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Level 10
Report Inappropriate Content
Message 1 of 7

Show Quota Bytes as Megabytes?

Jump to solution

Hello all. Is there any way I could convert the bytes shown in the photo to MB or some other unit that'd make it easier to inform users of their remaining quota?

20150423_162901.jpg

1 Solution

Accepted Solutions
Highlighted

Re: Re: Show Quota Bytes as Megabytes?

Jump to solution

Screenshot

2016-05-12_092735.png

2016-05-12_090928.png

And template

View solution in original post

6 Replies
Highlighted

Re: Show Quota Bytes as Megabytes?

Jump to solution

Try replacing $Number.ToString$ on it:


<script type="text/javascript">


  document.write(Math.round(($Quota.Volume.RemainingDay$/1048576*100000)/100000));


</script> MB



<script type="text/javascript">


  document.write(Math.round(($Quota.Volume.RemainingWeek$/1048576*100000)/100000));


</script> MB



<script type="text/javascript">


  document.write(Math.round(($Quota.Volume.RemainingMonth$/1048576*100000)/100000));


</script> MB



Highlighted
Level 10
Report Inappropriate Content
Message 3 of 7

Re: Show Quota Bytes as Megabytes?

Jump to solution

First off, I'm late by a year or so, I know. My apologies. Highers ups decided to scrap the project but now it's back to life, so thanks for your patience? This fix you suggested seems to show nothing where the value should show up so the result is just Remaining quota per day: MB.

Is there some other part of the block page HTML that I should edit?

Highlighted

Re: Re: Show Quota Bytes as Megabytes?

Jump to solution

Screenshot

2016-05-12_092735.png

2016-05-12_090928.png

And template

View solution in original post

Highlighted
Level 10
Report Inappropriate Content
Message 5 of 7

Re: Re: Show Quota Bytes as Megabytes?

Jump to solution

Thanks!

I've tried the script outside of MWG HTML and it works fine so I imagine the problem is from the $Header.Block.Get$ property. My property is currently Number.ToString(Quota.Volume.RemainingDay).


Below is my current HTML page. I haven't seen much wrong with the page. Would you be able to point me in the right direction?


<!-- FileName: VolumeSessionExceeded.html


     Language: [en]


-->


<!--Title-->


<table class='titleTable' background='$<propertyInstance useMostRecentConfiguration="false" propertyId="com.scur.engine.system.proxy.enduserurl"/>$/files/$<propertyInstance useMostRecentConfiguration="false" propertyId="com.scur.engine.proxy.message.collection"/>$/img/bg_navbar.jpg'>


  <tr>


    <td class='titleData'>


      Starting new Volume Session


    </td>


  </tr>


</table>


<!--/Title-->




<!--Content-->


<table class="contentTable">


  <tr>


    <td class="contentData">


     If you want to continue the volume session please confirm  with pushing the button "<b>Yes, I want to continue the session!</b>". After pushing the button you will be navigated to the original URL.<br /><b>Please note: </b><br />If you continue a volume session, your volume quota will be reduced during the session!


      <br />


    </td>


  </tr>


</table>


<!--/Content-->




<!--Info-->


<table class='infoTable'>


  <form id="activateform" method="post">


  <tr>


    <td class='confirmData'>


      <b>Please confirm: </b>


    </td>


    <td class='formData'>


      <input class="button" type="button" id="activatebutton" value="Yes, I want to continue the session!" onClick="$<propertyInstance useMostRecentConfiguration="false" propertyId="com.scur.engine.volquota.js.activatesession"/>$">


      <br />


    </td>


  </tr>


</form>


</table>


<table class='infoTable'>


  <tr>


    <td class='infoData'>


      <br />


      <b>URL: </b>


        <script type="text/javascript">


          computeLastQuotaURL("$<propertyInstance useMostRecentConfiguration="false" propertyId="com.scur.engine.system.url.raw"/>$","$<propertyInstance useMostRecentConfiguration="false" propertyId="com.scur.engine.system.proxy.enduserurl"/>$/plugin?target=QuotaPlugin&quotatype=");


        </script>


    </td>


  </tr>


  <tr>


    <td class='infoData'>


      <br />


        <script type="text/javascript">


          writeToDocument("<b>URL Categories: </b>" + "$<propertyInstance useMostRecentConfiguration="false" propertyId="com.scur.engine.trustedsource.categorylist.tostring">


  <parameters>


    <entry>


      <string>com.scur.engine.trustedsource.categorylist.tostring.categorylist</string>


      <parameter valueTyp="2">


        <value>


          <propertyInstance useMostRecentConfiguration="true" propertyId="com.scur.engine.trustedsource.url.categories"/>


        </value>


      </parameter>


    </entry>


  </parameters>


</propertyInstance>$" );


        </script>


    </td>


  </tr>


  <tr>


    <td class='infoData'>


      <b>Quota Type: </b>Volume Quota


      <br />


      <b>Remaining quota per day: </b>


  <!-- Header.Block.Get("X-Quota-RemainingDay") -->


  <script type="text/javascript">


  document.write(Math.round($<propertyInstance useMostRecentConfiguration="false" propertyId="com.scur.engine.headerfilter.block.headers.getheader">


  <parameters>


    <entry>


      <string>com.scur.engine.headerfilter.block.headers.getheader.headername</string>


      <parameter valueTyp="2">


        <value>


          <propertyInstance useMostRecentConfiguration="false" propertyId="com.scur.engine.stringfilter.number.tostring">


            <parameters>


              <entry>


                <string>com.scur.engine.stringfilter.number.tostring.number</string>


                <parameter valueTyp="2">


                  <value>


                    <propertyInstance useMostRecentConfiguration="true" propertyId="com.scur.engine.volquota.remainingday"/>


                  </value>


                </parameter>


              </entry>


            </parameters>


          </propertyInstance>


        </value>


      </parameter>


    </entry>


  </parameters>


</propertyInstance>$/1048576));


  </script> MB


      <br />


      <b>Remaining quota per week: </b>$<propertyInstance useMostRecentConfiguration="false" propertyId="com.scur.engine.stringfilter.number.tostring">


  <parameters>


    <entry>


      <string>com.scur.engine.stringfilter.number.tostring.number</string>


      <parameter valueTyp="2">


        <value>


          <propertyInstance useMostRecentConfiguration="true" propertyId="com.scur.engine.volquota.remainingweek"/>


        </value>


      </parameter>


    </entry>


  </parameters>


</propertyInstance>$ bytes


      <br />


      <b>Remaining quota per month: </b>$<propertyInstance useMostRecentConfiguration="false" propertyId="com.scur.engine.stringfilter.number.tostring">


  <parameters>


    <entry>


      <string>com.scur.engine.stringfilter.number.tostring.number</string>


      <parameter valueTyp="2">


        <value>


          <propertyInstance useMostRecentConfiguration="true" propertyId="com.scur.engine.volquota.remainingmonth"/>


        </value>


      </parameter>


    </entry>


  </parameters>


</propertyInstance>$ bytes


      <br />


    </td>


  </tr>


</table>


<!--/Info-->


Highlighted

Re: Re: Re: Show Quota Bytes as Megabytes?

Jump to solution

Sorry, my mistake. Forgot to add, you'll first need to add events (x-header) to the rule

2016-05-14_111212.jpg

and then edit the template as I have above in the message

Highlighted
Level 10
Report Inappropriate Content
Message 7 of 7

Re: Re: Re: Show Quota Bytes as Megabytes?

Jump to solution

Oh, awesome! I didn't know that was possible, you've basically created your own variables for use in the HTML page. I'll have to try this out elsewhere. Thank you!

You Deserve an Award
Don't forget, when your helpful posts earn a kudos or get accepted as a solution you can unlock perks and badges. Those aren't the only badges, either. How many can you collect? Click here to learn more.

Community Help Hub

    New to the forums or need help finding your way around the forums? There's a whole hub of community resources to help you.

  • Find Forum FAQs
  • Learn How to Earn Badges
  • Ask for Help
Go to Community Help

Join the Community

    Thousands of customers use the McAfee Community for peer-to-peer and expert product support. Enjoy these benefits with a free membership:

  • Get helpful solutions from McAfee experts.
  • Stay connected to product conversations that matter to you.
  • Participate in product groups led by McAfee employees.
Join the Community
Join the Community