Changeset 1046
- Timestamp:
- 03/26/07 12:27:53 (2 years ago)
- Files:
-
- devel/lib/uploadlib.php (modified) (1 diff)
- devel/lib/userlib.php (modified) (2 diffs)
- devel/mod/newsclient/lib.php (modified) (3 diffs)
- devel/mod/profile/css (modified) (4 diffs)
- devel/mod/profile/lib.php (modified) (8 diffs)
- devel/mod/profile/profile.config.php (modified) (1 diff)
- devel/mod/profile_photo/lib.php (modified) (3 diffs)
- devel/mod/widget/ajax_delete_widget.php (modified) (1 diff)
- devel/mod/widget/css (modified) (1 diff)
- devel/mod/widget/delete.php (modified) (2 diffs)
- devel/mod/widget/edit.php (modified) (6 diffs)
- devel/mod/widget/insert.php (modified) (2 diffs)
- devel/mod/widget/lib.php (modified) (21 diffs)
- devel/mod/widget/manage_widgets.php (modified) (1 diff)
- devel/mod/widget/move.php (modified) (3 diffs)
- devel/profile/index.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/lib/uploadlib.php
r659 r1046 223 223 } 224 224 } 225 if ( $savedsomething&& $this->config->deleteothers) {225 if (!empty($savedsomething) && $this->config->deleteothers) { 226 226 $this->delete_other_files($destination, $exceptions); 227 227 } devel/lib/userlib.php
r1022 r1046 97 97 * @return string Returns the user's name, or a blank string if something went wrong (eg the user didn't exist). 98 98 */ 99 function user_name($user_id) { 100 global $CFG; 101 $user_name = new stdClass; 102 $user_name->owner = $user_id; 103 if ($user_name->name = user_info("name",$user_id)) { 104 if ($user_name = plugin_hook("user_name","display",$user_name)) { 105 return $user_name->name; 106 } 107 } 108 return ""; 109 } 99 function user_name($user_id) { 100 global $CFG; 101 $user_name = new stdClass; 102 $user_name->owner = $user_id; 103 if ($user_name->name = user_info("name",$user_id)) { 104 if ($user_name = plugin_hook("user_name","display",$user_name)) { 105 return $user_name->name; 106 } 107 } 108 return ""; 109 } 110 110 111 /** 111 112 * Returns the HTML to display a user's icon, with event hooks allowing for interception. … … 119 120 * @return string Returns the icon HTML, or the default icon if something went wrong (eg the user didn't exist). 120 121 */ 121 function user_icon_html($user_id, $size = 100, $urlonly = false) {122 global $CFG;123 $extra = "";124 $user_icon = new stdClass;125 $user_icon->owner = $user_id;126 $user_icon->size = $size;127 if ($size < 100) {128 $extra = "/h/$size/w/$size";129 }130 if ($user_icon->icon = user_info("icon",$user_id)) {131 $user_icon->url = "{$CFG->wwwroot}_icon/user/{$user_icon->icon}{$extra}";132 $user_icon->html = "<img src=\"{$user_icon->url}\" border=\"0\" />";133 if ($user_icon = plugin_hook("user_icon","display",$user_icon)) {134 if ($urlonly) {122 function user_icon_html($user_id, $size = 100, $urlonly = false) { 123 global $CFG; 124 $extra = ""; 125 $user_icon = new stdClass; 126 $user_icon->owner = $user_id; 127 $user_icon->size = $size; 128 if ($size < 100) { 129 $extra = "/h/$size/w/$size"; 130 } 131 if ($user_icon->icon = user_info("icon",$user_id)) { 132 $user_icon->url = "{$CFG->wwwroot}_icon/user/{$user_icon->icon}{$extra}"; 133 $user_icon->html = "<img src=\"{$user_icon->url}\" border=\"0\" alt=\"user icon\" />"; 134 if ($user_icon = plugin_hook("user_icon","display",$user_icon)) { 135 if ($urlonly) { 135 136 return $user_icon->url; 136 } else {137 } else { 137 138 return $user_icon->html; 138 139 } 139 }140 }141 if ($urlonly) {142 return -1;143 } else {144 return "<img src=\"{$CFG->wwwroot}_icon/user/-1{$extra}\" border=\"0\" />";145 }146 }140 } 141 } 142 if ($urlonly) { 143 return -1; 144 } else { 145 return "<img src=\"{$CFG->wwwroot}_icon/user/-1{$extra}\" border=\"0\" alt=\"default user icon\" />"; 146 } 147 } 147 148 148 149 // USER FLAGS ////////////////////////////////////////////////////////////////// devel/mod/newsclient/lib.php
r1030 r1046 82 82 global $CFG; 83 83 84 // Delete users 85 listen_for_event("user","delete","newsclient_user_delete"); 86 84 87 //$CFG->widgets->display['feed'] = "newsclient_widget_display"; 85 88 //$CFG->widgets->edit['feed'] = "newsclient_widget_edit"; … … 179 182 function newsclient_get_subscriptions_user($userid, $joined = false) { 180 183 181 global $CFG;182 184 global $CFG; 185 183 186 $userid = (int) $userid; 184 187 if (empty($joined)) { … … 197 200 } 198 201 202 function newsclient_user_delete($object_type, $event, $object) { 203 global $CFG, $data; 204 if (!empty($object->ident) && $object_type == "user" && $event == "delete") { 205 delete_records('feed_subscriptions','user_id',$object->ident); 206 } 207 return $object; 208 } 209 210 199 211 ?> devel/mod/profile/css
r1037 r1046 1 <style >1 <style type="text/css"> 2 2 3 3 /* … … 6 6 7 7 img.profile-photo { 8 border:1px solid #eee;9 padding:2px;8 border:1px solid #eee; 9 padding:2px; 10 10 } 11 11 12 12 .profile_main p { 13 color:#000;13 color:#000; 14 14 } 15 15 16 16 .profile_main p a { 17 text-decoration: underline;17 text-decoration: underline; 18 18 } 19 19 20 20 .profile_main_bottom { 21 clear: both;21 clear: both; 22 22 } 23 23 24 24 .profile_primary { 25 float: left;26 width: 270px;27 margin-top: 10px;28 margin-left: 10px;25 float: left; 26 width: 270px; 27 margin-top: 10px; 28 margin-left: 10px; 29 29 } 30 30 31 31 .profile_secondary { 32 float: right;33 width: 400px;34 margin-top: 10px;35 color:#000;32 float: right; 33 width: 400px; 34 margin-top: 10px; 35 color:#000; 36 36 } 37 37 38 38 .profile_bio { 39 padding-top: 10px;40 background:#efefef;39 padding-top: 10px; 40 background:#efefef; 41 41 } 42 42 43 43 .profile_widgets { 44 clear: both;45 width: 760px;46 /*background: #004995;*/44 clear: both; 45 width: 760px; 46 /*background: #004995;*/ 47 47 } 48 48 49 49 .profile_icon img { 50 border:1px solid #eee;51 padding:2px 2px 2px 2px;50 border:1px solid #eee; 51 padding:2px 2px 2px 2px; 52 52 } 53 53 54 54 .profile_widgets_left { 55 float: left;56 width: 330px;55 float: left; 56 width: 330px; 57 57 } 58 58 59 59 .profile_widgets_right { 60 float: right;61 width: 330px60 float: right; 61 width: 330px 62 62 } 63 63 … … 65 65 66 66 #profile_widgets { 67 position:relative;67 position:relative; 68 68 } 69 69 70 70 .profile_bio { 71 width:244px;72 padding:2px;71 width:244px; 72 padding:2px; 73 73 } 74 74 75 75 .widgets_even { 76 float:left;77 width:340px;78 margin:0;79 padding:0;76 float:left; 77 width:340px; 78 margin:0; 79 padding:0; 80 80 } 81 81 82 82 .widgets_odd { 83 float:right;84 width:340px;85 margin:0;86 padding:0;83 float:right; 84 width:340px; 85 margin:0; 86 padding:0; 87 87 } 88 88 89 89 .widget { 90 border: 1px solid #BBDCE9; /*#95BDCD;*/91 margin-bottom: 15px;92 padding: 0;90 border: 1px solid #BBDCE9; /*#95BDCD;*/ 91 margin-bottom: 15px; 92 padding: 0; 93 93 } 94 94 95 95 .widget .widget_content { 96 padding: 4px 10px 4px 10px;96 padding: 4px 10px 4px 10px; 97 97 } 98 98 99 99 .widget .widget_content h3 { 100 padding:0;101 margin:0;100 padding:0; 101 margin:0; 102 102 } 103 103 104 104 .widget .widget_bottom { 105 display: block;106 background-color: #E2F0F6; /*#CBE5EF;*/107 margin: 0px;108 padding-left: 10px;109 border-top: 1px solid #BBDCE9;110 font-size:0.8em;105 display: block; 106 background-color: #E2F0F6; /*#CBE5EF;*/ 107 margin: 0px; 108 padding-left: 10px; 109 border-top: 1px solid #BBDCE9; 110 font-size:0.8em; 111 111 } 112 112 113 113 .widget .widget_menu ul { 114 margin:0 0 0 5px;115 padding:0;114 margin:0 0 0 5px; 115 padding:0; 116 116 } 117 117 118 118 .widget .widget_menu ul li { 119 list-style:none;119 list-style:none; 120 120 } 121 121 122 122 .widget .widget_menu ul li a { 123 text-decoration:underline;123 text-decoration:underline; 124 124 } 125 125 126 126 .widget .widget_admin_menu { 127 background-color: #E2F0F6;128 padding:2px 0 0 5px;127 background-color: #E2F0F6; 128 padding:2px 0 0 5px; 129 129 } 130 130 … … 134 134 135 135 .widget .widget_title { 136 border:0;137 border-bottom:1px solid #cdcdcd; /*#BBDCE9;*/138 padding:0 2px 0 2px;139 margin:0 0 10px 0;140 color:#000;141 font-size:1.2em;142 font-weight:bold;136 border:0; 137 border-bottom:1px solid #cdcdcd; /*#BBDCE9;*/ 138 padding:0 2px 0 2px; 139 margin:0 0 10px 0; 140 color:#000; 141 font-size:1.2em; 142 font-weight:bold; 143 143 } 144 144 145 145 .widget .widget_content h2 a { 146 background:url( {{url}}_templates/icons/arrow.gif) no-repeat left;147 padding:0 0 0 10px;146 background:url( {{url}}_templates/icons/arrow.gif) no-repeat left; 147 padding:0 0 0 10px; 148 148 } 149 149 devel/mod/profile/lib.php
r1041 r1046 30 30 'html' => '<a href="'.$CFG->wwwroot.'_icons/?context=profile&profile_id='.$pgowner.'">' 31 31 . __gettext("Change site picture") . '</a>'); 32 if ( $CFG->uses_YUI) {33 $PAGE->menu_sub[] = array( 'name' => 'profile:widget:manage',34 'html' => '<a href="'.$CFG->wwwroot.'mod/widget/manage_widgets.php">'35 . __gettext("Manage widgets") . '</a>');36 } else {37 $PAGE->menu_sub[] = array( 'name' => 'profile:widget:add',38 'html' => '<a href="'.$CFG->wwwroot.'mod/profile/add.php?owner='.$pgowner.'">'39 . __gettext("Add widget") . '</a>');40 }32 if (!empty($CFG->uses_YUI)) { 33 $PAGE->menu_sub[] = array( 'name' => 'profile:widget:manage', 34 'html' => '<a href="'.$CFG->wwwroot.'mod/widget/manage_widgets.php">' 35 . __gettext("Manage widgets") . '</a>'); 36 } else { 37 $PAGE->menu_sub[] = array( 'name' => 'profile:widget:add', 38 'html' => '<a href="'.$CFG->wwwroot.'mod/profile/add.php?owner='.$pgowner.'">' 39 . __gettext("Add widget") . '</a>'); 40 } 41 41 } 42 42 } … … 89 89 ); 90 90 /* 91 $CFG->widgets->list[] = array(91 $CFG->widgets->list[] = array( 92 92 'name' => __gettext("Files widget"), 93 93 'description' => __gettext("Displays images of some of your files."), … … 114 114 if ($widget->type == 'profile::profile') { 115 115 116 $profile_id = $page_owner;117 118 require_once($CFG->dirroot . 'profile/profile.class.php');119 120 $profile_field = widget_get_data("profile_widget_field",$widget->ident);121 $profile_id = $widget->owner;122 123 $title = __gettext("Profile widget");124 $body = "<p>" . __gettext("This profile box is undefined.") . "</p>";125 126 if (!isset($profile)) {127 $profile = new ElggProfile($profile_id);128 }129 130 $field = null;131 132 $user_type = user_info("user_type",$widget->owner);133 134 foreach($data['profile:details'] as $field_row) {135 if ($field_row->internal_name == $profile_field && (empty($field_row->user_type) || $field_row->user_type == $user_type)) {136 $field = $field_row;137 }138 }139 140 $title = $field->name;141 $value = get_record_sql("select * from ".$CFG->prefix."profile_data where owner = ".$widget->owner." and name = " . $db->qstr($field->internal_name));142 $body = display_output_field(array($value->value,$field->field_type,$field->internal_name,$field->name,$value->ident));143 144 return array('title'=>$title,'content'=>$body);145 } elseif ($widget->type == 'profile::friends') {146 return profile_friends_widget_display($widget->owner);147 } elseif ($widget->type == 'profile::files') {148 return profile_files_widget_display($widget->owner);149 }116 $profile_id = $page_owner; 117 118 require_once($CFG->dirroot . 'profile/profile.class.php'); 119 120 $profile_field = widget_get_data("profile_widget_field",$widget->ident); 121 $profile_id = $widget->owner; 122 123 $title = __gettext("Profile widget"); 124 $body = "<p>" . __gettext("This profile box is undefined.") . "</p>"; 125 126 if (!isset($profile)) { 127 $profile = new ElggProfile($profile_id); 128 } 129 130 $field = null; 131 132 $user_type = user_info("user_type",$widget->owner); 133 134 foreach($data['profile:details'] as $field_row) { 135 if ($field_row->internal_name == $profile_field && (empty($field_row->user_type) || $field_row->user_type == $user_type)) { 136 $field = $field_row; 137 } 138 } 139 140 $title = $field->name; 141 $value = get_record_sql("select * from ".$CFG->prefix."profile_data where owner = ".$widget->owner." and name = " . $db->qstr($field->internal_name)); 142 $body = display_output_field(array($value->value,$field->field_type,$field->internal_name,$field->name,$value->ident)); 143 144 return array('title'=>$title,'content'=>$body); 145 } elseif ($widget->type == 'profile::friends') { 146 return profile_friends_widget_display($widget->owner); 147 } elseif ($widget->type == 'profile::files') { 148 return profile_files_widget_display($widget->owner); 149 } 150 150 151 151 } … … 153 153 function profile_show_thumbs($id_list,$list_type) { 154 154 global $profile_id, $page_owner; 155 global $CFG, $USER;156 157 // Given a series of IDs as a parameter, will display a box containing the icons and names of each specified user, community or file158 // $parameter[0] is the title of the box; $parameter[1..n] is the user ID155 global $CFG, $USER; 156 157 // Given a series of IDs as a parameter, will display a box containing the icons and names of each specified user, community or file 158 // $parameter[0] is the title of the box; $parameter[1..n] is the user ID 159 159 160 160 $body = ""; … … 162 162 $cellnum = -1; 163 163 if ($list_type == 'files') { 164 $in_a_row = 3;164 $in_a_row = 3; 165 165 } else { 166 $in_a_row = 5;166 $in_a_row = 5; 167 167 } 168 168 169 169 foreach ($id_list as $key => $ident) { 170 171 if ($list_type == 'files') {172 if ($info = get_record_sql('SELECT folder, title, originalname FROM '.$CFG->prefix.'files '170 171 if ($list_type == 'files') { 172 if ($info = get_record_sql('SELECT folder, title, originalname FROM '.$CFG->prefix.'files ' 173 173 .'WHERE ident = ?',array($page_owner,$ident))) { 174 $displayname = $info->title;175 $icon_url = $CFG->wwwroot.'_icon/file/'.$ident;176 $username = user_info('username',$page_owner);177 $object_url = $CFG->wwwroot.$username.'/files/'.$info->folder.'/'.$ident.'/'.$info->originalname;178 }179 } else {180 181 $ident = (int) $ident;182 $info = get_record('users','ident',$ident);183 $_SESSION['user_info_cache'][$ident] = $info;184 185 $icon = user_info('icon',$ident);186 $icon_url = $CFG->wwwroot.'_icon/user/'.$icon.'/w/50';187 188 $info = $_SESSION['user_info_cache'][$ident];189 $displayname = run("profile:display:name", $info->ident);190 $usermenu = '';191 $object_url = $CFG->wwwroot.$info->username.'/';192 } 193 194 if ($info) { 195 $cellnum++;196 if ($cellnum % $in_a_row == 0 && $cellnum > 0) {197 $body .= "</tr><tr>";198 }199 if ($list_type == 'files') {200 $body .= <<< END201 <td>202 <a href="$object_url">203 <img border="0" src="$icon_url" alt="{$displayname}" title="{$displayname}" />204 </a>205 </td> 174 $displayname = $info->title; 175 $icon_url = $CFG->wwwroot.'_icon/file/'.$ident; 176 $username = user_info('username',$page_owner); 177 $object_url = $CFG->wwwroot.$username.'/files/'.$info->folder.'/'.$ident.'/'.$info->originalname; 178 } 179 } else { 180 181 $ident = (int) $ident; 182 $info = get_record('users','ident',$ident); 183 $_SESSION['user_info_cache'][$ident] = $info; 184 185 $icon = user_info('icon',$ident); 186 $icon_url = $CFG->wwwroot.'_icon/user/'.$icon.'/w/50'; 187 188 $info = $_SESSION['user_info_cache'][$ident]; 189 $displayname = run("profile:display:name", $info->ident); 190 $usermenu = ''; 191 $object_url = $CFG->wwwroot.$info->username.'/'; 192 } 193 194 if ($info) { 195 $cellnum++; 196 if ($cellnum % $in_a_row == 0 && $cellnum > 0) { 197 $body .= "</tr><tr>"; 198 } 199 if ($list_type == 'files') { 200 $body .= <<< END 201 <td> 202 <a href="$object_url"> 203 <img border="0" src="$icon_url" alt="{$displayname}" title="{$displayname}" /> 204 </a> 205 </td> 206 206 END; 207 } else { 208 $body .= <<< END209 <td>210 <div style="clear:right;">211 <a href="$object_url">212 <img border="0" src="$icon_url" alt="{$displayname}" title="{$displayname}" />213 </a>214 </div>215 <div>216 <a href="{$CFG->wwwroot}{$info->username}/">{$info->username}</a>217 </div>218 </td> 207 } else { 208 $body .= <<< END 209 <td> 210 <div style="clear:right;"> 211 <a href="$object_url"> 212 <img border="0" src="$icon_url" alt="{$displayname}" title="{$displayname}" /> 213 </a> 214 </div> 215 <div> 216 <a href="{$CFG->wwwroot}{$info->username}/">{$info->username}</a> 217 </div> 218 </td> 219 219 END; 220 }221 } 220 } 221 } 222 222 } 223 223 224 224 $body .= "\t</tr>\n</table>\n"; 225 226 return $body;225 226 return $body; 227 227 } 228 228 229 229 function profile_files_widget_display($userid) { 230 global $CFG;231 $file_list = array();232 $where1 = run("users:access_level_sql_where",$_SESSION['userid']);233 if ($files = get_records_sql('SELECT * FROM '.$CFG->prefix.'files WHERE files_owner = '.$userid.' AND '.$where1.' LIMIT 9')) {234 $file_count = count_records('files','files_owner',$userid);235 foreach($files as $file) {236 //if (run("users:access_level_check",$file->access) == true || $file->owner == $_SESSION['userid']) {237 $file_list[] = (int) $file->ident;238 //}239 }240 }241 if ($file_list) {242 $username = user_info('username',$userid);243 $title = __gettext('Files');230 global $CFG; 231 $file_list = array(); 232 $where1 = run("users:access_level_sql_where",$_SESSION['userid']); 233 if ($files = get_records_sql('SELECT * FROM '.$CFG->prefix.'files WHERE files_owner = '.$userid.' AND '.$where1.' LIMIT 9')) { 234 $file_count = count_records('files','files_owner',$userid); 235 foreach($files as $file) { 236 //if (run("users:access_level_check",$file->access) == true || $file->owner == $_SESSION['userid']) { 237 $file_list[] = (int) $file->ident; 238 //} 239 } 240 } 241 if ($file_list) { 242 $username = user_info('username',$userid); 243 $title = __gettext('Files'); 244 244 $menu = array(array('text' => __gettext('View all'), 'link' => $CFG->wwwroot.$username.'/files', 'title'=>$file_count .' '. ($file_count == 1 ? __gettext("file"):__gettext("files")))); 245 $content = profile_show_thumbs($file_list,'files');245 $content = profile_show_thumbs($file_list,'files'); 246 246 $widget_array = array('title'=>$title,'menu'=>$menu,'content'=>$content); 247 247 } else { … … 256 256 $html = ''; 257 257 $friends = array(); 258 if ($result = get_records_sql('SELECT DISTINCT u.ident,1 FROM '.$CFG->prefix.'friends f258 if ($result = get_records_sql('SELECT DISTINCT u.ident,1 FROM '.$CFG->prefix.'friends f 259 259 JOIN '.$CFG->prefix.'users u ON u.ident = f.friend 260 260 WHERE f.owner = ? AND u.user_type = ? order by u.last_action desc LIMIT 9',array($userid,'person'))) { 261 $friend_count = get_record_sql('SELECT count(*) as count FROM '.$CFG->prefix.'friends f261 $friend_count = get_record_sql('SELECT count(*) as count FROM '.$CFG->prefix.'friends f 262 262 JOIN '.$CFG->prefix.'users u ON u.ident = f.friend 263 263 WHERE f.owner = ? AND u.user_type = ?',array($userid,'person')); … … 266 266 } 267 267 if ($userid != $_SESSION['userid']) { 268 $link = url."_friends/?owner=$userid";269 } else {270 $link = url.$_SESSION['username']."/friends/";271 }268 $link = url."_friends/?owner=$userid"; 269 } else { 270 $link = url.$_SESSION['username']."/friends/"; 271 } 272 272 $title = __gettext('Friends'); 273 273 $menu_array = array(array('text' => __gettext('View all Friends'), 'link' => $link, 'title'=>$friend_count->count .' '. ($friend_count->count == 1 ? __gettext("friend"):__gettext("friends")))); 274 $content = profile_show_thumbs($friends,'users');275 $widget_array = array('title'=>$title,'menu'=>$menu_array,'content'=>$content);274 $content = profile_show_thumbs($friends,'users'); 275 $widget_array = array('title'=>$title,'menu'=>$menu_array,'content'=>$content); 276 276 } else { 277 $widget_array = array();278 }279 return $widget_array;277 $widget_array = array(); 278 } 279 return $widget_array; 280 280 } 281 281 … … 287 287 if ($widget->type == 'profile::profile') { 288 288 289 $profile_id = $page_owner;290 291 require_once($CFG->dirroot . 'profile/profile.class.php');292 293 $profile_field = widget_get_data("profile_widget_field",$widget->ident);294 295 if (!isset($profile)) {296 $profile = new ElggProfile($profile_id);297 }298 299 $body = "<h2>" . __gettext("Profile widget") . "</h2>";300 $body .= "<p>" . __gettext("Select a profile field below; the widget will then display the profile content from this field.") . "</p>";301 302 $body .= "<select name=\"widget_data[profile_widget_field]\">";303 304 $user_type = user_info("user_type",$widget->owner);305 306 307 foreach($data['profile:details'] as $field_row) {308 309 if (empty($field_row->user_type) || $field_row->user_type == $user_type) {310 if ($field_row->internal_name == $profile_field ) {311 $selected = "selected=\"selected\"";312 } else {313 $selected = "";314 }315 316 $body .= "<option value=\"" . $field_row->internal_name . "\">" . $field_row->name . "</option>\n";317 }318 }319 320 $body .= "</select>";321 322 } elseif ($widget->type == 'profile::friends') {323 // can't edit this widget for now324 $body = '';289 $profile_id = $page_owner; 290 291 require_once($CFG->dirroot . 'profile/profile.class.php'); 292 293 $profile_field = widget_get_data("profile_widget_field",$widget->ident); 294 295 if (!isset($profile)) { 296 $profile = new ElggProfile($profile_id); 297 } 298 299 $body = "<h2>" . __gettext("Profile widget") . "</h2>"; 300 $body .= "<p>" . __gettext("Select a profile field below; the widget will then display the profile content from this field.") . "</p>"; 301 302 $body .= "<select name=\"widget_data[profile_widget_field]\">"; 303 304 $user_type = user_info("user_type",$widget->owner); 305 306 307 foreach($data['profile:details'] as $field_row) { 308 309 if (empty($field_row->user_type) || $field_row->user_type == $user_type) { 310 if ($field_row->internal_name == $profile_field ) { 311 $selected = "selected=\"selected\""; 312 } else { 313 $selected = ""; 314 } 315 316 $body .= "<option value=\"" . $field_row->internal_name . "\">" . $field_row->name . "</option>\n"; 317 } 318 } 319 320 $body .= "</select>"; 321 322 } elseif ($widget->type == 'profile::friends') { 323 // can't edit this widget for now 324 $body = ''; 325 325 } elseif ($widget->type == 'profile::files') { 326 // can't edit this widget for now327 $body = '';326 // can't edit this widget for now 327 $body = ''; 328 328 } 329 329 devel/mod/profile/profile.config.php
r1030 r1046 62 62 "invisible" => false, 63 63 "required" => false, 64 "user_type" => "", 64 65 )); 65 66 devel/mod/profile_photo/lib.php
r1036 r1046 35 35 } 36 36 if (!empty($parameter[1])) { 37 $html .= "<img src=\"{$CFG->wwwroot}mod/profile_photo/img.php?id={$parameter[4]}& constraint1=w&size1=250&constraint2=h&size2=200\" /><br />";38 $html .= "< input name=\"".$parameter[0]."\" type=\"checkbox\" id=\"$cleanid\" value=\"photo\" />";37 $html .= "<img src=\"{$CFG->wwwroot}mod/profile_photo/img.php?id={$parameter[4]}&constraint1=w&size1=250&constraint2=h&size2=200\" alt=\"Profile photo\" /><br />"; 38 $html .= "<label for=\"$cleanid\"><input name=\"".$parameter[0]."\" type=\"checkbox\" id=\"$cleanid\" value=\"photo\" />"; 39 39 $html .= __gettext("Click here to remove this photo."); 40 $html .= "</label>"; 40 41 } else { 41 42 $html .= "<input name=\"profile_photo_".$parameter[3]."\" type=\"file\" /><br />"; 42 $html .= "< input name=\"".$parameter[0]."\" type=\"checkbox\" id=\"$cleanid\" value=\"photo\" />";43 $html .= "<label for=\"$cleanid\"><input name=\"".$parameter[0]."\" type=\"checkbox\" id=\"$cleanid\" value=\"photo\" />"; 43 44 $html .= __gettext("Click here to verify that this is a photo of you and that it is not obscene or abusive."); 45 $html .= "</label>"; 44 46 } 45 47 } … … 49 51 function profile_photo_display_output_field($parameter) { 50 52 global $CFG, $profile_id; 53 $html = ''; 51 54 if ($parameter[1] == "profile_photo") { 52 if (!empty($parameter[4]) 53 && $parameter[0] != "photo") { 54 $html .= "<img class=\"profile-photo\" src=\"{$CFG->wwwroot}mod/profile_photo/img.php?id={$parameter[4]}&constraint1=w&size1=250\" />"; 55 if (!empty($parameter[4]) && $parameter[0] != "photo") { 56 $html .= "<img class=\"profile-photo\" src=\"{$CFG->wwwroot}mod/profile_photo/img.php?id={$parameter[4]}&constraint1=w&size1=250\" alt=\"Profile photo\" />"; 55 57 } else { 56 58 $pictureglyph = __gettext("Click here to upload a photo"); 57 59 $html = <<< END 58 60 </p> 59 <style >61 <style type="text/css"> 60 62 div#default-profile-icon { 61 63 width:250px; … … 82 84 <div id="default-profile-icon"> 83 85 <p><a href="{$CFG->wwwroot}profile/edit.php?profile_id={$profile_id}">{$pictureglyph}</a></p> 84 </div> 86 </div> 85 87 <p> 86 88 END; devel/mod/widget/ajax_delete_widget.php
r1030 r1046 2 2 3 3 // Load Elgg framework 4 @require_once("../../includes.php");5 4 @require_once("../../includes.php"); 5 6 6 $id = optional_param('id',0,PARAM_INT); 7 7 8 8 if (isloggedin()) { 9 $widget = get_record_sql("select * from ".$CFG->prefix."widgets where ident = $id"); 9 if ($widget = get_record('widgets','ident',$id)) { 10 11 // Page owner = where the widget resides 12 $page_owner = $widget->owner; 13 14 // Do we have permission to touch this? 15 // If so, wipe it! 16 if (run("permissions:check","profile")) { 10 17 11 // Page owner = where the widget resides 12 $page_owner = $widget->owner; 13 14 // Do we have permission to touch this? 15 // If so, wipe it! 16 if (run("permissions:check","profile")) { 17 18 widget_destroy($widget->ident); 19 widget_reorder($page_owner,$widget->location,$widget->location_id,$widget->column); 20 21 } 18 widget_destroy($widget->ident); 19 widget_reorder($page_owner,$widget->location,$widget->location_id,$widget->column); 20 21 } 22 } 22 23 } 23 24 devel/mod/widget/css
r1030 r1046 2 2 3 3 #profile_widgets { 4 position:relative;4 position:relative; 5 5 } 6 6 7 7 .widgets_even { 8 float:left;9 width:330px;8 float:left; 9 width:330px; 10 10 } 11 11 12 12 .widgets_odd { 13 float:right;14 width:330px;13 float:right; 14 width:330px; 15 15 } 16 16 17 17 .widget { 18 border: 1px solid #BBDCE9; /*#95BDCD;*/19 margin-bottom: 5px;20 padding: 0;18 border: 1px solid #BBDCE9; /*#95BDCD;*/ 19 margin-bottom: 5px; 20 padding: 0; 21 21 } 22 22 23 23 .widget .widget_content { 24 padding: 10px;24 padding: 10px; 25 25 } 26 26 .widget .widget_content h3 { 27 padding:0;28 margin:0;27 padding:0; 28 margin:0; 29 29 } 30 30 31 31 .widget .widget_menu { 32 display: block;33 background-color: #E2F0F6; /*#CBE5EF;*/34
