From 87d7c7b5783409ffc68d2da80ef00fa911a768b8 Mon Sep 17 00:00:00 2001 From: Aparup Banerjee Date: Thu, 14 Mar 2013 11:17:23 +0800 Subject: [PATCH] Revert "Merge branch 'wip-MDL-35875-master' of git://github.com/phalacee/moodle" This reverts commit 02dcf9b501d613c077fa51f5f0a35a477ef81c48, reversing changes made to 61cd50618a5ff227f5a52006f94c5b2310a73abf. --- theme/base/style/user.css | 11 +++-- theme/canvas/style/core.css | 28 ++---------- theme/upgrade.txt | 1 - user/profile.php | 90 ++++++++++++++----------------------- user/profile/lib.php | 3 +- user/view.php | 34 +++++++------- 6 files changed, 61 insertions(+), 106 deletions(-) diff --git a/theme/base/style/user.css b/theme/base/style/user.css index e4f4d5f8c26..d4cb500eb03 100644 --- a/theme/base/style/user.css +++ b/theme/base/style/user.css @@ -1,11 +1,9 @@ /*$$$$$$$$$$$$$$$$$ User $$$$$$$$$$$$$$$$$$$$*/ + .userprofile .fullprofilelink {text-align:center; margin:10px;} .userprofile .profilepicture {float:left; margin-right:20px;} .userprofile .description {margin-bottom:20px;} -.userprofile dl {margin-top:10px; margin-left:0px; width:100%;} -.userprofile dl dt, .userprofile dl dd {padding-top:3px; padding-bottom:3px;} -.userprofile dl dt {margin:0px; font-weight:bold; display:block; float:left; width:110px; margin-right:10px;} -.userprofile dl dd {display:block; margin:0px; margin-left:120px;} +.userprofile .label {font-weight:normal;text-align:left;} .user-box {margin:8px;width:115px;height:160px;text-align:center;float:left;clear: none;} @@ -33,6 +31,7 @@ .userinfobox .list td {padding: 3px;} .userinfobox .username {padding-bottom: 20px;font-weight: bold;} .userinfobox td.label {text-align:right;white-space: nowrap;vertical-align: top;font-weight:bold;} + .groupinfobox {border:1px solid;} .groupinfobox .left {padding: 10px;width: 100px;vertical-align: top;} @@ -58,9 +57,9 @@ /** Overide for RTL layout **/ .dir-rtl .userprofile .profilepicture {float:right; margin-left:20px;margin-right:0px;} +.dir-rtl .descriptionbox {margin-right: 110px;margin-left: 0px; } .dir-rtl .userlist table#participants td, .dir-rtl .userlist table#participants th {text-align: right;} .dir-rtl .userlist table#participants {margin: 0 auto;} -.dir-rtl .userprofile dl dt {float:right; width:110px; margin-left:10px;} -.dir-rtl .userprofile dl dd {margin-right: 120px;} + #page-my-index.dir-rtl .block h3.main { text-align: right;} diff --git a/theme/canvas/style/core.css b/theme/canvas/style/core.css index f1a86f39f72..51248ec8ce9 100644 --- a/theme/canvas/style/core.css +++ b/theme/canvas/style/core.css @@ -268,7 +268,6 @@ input[type="radio"] { margin-left: 110px; border: 1px solid #ddd; padding: 10px; - width: 80%; } .path-user .description { @@ -276,39 +275,18 @@ input[type="radio"] { border-bottom: 1px solid #eee; } -.userprofile dl { +.userprofile .list { margin-top: 10px; } -.userprofile dl dt, .userprofile dl dd { +.userprofile .list td { padding-top: 3px; padding-bottom: 3px; - float: left; } -.dir-rtl .userprofile dl dt, .dir-rtl .userprofile dl dd { - float: right; -} - -.userprofile dl dt { +.userprofile .list .c0 { padding-left: 0; font-weight: bold; - display: inline-block; - padding-right: 2%; - min-width: 100px; - width: 15%; - clear: both; -} - -.dir-rtl .userprofile dl dt { - padding-left: 2%; - padding-right: 0; -} - -.userprofile dl dd { - display: inline-block; - margin: 0px; - width: 75%; } #page-user-view .buttons { diff --git a/theme/upgrade.txt b/theme/upgrade.txt index d66430af4da..cd0098f7587 100644 --- a/theme/upgrade.txt +++ b/theme/upgrade.txt @@ -5,7 +5,6 @@ information provided here is intended especially for theme designer. DOM changes: * changed the h1 title in the help popup to a h2. -* Re-wrote the user profile views to definition lists. === 2.4 === diff --git a/user/profile.php b/user/profile.php index c5ac5b0928b..9439c4e8338 100644 --- a/user/profile.php +++ b/user/profile.php @@ -243,53 +243,45 @@ echo ''; // Print all the little details in a list -echo html_writer::start_tag('dl', array('class'=>'list')); -if (!isset($hiddenfields['country']) && $user->country) { - echo html_writer::tag('dt', get_string('country')); - echo html_writer::tag('dd', get_string($user->country, 'countries')); +echo ''; + +if (! isset($hiddenfields['country']) && $user->country) { + print_row(get_string('country') . ':', get_string($user->country, 'countries')); } -if (!isset($hiddenfields['city']) && $user->city) { - echo html_writer::tag('dt', get_string('city')); - echo html_writer::tag('dd', $user->city); +if (! isset($hiddenfields['city']) && $user->city) { + print_row(get_string('city') . ':', $user->city); } if (isset($identityfields['address']) && $user->address) { - echo html_writer::tag('dt', get_string('address')); - echo html_writer::tag('dd', $user->address); + print_row(get_string("address").":", "$user->address"); } if (isset($identityfields['phone1']) && $user->phone1) { - echo html_writer::tag('dt', get_string('phone')); - echo html_writer::tag('dd', $user->phone1); + print_row(get_string("phone").":", "$user->phone1"); } if (isset($identityfields['phone2']) && $user->phone2) { - echo html_writer::tag('dt', get_string('phone2')); - echo html_writer::tag('dd', $user->phone2); + print_row(get_string("phone2").":", "$user->phone2"); } if (isset($identityfields['institution']) && $user->institution) { - echo html_writer::tag('dt', get_string('institution')); - echo html_writer::tag('dd', $user->institution); + print_row(get_string("institution").":", "$user->institution"); } if (isset($identityfields['department']) && $user->department) { - echo html_writer::tag('dt', get_string('department')); - echo html_writer::tag('dd', $user->department); + print_row(get_string("department").":", "$user->department"); } if (isset($identityfields['idnumber']) && $user->idnumber) { - echo html_writer::tag('dt', get_string('idnumber')); - echo html_writer::tag('dd', $user->idnumber); + print_row(get_string("idnumber").":", "$user->idnumber"); } if (isset($identityfields['email']) and ($currentuser or $user->maildisplay == 1 or has_capability('moodle/course:useremail', $context) or ($user->maildisplay == 2 and enrol_sharing_course($user, $USER)))) { - echo html_writer::tag('dt', get_string('email')); - echo html_writer::tag('dd', obfuscate_mailto($user->email, '')); + print_row(get_string("email").":", obfuscate_mailto($user->email, '')); } if ($user->url && !isset($hiddenfields['webpage'])) { @@ -297,46 +289,30 @@ if ($user->url && !isset($hiddenfields['webpage'])) { if (strpos($user->url, '://') === false) { $url = 'http://'. $url; } - $webpageurl = new moodle_url($url); - echo html_writer::tag('dt', get_string('webpage')); - echo html_writer::tag('dd', html_writer::link($webpageurl, s($user->url))); + print_row(get_string("webpage") .":", ''.s($user->url).''); } if ($user->icq && !isset($hiddenfields['icqnumber'])) { - $imurl = new moodle_url('http://web.icq.com/wwp', array('uin'=>$user->icq) ); - $iconurl = new moodle_url('http://web.icq.com/whitepages/online', array('icq'=>$user->icq, 'img'=>'5')); - $statusicon = html_writer::tag('img', '', array('src'=>$iconurl, 'class'=>'icon icon-post', 'alt'=>get_string('status'))); - echo html_writer::tag('dt', get_string('icqnumber')); - echo html_writer::tag('dd', html_writer::link($imurl, s($user->icq) . $statusicon)); + print_row(get_string('icqnumber').':',"icq)."\">".s($user->icq)." icq)."&img=5\" alt=\"\" />"); } if ($user->skype && !isset($hiddenfields['skypeid'])) { - $imurl = 'skype:'.urlencode($user->skype).'?call'; - $iconurl = new moodle_url('http://mystatus.skype.com/smallicon/'.$user->skype); if (strpos($CFG->httpswwwroot, 'https:') === 0) { // Bad luck, skype devs are lazy to set up SSL on their servers - see MDL-37233. $statusicon = ''; } else { - $statusicon = html_writer::empty_tag('img', array('src'=>$iconurl, 'class'=>'icon icon-post', 'alt'=>get_string('status'))); + $statusicon = ' '.html_writer::empty_tag('img', array('src'=>'http://mystatus.skype.com/smallicon/'.urlencode($user->skype), 'alt'=>get_string('status'))); } - echo html_writer::tag('dt', get_string('skypeid')); - echo html_writer::tag('dd', html_writer::link($imurl, s($user->skype) . $statusicon)); + print_row(get_string('skypeid').':',''.s($user->skype).$statusicon.''); } if ($user->yahoo && !isset($hiddenfields['yahooid'])) { - $imurl = new moodle_url('http://edit.yahoo.com/config/send_webmesg', array('.target'=>$user->yahoo, '.src'=>'pg')); - $iconurl = new moodle_url('http://opi.yahoo.com/online', array('u'=>$user->yahoo, 'm'=>'g', 't'=>'0')); - $statusicon = html_writer::tag('img', '', array('src'=>$iconurl, 'class'=>'iconsmall icon-post', 'alt'=>get_string('status'))); - echo html_writer::tag('dt', get_string('yahooid')); - echo html_writer::tag('dd', html_writer::link($imurl, s($user->yahoo) . $statusicon)); + print_row(get_string('yahooid').':', ''.s($user->yahoo)." yahoo)."&m=g&t=0\" alt=\"\">"); } if ($user->aim && !isset($hiddenfields['aimid'])) { - $imurl = 'aim:goim?screenname='.urlencode($user->aim); - echo html_writer::tag('dt', get_string('aimid')); - echo html_writer::tag('dd', html_writer::link($imurl, s($user->aim))); + print_row(get_string('aimid').':', ''.s($user->aim).''); } if ($user->msn && !isset($hiddenfields['msnid'])) { - echo html_writer::tag('dt', get_string('msnid')); - echo html_writer::tag('dd', s($user->msn)); + print_row(get_string('msnid').':', s($user->msn)); } /// Print the Custom User Fields @@ -366,8 +342,7 @@ if (!isset($hiddenfields['mycourses'])) { break; } } - echo html_writer::tag('dt', get_string('courseprofiles')); - echo html_writer::tag('dd', rtrim($courselisting,', ')); + print_row(get_string('courseprofiles').':', rtrim($courselisting,', ')); } } if (!isset($hiddenfields['firstaccess'])) { @@ -376,8 +351,7 @@ if (!isset($hiddenfields['firstaccess'])) { } else { $datestring = get_string("never"); } - echo html_writer::tag('dt', get_string('firstaccess')); - echo html_writer::tag('dd', $datestring); + print_row(get_string("firstaccess").":", $datestring); } if (!isset($hiddenfields['lastaccess'])) { if ($user->lastaccess) { @@ -385,27 +359,24 @@ if (!isset($hiddenfields['lastaccess'])) { } else { $datestring = get_string("never"); } - echo html_writer::tag('dt', get_string('lastaccess')); - echo html_writer::tag('dd', $datestring); + print_row(get_string("lastaccess").":", $datestring); } /// Printing tagged interests if (!empty($CFG->usetags)) { if ($interests = tag_get_tags_csv('user', $user->id) ) { - echo html_writer::tag('dt', get_string('interests')); - echo html_writer::tag('dd', $interests); + print_row(get_string('interests') .": ", $interests); } } if (!isset($hiddenfields['suspended'])) { if ($user->suspended) { - echo html_writer::tag('dt', ' '); - echo html_writer::tag('dd', get_string('suspended', 'auth')); + print_row('', get_string('suspended', 'auth')); } } -echo html_writer::end_tag('dl'); -echo ""; // Closing desriptionbox and userprofilebox. +echo "
"; + echo '
'; echo $OUTPUT->blocks_for_region('content'); echo '
'; @@ -425,4 +396,9 @@ if ($CFG->debugdisplay && debugging('', DEBUG_DEVELOPER) && $currentuser) { // } echo ''; // userprofile class -echo $OUTPUT->footer(); \ No newline at end of file +echo $OUTPUT->footer(); + + +function print_row($left, $right) { + echo "\n$left$right\n"; +} diff --git a/user/profile/lib.php b/user/profile/lib.php index 9f68f59cf5b..2ea68f25bef 100644 --- a/user/profile/lib.php +++ b/user/profile/lib.php @@ -452,8 +452,7 @@ function profile_display_fields($userid) { $newfield = 'profile_field_'.$field->datatype; $formfield = new $newfield($field->id, $userid); if ($formfield->is_visible() and !$formfield->is_empty()) { - echo html_writer::tag('dt', format_string($formfield->field->name)); - echo html_writer::tag('dd', $formfield->display_data()); + print_row(format_string($formfield->field->name.':'), $formfield->display_data()); } } } diff --git a/user/view.php b/user/view.php index 27df57e9926..258608314c1 100644 --- a/user/view.php +++ b/user/view.php @@ -237,7 +237,8 @@ echo ''; // Print all the little details in a list -echo html_writer::start_tag('dl', array('class'=>'list')); +echo ''; + // Show email if any of the following conditions match. // 1. User is viewing his own profile. // 2. Has allowed everyone to see email @@ -248,8 +249,7 @@ if ($currentuser or ($user->maildisplay == 2 && is_enrolled($coursecontext, $USER)) or has_capability('moodle/course:viewhiddenuserfields', $coursecontext) or has_capability('moodle/site:viewuseridentity', $coursecontext)) { - echo html_writer::tag('dt', get_string('email')); - echo html_writer::tag('dd', obfuscate_mailto($user->email, '')); + print_row(get_string("email").":", obfuscate_mailto($user->email, '')); } // Show last time this user accessed this course @@ -259,14 +259,12 @@ if (!isset($hiddenfields['lastaccess'])) { } else { $datestring = get_string("never"); } - echo html_writer::tag('dt', get_string('lastaccess')); - echo html_writer::tag('dd', $datestring); + print_row(get_string("lastaccess").":", $datestring); } // Show roles in this course if ($rolestring = get_user_roles_in_course($id, $course->id)) { - echo html_writer::tag('dt', get_string('roles')); - echo html_writer::tag('dd', $rolestring); + print_row(get_string('roles').':', $rolestring); } // Show groups this user is in @@ -288,8 +286,7 @@ if (!isset($hiddenfields['groups'])) { } } if ($groupstr !== '') { - echo html_writer::tag('dt', get_string('group')); - echo html_writer::tag('dd', rtrim($groupstr, ', ')); + print_row(get_string("group").":", rtrim($groupstr, ', ')); } } } @@ -325,19 +322,18 @@ if (!isset($hiddenfields['mycourses'])) { break; } } - echo html_writer::tag('dt', get_string('courseprofiles')); - echo html_writer::tag('dd', rtrim($courselisting,', ')); + print_row(get_string('courseprofiles').':', rtrim($courselisting,', ')); } } if (!isset($hiddenfields['suspended'])) { if ($user->suspended) { - echo html_writer::tag('dt', " "); - echo html_writer::tag('dd', get_string('suspended', 'auth')); + print_row('', get_string('suspended', 'auth')); } } -echo html_writer::end_tag('dl'); -echo ""; // Closing desriptionbox and userprofilebox. + +echo "
"; + // Print messaging link if allowed if (isloggedin() && has_capability('moodle/site:sendmessage', $usercontext) && !empty($CFG->messaging) && !isguestuser() && !isguestuser($user) && ($USER->id != $user->id)) { @@ -365,3 +361,11 @@ if ($currentuser || has_capability('moodle/user:viewdetails', $usercontext) || h echo ''; // userprofile class echo $OUTPUT->footer(); + +/// Functions /////// + +function print_row($left, $right) { + echo "\n$left$right\n"; +} + +