/[drupal]/contributions/modules/blogroll/blogroll.module
ViewVC logotype

Diff of /contributions/modules/blogroll/blogroll.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.7, Sat Jan 29 10:37:15 2005 UTC revision 1.8, Sun Jan 30 17:29:16 2005 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: blogroll.module,v 1.6 2005/01/11 23:40:15 grantbow Exp $  // $Id: blogroll.module,v 1.7 2005/01/29 10:37:15 grantbow Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 167  function blogroll_block($op = 'list', $d Line 167  function blogroll_block($op = 'list', $d
167              $output .= '<li><a href="'. $roll->url .'">'. $roll->name .'</a></li>';              $output .= '<li><a href="'. $roll->url .'">'. $roll->name .'</a></li>';
168            }            }
169          } else { // for community /blog collection          } else { // for community /blog collection
170            $rolls = db_query('SELECT name, url, count(*) as cnt FROM {blogroll} GROUP BY name, url ORDER BY cnt desc, name');            $rolls = db_query('SELECT name, url, sum(10-weight) as wgt, count(*) as cnt FROM {blogroll} GROUP BY name, url ORDER BY wgt desc, name');
171            while ($roll = db_fetch_object($rolls)) {            while ($roll = db_fetch_object($rolls)) {
172              $output .= '<li><a href="' . $roll->url .'">'. $roll->name .'</a> ('. $roll->cnt .')</li>';              $output .= '<li><a href="' . $roll->url .'">'. $roll->name .'</a> ('. $roll->cnt .')</li>';
173            }            }
# Line 188  function blogroll_block($op = 'list', $d Line 188  function blogroll_block($op = 'list', $d
188   * If no uid is provided output all user's blogrolls grouped by frequency   * If no uid is provided output all user's blogrolls grouped by frequency
189   */   */
190  function blogroll_script() {  function blogroll_script() {
191    print "<!-- drawroll( \n";    print "<!-- \ndrawroll( \n";
192    if ( arg(2) == "") {  // no userID provided    if ( arg(2) == "") {  // no userID provided
193      $result = db_query('SELECT name, url, count(*) as cnt FROM {blogroll} GROUP BY name, url ORDER BY cnt desc, name');      $result = db_query('SELECT name, url, sum(10-weight) as cnt FROM {blogroll} GROUP BY name, url ORDER BY cnt desc, name');
194    }    }
195    else {    else {
196      $result = db_query('SELECT name, url, weight FROM {blogroll} WHERE uid = %d ORDER BY weight',arg(2));      $result = db_query('SELECT name, url, weight FROM {blogroll} WHERE uid = %d ORDER BY weight',arg(2));
197    }    }
198    while ($feed = db_fetch_object($result)) {    while ($feed = db_fetch_object($result)) {
199       print "'<a href=".$feed->url.">".$feed->name."</a><br>'+\n";       print "'<a href=\"".$feed->url."\">".$feed->name."</a><br>'+\n";
200    }    }
201    print "'');\n";    print "'');\n\n";
202    
203    print "function drawroll(s){ document.write(s); }\n";    print "function drawroll(s){\n        document.write(s);\n}\n";
204    print "// -->\n";    print "// -->\n";
205    
206  }  }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.2