6 Replies Latest reply on May 16, 2016 9:36 AM by kbolt

    Show Quota Bytes as Megabytes?

    kbolt

      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. Re: Show Quota Bytes as Megabytes?
          darkfell

          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

          • 2. Re: Show Quota Bytes as Megabytes?
            kbolt

            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?

            • 3. Re: Re: Show Quota Bytes as Megabytes?
              darkfell

              Screenshot

              2016-05-12_092735.png

              2016-05-12_090928.png

              And template

              • 4. Re: Re: Show Quota Bytes as Megabytes?
                kbolt

                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/$<propertyInstanc e 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=QuotaPlug in&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</strin g>

                      <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-->

                • 5. Re: Re: Re: Show Quota Bytes as Megabytes?
                  darkfell

                  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

                  • 6. Re: Re: Re: Show Quota Bytes as Megabytes?
                    kbolt

                    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!