add like/dislike to profiles

This commit is contained in:
friendica 2012-06-24 21:16:55 -07:00
parent 9528beac34
commit c464bc494c
7 changed files with 75 additions and 3 deletions

View file

@ -12,7 +12,7 @@ require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '3.0.1384' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1149 );
define ( 'DB_UPDATE_VERSION', 1150 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );

View file

@ -831,6 +831,8 @@ CREATE TABLE IF NOT EXISTS `profile` (
`religion` char(255) NOT NULL,
`pub_keywords` text NOT NULL,
`prv_keywords` text NOT NULL,
`likes` text NOT NULL,
`dislikes` text NOT NULL,
`about` text NOT NULL,
`summary` char(255) NOT NULL,
`music` text NOT NULL,

View file

@ -59,6 +59,11 @@ function advanced_profile(&$a) {
if($txt = prepare_text($a->profile['interest'])) $profile['interest'] = array( t('Hobbies/Interests:'), $txt);
if($txt = prepare_text($a->profile['likes'])) $profile['likes'] = array( t('Likes:'), $txt);
if($txt = prepare_text($a->profile['dislikes'])) $profile['dislikes'] = array( t('Dislikes:'), $txt);
if($txt = prepare_text($a->profile['contact'])) $profile['contact'] = array( t('Contact information and Social Networks:'), $txt);
if($txt = prepare_text($a->profile['music'])) $profile['music'] = array( t('Musical interests:'), $txt);

View file

@ -130,6 +130,9 @@ function profiles_post(&$a) {
$politic = notags(trim($_POST['politic']));
$religion = notags(trim($_POST['religion']));
$likes = fix_mce_lf(escape_tags(trim($_POST['likes'])));
$dislikes = fix_mce_lf(escape_tags(trim($_POST['dislikes'])));
$about = fix_mce_lf(escape_tags(trim($_POST['about'])));
$interest = fix_mce_lf(escape_tags(trim($_POST['interest'])));
$contact = fix_mce_lf(escape_tags(trim($_POST['contact'])));
@ -156,6 +159,14 @@ function profiles_post(&$a) {
$changes[] = '[color=#ff0000]&hearts;[/color] ' . t('Romantic Partner');
$value = strip_tags($with);
}
if($likes != $orig[0]['likes']) {
$changes[] = t('Likes');
$value = $likes;
}
if($dislikes != $orig[0]['dislikes']) {
$changes[] = t('Dislikes');
$value = $dislikes;
}
if($work != $orig[0]['work']) {
$changes[] = t('Work/Employment');
}
@ -222,6 +233,8 @@ function profiles_post(&$a) {
`religion` = '%s',
`pub_keywords` = '%s',
`prv_keywords` = '%s',
`likes` = '%s',
`dislikes` = '%s',
`about` = '%s',
`interest` = '%s',
`contact` = '%s',
@ -254,6 +267,8 @@ function profiles_post(&$a) {
dbesc($religion),
dbesc($pub_keywords),
dbesc($prv_keywords),
dbesc($likes),
dbesc($dislikes),
dbesc($about),
dbesc($interest),
dbesc($contact),
@ -577,6 +592,8 @@ function profiles_content(&$a) {
'$lbl_religion' => t('Religious Views:'),
'$lbl_pubkey' => t('Public Keywords:'),
'$lbl_prvkey' => t('Private Keywords:'),
'$lbl_likes' => t('Likes:'),
'$lbl_dislikes' => t('Dislikes:'),
'$lbl_ex2' => t('Example: fishing photography software'),
'$lbl_pubdsc' => t("\x28Used for suggesting potential friends, can be seen by others\x29"),
'$lbl_prvdsc' => t("\x28Used for searching profiles, never shown to others\x29"),
@ -617,6 +634,8 @@ function profiles_content(&$a) {
'$religion' => $r[0]['religion'],
'$pub_keywords' => $r[0]['pub_keywords'],
'$prv_keywords' => $r[0]['prv_keywords'],
'$likes' => $r[0]['likes'],
'$dislikes' => $r[0]['dislikes'],
'$music' => $r[0]['music'],
'$book' => $r[0]['book'],
'$tv' => $r[0]['tv'],

View file

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1149 );
define( 'UPDATE_VERSION' , 1150 );
/**
*
@ -1289,3 +1289,12 @@ function update_1148() {
return UPDATE_FAILED;
return UPDATE_SUCCESS;
}
function update_1149() {
$r1 = q("ALTER TABLE profile ADD likes text NOT NULL after prv_keywords");
$r2 = q("ALTER TABLE profile ADD dislikes text NOT NULL after likes");
if (! ($r1 && $r2))
return UPDATE_FAILED;
return UPDATE_SUCCESS;
}

View file

@ -89,6 +89,19 @@
</dl>
{{ endif }}
{{ if $profile.likes }}
<dl id="aprofile-likes" class="aprofile">
<dt>$profile.likes.0</dt>
<dd>$profile.likes.1</dd>
</dl>
{{ endif }}
{{ if $profile.dislikes }}
<dl id="aprofile-dislikes" class="aprofile">
<dt>$profile.dislikes.0</dt>
<dd>$profile.dislikes.1</dd>
</dl>
{{ endif }}
{{ if $profile.contact }}
<dl id="aprofile-contact" class="aprofile">

View file

@ -187,6 +187,30 @@ $lbl_hobbies
</div>
<div id="likes-jot-wrapper" >
<p id="likes-jot-desc" >
$lbl_likes
</p>
<textarea rows="10" cols="72" id="likes-jot-text" name="likes" >$likes</textarea>
</div>
<div id="likes-jot-end"></div>
</div>
<div id="dislikes-jot-wrapper" >
<p id="dislikes-jot-desc" >
$lbl_dislikes
</p>
<textarea rows="10" cols="72" id="dislikes-jot-text" name="dislikes" >$dislikes</textarea>
</div>
<div id="dislikes-jot-end"></div>
</div>
<div id="contact-jot-wrapper" >
<p id="contact-jot-desc" >
$lbl_social