small note: the second patch is to be applied on the src/ directory 

> -----Original Message-----
> From: Rodrigo Borges Pereira [mailto:[EMAIL PROTECTED] 
> Sent: ter�a-feira, 7 de Setembro de 2004 18:24
> To: [EMAIL PROTECTED]
> Subject: [users] List domains by first letter (includes code)
> 
> While i'm at it..
> 
> Very often i like to list domains by their first letter. That 
> sould be easy to do. Click on a letter and list only those 
> that match. Search does not allow me this, but the form could 
> support regexps, allowing to search something like "^a". But 
> that way i would need to type the expression on the form, 
> instead of one click. To ease my life, i created a couple of 
> patches that do the job for me. Removed some custom css 
> styles though, might need tweaking for the font style. Be 
> careful with the letter links line.. it's a whole line!
> 
> Warning: i only tested this as a senior_admin.
> 
> 
> ---cut here---
> --- templates/list_domains.tpl    2004-04-25 16:34:05.000000000 +0100
> +++ templates/list_domains.new    2004-09-07 18:26:43.000000000 +0100
> @@ -28,6 +28,12 @@
>  
>                  </td>
>                  </tr>
> +               <tr>
> +                <td align="center" colspan="6" width=100%> <a 
> +href="{$all_url}">ALL</a> | <a 
> href="{$all_url}&scope=num">0-9</a> | <a
> href="{$all_url}&scope=a">A</a> | <a 
> href="{$all_url}&scope=b">B</a> | <a 
> href="{$all_url}&scope=c">C</a> | <a 
> href="{$all_url}&scope=d">D</a> | <a 
> href="{$all_url}&scope=e">E</a> | <a 
> href="{$all_url}&scope=f">F</a> | <a 
> href="{$all_url}&scope=g">G</a> | <a 
> href="{$all_url}&scope=h">H</a> | <a 
> href="{$all_url}&scope=i">I</a> | <a 
> href="{$all_url}&scope=j">J</a> | <a 
> href="{$all_url}&scope=k">K</a> | <a 
> href="{$all_url}&scope=l">L</a> | <a 
> href="{$all_url}&scope=m">M</a> | <a 
> href="{$all_url}&scope=n">N</a> | <a 
> href="{$all_url}?&scope=o">O</a> | <a 
> href="{$all_url}&scope=p">P</a> | <a 
> href="{$all_url}&scope=q">Q</a> | <a 
> href="{$all_url}&scope=r">R</a> | <a 
> href="{$all_url}&scope=s">S</a> | <a 
> href="{$all_url}&scope=t">T</a> | <a 
> href="{$all_url}&scope=u">U</a> | <a 
> href="{$all_url}&scope=v">V</a> | <a 
> href="{$all_url}&scope=x">X</a> | <a 
> href="{$all_url}&scope=y">Y</a> | <a 
> href="{$all_url}&scope=w">W</a> | <a href="{$all_url}&scope=z">Z</a>
> +                </td>
> +               </tr>
> +
>              </table>
> --- cut here ---
> 
> 
> --- cut here ---
> --- domains.php 2004-06-18 04:45:48.000000000 +0100
> +++ domains.new 2004-09-07 19:20:47.000000000 +0100
> @@ -46,14 +46,36 @@
>          $search = "";
>      }
>  
> +    // Get scope of domain list, if it exists
> +    if(isset($_REQUEST['scope']) && $_REQUEST['scope'] != "") {
> +        $searchstring = "";
> +        $search = "";
> +        $scope = $_REQUEST['scope'];
> +        $smarty->assign('scope', $_REQUEST['scope']);
> +
> +        if($user_info['Account_Type'] == 'senior_admin') {
> +                $aux = "where";
> +        } else {
> +                $aux = "and";
> +        }
> +
> +        if($scope != "num") {
> +                $sq = "$aux domain regexp \"^[$scope" . 
> + strtoupper($scope)
> . "]\"";
> +        } else {
> +                $sq = "$aux domain regexp \"^[0-9]\"";
> +        }
> +    } else {
> +        $sq = "";
> +    }
> +
>      // Show domain list
>  
>      if($user_info['Account_Type'] == 'senior_admin') {
> -        $q = "select * from domains $searchstring order by 
> status desc,
> domain";
> +        $q = "select * from domains $searchstring $sq order 
> by status 
> + desc,
> domain";
>      } else if($user_info['Account_Type'] == 'group_admin') {
> -        $q = "select * from domains where $searchstring owner_id =
> '".$user_info['cid']."' or group_owner_id = 
> '".$user_info['cid']."' order by status desc, domain";
> +        $q = "select * from domains where $searchstring owner_id =
> '".$user_info['cid']."' or group_owner_id = 
> '".$user_info['cid']."' $sq order by status desc, domain";
>      } else if($user_info['Account_Type'] == 'user') {
> -        $q = "select * from domains where $searchstring owner_id =
> '".$user_info['cid']."' order by status desc, domain";
> +        $q = "select * from domains where $searchstring owner_id =
> '".$user_info['cid']."' $sq order by status desc, domain";
>      }
>      $result = mysql_query($q) or die(mysql_error());
>      $totaldomains = mysql_num_rows($result); ---cut here --- 
> 
> Best regards,
> rodrigo
> 
> 

Attachment: smime.p7s
Description: S/MIME cryptographic signature



Reply via email to