Changeset 1080
- Timestamp:
- 04/23/07 13:34:08 (1 year ago)
- Files:
-
- devel/htaccess-dist (modified) (1 diff)
- devel/includes_system.php (modified) (1 diff)
- devel/mod/community/addgroup.php (added)
- devel/mod/community/css.css (added)
- devel/mod/community/default_template.php (added)
- devel/mod/community/index.php (added)
- devel/mod/community/lib (added)
- devel/mod/community/lib.php (modified) (4 diffs)
- devel/mod/community/lib/communities_access_level_check.php (added)
- devel/mod/community/lib/communities_access_level_sql_check.php (added)
- devel/mod/community/lib/communities_access_levels.php (added)
- devel/mod/community/lib/communities_actions.php (added)
- devel/mod/community/lib/communities_config.php (added)
- devel/mod/community/lib/communities_create.php (added)
- devel/mod/community/lib/communities_edit.php (added)
- devel/mod/community/lib/communities_edit_wrapper.php (added)
- devel/mod/community/lib/communities_members.php (added)
- devel/mod/community/lib/communities_membership_requests.php (added)
- devel/mod/community/lib/communities_moderator_of.php (added)
- devel/mod/community/lib/communities_owned.php (added)
- devel/mod/community/lib/community_memberships.php (added)
- devel/mod/community/lib/permissions_check.php (added)
- devel/mod/community/lib/profile_edit_link.php (added)
- devel/mod/community/lib/user_info_menu_text.php (added)
- devel/mod/community/lib/userdetails_actions.php (added)
- devel/mod/community/lib/userdetails_edit.php (added)
- devel/mod/community/members.php (added)
- devel/mod/community/new.php (added)
- devel/mod/community/owned.php (added)
- devel/mod/community/profile.config.php (added)
- devel/mod/community/requests.php (added)
- devel/mod/community/templates (added)
- devel/mod/community/templates/community_create.html (added)
- devel/mod/community/templates/community_member_view.html (added)
- devel/mod/community/templates/community_membership_view.html (added)
- devel/units/communities (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/htaccess-dist
r1077 r1080 98 98 RewriteRule ^([A-Za-z0-9]+)\/foaf\/?$ _friends/foaf.php?friends_name=$1 99 99 100 RewriteRule ^([A-Za-z0-9]+)\/communities\/?$ _communities/index.php?friends_name=$1 101 RewriteRule ^community\/([0-9]+)\/?$ _communities/community.php?community_id=$1 100 RewriteRule ^([A-Za-z0-9]+)\/communities\/?$ mod/community/index.php?friends_name=$1 101 RewriteRule ^([A-Za-z0-9]+)\/communities\/owned$ mod/community/owned.php?profile_name=$1 102 RewriteRule ^([A-Za-z0-9]+)\/communities\/new$ mod/community/new.php?profile_name=$1 103 RewriteRule ^([A-Za-z0-9]+)\/community\/delete$ mod/community/index.php?profile_name=$1&action=community:delete 104 RewriteRule ^([A-Za-z0-9]+)\/community\/requests$ mod/community/requests.php?profile_name=$1 105 RewriteRule ^([A-Za-z0-9]+)\/community\/requests\/aprove\/([0-9]+)$ mod/community/requests.php?profile_name=$1&action=community:approve:request&request_id=$2 106 RewriteRule ^([A-Za-z0-9]+)\/community\/requests\/decline\/([0-9]+)$ mod/community/requests.php?profile_name=$1&action=community:decline:request&request_id=$2 107 RewriteRule ^([A-Za-z0-9]+)\/community\/members$ mod/community/members.php?profile_name=$1 108 RewriteRule ^([A-Za-z0-9]+)\/community\/separate\/([0-9]+)$ mod/community/members.php?profile_name=$1&friend_id=$2&action=separate 109 RewriteRule ^community\/([0-9]+)\/?$ mod/communities/community.php?community_id=$1 102 110 103 111 RewriteRule ^([A-Za-z0-9]+)\/files\/?$ _files/index.php?files_name=$1 devel/includes_system.php
r1077 r1080 29 29 include($CFG->dirroot . "units/files/main.php"); 30 30 31 // Communities32 require($CFG->dirroot . "units/communities/main.php");33 34 31 // Friends 35 32 include($CFG->dirroot . "units/friends/main.php"); devel/mod/community/lib.php
r1010 r1080 1 1 <?php 2 // Communities module 3 4 /* 5 A brief explanation: 6 7 Communities are a specialisation of users. Each community is just another 8 row in the users table, albeit with user_type set to 'community', which 9 allows it to have all the features of a regular user. 10 11 Friendships are stored in the same way too, but displayed as memberships. 12 The 'owner' field of the users table stores the moderator for a community 13 (for regular users it's set to -1). 14 15 TO DO: 16 17 - Allow a moderator to restrict access to communities 18 - Allow moderators to delete all weblog postings and file uploads 19 20 */ 2 21 3 22 function community_pagesetup() { 4 // register links -- 23 // register links -- 5 24 global $profile_id; 6 25 global $PAGE; 7 26 global $CFG; 8 27 global $USER; 28 global $metatags; 29 30 require_once (dirname(__FILE__)."/default_template.php"); 31 require_once (dirname(__FILE__)."/lib/communities_config.php"); 32 33 $metatags .= "<link rel=\"stylesheet\" href=\"" . $CFG->wwwroot . "mod/community/css.css\" type=\"text/css\" media=\"screen\" />"; 9 34 10 35 $page_owner = $profile_id; 11 36 12 37 $usertype = user_type($page_owner); 13 38 39 $username= user_info('username', $page_owner); 40 14 41 if ($usertype == "community") { 15 42 16 43 if (defined("context") && context == "profile") { 17 44 18 45 if (run("permissions:check", "profile")) { 19 20 $PAGE->menu_sub[] = array( 'name' => 'profile:edit', 46 47 // Edit community functions 48 $PAGE->menu_sub[] = array( 'name' => 'profile:edit', 21 49 'html' => '<a href="'.$CFG->wwwroot.'profile/edit.php?profile_id='.$page_owner.'">' 22 . __gettext("Edit thisprofile") . '</a>');23 50 . __gettext("Edit community profile") . '</a>'); 51 24 52 $PAGE->menu_sub[] = array( 'name' => 'community:pic', 25 53 'html' => a_href("{$CFG->wwwroot}_icons/?context=profile&profile_id=$page_owner" , 26 54 __gettext("Community site picture"))); 27 55 28 56 $PAGE->menu_sub[] = array( 'name' => 'community:edit', 29 57 'html' => a_href("{$CFG->wwwroot}_userdetails/?context=profile&profile_id=$page_owner" , 30 58 __gettext("Edit community details"))); 59 } 31 60 32 }33 34 61 } 35 if (defined("context") && (context == "profile" || context == "network")) { 36 if (run("permissions:check", "profile")) { 37 $PAGE->menu_sub[] = array( 'name' => 'community:requests', 38 'html' => a_href("{$CFG->wwwroot}_communities/requests.php?profile_id=$page_owner", 39 __gettext("View membership requests"))); 62 63 if (defined("context") && (context == "profile" || context == COMMUNITY_CONTEXT)) { 64 if (run("permissions:check", "profile")) { 65 if(context == COMMUNITY_CONTEXT){ 66 $PAGE->menu_sub[] = array( 'name' => 'profile:view', 67 'html' => a_href("{$CFG->wwwroot}{$username}/profile", 68 __gettext("Return to community profile"))); 69 } 70 71 $PAGE->menu_sub[] = array( 'name' => 'community:adminmembers', 72 'html' => a_href("{$CFG->wwwroot}{$username}/community/members", 73 __gettext("Edit members"))); 74 75 $PAGE->menu_sub[] = array( 'name' => 'community:requests', 76 'html' => a_href("{$CFG->wwwroot}{$username}/community/requests", 77 __gettext("View membership requests"))); 40 78 } 41 79 } 42 43 /*$PAGE->menu_sub[] = array( 'name' => 'community:members',44 'html' => a_href("{$CFG->wwwroot}_communities/members.php?owner=$page_owner" ,45 __gettext("Community Members")));*/46 47 48 80 } else if ($usertype == "person") { 49 50 if (defined("context") && context == "network") {51 81 82 if (defined("context") && context == COMMUNITY_CONTEXT) { 83 if(COMMUNITY_COMPACT_VIEW){ 52 84 $PAGE->menu_sub[] = array( 'name' => 'community', 53 'html' => a_href("{$CFG->wwwroot}_communities/?owner=$page_owner" , 54 __gettext("Communities"))); 85 'html' => a_href("{$CFG->wwwroot}{$username}/communities" , 86 __gettext("Communities"))); 87 88 if (logged_on && $page_owner == $_SESSION['userid'] && 89 ($CFG->community_create_flag == "" || user_flag_get($CFG->community_create_flag, $USER->ident))) { 90 $PAGE->menu_sub[] = array( 'name' => 'community:owned', 91 'html' => a_href("{$CFG->wwwroot}{$username}/communities/new" , 92 __gettext("New Community"))); 93 } 94 } 95 else{ 96 $PAGE->menu_sub[] = array( 'name' => 'community', 97 'html' => a_href("{$CFG->wwwroot}{$username}/communities" , 98 __gettext("Communities"))); 99 55 100 if ($CFG->community_create_flag == "" || user_flag_get($CFG->community_create_flag, $USER->ident)) { 56 $PAGE->menu_sub[] = array( 'name' => 'community:owned',57 'html' => a_href("{$CFG->wwwroot}_communities/owned.php?owner=$page_owner" ,58 __gettext("Owned Communities")));101 $PAGE->menu_sub[] = array( 'name' => 'community:owned', 102 'html' => a_href("{$CFG->wwwroot}{$username}/communities/owned" , 103 __gettext("Owned Communities"))); 59 104 } 105 } 60 106 } 61 62 107 } 63 108 64 109 $PAGE->search_menu[] = array( 'name' => __gettext("Communities"), 65 110 'user_type' => 'community'); … … 68 113 69 114 function community_init() { 115 global $CFG,$function; 116 117 // Add communities to access levels 118 $function['init'][] = $CFG->dirroot . "mod/community/lib/communities_access_levels.php"; 119 $function['userdetails:init'][] = $CFG->dirroot . "mod/community/lib/userdetails_actions.php"; 120 121 // Communities actions 122 $function['communities:init'][] = $CFG->dirroot . "mod/community/lib/communities_config.php"; 123 $function['communities:init'][] = $CFG->dirroot . "mod/community/lib/communities_actions.php"; 124 125 // Communities modifications of friends actions 126 //$function['friends:init'][] = $CFG->dirroot . "mod/community/lib/communities_actions.php"; 127 128 // Communities bar down the right hand side 129 $function['display:sidebar'][] = $CFG->dirroot . "mod/community/lib/communities_owned.php"; 130 $function['display:sidebar'][] = $CFG->dirroot . "mod/community/lib/community_memberships.php"; 131 132 // 'Communities' aspect to the little menus beneath peoples' icons 133 $function['users:infobox:menu:text'][] = $CFG->dirroot . "mod/community/lib/user_info_menu_text.php"; 134 135 // Permissions for communities 136 $function['permissions:check'][] = $CFG->dirroot . "mod/community/lib/permissions_check.php"; 137 138 // View community memberships 139 $function['communities:editpage'][] = $CFG->dirroot . "mod/community/lib/communities_edit_wrapper.php"; 140 $function['communities:edit'][] = $CFG->dirroot . "mod/community/lib/communities_edit.php"; 141 $function['communities:members'][] = $CFG->dirroot . "mod/community/lib/communities_members.php"; 142 $function['communities:owned'][] = $CFG->dirroot . "mod/community/lib/communities_moderator_of.php"; 143 $function['communities:owned'][] = $CFG->dirroot . "mod/community/lib/communities_create.php"; 144 $function['communities:create'][] = $CFG->dirroot . "mod/community/lib/communities_create.php"; 145 146 // Membership requests 147 $function['communities:requests:view'][] = $CFG->dirroot . "mod/community/lib/communities_membership_requests.php"; 148 149 // Check access levels 150 $function['users:access_level_check'][] = $CFG->dirroot . "mod/community/lib/communities_access_level_check.php"; 151 152 // Obtain SQL "where" string for access levels 153 $function['users:access_level_sql_where'][] = $CFG->dirroot . "mod/community/lib/communities_access_level_sql_check.php"; 154 155 // Link to edit icons 156 $function['profile:edit:link'][] = $CFG->dirroot . "mod/community/lib/profile_edit_link.php"; 157 158 // Edit profile details 159 $function['userdetails:edit'][] = $CFG->dirroot . "mod/community/lib/userdetails_edit.php"; 160 70 161 // Delete users 71 162 listen_for_event("user","delete","community_user_delete"); … … 79 170 $newsuser = -1; 80 171 } 81 172 82 173 if ($communities = get_records_sql("select * from {$CFG->prefix}users where owner = {$object->ident}")) { 83 174 foreach($communities as $community) { … … 92 183 } 93 184 } 185 // $members = get_records("friends","friend",$page_owner); 186 94 187 return $object; 95 188 }
