more backend work on poco rating
This commit is contained in:
parent
56bc3bcdce
commit
1c9299ed42
2
boot.php
2
boot.php
@ -49,7 +49,7 @@ define ( 'RED_PLATFORM', 'redmatrix' );
|
|||||||
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
|
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
|
||||||
define ( 'ZOT_REVISION', 1 );
|
define ( 'ZOT_REVISION', 1 );
|
||||||
|
|
||||||
define ( 'DB_UPDATE_VERSION', 1131 );
|
define ( 'DB_UPDATE_VERSION', 1132 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constant with a HTML line break.
|
* Constant with a HTML line break.
|
||||||
|
@ -117,6 +117,7 @@ function poco_load($xchan = '',$url = null) {
|
|||||||
$name = $entry['displayName'];
|
$name = $entry['displayName'];
|
||||||
$hash = $entry['hash'];
|
$hash = $entry['hash'];
|
||||||
$rating = ((array_key_exists('rating',$entry)) ? intval($entry['rating']) : 0);
|
$rating = ((array_key_exists('rating',$entry)) ? intval($entry['rating']) : 0);
|
||||||
|
$rating = ((array_key_exists('rating_text',$entry)) ? escape_tags($entry['rating_text']) :'');
|
||||||
|
|
||||||
if(x($entry,'urls') && is_array($entry['urls'])) {
|
if(x($entry,'urls') && is_array($entry['urls'])) {
|
||||||
foreach($entry['urls'] as $url) {
|
foreach($entry['urls'] as $url) {
|
||||||
@ -188,17 +189,19 @@ function poco_load($xchan = '',$url = null) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if(! $r) {
|
if(! $r) {
|
||||||
q("insert into xlink ( xlink_xchan, xlink_link, xlink_rating, xlink_updated ) values ( '%s', '%s', %d, '%s' ) ",
|
q("insert into xlink ( xlink_xchan, xlink_link, xlink_rating, xlink_rating_text, xlink_updated ) values ( '%s', '%s', %d, '%s', '%s' ) ",
|
||||||
dbesc($xchan),
|
dbesc($xchan),
|
||||||
dbesc($hash),
|
dbesc($hash),
|
||||||
intval($rating),
|
intval($rating),
|
||||||
|
dbesc($rating_text),
|
||||||
dbesc(datetime_convert())
|
dbesc(datetime_convert())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
q("update xlink set xlink_updated = '%s', xlink_rating = %d where xlink_id = %d",
|
q("update xlink set xlink_updated = '%s', xlink_rating = %d, xlink_rating_text = '%s' where xlink_id = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($rating),
|
intval($rating),
|
||||||
|
dbesc($rating_text),
|
||||||
intval($r[0]['xlink_id'])
|
intval($r[0]['xlink_id'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define( 'UPDATE_VERSION' , 1131 );
|
define( 'UPDATE_VERSION' , 1132 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -1483,4 +1483,14 @@ function update_r1130() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return UPDATE_SUCCESS;
|
return UPDATE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_r1131() {
|
||||||
|
$r1 = q("ALTER TABLE `abook` ADD `abook_rating_text` TEXT NOT NULL DEFAULT '' AFTER `abook_rating` ");
|
||||||
|
$r2 = q("ALTER TABLE `xlink` ADD `xlink_rating_text` TEXT NOT NULL DEFAULT '' AFTER `xlink_rating` ");
|
||||||
|
|
||||||
|
if($r1 && $r2)
|
||||||
|
return UPDATE_SUCCESS;
|
||||||
|
return UPDATE_FAILED;
|
||||||
|
|
||||||
}
|
}
|
@ -524,6 +524,12 @@ function connedit_content(&$a) {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$rating = replace_macros(get_markup_template('rating_slider.tpl'),array(
|
||||||
|
'$min' => -10,
|
||||||
|
'$val' => (($contact['abook_rating']) ? $contact['abook_rating'] : 0),
|
||||||
|
));
|
||||||
|
|
||||||
$perms = array();
|
$perms = array();
|
||||||
$channel = $a->get_channel();
|
$channel = $a->get_channel();
|
||||||
|
|
||||||
@ -555,6 +561,8 @@ function connedit_content(&$a) {
|
|||||||
'$buttons' => (($self) ? '' : $buttons),
|
'$buttons' => (($self) ? '' : $buttons),
|
||||||
'$viewprof' => t('View Profile'),
|
'$viewprof' => t('View Profile'),
|
||||||
'$lbl_slider' => t('Slide to adjust your degree of friendship'),
|
'$lbl_slider' => t('Slide to adjust your degree of friendship'),
|
||||||
|
'$lbl_rating' => t('Rating (this information is public)'),
|
||||||
|
'$rating' => $rating,
|
||||||
'$slide' => $slide,
|
'$slide' => $slide,
|
||||||
'$tabs' => $t,
|
'$tabs' => $t,
|
||||||
'$tab_str' => $tab_str,
|
'$tab_str' => $tab_str,
|
||||||
|
@ -178,7 +178,8 @@ function poco_init(&$a) {
|
|||||||
if($fields_ret['photos'])
|
if($fields_ret['photos'])
|
||||||
$entry['photos'] = array(array('value' => $rr['xchan_photo_l'], 'mimetype' => $rr['xchan_photo_mimetype'], 'type' => 'profile'));
|
$entry['photos'] = array(array('value' => $rr['xchan_photo_l'], 'mimetype' => $rr['xchan_photo_mimetype'], 'type' => 'profile'));
|
||||||
if($fields_ret['rating']) {
|
if($fields_ret['rating']) {
|
||||||
$entry['rating'] = ((array_key_exists('abook_rating',$rr)) ? array(intval($rr['abook_rating'])) : 0);
|
$entry['rating'] = ((array_key_exists('abook_rating',$rr)) ? intval($rr['abook_rating'])) : 0);
|
||||||
|
$entry['rating_text'] = ((array_key_exists('abook_rating_text',$rr)) ? $rr['abook_rating_text'])) : '');
|
||||||
// maybe this should be a composite calculated rating in $system_mode
|
// maybe this should be a composite calculated rating in $system_mode
|
||||||
if($system_mode)
|
if($system_mode)
|
||||||
$entry['rating'] = 0;
|
$entry['rating'] = 0;
|
||||||
|
@ -43,6 +43,14 @@
|
|||||||
{{$slide}}
|
{{$slide}}
|
||||||
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{if $rating}}
|
||||||
|
<h3>{{$lbl_rating}}</h3>
|
||||||
|
|
||||||
|
{{$rating}}
|
||||||
|
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
{{if $entry.id}}<id>{{$entry.id}}</id>{{/if}}
|
{{if $entry.id}}<id>{{$entry.id}}</id>{{/if}}
|
||||||
{{if $entry.displayName}}<displayName>{{$entry.displayName}}</displayName>{{/if}}
|
{{if $entry.displayName}}<displayName>{{$entry.displayName}}</displayName>{{/if}}
|
||||||
{{if $entry.preferredUsername}}<preferredUsername>{{$entry.preferredUsername}}</preferredUsername>{{/if}}
|
{{if $entry.preferredUsername}}<preferredUsername>{{$entry.preferredUsername}}</preferredUsername>{{/if}}
|
||||||
|
{{if $entry.rating}}<rating>{{$entry.rating}}</rating>{{/if}}
|
||||||
{{if $entry.urls}}{{foreach $entry.urls as $url}}<urls><value>{{$url.value}}</value><type>{{$url.type}}</type></urls>{{/foreach}}{{/if}}
|
{{if $entry.urls}}{{foreach $entry.urls as $url}}<urls><value>{{$url.value}}</value><type>{{$url.type}}</type></urls>{{/foreach}}{{/if}}
|
||||||
{{if $entry.photos}}{{foreach $entry.photos as $photo}}<photos><value>{{$photo.value}}</value><type>{{$photo.type}}</type></photos>{{/foreach}}{{/if}}
|
{{if $entry.photos}}{{foreach $entry.photos as $photo}}<photos><value>{{$photo.value}}</value><type>{{$photo.type}}</type></photos>{{/foreach}}{{/if}}
|
||||||
</entry>
|
</entry>
|
||||||
|
4
view/tpl/rating_slider.tpl
Normal file
4
view/tpl/rating_slider.tpl
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<div id="rating-slider" class="slider" style="height: 32px; position: relative; left: 5%; width: 90%;"><input id="rating-range" type="text" name="fake-rating" value="{{$val}}" /></div>
|
||||||
|
<script>
|
||||||
|
$("#rating-range").jRange({ from: {{$min|default:'-10'}}, to: 10, step: 1, width:'100%', showLabels: false, onstatechange: function(v) { $("#contact-rating-mirror").val(v); } });
|
||||||
|
</script>
|
Reference in New Issue
Block a user