Changeset 115
- Timestamp:
- 06/25/07 23:20:32 (1 year ago)
- Files:
-
- folio/folio/config.php (modified) (2 diffs)
- folio/folio/control/page_edit.php (modified) (3 diffs)
- folio/folio/control/page_edit_post.php (modified) (2 diffs)
- folio/folio/html/edit.php (modified) (1 diff)
- folio/folio/html/feeds.php (modified) (5 diffs)
- folio/folio/html/history.php (modified) (1 diff)
- folio/folio/html/setupdb.php (modified) (7 diffs)
- folio/folio/html/view.php (modified) (2 diffs)
- folio/folio/html/view_old.php (modified) (1 diff)
- folio/folio/lib.php (modified) (14 diffs)
- folio/folio/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
folio/folio/config.php
r112 r115 3 3 4 4 global $CFG; 5 $FOLIO_CFG->version = 0.6 1;5 $FOLIO_CFG->version = 0.62; 6 6 $FOLIO_CFG->ajaxprefix = 'folio_control_tree_'; 7 7 … … 12 12 // Default permission level for a new page. Can be PUBLIC, MODERATED, or PRIVATE 13 13 $FOLIO_CFG->page_defaultpermission = 'MODERATED'; 14 15 // Keep old pages in the rss feed. AKA, if bob makes a change, and then tim, do you only want to see 16 // tim's? If you want both, set to false, else true. 17 // Please note that this doesn't change the page history records, those are always kept. it's just about 18 // exposing the record changes thru the feed system. 19 $FOLIO_CFG->page_deleteoldpagesfromrss = false; 20 14 21 15 22 /////////////////////////////////////////////////////////////////////////////////////// folio/folio/control/page_edit.php
r101 r115 32 32 global $metatags; 33 33 34 34 35 if (!$page && !isloggedin() ) { 35 36 // We don't allow non-logged in users to create new pages … … 87 88 <SCRIPT type="text/javascript" src="$url/mod/folio/control/yav1_2_3/js_compact/yav.js"></SCRIPT> 88 89 <SCRIPT type="text/javascript" src="$url/mod/folio/control/yav1_2_3/js_compact/yav-config.js"></SCRIPT> 89 <script language="javascript" type="text/javascript" src="$url/_tinymce/jscripts/tiny_mce/tiny_mce_gzip.php"></script> 90 <script language="javascript" type="text/javascript"> 91 tinyMCE.init({ 92 language : "en", 93 mode : "exact", 94 convert_urls : false, 95 relative_urls : false, 96 elements : "new_weblog_post,new_weblog_comment,page_body", 97 theme : "advanced", 98 theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,image,undo,redo,link,unlink,code,fullscreen,spellchecker", 99 theme_advanced_buttons2 : "", 100 theme_advanced_buttons3 : "", 101 theme_advanced_toolbar_location : "top", 102 theme_advanced_toolbar_align : "left", 103 theme_advanced_path_location : "bottom", 104 extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", 105 remove_linebreaks: true, 106 theme_advanced_source_editor_width : "400", 107 theme_advanced_source_editor_height : "300", 108 plugins : "fullscreen,spellchecker", 109 spellchecker_languages : "+English=en,Dutch=nl,German=de,Spanish=es,Danish=dk,Swedish=sv,French=fr,Japanese=jp", 110 document_base_url : "http://localhost/dev/elgg/trunk", 111 fullscreen_settings : { 112 theme_advanced_path_location : "top" 113 } 114 115 }); 116 </script>\n 90 \n 117 91 <SCRIPT> 118 92 var rules=new Array(); … … 120 94 </SCRIPT> 121 95 END; 96 97 122 98 123 99 // Restore the trailing slash in $url folio/folio/control/page_edit_post.php
r112 r115 83 83 insert_tags_from_string ($tags, 'page', $page->page_ident, $security, $page->user_ident); 84 84 85 // We want to delete RSSrecords of changes to this page by this user within the last hour UNLESS they're by an anonymous user85 // We want to delete history records of changes to this page by this user within the last hour UNLESS they're by an anonymous user 86 86 if ( $page->creator_ident <> -1 ) { 87 87 rss_deleteitem( 'page', $page->page_ident, $page->creator_ident, 3600 ); 88 rss_deleteitem( 'page', $page->page_ident, $page->creator_ident, 3600 ); 89 } 90 91 // If configured, remove all old history entries from the RSS feed. 92 if ( $FOLIO_CFG->page_deleteoldpagesfromrss ) { 93 94 // Delete 95 rss_deleteitem( 'page', $page->page_ident ); 96 88 97 } 89 98 … … 98 107 ); 99 108 109 110 // If the page security is private, then set all past RSS entries to private as well. 111 if ( optional_param('folio_control_page_edit_security_custom', 'PUBLIC') == 'PRIVATE' ) { 112 113 $stmt = $db->Prepare( "UPDATE {$CFG->prefix}folio_rss SET access = '{$security}' 114 WHERE type_ident = {$insert_id} AND type='page' AND access <> 'PRIVATE'"); 115 $returnvalue = $db->Execute($stmt); 116 } 117 118 100 119 // Update any comments to match the same permission level. 101 120 $stmt = $db->Prepare("UPDATE {$CFG->prefix}folio_comment SET access = '{$security}' " . folio/folio/html/edit.php
r101 r115 18 18 require_once("../../../includes.php"); 19 19 require_once("../control/page_edit.php"); 20 require_once("../../../units/tinymce/tinymce_js.php"); 20 21 21 22 //run("profile:init"); 22 23 //run("friends:init"); 23 24 //run("folio:init"); 25 global $metatags; 26 27 $metatags = str_replace( ' elements : "',' elements : "page_body,',$metatags); 24 28 25 29 $title = " Folio :: Edit Page"; folio/folio/html/feeds.php
r111 r115 241 241 if ( count( $friendlist ) > 0 ) { 242 242 $where = ' owner_ident in (' . implode( ',', $friendlist) . ') and owner_ident <> ' . 243 implode( ',', $arguments['user_ident']) . ' and user_ident <> ' . 243 244 implode( ',', $arguments['user_ident']) . ' '; 244 245 } else { … … 333 334 // Transfer into template & write. 334 335 templates_page_setup(); 335 336 337 $users = array(); 338 foreach ( $arguments['username'] as $name ) { 339 $u = get_record_select('users',"username = '$name'"); 340 $users[] = $u->name; 341 } 336 342 $body = templates_draw(array( 337 343 'context' => 'contentholder', … … 339 345 array( array( 'name'=>'format','value'=> 'rss'), 340 346 array( 'name'=>'format','value'=> $arguments['format'][0])) ) . 341 $rsskey . "'><img border=0 src='{$url}mod/folio/image/ rss.png' /></a> " .342 implode( ', ', $ arguments['username']) . " :: $pagetitle ",347 $rsskey . "'><img border=0 src='{$url}mod/folio/image/feed.png' /></a> " . 348 implode( ', ', $users ) . " :: $pagetitle ", 343 349 'body' => $body )); 344 350 … … 355 361 templates_page_setup(); 356 362 363 $users = array(); 364 foreach ( $arguments['username'] as $name ) { 365 $u = get_record_select('users',"username = '$name'"); 366 $users[] = $u->name; 367 } 368 357 369 $body = templates_draw(array( 358 370 'context' => 'contentholder', … … 360 372 array( array( 'name'=>'format','value'=> 'rss'), 361 373 array( 'name'=>'format','value'=> $arguments['format'][0])) ) . 362 $rsskey . "'><img border=0 src='{$url}mod/folio/image/ rss.png' /></a> " .363 implode( ', ', $ arguments['username']) . " :: $pagetitle ",374 $rsskey . "'><img border=0 src='{$url}mod/folio/image/feed.png' /></a> " . 375 implode( ', ', $users ) . " :: $pagetitle ", 364 376 'body' => $body )); 365 377 folio/folio/html/history.php
r101 r115 85 85 86 86 // Build nice titles 87 $html_title = "<a href='$url{$username}/subscribe/rss/page+page_comment/'><img border=0 src='{$url}mod/folio/image/ rss.png' /></a> $name : " . folio_control_breadcrumb( $page, $username ) ;87 $html_title = "<a href='$url{$username}/subscribe/rss/page+page_comment/'><img border=0 src='{$url}mod/folio/image/feed.png' /></a> $name : " . folio_control_breadcrumb( $page, $username ) ; 88 88 $plain_title = $page->title; 89 89 folio/folio/html/setupdb.php
r112 r115 12 12 13 13 // The current version of the folio db scheme. 14 $folio_dbversion = 8;14 $folio_dbversion = 9; 15 15 16 16 // Setup variables. … … 20 20 require_once '../config.php'; 21 21 require_once '../lib.php'; 22 22 23 23 // See if we're using postgreesss or an old version of mysql. Cancel, as this only works with MySQL. 24 24 if ($CFG->dbtype == 'postgres7') { … … 65 65 case 7: 66 66 gotoVersion8(); 67 // no break, need to continue updating. 68 case 8: 69 gotoVersion9(); 67 70 // no break, need to continue updating. 68 71 } … … 101 104 102 105 /** 103 * Update to version 8, re-do the auto-import blog entries, blog comments, & files into the global RSS table. 104 **/ 105 function gotoVersion8() { 106 global $CFG; 107 $prefix = $CFG->prefix; 108 $db = $CFG->dbname; 109 110 // Remove existing ones in case this is an upgrade. 106 * Update to version 9, reset wiki permissions in the global RSS table. 107 **/ 108 function gotoVersion9() { 109 global $CFG; 110 $prefix = $CFG->prefix; 111 $db = $CFG->dbname; 112 113 114 // Pull records from DB & run the api to auto-load them. 115 $records = recordset_to_array(get_recordset_sql( 116 "SELECT * FROM " . $CFG->prefix . "folio_page e WHERE newest = 1")); 117 118 if ( $records) { 119 foreach ( $records as $record) { 120 121 // Assume only a single access level per page. 122 $security = get_record_select('folio_page_security','security_ident = ' . $record->page_ident ); 123 $security = $security->accesslevel; 124 if ( $security == 'PRIVATE' ) { 125 $user = get_record_select('users','ident = ' . $record->user_ident ); 126 if ( $user->user_type == 'community' ) { 127 $security = 'community' . $record->user_ident; 128 } else { 129 $security = 'user' . $record->user_ident; 130 } 131 } 132 133 // Set all permissions to the permission of the latest wiki entry. 134 execute_sql( "UPDATE {$db}.{$prefix}folio_rss SET access = '{$security}' 135 WHERE type_ident = {$record->page_ident} AND type='page'"); 136 137 138 139 } 140 } 141 142 143 // Re-do the load again of rss entries so that dates are correctly pulled. 111 144 execute_sql( "DELETE FROM {$db}.{$prefix}folio_rss where type IN ( 'weblog', 'weblog_comment', 'file')"); 112 145 … … 127 160 if ( $records) { 128 161 foreach ( $records as $record) { 129 folio_rss_weblog_comment ( 'weblog_comment', 'publish', $record );162 folio_rss_weblog_comment_post( 'weblog_comment', 'publish', $record ); 130 163 } 131 164 } … … 137 170 if ( $records) { 138 171 foreach ( $records as $record) { 139 folio_rss_file ( 'file', 'publish', $record );172 folio_rss_file_post( 'file', 'publish', $record ); 140 173 } 141 174 } 175 $version = new StdClass; 176 $version->version = 9; 177 insert_record("folio_version",$version); 178 } 179 180 /** 181 * Update to version 8, re-do the auto-import blog entries, blog comments, & files into the global RSS table. 182 **/ 183 function gotoVersion8() { 184 global $CFG; 185 $prefix = $CFG->prefix; 186 $db = $CFG->dbname; 187 188 // depreciated 142 189 143 190 $version = new StdClass; … … 154 201 $db = $CFG->dbname; 155 202 203 // depreciated 156 204 157 205 $version = new StdClass; folio/folio/html/view.php
r111 r115 95 95 // Build nice titles 96 96 $plain_title = 'Create ' . $page_title; 97 $html_title = $username . ' : ' . $page_title;97 $html_title = $username . ' :: ' . $page_title; 98 98 // Run the command to actually retrieve the content. 99 99 $body = … … 112 112 $html_title = "<a href='{$url}activity/user/{$username}/rss/page+page_comment/all/1:" . 113 113 folio_createhash( $_SESSION['userid'] ) . 114 "'><img border=0 src='{$url}mod/folio/image/ rss.png' /></a> $name : " . folio_control_breadcrumb( $page, $username ) ;114 "'><img border=0 src='{$url}mod/folio/image/feed.png' /></a> $name : " . folio_control_breadcrumb( $page, $username ) ; 115 115 $plain_title = $page->title; 116 116 folio/folio/html/view_old.php
r101 r115 65 65 66 66 // Build nice titles 67 $html_title = "<a href='$url{$username}/subscribe/rss/page+page_comment/'><img border=0 src='{$url}mod/folio/image/ rss.png' /></a> $name : " . folio_control_breadcrumb( $page, $username ) ;67 $html_title = "<a href='$url{$username}/subscribe/rss/page+page_comment/'><img border=0 src='{$url}mod/folio/image/feed.png' /></a> $name : " . folio_control_breadcrumb( $page, $username ) ; 68 68 $plain_title = $page->title; 69 69 folio/folio/lib.php
r112 r115 26 26 global $_SESSION; 27 27 28 listen_for_event("weblog_post","delete","folio_rss_weblog_delete"); 28 29 listen_for_event("weblog_post","publish","folio_rss_weblog_post"); 29 30 listen_for_event("weblog_post","update","folio_rss_weblog_post"); 30 listen_for_event("weblog_comment","publish","folio_rss_weblog_comment"); 31 listen_for_event("file","publish","folio_rss_file"); 32 listen_for_event("file","update","folio_rss_file"); 31 listen_for_event("weblog_comment","publish","folio_rss_weblog_comment_post"); 32 listen_for_event("weblog_comment","delete","folio_rss_weblog_comment_delete"); 33 listen_for_event("file","publish","folio_rss_file_post"); 34 listen_for_event("file","update","folio_rss_file_post"); 35 listen_for_event("file","delete","folio_rss_file_delete"); 33 36 34 37 // Test to see if there has been a log-on event … … 122 125 global $page_title; 123 126 global $username; // this is who we're looking at, not the logged in user. 127 // Depreciated in v.7? Start referring to profile_id 128 124 129 125 130 // This will change the log-on page to a custom session variable … … 133 138 134 139 $currentusername = $_SESSION['username']; 140 $currentuserident = $_SESSION['userid']; 141 //var_dump( $_SESSION ); 135 142 136 143 // ----------------------------------------------- … … 139 146 // Add Wiki Link 140 147 if (isloggedin() & defined('context') ) { 141 if ( substr(context, 0, 5) == "folio" & $ username == $currentusername) {148 if ( substr(context, 0, 5) == "folio" & $page_owner == $currentuserident) { 142 149 // Show selected 143 150 $PAGE->menu[] = array( 'name' => 'folio', … … 157 164 // Add Activity Link (as first option) 158 165 if (isloggedin() & defined('context') ) { 159 if ( context == "feeds" & $ username == $currentusername) {166 if ( context == "feeds" & $page_owner == $currentuserident) { 160 167 // Show selected 161 168 array_splice( $PAGE->menu, 0,0, array( array( 'name' => 'folio_feeds', 162 'html' => '<li><a href="'.$CFG->wwwroot . 'activity/ inbox/' . $currentusername . '/html/all/all/1">Your Activity</a></li>')));169 'html' => '<li><a href="'.$CFG->wwwroot . 'activity/fac/' . $currentusername . '/summary/all/all/1" class="selected">Your Activity</a></li>'))); 163 170 } else { 164 171 // Show main menu unselected 165 172 array_splice( $PAGE->menu, 0,0, array( array( 'name' => 'folio_feeds', 166 'html' => '<li><a href="'.$CFG->wwwroot . 'activity/ inbox/' . $currentusername . '/html/all/all/1">Your Activity</a></li>')));173 'html' => '<li><a href="'.$CFG->wwwroot . 'activity/fac/' . $currentusername . '/summary/all/all/1" >Your Activity</a></li>'))); 167 174 168 175 } … … 872 879 * @param string access (the permission level for the rss item, def=public). 873 880 **/ 874 function rss_additem( $owner_ident, $owner_username, $user_ident, $user_name, $user_username, $type, $type_ident, $tags, $title, $body, $link, $access='PUBLIC' ) { 875 881 function rss_additem( $owner_ident, $owner_username, $user_ident, $user_name, $user_username, $type, $type_ident, $tags, $title, $body, $link, $access='PUBLIC', $created = -1 ) { 882 883 if ($created == -1 ) { 884 $created = time(); 885 } 886 876 887 $rss = new StdClass; 877 888 $rss->owner_ident = intval($owner_ident); … … 885 896 $rss->body = $body; 886 897 $rss->link = $link; 887 $rss->created = time();898 $rss->created = $created; 888 899 $rss->access = $access; 889 900 … … 1018 1029 1019 1030 /** 1020 * Post the new weblog post to the RSS table 1031 * Post the new weblog post to the RSS table. Also called for weblog edits. 1021 1032 **/ 1022 1033 function folio_rss_weblog_post($object_type, $event, $object) { … … 1038 1049 $type = 'weblog'; 1039 1050 1040 // Ugly hack to grab tags. 1051 // Ugly hack to grab tags. Only works for new posts, not for edits. Need to fix. 1052 // TODO: Fix to work with edits. 1041 1053 $tags = explode(',', trim(optional_param('new_weblog_keywords'))); 1042 1054 … … 1044 1056 1045 1057 $link = $CFG->wwwroot . $owner_username . '/weblog/' . $type_ident . '.html'; 1046 1058 $created = $object->posted; 1059 1047 1060 //generate rss 1048 1061 rss_deleteitem( $type, $type_ident ); 1049 rss_additem( $owner_id, $owner_username, $user_id, $user_name, $user_username, $type, $type_ident, $tags, $title, $body, $link, $access );1062 rss_additem( $owner_id, $owner_username, $user_id, $user_name, $user_username, $type, $type_ident, $tags, $title, $body, $link, $access, $created); 1050 1063 1051 1064 // Update RSS in comments to match the same permission level. … … 1059 1072 } 1060 1073 1074 1075 /** 1076 * Deletes the post from the RSS table. 1077 **/ 1078 function folio_rss_weblog_delete($object_type, $event, $object) { 1079 global $db, $CFG; 1080 1081 $stmt = $db->Prepare( "DELETE FROM {$CFG->prefix}folio_rss 1082 WHERE type_ident = {$object->ident} AND type='weblog'"); 1083 $returnvalue = $db->Execute($stmt); 1084 1085 // return results 1086 return $object; 1087 } 1088 1089 1090 /** 1091 * Deletes the post from the RSS table. 1092 **/ 1093 function folio_rss_weblog_comment_delete($object_type, $event, $object) { 1094 global $db, $CFG; 1095 $stmt = $db->Prepare( "DELETE FROM {$CFG->prefix}folio_rss 1096 WHERE type_ident = {$object->ident} AND type='weblog_comment'"); 1097 $returnvalue = $db->Execute($stmt); 1098 1099 // return results 1100 return $object; 1101 } 1102 1061 1103 /** 1062 1104 * Post the new weblog comment to the RSS table 1063 1105 **/ 1064 function folio_rss_weblog_comment ($object_type, $event, $object) {1106 function folio_rss_weblog_comment_post($object_type, $event, $object) { 1065 1107 global $CFG; 1066 1108 … … 1092 1134 $title = 'Comment on "' . $post->title . '"'; 1093 1135 $link = url . $owner_username. "/weblog/" . $post->ident . ".html"; 1094 1136 $created = $object->posted; 1137 1095 1138 //generate rss 1096 1139 rss_additem( $owner_id, $owner_username, 1097 1140 $user_id, $user_name, $user_username, 1098 1141 'weblog_comment', $object->ident, '', 1099 $title, $object->body, $link, $access );1142 $title, $object->body, $link, $access, $created ); 1100 1143 } 1101 1144 … … 1103 1146 * Record a file upload or edit 1104 1147 **/ 1105 function folio_rss_file ($object_type, $event, $object) {1148 function folio_rss_file_post($object_type, $event, $object) { 1106 1149 global $CFG; 1107 1150 … … 1149 1192 $link = url . $owner_username . '/files/' . $object->folder . '/' . $type_ident . '/filename' ; 1150 1193 $access = $object->access; 1194 $created = $object->time_uploaded; 1151 1195 1152 1196 //generate rss 1153 1197 rss_deleteitem( $type, $type_ident ); 1154 rss_additem( $owner_ident, $owner_username, $user_ident, $user_name, $user_username, $type, $type_ident, $tags, $title, $body, $link, $access ); 1155 1156 1157 } 1158 1159 1198 rss_additem( $owner_ident, $owner_username, $user_ident, $user_name, $user_username, $type, $type_ident, $tags, $title, $body, $link, $access, $created ); 1199 1200 1201 } 1202 1203 /** 1204 * Deletes the file from the RSS table. 1205 **/ 1206 function folio_rss_file_delete($object_type, $event, $object) { 1207 global $db, $CFG; 1208 $stmt = $db->Prepare( "DELETE FROM {$CFG->prefix}folio_rss 1209 WHERE type_ident = {$object->ident} AND type='file'"); 1210 $returnvalue = $db->Execute($stmt); 1211 1212 // return results 1213 return $object; 1214 } 1160 1215 1161 1216 folio/folio/readme.txt
r112 r115 1 1 ---------------------------------------------------------------------------------- 2 2 Elgg Folio Add-in 3 Updated 6/ 6/20073 Updated 6/25/2007 4 4 ---------------------------------------------------------------------------------- 5 5 … … 93 93 94 94 Occurred: 95 2007.06.06 v0.61 Fixed more bugs. 95 2007.06.25 v0.62 Fixed bugs. Updated DB Scheme 96 2007.06.06 v0.61 Fixed bugs. Updated DB Scheme 96 97 2007.06.06 v0.6 Fixed a number of bugs. Added options via config.php for 97 98 different display options.
