Changeset 551
- Timestamp:
- 09/15/06 09:31:09 (2 years ago)
- Files:
-
- devel/htaccess-dist (modified) (1 diff)
- devel/mod/adash (added)
- devel/mod/adash/add.php (added)
- devel/mod/adash/css (added)
- devel/mod/adash/delete.php (added)
- devel/mod/adash/edit.php (added)
- devel/mod/adash/index.php (added)
- devel/mod/adash/init.php (added)
- devel/mod/adash/lib.php (added)
- devel/mod/adash/move.php (added)
- devel/mod/adash/mysql.sql (added)
- devel/mod/adash/postgres7.sql (added)
- devel/mod/blog/lib.php (modified) (1 diff)
- devel/mod/profile/lib.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/htaccess-dist
r510 r551 34 34 RewriteRule ^(.+)\/rssstyles.xsl$ _rss/styles.php?rssurl=$1&url=$1 35 35 36 RewriteRule ^([A-Za-z0-9]+)\/dashboard(\/)?$ mod/adash/index.php?user=$1 37 36 38 RewriteRule ^([A-Za-z0-9]+)(\/)?$ profile/index.php?profile_name=$1 39 RewriteRule ^([A-Za-z0-9]+)\/profile(\/)?$ profile/index.php?profile_name=$1 37 40 RewriteRule ^([A-Za-z0-9]+)\/tags(\/)?$ search/personaltags.php?profile_name=$1 38 41 RewriteRule ^(([A-Za-z0-9])[A-Za-z0-9]+)\/rss\/?$ _rss/static.php?username=$1&userref=$2&type=profile devel/mod/blog/lib.php
r527 r551 65 65 66 66 } 67 68 function blog_init() { 69 70 global $CFG, $function; 71 72 $CFG->widgets->display['blog'] = "blog_widget_display"; 73 $CFG->widgets->edit['blog'] = "blog_widget_edit"; 74 $CFG->widgets->list[] = array( 75 'name' => gettext("Blog widget"), 76 'description' => gettext("Displays the latest blog posts from a blog of your choice."), 77 'id' => "blog" 78 ); 79 80 } 81 82 function blog_widget_display($widget) { 83 84 global $CFG; 85 86 $blog_id = adash_get_data("blog_id",$widget->ident); 87 $blog_posts = adash_get_data("blog_posts",$widget->ident); 88 89 $body = ""; 90 91 if (empty($blog_id)) { 92 global $page_owner; 93 $blog_id = $page_owner; 94 } 95 if (empty($blog_posts)) { 96 $blog_posts = 1; 97 } 98 99 100 $where = run("users:access_level_sql_where",$_SESSION['userid']); 101 $posts = get_records_sql("select * from ".$CFG->prefix."weblog_posts where ($where) and weblog = $blog_id order by posted desc limit $blog_posts"); 102 103 if (is_array($posts) && !empty($posts)) { 104 foreach($posts as $post) { 105 $body .= run("weblogs:posts:view",$post); 106 } 107 } 108 109 return $body; 110 111 } 112 113 function blog_widget_edit($widget) { 114 115 global $CFG, $page_owner; 116 117 $blog_id = adash_get_data("blog_id",$widget->ident); 118 $blog_posts = adash_get_data("blog_posts",$widget->ident); 119 if (empty($blog_posts)) { 120 $blog_posts = 1; 121 } 122 if (empty($blog_id)) { 123 $blog_id = $page_owner; 124 } 125 126 $connections = get_records_sql("select u.ident, u.name from ".$CFG->prefix."friends f join ".$CFG->prefix."users u on u.ident = f.friend where f.owner = " . $_SESSION['userid'] . " order by u.name asc"); 127 $data = new stdClass; 128 $data->ident = $page_owner; 129 $data->name = user_info("name",$page_owner); 130 $connections[] = $data; 131 if ($page_owner != $_SESSION['userid']) { 132 $data = new stdClass; 133 $data->ident = $_SESSION['userid']; 134 $data->name = user_info("name",$_SESSION['userid']); 135 $connections[] = $data; 136 } 137 138 $body = "<h2>" . gettext("Blog dashboard widget") . "</h2>"; 139 $body .= "<p>" . gettext("This widget displays the last couple of blog posts from an individual user. To begin, select the user from your connections below:") . "</p>"; 140 141 $body .= "<p><select name=\"dashboard_data[blog_id]\">\n"; 142 if (is_array($connections) && !empty($connections)) { 143 foreach ($connections as $connection) { 144 if ($connection->ident == $blog_id) { 145 $selected = "selected=\"selected\""; 146 } else { 147 $selected = ""; 148 } 149 $body .= "<option value=\"" . $connection->ident . "\" $selected>" . $connection->name . "</option>\n"; 150 } 151 } 152 $body .= "</select></p>\n"; 153 154 $body .= "<p>" . gettext("Then enter the number of blog posts you'd like to display:") . "</p>"; 155 156 $body .= "<p><input type=\"text\" name=\"dashboard_data[blog_posts]\" value=\"" . $blog_posts . "\" /></p>"; 157 158 return $body; 159 160 } 67 161 68 162 ?> devel/mod/profile/lib.php
r543 r551 42 42 } 43 43 44 function profile_init() { 45 46 global $CFG; 47 48 $CFG->widgets->display['profile'] = "profile_widget_display"; 49 $CFG->widgets->edit['profile'] = "profile_widget_edit"; 50 $CFG->widgets->list[] = array( 51 'name' => gettext("Profile widget"), 52 'description' => gettext("Displays the contents of a profile field."), 53 'id' => "profile" 54 ); 55 56 } 57 44 58 function profile_permissions_check ($object) { 45 59 global $page_owner; … … 52 66 53 67 68 function profile_widget_display($widget) { 69 70 global $CFG, $profile_id, $data, $page_owner, $db; 71 static $profile; 72 73 $profile_id = $page_owner; 74 75 require_once($CFG->dirroot . 'profile/profile.class.php'); 76 77 $profile_field = adash_get_data("profile_widget_field",$widget->ident); 78 $profile_id = $widget->owner; 79 80 $title = gettext("Profile widget"); 81 $body = "<p>" . gettext("This profile box is undefined.") . "</p>"; 82 83 if (!isset($profile)) { 84 $profile = new ElggProfile($profile_id); 85 } 86 87 $field = null; 88 89 $user_type = user_info("user_type",$widget->owner); 90 91 foreach($data['profile:details'] as $field_row) { 92 if ($field_row[1] == $profile_field && (!isset($field_row[4]) || $field_row[4] == $user_type)) { 93 $field = $field_row; 94 } 95 } 96 97 $title = $field[0]; 98 $value = get_record_sql("select * from ".$CFG->prefix."profile_data where owner = ".$widget->owner." and name = " . $db->qstr($field[1])); 99 $body = display_output_field(array($value->value,$field[2],$field[1],$field[0],$value->ident)); 100 101 return "<h2>$title</h2>$body"; 102 103 } 104 105 function profile_widget_edit($widget) { 106 107 global $CFG, $profile_id, $data, $page_owner; 108 static $profile; 109 110 $profile_id = $page_owner; 111 112 require_once($CFG->dirroot . 'profile/profile.class.php'); 113 114 $profile_field = adash_get_data("profile_widget_field",$widget->ident); 115 116 if (!isset($profile)) { 117 $profile = new ElggProfile($profile_id); 118 } 119 120 $body = "<h2>" . gettext("Profile widget") . "</h2>"; 121 $body .= "<p>" . gettext("Select a profile field below; the widget will then display the profile content from this field.") . "</p>"; 122 123 $body .= "<select name=\"dashboard_data[profile_widget_field]\">"; 124 125 $user_type = user_info("user_type",$widget->owner); 126 127 foreach($data['profile:details'] as $field_row) { 128 129 if (!isset($field_row[4]) || $field_row[4] == $user_type) { 130 if ($field_row[1] == $profile_field ) { 131 $selected = "selected=\"selected\""; 132 } else { 133 $selected = ""; 134 } 135 136 $body .= "<option value=\"" . $field_row[1] . "\">" . $field_row[0] . "</option>\n"; 137 } 138 } 139 140 $body .= "</select>"; 141 142 return $body; 143 144 } 145 146 54 147 ?>
