configure quota webmail roundcube

Discussion in 'Installation/Configuration' started by shynma, Oct 4, 2007.

  1. shynma

    shynma New Member

    Hello excuse my English.
    I install debian perfect server etch 4 and ispconfig. I install roundcube package but i can't configure the quota in webmail client "Disk usage: unlimited".
    Could you tell me how configure the webmail client if I want to view "Dik usage: xxxMb"
    Thanks!!
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    You can not configure quota in the webmail client, quota is configured in the email user settings in ISPconfig.
     
  3. shynma

    shynma New Member

    Yes, i configure in ISPConfig but in webmail client it puts "Disk usage: unlimited". I like what in "Disk usage:" it puts the quota user.
    thanks.
     
  4. Tripple

    Tripple New Member

    Same setup here, same quota message.
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Roundcube is not a part of ISPConfig, its a third party package. You might aslk the roundcube developers if they want to implement support for linux quota.
     
  6. Tripple

    Tripple New Member

    Where can a user check his disk space?
    Not here: domain.com:81/mailuser/ You can only see the maximum.

    With UebiMiau Webmail, there's a theme that shows the quota.
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    UebiMiau has a patch for ISPConfig to show the quota, thats one of the reasons why UebiMiau is the only supported webmail app. Such a patch does not exits for roundcube.
     
  8. shynma

    shynma New Member

    Thanks for your help.

    ok. more thanks
     
  9. Tripple

    Tripple New Member

    If roundcube is not supported, why is there a link on the ISPConfig webpage to download this tool. Looks confusing to me.
     
  10. jnsc

    jnsc rotaredoM Moderator

    The difference is in the fact that UebiMiau is under the Tools & Add-ons section and roundcube under Third-Party Tools & Add-ons, which means that's it's not officially supported.

    Regards
     
  11. luchs3

    luchs3 New Member

    How does this patch work?

    Is it possible to adapt it for RC?
    In wich language is it written?
     
  12. bswinnerton

    bswinnerton New Member

    Not to bring back an old post, but I thought maybe something had changed from the old versions of ISPConfig until now.

    Roundcube still uses this feature, Disk Usage:.. and it just states that it is unlimited.

    So I believe what has to be done is that you have to configure imap to use quota. How would we go about doing that?

    Thanks everyone
     
  13. johnwilson1969

    johnwilson1969 New Member

    Quick and Dirty Hack to get Roundcube to Show Quota Usage in ISPCONFIG2

    I hammered this out today, just as a test. Need to refine and rewrite....

    ** Fixed error caused by quota output containing varying number of spaces as quota changes
    ** added comments for clarity

    This is version 0.3.2

    Basically, I am highjacking what is already there, pulling the username from roundcube, doing a quota query using the shell and returning the results back to roundcube.

    1. Open 'program/steps/mail/func.inc
    2. replace rcmail_quota_content function with the following:

    Code:
    function rcmail_quota_content($attrib)
      {
      global $RCMAIL;
     
      #get user name from roundcube
      $temp = $RCMAIL->user->get_username();
      $tempboom = explode ('@', $temp);
      $qusern=$tempboom[0];
    
      #run quota on user name
      $output= shell_exec("/usr/bin/quota " . $qusern);
      # remove consecutive spaces
      $output = ereg_replace("[ \t\n\r]+", " ", $output);
      #split apart
      $parts = explode(" ",$output);
      #calculate 
      $out = 35 - round(($parts[17] * 1024)/1048576);
      $quota_result = $out . "MB";
      
      return $quota_result;
      }
    Note: I set all my user quotas to 35M, change this to reflect your needs or remove to show usage.

    3. Open /skins/default/templates/main.html

    4. look for <div id="listcontrols"> (should be around line 74)

    change the last span to:
    Code:
    <span style="margin-left: 20px; margin-right: 5px">Storage Space Remaining:</span>
    <roundcube:object name="quotaDisplay" id="quotadisplay" />
    
    5. This needs to be cleaned up to be an actual option, maybe add a database query to get the actual user quota from either the database or from the results of the quota query.

    6. Double check for typos, etc. if you need any help, send me a message.

    NOTE: this is mainly a proof of concept, a starting point. I am using this on a production machine, but it has very low volume of users.

    Anyone that can help continue, please please do.
     
    Last edited: Jan 23, 2010
  14. johnwilson1969

    johnwilson1969 New Member

    Changes Quota working in Roundcube Stable: 0.4.2 for ISPConfig 2

    edit: program/steps/mail/func.inc

    replace the following function

    Unlike 0.3, No other changes required on this version.
    Would love to automate the retrieval of the individual quota settings, but do not have the time right now. Currently set to 35M, change value to your standard quota setting.


    Code:
    function rcmail_quota_content($attrib=NULL)
      {
      global $COMM_PATH, $RCMAIL;
    
      #### MOD STARTS HERE
      #$quota = $RCMAIL->imap->get_quota();
      #$quota = $RCMAIL->plugins->exec_hook('quota', $quota);
    
      #$quota_result = (array) $quota;
      $quota_result['type'] = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : '';
    
      #get user name from roundcube
      $temp = $RCMAIL->user->get_username();
      $tempboom = explode ('@', $temp);
      $qusern=$tempboom[0];
    
      #run quota on user name
      $output= shell_exec("/usr/bin/quota " . $qusern);
      # remove consecutive spaces
      $output = ereg_replace("[ \t\n\r]+", " ", $output);
      #split apart
      $parts = explode(" ",$output);
      #This is what you assign to your users
      $quota['total'] = 35000; 
      #get amount used
      $quota['used'] = round($parts[17]);
      #### MOD ENDS HERE
      
      if (!$quota['total'] && $RCMAIL->config->get('quota_zero_as_unlimited')) {
        $quota_result['title'] = rcube_label('unlimited');
        $quota_result['percent'] = 0;
        }
      else if ($quota['total']) {
        if (!isset($quota['percent']))
          $quota_result['percent'] = min(100, round(($quota['used']/max(1,$quota['total']))*100));
    
        $title = sprintf('%s / %s (%.0f%%)',
            show_bytes($quota['used'] * 1024), show_bytes($quota['total'] * 1024),
            $quota_result['percent']);
    
        $quota_result['title'] = $title;
    
        if ($attrib['width'])
          $quota_result['width'] = $attrib['width'];
        if ($attrib['height'])
          $quota_result['height']	= $attrib['height'];
        }
      else {
        $quota_result['title'] = rcube_label('unknown');
        $quota_result['percent'] = 0;
        }
    
      return $quota_result;
      }
     

Share This Page