Changeset 332
- Timestamp:
- 07/29/08 09:52:16 (4 months ago)
- Files:
-
- bookmarks/releases/2.1 (moved) (moved from bookmarks/releases/2.0)
- bookmarks/releases/2.1/INSTALL (modified) (1 diff)
- bookmarks/releases/2.1/lib.php (modified) (5 diffs)
- bookmarks/releases/2.1/lib/bookmarks_actions.php (modified) (5 diffs)
- bookmarks/releases/2.1/lib/bookmarks_posts_edit.php (modified) (4 diffs)
- bookmarks/releases/2.1/lib/bookmarks_subscriptions.php (modified) (2 diffs)
- bookmarks/releases/2.1/lib/bookmarks_user_info_menu.php (modified) (1 diff)
- bookmarks/releases/2.1/lib/bookmarks_view_recent.php (added)
- bookmarks/releases/2.1/lib/function_rss_getitems.php (modified) (5 diffs)
- bookmarks/releases/2.1/lib/function_rss_publish.php (added)
- bookmarks/releases/2.1/lib/main.php (modified) (3 diffs)
- bookmarks/releases/2.1/popular.php (modified) (3 diffs)
- bookmarks/releases/2.1/popularfeeds.php (added)
- bookmarks/releases/2.1/recent.php (added)
- bookmarks/releases/2.1/recentfeeds.php (added)
- bookmarks/releases/2.1/remotepost.php (modified) (1 diff)
- bookmarks/releases/2.1/remotepost2.php (modified) (3 diffs)
- bookmarks/trunk/lib/bookmarks_user_info_menu.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
bookmarks/releases/2.1/INSTALL
r261 r332 19 19 RewriteRule ^bookmarks\/popular$ mod/bookmarks/popular.php 20 20 RewriteRule ^bookmarks\/popular\/skip/([0-9]+)$ mod/bookmarks/popular.php?skip=$1 21 RewriteRule ^bookmarks\/recent$ mod/bookmarks/recent.php 22 RewriteRule ^bookmarks\/recent\/skip/([0-9]+)$ mod/bookmarks/recent.php?skip=$1 23 RewriteRule ^(([A-Za-z0-9])[A-Za-z0-9]+)\/bookmarks\/rss\/?$ mod/newsclient/static.php?username=$1&userref=$2&type=bookmark 21 24 22 25 That's it. bookmarks/releases/2.1/lib.php
r261 r332 3 3 * @package bookmarks 4 4 * @filesource mod/bookmarks/ 5 * @version 2. 05 * @version 2.1 6 6 * @author beni<b.taraghi@tugraz.at> 7 7 * @copyright Copyright © 2007, Graz University of Technology - WG Social Learning<http://www.tugraz.at> … … 21 21 22 22 if (isloggedin() && user_info("user_type", $_SESSION['userid']) != "external" && !(defined("context") && context == "admin")) { 23 //if (user_type($page_owner) == "person") {24 23 if (defined("context") && context == "bookmarks" && $page_owner == $_SESSION['userid']) { 25 24 $PAGE->menu[] = array ( … … 32 31 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/bookmarks/all/\" >" . __gettext("Your Bookmarks" 33 32 ) . '</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 } 51 34 } 52 35 … … 54 37 55 38 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 56 44 if (run("permissions:check", array ( 57 45 "bookmark:add", … … 83 71 __gettext("Popular Bookmarks" 84 72 ))); 73 $PAGE->menu_sub[] = array ( 74 'name' => 'bookmarks:recent', 75 'html' => a_href($CFG->wwwroot . "bookmarks/recent", 76 __gettext("Recent Bookmarks" 77 ))); 78 85 79 //} 86 80 bookmarks/releases/2.1/lib/bookmarks_actions.php
r262 r332 42 42 43 43 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 53 45 $bool_success = run("bookmarks:import:content", array('import_bookmark_file', $access, $keywords, $category_id, $view)); 54 46 } … … 59 51 // commented to let #page=55&view=FitView work for pdfs 60 52 //$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 68 54 if ($bm_exists = get_field('bookmarks','ident','url',$url)) { 69 55 if (!run("bookmark:subscribed",$bm_exists)) { … … 164 150 } 165 151 } 152 elseif(empty($url)) { 153 $messages[] = __gettext("URL seems to be invalid"); 154 } 166 155 if($bool_success) {// success 156 $rssresult = run("bookmarks:rss:publish", array($page_owner, false)); 167 157 if($action == "bookmarks:post:add") 168 158 define('redirect_url',url . user_info("username",$page_owner) . "/bookmarks/all/"); … … 208 198 209 199 } 200 $rssresult = run("bookmarks:rss:publish", array($oldpost->bookmark, false)); 210 201 $messages[] = __gettext("The bookmark has been modified."); // gettext variable 211 202 } … … 224 215 delete_records('tags','tagtype','bookmark','ref',$id); 225 216 226 217 $rssresult = run("bookmarks:rss:publish", array($post_info->bookmark, false)); 227 218 $messages[] = __gettext("The selected bookmark was deleted."); 219 228 220 229 221 // 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 42 42 $title = (empty($post->title)) ? $post_b->title : $post->title; 43 43 $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>"; 45 45 46 46 $postTitle = "<a href=\"javascript:changeVisibility('1', '$url_img', '')\" ><img id=\"img1\" src=\"".$url_img."minus.gif\" border=\"0\" name=\"close\"> $postTitle</a>"; … … 62 62 $title = html_entity_decode($title, ENT_COMPAT, 'utf-8'); 63 63 64 $body = <<< END64 $body = <<<END 65 65 66 66 <form method="post" name="elggform" action="{$CFG->wwwroot}{$username}/bookmarks/{$post->ident}.html" onsubmit="return keywordsAreSet('edit_bookmark_keywords');"> … … 69 69 END; 70 70 71 $body .= <<< END71 $body .= <<<END 72 72 <script language="JavaScript" type="text/javascript"> 73 73 <!-- … … 127 127 128 128 $js_keyword_message = __gettext("You must set at least one key word for your bookmark."); 129 $body .= <<< END129 $body .= <<<END 130 130 <p> 131 131 <input type="hidden" name="action" value="bookmarks:post:edit" /> bookmarks/releases/2.1/lib/bookmarks_subscriptions.php
r262 r332 49 49 $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 50 50 $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>"; 52 52 53 53 $redirect = url . user_info('username', $page_owner) . "/bookmarks/"; … … 200 200 $acc_input = str_replace("id=\"img26\"", "id=\"img14\"", $acc_input); 201 201 $acc_input = str_replace("id=\"element26\"", "id=\"element14\"", $acc_input); 202 202 203 203 204 bookmarks/releases/2.1/lib/bookmarks_user_info_menu.php
r262 r332 22 22 $bm_username = user_info('username', $page_owner); 23 23 $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 29 25 $bookmarks_see = __gettext("Bookmark Storage"); 30 26 $body = '<ul>'; 31 27 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>"; 33 30 34 31 bookmarks/releases/2.1/lib/function_rss_getitems.php
r262 r332 56 56 ORDER BY bs.created_on DESC LIMIT '.$numrows,array($userid,'PUBLIC','bookmark',0)); 57 57 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.view59 JOIN '.$CFG->prefix.'bookmarks b ON b.ident=bs.bookmark_id60 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 64 58 } else if (isset($parameter[3]) && $parameter[3] == "all") { 65 59 $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 … … 68 62 ORDER BY bs.created_on DESC LIMIT '.$numrows,array('PUBLIC','bookmark',0)); 69 63 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.owner71 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 75 64 } else if ($tag) { 76 65 $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 … … 80 69 ORDER BY bs.created_on DESC limit '.$numrows,array($userid,'PUBLIC','bookmark')); 81 70 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.ref83 JOIN '.$CFG->prefix.'views v on v.ref = bs.ident JOIN '.$CFG->prefix.'users u on u.ident = v.view84 JOIN '.$CFG->prefix.'bookmarks b ON b.ident=bs.bookmark_id85 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 88 71 } else { 89 72 $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 … … 92 75 ORDER BY bs.created_on DESC LIMIT '.$numrows, array($userid, 'PUBLIC')); 93 76 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.ident95 JOIN '.$CFG->prefix.'users u ON u.ident = v.view JOIN '.$CFG->prefix.'bookmarks b ON b.ident=bs.bookmark_id96 WHERE v.view = ? AND bs.access = ? AND v.viewtype = ?97 ORDER BY bs.created_on DESC LIMIT '.$numrows, array($userid, 'PUBLIC', 'bookmark'));98 99 77 } 100 78 101 79 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; 105 83 foreach($entries_result as $obj_entries) { 106 $entries[$obj_entries->created_on ] = $obj_entries;84 $entries[$obj_entries->created_on + $cnt++] = $obj_entries; 107 85 } 108 86 krsort($entries); … … 114 92 $body = '<p><a href="'.$entry->url.'" target="_blank">' . $entry->url . '</a></p>'; 115 93 $body .= '<p>' . $entry->description . '</p>'; 116 $body = (run("bookmarks:text:process",stripslashes($body)));94 //$body = (run("bookmarks:text:process",stripslashes($body))); 117 95 $pubdate = gmdate("D, d M Y H:i:s T", $entry->created_on); 118 96 $keywordtags = ""; bookmarks/releases/2.1/lib/main.php
r262 r332 4 4 * @package bookmarks 5 5 * @filesource mod/bookmarks/lib/ 6 * @version 1. 56 * @version 1.6 7 7 * @author beni<b.taraghi@tugraz.at> 8 8 * @copyright Copyright © 2007, Graz University of Technology - WG Social Learning<http://www.tugraz.at> … … 33 33 $function['bookmarks:view'][] = dirname(__FILE__) . "/bookmarks_view.php"; 34 34 $function['bookmarks:view:all'][] = dirname(__FILE__) . "/bookmarks_view_all.php"; 35 $function['bookmarks:view:recent'][] = dirname(__FILE__) . "/bookmarks_view_recent.php"; 35 36 // filter lay out 36 37 $function['bookmarks:filter:view'][] = dirname(__FILE__) . "/bookmark_filter.php"; … … 48 49 // Publish static RSS file of posts 49 50 $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"; 52 52 // Update URLs 53 53 $function['bookmarks:url:update'][] = dirname(__FILE__) . "/function_url_update.php"; bookmarks/releases/2.1/popular.php
r261 r332 3 3 * @package bookmarks 4 4 * @filesource mod/bookmarks/ 5 * @version 1. 05 * @version 1.2 6 6 * @author beni<b.taraghi@tugraz.at> 7 7 * @copyright Copyright © 2007, Graz University of Technology - WG Social Learning<http://www.tugraz.at> … … 30 30 } 31 31 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 32 34 templates_page_setup(); 33 35 … … 39 41 $body = templates_draw(array( 40 42 'context' => 'contentholder', 41 'title' => $ title,43 'title' => $rsslink . $title, 42 44 'body' => "<div id=\"view_own_blog\">" . $body . "</div>" 43 45 ) bookmarks/releases/2.1/remotepost.php
r261 r332 46 46 $uri = optional_param("url", ""); 47 47 $doc_title = optional_param("title", ""); 48 $doc_title = urlencode($doc_title); 48 49 $uri_encode = urlencode($uri); 49 50 global $CFG; bookmarks/releases/2.1/remotepost2.php
r261 r332 93 93 $view = array(); 94 94 95 96 95 // Ajax call 97 96 $logMeOut = optional_param("logout", 0, PARAM_INT); … … 154 153 END; 155 154 155 156 156 // ajax tagsuggest plugin 157 157 if(plugin_is_loaded('tagsuggest')) … … 181 181 $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 182 182 $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>"; 184 184 185 185 $body1 = "<form action=\"\" method=\"post\" onsubmit=\"return keywordsAreSet('new_bookmark_keywords');\">"; bookmarks/trunk/lib/bookmarks_user_info_menu.php
r284 r332 22 22 $bm_username = user_info('username', $page_owner); 23 23 $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 29 25 $bookmarks_see = __gettext("Bookmark Storage"); 30 26 $body = '<ul>';
