Changeset 332

Show
Ignore:
Timestamp:
07/29/08 09:52:16 (4 months ago)
Author:
beni
Message:

update to v. 2.1
some bugs removed
recent bookmarks + rss support added

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • bookmarks/releases/2.1/INSTALL

    r261 r332  
    1919RewriteRule ^bookmarks\/popular$ mod/bookmarks/popular.php 
    2020RewriteRule ^bookmarks\/popular\/skip/([0-9]+)$ mod/bookmarks/popular.php?skip=$1 
     21RewriteRule ^bookmarks\/recent$ mod/bookmarks/recent.php 
     22RewriteRule ^bookmarks\/recent\/skip/([0-9]+)$ mod/bookmarks/recent.php?skip=$1 
     23RewriteRule ^(([A-Za-z0-9])[A-Za-z0-9]+)\/bookmarks\/rss\/?$ mod/newsclient/static.php?username=$1&userref=$2&type=bookmark 
    2124 
    2225That's it. 
  • bookmarks/releases/2.1/lib.php

    r261 r332  
    33 * @package bookmarks 
    44 * @filesource mod/bookmarks/ 
    5  * @version 2.0 
     5 * @version 2.1 
    66 * @author beni<b.taraghi@tugraz.at> 
    77 * @copyright Copyright &copy; 2007, Graz University of Technology - WG Social Learning<http://www.tugraz.at> 
     
    2121 
    2222        if (isloggedin() && user_info("user_type", $_SESSION['userid']) != "external" && !(defined("context") && context == "admin")) { 
    23                 //if (user_type($page_owner) == "person") { 
    2423                        if (defined("context") && context == "bookmarks" && $page_owner == $_SESSION['userid']) { 
    2524                                $PAGE->menu[] = array ( 
     
    3231                                        'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/bookmarks/all/\" >" . __gettext("Your Bookmarks" 
    3332                                ) . '</a></li>'); 
    34                         //} 
    35                 } 
    36                 /* 
    37                 if (user_type($page_owner) == "community") { 
    38                         if (defined("context") && context == "bookmarks") { 
    39                                 $PAGE->menu[] = array ( 
    40                                         'name' => 'bookmarks', 
    41                                         'html' => '<li><a href="' . $CFG->wwwroot . $bm_username . '/bookmarks/all/" class="selected">' . __gettext("Bookmarks" 
    42                                 ) . '</a></li>'); 
    43                         } else { 
    44                                 $PAGE->menu[] = array ( 
    45                                         'name' => 'bookmarks', 
    46                                         'html' => '<li><a href="' . $CFG->wwwroot . $bm_username . '/bookmarks/all/">' . __gettext("Bookmarks" 
    47                                 ) . '</a></li>'); 
    48                         } 
    49                 } 
    50                 */ 
     33                } 
    5134        } 
    5235 
     
    5437 
    5538                if ($page_owner != -1) { 
     39                      $PAGE->menu_sub[]= array ( 
     40                        'name' => 'bookmark:rssfeed', 
     41                        'html' => "<a href=\"{$CFG->wwwroot}{$bm_username}/bookmarks/rss/\"><img src=\"{$CFG->wwwroot}mod/template/icons/rss.png\" border=\"0\" alt=\"rss\" /></a>" 
     42                      ); 
     43 
    5644                        if (run("permissions:check", array ( 
    5745                                        "bookmark:add", 
     
    8371                        __gettext("Popular Bookmarks" 
    8472                ))); 
     73                $PAGE->menu_sub[] = array ( 
     74                        'name' => 'bookmarks:recent', 
     75                        'html' => a_href($CFG->wwwroot . "bookmarks/recent", 
     76                        __gettext("Recent Bookmarks" 
     77                ))); 
     78 
    8579                //} 
    8680 
  • bookmarks/releases/2.1/lib/bookmarks_actions.php

    r262 r332  
    4242         
    4343        if(optional_param('bm_import', "0")) { 
    44                 // not used in ELGG 
    45                 // not nacessary because of js 
    46                 /* 
    47                     if(!Modifications::TagsFromStringAreValid($keywords)) 
    48                     { 
    49                                 $messages[] = __gettext("You must set at least one key word for your bookmark."); 
    50                                 break; 
    51                     } 
    52                     */ 
     44 
    5345                $bool_success = run("bookmarks:import:content", array('import_bookmark_file', $access, $keywords, $category_id, $view)); 
    5446        } 
     
    5951                // commented to let #page=55&view=FitView work for pdfs 
    6052                //$url = preg_replace('/#.*$/', '', $url); 
    61                 /* 
    62             if(!Modifications::TagsFromStringAreValid($keywords)) 
    63             { 
    64                                 $messages[] = __gettext("You must set at least one key word for your bookmark."); 
    65                                 break; 
    66             } 
    67                         */ 
     53 
    6854                if ($bm_exists = get_field('bookmarks','ident','url',$url)) { 
    6955                if (!run("bookmark:subscribed",$bm_exists)) { 
     
    164150                } 
    165151        } 
     152        elseif(empty($url)) { 
     153                $messages[] = __gettext("URL seems to be invalid"); 
     154        } 
    166155        if($bool_success) {// success 
     156                $rssresult = run("bookmarks:rss:publish", array($page_owner, false)); 
    167157                if($action == "bookmarks:post:add") 
    168158                        define('redirect_url',url . user_info("username",$page_owner) . "/bookmarks/all/"); 
     
    208198 
    209199            } 
     200            $rssresult = run("bookmarks:rss:publish", array($oldpost->bookmark, false)); 
    210201            $messages[] = __gettext("The bookmark has been modified."); // gettext variable 
    211202                } 
     
    224215                                delete_records('tags','tagtype','bookmark','ref',$id); 
    225216 
    226                              
     217                               $rssresult = run("bookmarks:rss:publish", array($post_info->bookmark, false)); 
    227218                                $messages[] = __gettext("The selected bookmark was deleted."); 
     219                                 
    228220                                 
    229221                                // if the user has been the only owner of the bookmark, delete it completely from DB 
  • bookmarks/releases/2.1/lib/bookmarks_posts_edit.php

    r262 r332  
    4242$title = (empty($post->title)) ? $post_b->title : $post->title; 
    4343$url_input_field = "<input type=\"text\" name=\"edit_bookmark_post\" value=\"".htmlspecialchars($post_b->url, ENT_COMPAT, 'utf-8')."\" style=\"width: 95%\" id=\"edit_bookmark_post\" readonly />"; 
    44 $description_input_field = "<input type=\"text\" name=\"edit_bookmark_desc\" value=\"".htmlspecialchars($post->description, ENT_COMPAT, 'utf-8')."\" style=\"width: 95%\" id=\"edit_bookmark_desc\" maxlength=\"80\" />"; 
     44$description_input_field = "<textarea name=\"edit_bookmark_desc\" style=\"width: 95%; height: 100px\" />".htmlspecialchars($post->description, ENT_COMPAT, 'utf-8')."</textarea>"; 
    4545 
    4646        $postTitle = "<a href=\"javascript:changeVisibility('1', '$url_img', '')\" ><img id=\"img1\" src=\"".$url_img."minus.gif\" border=\"0\" name=\"close\"> $postTitle</a>"; 
     
    6262$title = html_entity_decode($title, ENT_COMPAT, 'utf-8'); 
    6363 
    64 $body = <<< END 
     64$body = <<<END 
    6565 
    6666<form method="post" name="elggform" action="{$CFG->wwwroot}{$username}/bookmarks/{$post->ident}.html" onsubmit="return keywordsAreSet('edit_bookmark_keywords');"> 
     
    6969END; 
    7070 
    71 $body .= <<< END 
     71$body .= <<<END 
    7272    <script language="JavaScript" type="text/javascript"> 
    7373    <!-- 
     
    127127     
    128128    $js_keyword_message = __gettext("You must set at least one key word for your bookmark."); 
    129     $body .= <<< END 
     129    $body .= <<<END 
    130130    <p> 
    131131        <input type="hidden" name="action" value="bookmarks:post:edit" /> 
  • bookmarks/releases/2.1/lib/bookmarks_subscriptions.php

    r262 r332  
    4949    $keywordDesc = __gettext("Keywords commonly referred to as 'Tags' are words that represent the bookmark you are going to save. This will make it easier for others to search and find your posting."); // gettext variable 
    5050    $accessRes = __gettext("Access restrictions:"); // gettext variable 
    51         $description_input_field = "<input type=\"text\" name=\"new_bookmark_desc\" value=\"".htmlspecialchars(stripslashes($desc), ENT_COMPAT, 'utf-8')."\" style=\"width: 95%\" id=\"new_bookmark_desc\" maxlength=\"80\" />"; 
     51        $description_input_field = "<textarea name=\"new_bookmark_desc\" style=\"width: 95%; height: 100px\" />".htmlspecialchars(stripslashes($desc), ENT_COMPAT, 'utf-8')."</textarea>"; 
    5252         
    5353        $redirect = url . user_info('username', $page_owner) . "/bookmarks/"; 
     
    200200        $acc_input = str_replace("id=\"img26\"", "id=\"img14\"", $acc_input); 
    201201        $acc_input = str_replace("id=\"element26\"", "id=\"element14\"", $acc_input); 
     202 
    202203 
    203204 
  • bookmarks/releases/2.1/lib/bookmarks_user_info_menu.php

    r262 r332  
    2222            $bm_username = user_info('username', $page_owner); 
    2323            $cnt_bm = count_records_select('bookmark_subscriptions',"bookmark = $page_owner AND (".run("users:access_level_sql_where",$_SESSION['userid']).")"); 
    24             $sql = 'SELECT count(v.ident) AS cnt_view FROM ' .$CFG->prefix. 'views v JOIN ' .$CFG->prefix. 'bookmark_subscriptions bs ON bs.ident=v.ref WHERE v.viewtype="bookmark" AND v.view=' .$page_owner. " AND (".run("users:access_level_sql_where",$_SESSION['userid']).")"; 
    25             $cnt_bm2 = get_record_sql($sql); 
    26             $cnt_bm2 = $cnt_bm2->cnt_view; 
    27              
    28             $cnt_bm += $cnt_bm2; 
     24 
    2925            $bookmarks_see = __gettext("Bookmark Storage"); 
    3026            $body  = '<ul>'; 
    3127             
    32             $body .= "<li><a href=\"$CFG->wwwroot" .$bm_username ."/bookmarks/all/\">$bookmarks_see</a> ( $cnt_bm )</li>"; 
     28            $rsslink = "<a href=\"{$CFG->wwwroot}{$bm_username}/bookmarks/rss/\"><img src=\"{$CFG->wwwroot}mod/template/icons/rss.png\" border=\"0\" alt=\"rss\" /></a>"; 
     29            $body .= "<li><a href=\"$CFG->wwwroot" .$bm_username ."/bookmarks/all/\">$bookmarks_see</a> {$rsslink} ($cnt_bm)</li>"; 
    3330 
    3431             
  • bookmarks/releases/2.1/lib/function_rss_getitems.php

    r262 r332  
    5656                                            ORDER BY bs.created_on DESC LIMIT '.$numrows,array($userid,'PUBLIC','bookmark',0)); 
    5757 
    58                 $entries_views = get_records_sql('SELECT bs.*, u.username, b.url, b.title as b_title FROM '.$CFG->prefix.'bookmark_subscriptions bs JOIN '.$CFG->prefix.'views v on v.ref = bs.ident JOIN '.$CFG->prefix.'users u ON u.ident = v.view 
    59                                                   JOIN '.$CFG->prefix.'bookmarks b ON b.ident=bs.bookmark_id 
    60                                                   WHERE v.view = ? AND bs.access = ? AND v.viewtype = ?   
    61                                                   AND (SELECT count(ident) FROM '.$CFG->prefix.'tags t WHERE t.tagtype = ? AND t.tag IN ('.$tag_in.') AND t.ref = bs.ident) = ? 
    62                                                   ORDER BY bs.created_on DESC LIMIT '.$numrows,array($userid,'PUBLIC','bookmark','bookmark',0)); 
    63  
    6458            } else if (isset($parameter[3]) && $parameter[3] == "all") { 
    6559                $entries = get_records_sql('SELECT bs.*, u.username, b.url, b.title as b_title FROM '.$CFG->prefix.'bookmark_subscriptions bs JOIN '.$CFG->prefix.'users u ON u.ident = bs.owner 
     
    6862                                            ORDER BY bs.created_on DESC LIMIT '.$numrows,array('PUBLIC','bookmark',0)); 
    6963                                             
    70                 $entries_views = get_records_sql('SELECT bs.*, u.username, b.url, b.title as b_title FROM '.$CFG->prefix.'bookmark_subscriptions bs JOIN '.$CFG->prefix.'users u ON u.ident = bs.owner  
    71                                                                                   JOIN '.$CFG->prefix.'views v on v.ref = bs.ident JOIN '.$CFG->prefix.'bookmarks b ON b.ident=bs.bookmark_id WHERE bs.access = ? AND v.viewtype = ?  
    72                                                   AND (SELECT count(ident) FROM '.$CFG->prefix.'tags t WHERE t.tagtype = ? AND t.tag IN ('.$tag_in.') AND t.ref = bs.ident) = ?  
    73                                                   ORDER BY bs.created_on DESC LIMIT '.$numrows,array('PUBLIC','bookmark','bookmark',0)); 
    74  
    7564            } else if ($tag) { 
    7665                $entries = get_records_sql('SELECT bs.*, u.username, b.url, b.title as b_title FROM '.$CFG->prefix.'tags t JOIN '.$CFG->prefix.'bookmark_subscriptions bs ON bs.ident = t.ref 
     
    8069                                            ORDER BY bs.created_on DESC limit '.$numrows,array($userid,'PUBLIC','bookmark')); 
    8170 
    82                 $entries_views = get_records_sql('SELECT bs.*, u.username, b.url, b.title as b_title FROM '.$CFG->prefix.'tags t JOIN '.$CFG->prefix.'bookmark_subscriptions bs ON bs.ident = t.ref 
    83                                                       JOIN '.$CFG->prefix.'views v on v.ref = bs.ident JOIN '.$CFG->prefix.'users u on u.ident = v.view  
    84                                                   JOIN '.$CFG->prefix.'bookmarks b ON b.ident=bs.bookmark_id 
    85                                                       WHERE v.view = ? AND bs.access = ? AND t.tag IN ('.$tag_in.') AND t.tagtype = ? AND v.viewtype = ? 
    86                                                       ORDER BY bs.created_on DESC limit '.$numrows,array($userid,'PUBLIC','bookmark','bookmark')); 
    87  
    8871            } else { 
    8972                $entries = get_records_sql('SELECT bs.*, u.username, b.url, b.title as b_title FROM '.$CFG->prefix.'bookmark_subscriptions bs JOIN '.$CFG->prefix.'users u ON u.ident = bs.bookmark 
     
    9275                                            ORDER BY bs.created_on DESC LIMIT '.$numrows, array($userid, 'PUBLIC')); 
    9376 
    94                 $entries_views = get_records_sql('SELECT bs.*, u.username, b.url, b.title as b_title FROM '.$CFG->prefix.'bookmark_subscriptions bs JOIN '.$CFG->prefix.'views v ON v.ref = bs.ident 
    95                                                   JOIN '.$CFG->prefix.'users u ON u.ident = v.view JOIN '.$CFG->prefix.'bookmarks b ON b.ident=bs.bookmark_id   
    96                                                   WHERE v.view = ? AND bs.access = ? AND v.viewtype = ?  
    97                                                   ORDER BY bs.created_on DESC LIMIT '.$numrows, array($userid, 'PUBLIC', 'bookmark')); 
    98  
    9977            } 
    10078 
    10179            if(!is_array($entries)) $entries = array(); 
    102             if(!is_array($entries_views)) $entries_views = array(); 
    103             $entries_result = array_merge($entries, $entries_views)
    104             $entries = array(); 
     80 
     81            $entries_result = $entries
     82            $entries = array();$cnt=0; 
    10583            foreach($entries_result as $obj_entries) { 
    106                 $entries[$obj_entries->created_on] = $obj_entries; 
     84                $entries[$obj_entries->created_on + $cnt++] = $obj_entries; 
    10785            } 
    10886            krsort($entries); 
     
    11492                                    $body = '<p><a href="'.$entry->url.'" target="_blank">' . $entry->url . '</a></p>'; 
    11593                                    $body .= '<p>' . $entry->description . '</p>'; 
    116                     $body = (run("bookmarks:text:process",stripslashes($body))); 
     94                    //$body = (run("bookmarks:text:process",stripslashes($body))); 
    11795                    $pubdate = gmdate("D, d M Y H:i:s T", $entry->created_on); 
    11896                    $keywordtags = ""; 
  • bookmarks/releases/2.1/lib/main.php

    r262 r332  
    44 * @package bookmarks 
    55 * @filesource mod/bookmarks/lib/ 
    6  * @version 1.5 
     6 * @version 1.6 
    77 * @author beni<b.taraghi@tugraz.at> 
    88 * @copyright Copyright &copy; 2007, Graz University of Technology - WG Social Learning<http://www.tugraz.at> 
     
    3333$function['bookmarks:view'][] = dirname(__FILE__) . "/bookmarks_view.php"; 
    3434$function['bookmarks:view:all'][] = dirname(__FILE__) . "/bookmarks_view_all.php"; 
     35$function['bookmarks:view:recent'][] = dirname(__FILE__) . "/bookmarks_view_recent.php"; 
    3536// filter lay out 
    3637$function['bookmarks:filter:view'][] = dirname(__FILE__) . "/bookmark_filter.php"; 
     
    4849// Publish static RSS file of posts 
    4950$function['bookmarks:rss:getitems'][] = dirname(__FILE__) . "/function_rss_getitems.php"; 
    50 // no bookmark.xml => no publishing for now 
    51 //$function['bookmarks:rss:publish'][] =  dirname(__FILE__) . "/function_rss_publish.php"; 
     51$function['bookmarks:rss:publish'][] =  dirname(__FILE__) . "/function_rss_publish.php"; 
    5252// Update URLs 
    5353$function['bookmarks:url:update'][] = dirname(__FILE__) . "/function_url_update.php"; 
  • bookmarks/releases/2.1/popular.php

    r261 r332  
    33 * @package bookmarks 
    44 * @filesource mod/bookmarks/ 
    5  * @version 1.0 
     5 * @version 1.2 
    66 * @author beni<b.taraghi@tugraz.at> 
    77 * @copyright Copyright &copy; 2007, Graz University of Technology - WG Social Learning<http://www.tugraz.at> 
     
    3030        } 
    3131         
     32        $rsslink = "<a href=\"{$CFG->wwwroot}mod/bookmarks/popularfeeds.php\"><img src=\"{$CFG->wwwroot}mod/template/icons/rss.png\" border=\"0\" alt=\"rss\" /></a> "; 
     33         
    3234        templates_page_setup(); 
    3335                 
     
    3941        $body = templates_draw(array( 
    4042                        'context' => 'contentholder', 
    41                         'title' => $title, 
     43                        'title' => $rsslink . $title, 
    4244                        'body' => "<div id=\"view_own_blog\">" . $body . "</div>" 
    4345                    ) 
  • bookmarks/releases/2.1/remotepost.php

    r261 r332  
    4646 $uri = optional_param("url", ""); 
    4747 $doc_title = optional_param("title", ""); 
     48 $doc_title = urlencode($doc_title); 
    4849 $uri_encode = urlencode($uri); 
    4950 global $CFG; 
  • bookmarks/releases/2.1/remotepost2.php

    r261 r332  
    9393 $view = array(); 
    9494  
    95   
    9695 // Ajax call 
    9796 $logMeOut = optional_param("logout", 0, PARAM_INT); 
     
    154153END; 
    155154 
     155 
    156156 // ajax tagsuggest plugin 
    157157 if(plugin_is_loaded('tagsuggest')) 
     
    181181                    $keywordDesc = __gettext("Keywords commonly referred to as 'Tags' are words that represent the bookmark you are going to save. This will make it easier for others to search and find your posting."); // gettext variable 
    182182                    $accessRes = __gettext("Access restrictions:"); // gettext variable 
    183                         $description_input_field = "<input type=\"text\" name=\"new_bookmark_desc\" value=\"\" style=\"width: 95%\" id=\"new_bookmark_desc\" maxlength=\"80\" />"; 
     183                        $description_input_field = "<textarea name=\"new_bookmark_desc\" style=\"width: 95%; height: 100px\" /></textarea>"; 
    184184         
    185185                    $body1 = "<form action=\"\" method=\"post\" onsubmit=\"return keywordsAreSet('new_bookmark_keywords');\">"; 
  • bookmarks/trunk/lib/bookmarks_user_info_menu.php

    r284 r332  
    2222            $bm_username = user_info('username', $page_owner); 
    2323            $cnt_bm = count_records_select('bookmark_subscriptions',"bookmark = $page_owner AND (".run("users:access_level_sql_where",$_SESSION['userid']).")"); 
    24             $sql = 'SELECT count(v.ident) AS cnt_view FROM ' .$CFG->prefix. 'views v JOIN ' .$CFG->prefix. 'bookmark_subscriptions bs ON bs.ident=v.ref WHERE v.viewtype="bookmark" AND v.view=' .$page_owner. " AND (".run("users:access_level_sql_where",$_SESSION['userid']).")"; 
    25             $cnt_bm2 = get_record_sql($sql); 
    26             $cnt_bm2 = $cnt_bm2->cnt_view; 
    27              
    28             $cnt_bm += $cnt_bm2; 
     24 
    2925            $bookmarks_see = __gettext("Bookmark Storage"); 
    3026            $body  = '<ul>';