some work on poke template
This commit is contained in:
parent
64a5b33e77
commit
8f92b6eea4
12 changed files with 206 additions and 51 deletions
49
mod/poke.php
49
mod/poke.php
|
@ -1,4 +1,18 @@
|
||||||
<?php
|
<?php /** @file */
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Poke, prod, finger, or otherwise do unspeakable things to somebody - who must be a connection in your address book
|
||||||
|
* This function can be invoked with the required arguments (verb and cid and private and possibly parent) silently via ajax or
|
||||||
|
* other web request. You must be logged in and connected to a profile.
|
||||||
|
* If the required arguments aren't present, we'll display a simple form to choose a recipient and a verb.
|
||||||
|
* parent is a special argument which let's you attach this activity as a comment to an existing conversation, which
|
||||||
|
* may have started with somebody else poking (etc.) somebody, but this isn't necessary. This can be used in the more pokes
|
||||||
|
* plugin version to have entire conversations where Alice poked Bob, Bob fingered Alice, Alice hugged Bob, etc.
|
||||||
|
*
|
||||||
|
* private creates a private conversation with the recipient. Otherwise your profile's default post privacy is used.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
require_once('include/security.php');
|
require_once('include/security.php');
|
||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
|
@ -33,7 +47,7 @@ function poke_init(&$a) {
|
||||||
logger('poke: verb ' . $verb . ' contact ' . $contact_id, LOGGER_DEBUG);
|
logger('poke: verb ' . $verb . ' contact ' . $contact_id, LOGGER_DEBUG);
|
||||||
|
|
||||||
|
|
||||||
$r = q("SELECT * FROM `contact` WHERE `id` = %d and `uid` = %d LIMIT 1",
|
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||||
intval($contact_id),
|
intval($contact_id),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
|
@ -46,8 +60,8 @@ function poke_init(&$a) {
|
||||||
$target = $r[0];
|
$target = $r[0];
|
||||||
|
|
||||||
if($parent) {
|
if($parent) {
|
||||||
$r = q("select uri, private, allow_cid, allow_gid, deny_cid, deny_gid
|
$r = q("SELECT `uri`, `private`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`
|
||||||
from item where id = %d and parent = %d and uid = %d limit 1",
|
FROM `item` WHERE `id` = %d AND `parent` = %d AND `uid` = %d LIMIT 1",
|
||||||
intval($parent),
|
intval($parent),
|
||||||
intval($parent),
|
intval($parent),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
|
@ -140,7 +154,7 @@ function poke_content(&$a) {
|
||||||
$id = '';
|
$id = '';
|
||||||
|
|
||||||
if(intval($_GET['c'])) {
|
if(intval($_GET['c'])) {
|
||||||
$r = q("select id,name from contact where id = %d and uid = %d limit 1",
|
$r = q("SELECT `id`,`name` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||||
intval($_GET['c']),
|
intval($_GET['c']),
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
|
@ -153,31 +167,16 @@ function poke_content(&$a) {
|
||||||
|
|
||||||
$base = $a->get_baseurl();
|
$base = $a->get_baseurl();
|
||||||
|
|
||||||
$a->page['htmlhead'] .= '<script src="' . $a->get_baseurl(true) . '/library/jquery_ac/friendica.complete.js" ></script>';
|
$head_tpl = get_markup_template('poke_head.tpl');
|
||||||
$a->page['htmlhead'] .= <<< EOT
|
$a->page['htmlhead'] .= replace_macros($head_tpl,array(
|
||||||
|
'$baseurl' => $a->get_baseurl(true),
|
||||||
|
'$base' => $base
|
||||||
|
));
|
||||||
|
|
||||||
<script>$(document).ready(function() {
|
|
||||||
var a;
|
|
||||||
a = $("#poke-recip").autocomplete({
|
|
||||||
serviceUrl: '$base/acl',
|
|
||||||
minChars: 2,
|
|
||||||
width: 350,
|
|
||||||
onSelect: function(value,data) {
|
|
||||||
$("#poke-recip-complete").val(data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
a.setOptions({ params: { type: 'a' }});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
EOT;
|
|
||||||
|
|
||||||
$parent = ((x($_GET,'parent')) ? intval($_GET['parent']) : '0');
|
$parent = ((x($_GET,'parent')) ? intval($_GET['parent']) : '0');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$verbs = get_poke_verbs();
|
$verbs = get_poke_verbs();
|
||||||
|
|
||||||
$shortlist = array();
|
$shortlist = array();
|
||||||
|
|
|
@ -3,31 +3,33 @@
|
||||||
|
|
||||||
<div id="poke-desc">{{$desc}}</div>
|
<div id="poke-desc">{{$desc}}</div>
|
||||||
|
|
||||||
<form action="poke" method="get">
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<div id="poke-recip-label">{{$clabel}}</div>
|
<div id="poke-wrapper">
|
||||||
<br />
|
<form action="poke" method="get">
|
||||||
<input id="poke-recip" type="text" size="64" maxlength="255" value="{{$name|escape:'html'}}" name="pokename" autocomplete="off" />
|
|
||||||
<input id="poke-recip-complete" type="hidden" value="{{$id}}" name="cid" />
|
<div id="poke-recipient">
|
||||||
<input id="poke-parent" type="hidden" value="{{$parent}}" name="parent" />
|
<div id="poke-recip-label">{{$clabel}}</div>
|
||||||
<br />
|
<input id="poke-recip" type="text" size="64" maxlength="255" value="{{$name|escape:'html'}}" name="pokename" autocomplete="off" />
|
||||||
<br />
|
<input id="poke-recip-complete" type="hidden" value="{{$id}}" name="cid" />
|
||||||
<div id="poke-action-label">{{$choice}}</div>
|
<input id="poke-parent" type="hidden" value="{{$parent}}" name="parent" />
|
||||||
<br />
|
</div>
|
||||||
<br />
|
|
||||||
<select name="verb" id="poke-verb-select" >
|
<div id="poke-action">
|
||||||
{{foreach $verbs as $v}}
|
<div id="poke-action-label">{{$choice}}</div>
|
||||||
<option value="{{$v.0}}">{{$v.1}}</option>
|
<select name="verb" id="poke-verb-select" >
|
||||||
{{/foreach}}
|
{{foreach $verbs as $v}}
|
||||||
</select>
|
<option value="{{$v.0}}">{{$v.1}}</option>
|
||||||
<br />
|
{{/foreach}}
|
||||||
<br />
|
</select>
|
||||||
<div id="poke-private-desc">{{$prv_desc}}</div>
|
</div>
|
||||||
<input type="checkbox" name="private" {{if $parent}}disabled="disabled"{{/if}} value="1" />
|
|
||||||
<br />
|
<div id="poke-privacy-settings">
|
||||||
<br />
|
<div id="poke-private-desc">{{$prv_desc}}</div>
|
||||||
<input type="submit" name="submit" value="{{$submit|escape:'html'}}" />
|
<input type="checkbox" name="private" {{if $parent}}disabled="disabled"{{/if}} value="1" />
|
||||||
</form>
|
</div>
|
||||||
|
|
||||||
|
<input type="submit" name="submit" value="{{$submit|escape:'html'}}" />
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
18
view/templates/poke_head.tpl
Normal file
18
view/templates/poke_head.tpl
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<script src="{{$baseurl}}/library/jquery_ac/friendica.complete.js" ></script>
|
||||||
|
|
||||||
|
<script>$(document).ready(function() {
|
||||||
|
var a;
|
||||||
|
a = $("#poke-recip").autocomplete({
|
||||||
|
serviceUrl: '{{$base}}/acl',
|
||||||
|
minChars: 2,
|
||||||
|
width: 350,
|
||||||
|
onSelect: function(value,data) {
|
||||||
|
$("#poke-recip-complete").val(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
a.setOptions({ params: { type: 'a' }});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
|
@ -2022,6 +2022,21 @@ a.mail-list-link {
|
||||||
.message-links-end {
|
.message-links-end {
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
|
#poke-desc {
|
||||||
|
margin: 5px 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#poke-wrapper {
|
||||||
|
padding: 10px 0 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#poke-recipient, #poke-action, #poke-privacy-settings {
|
||||||
|
margin: 10px 0 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#poke-recip-label, #poke-action-label, #prvmail-message-label {
|
||||||
|
margin: 10px 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
#sidebar-group-list ul {
|
#sidebar-group-list ul {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
|
|
|
@ -2500,6 +2500,22 @@ a.mail-list-link {
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#poke-desc {
|
||||||
|
margin: 5px 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#poke-wrapper {
|
||||||
|
padding: 10px 0 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#poke-recipient, #poke-action, #poke-privacy-settings {
|
||||||
|
margin: 10px 0 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#poke-recip-label, #poke-action-label, #prvmail-message-label {
|
||||||
|
margin: 10px 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
#sidebar-group-list ul {
|
#sidebar-group-list ul {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2315,6 +2315,22 @@ a.mail-list-link {
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#poke-desc {
|
||||||
|
margin: 5px 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#poke-wrapper {
|
||||||
|
padding: 10px 0 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#poke-recipient, #poke-action, #poke-privacy-settings {
|
||||||
|
margin: 10px 0 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#poke-recip-label, #poke-action-label, #prvmail-message-label {
|
||||||
|
margin: 10px 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
#sidebar-group-list ul {
|
#sidebar-group-list ul {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2267,6 +2267,20 @@ ul.tabs li .active {
|
||||||
-ms-transition: all 0.2s ease-in-out;
|
-ms-transition: all 0.2s ease-in-out;
|
||||||
transition: all 0.2s ease-in-out;
|
transition: all 0.2s ease-in-out;
|
||||||
}
|
}
|
||||||
|
/* poke */
|
||||||
|
#poke-desc {
|
||||||
|
margin: 5px 0 25px;
|
||||||
|
}
|
||||||
|
#poke-recipient,
|
||||||
|
#poke-action,
|
||||||
|
#poke-privacy-settings {
|
||||||
|
margin: 10px 0 30px;
|
||||||
|
}
|
||||||
|
#poke-recip-label,
|
||||||
|
#poke-action-label,
|
||||||
|
#prvmail-message-label {
|
||||||
|
margin: 10px 0 10px;
|
||||||
|
}
|
||||||
/* theme screenshot */
|
/* theme screenshot */
|
||||||
.screenshot,
|
.screenshot,
|
||||||
#theme-preview {
|
#theme-preview {
|
||||||
|
|
|
@ -2267,6 +2267,20 @@ ul.tabs li .active {
|
||||||
-ms-transition: all 0.2s ease-in-out;
|
-ms-transition: all 0.2s ease-in-out;
|
||||||
transition: all 0.2s ease-in-out;
|
transition: all 0.2s ease-in-out;
|
||||||
}
|
}
|
||||||
|
/* poke */
|
||||||
|
#poke-desc {
|
||||||
|
margin: 5px 0 25px;
|
||||||
|
}
|
||||||
|
#poke-recipient,
|
||||||
|
#poke-action,
|
||||||
|
#poke-privacy-settings {
|
||||||
|
margin: 10px 0 30px;
|
||||||
|
}
|
||||||
|
#poke-recip-label,
|
||||||
|
#poke-action-label,
|
||||||
|
#prvmail-message-label {
|
||||||
|
margin: 10px 0 10px;
|
||||||
|
}
|
||||||
/* theme screenshot */
|
/* theme screenshot */
|
||||||
.screenshot,
|
.screenshot,
|
||||||
#theme-preview {
|
#theme-preview {
|
||||||
|
|
|
@ -2267,6 +2267,20 @@ ul.tabs li .active {
|
||||||
-ms-transition: all 0.2s ease-in-out;
|
-ms-transition: all 0.2s ease-in-out;
|
||||||
transition: all 0.2s ease-in-out;
|
transition: all 0.2s ease-in-out;
|
||||||
}
|
}
|
||||||
|
/* poke */
|
||||||
|
#poke-desc {
|
||||||
|
margin: 5px 0 25px;
|
||||||
|
}
|
||||||
|
#poke-recipient,
|
||||||
|
#poke-action,
|
||||||
|
#poke-privacy-settings {
|
||||||
|
margin: 10px 0 30px;
|
||||||
|
}
|
||||||
|
#poke-recip-label,
|
||||||
|
#poke-action-label,
|
||||||
|
#prvmail-message-label {
|
||||||
|
margin: 10px 0 10px;
|
||||||
|
}
|
||||||
/* theme screenshot */
|
/* theme screenshot */
|
||||||
.screenshot,
|
.screenshot,
|
||||||
#theme-preview {
|
#theme-preview {
|
||||||
|
|
|
@ -1525,6 +1525,18 @@ ul.tabs {
|
||||||
&:hover .mail-delete { .opaque(1); }
|
&:hover .mail-delete { .opaque(1); }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/* poke */
|
||||||
|
#poke-desc {
|
||||||
|
margin: 5px 0 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#poke-recipient, #poke-action, #poke-privacy-settings {
|
||||||
|
margin: 10px 0 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#poke-recip-label, #poke-action-label, #prvmail-message-label {
|
||||||
|
margin: 10px 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
/* theme screenshot */
|
/* theme screenshot */
|
||||||
.screenshot, #theme-preview {
|
.screenshot, #theme-preview {
|
||||||
|
|
|
@ -2693,6 +2693,25 @@ margin-left: 0px;
|
||||||
border: 1px solid #7C7D7B;
|
border: 1px solid #7C7D7B;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ========== */
|
||||||
|
/* = Poke = */
|
||||||
|
/* ========== */
|
||||||
|
#poke-desc {
|
||||||
|
margin: 5px 0 20px;
|
||||||
|
}
|
||||||
|
#poke-wrapper {
|
||||||
|
margin: 40px 0 20px;
|
||||||
|
}
|
||||||
|
#poke-recipient, #poke-action, #poke-privacy-settings {
|
||||||
|
margin: 10px 0 30px;
|
||||||
|
}
|
||||||
|
#poke-recip-label, #poke-action-label, #prvmail-message-label {
|
||||||
|
margin: 10px 0 20px;
|
||||||
|
}
|
||||||
|
#poke-recip {
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* ================= */
|
/* ================= */
|
||||||
/* = Notifications = */
|
/* = Notifications = */
|
||||||
/* ================= */
|
/* ================= */
|
||||||
|
|
|
@ -2496,6 +2496,22 @@ a.mail-list-link {
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ========== */
|
||||||
|
/* = Poke = */
|
||||||
|
/* ========== */
|
||||||
|
#poke-desc {
|
||||||
|
margin: 10px 0 20px;
|
||||||
|
}
|
||||||
|
#poke-wrapper {
|
||||||
|
margin: 40px 0 20px;
|
||||||
|
}
|
||||||
|
#poke-recipient, #poke-action, #poke-privacy-settings {
|
||||||
|
margin: 10px 0 30px;
|
||||||
|
}
|
||||||
|
#poke-recip-label, #poke-action-label, #prvmail-message-label {
|
||||||
|
margin: 10px 0 20px;
|
||||||
|
}
|
||||||
|
|
||||||
/* ========== */
|
/* ========== */
|
||||||
/* = Events = */
|
/* = Events = */
|
||||||
/* ========== */
|
/* ========== */
|
||||||
|
|
Loading…
Reference in a new issue