file as widget and basic filing implementation for duepuntozero,slackr
much more work needed - this is just for test/evaluation currently
This commit is contained in:
parent
8a789a33d1
commit
be48fff157
|
@ -75,4 +75,33 @@ function networks_widget($baseurl,$selected = '') {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fileas_widget($baseurl,$selected = '') {
|
||||||
|
$a = get_app();
|
||||||
|
if(! local_user())
|
||||||
|
return '';
|
||||||
|
|
||||||
|
$saved = get_pconfig(local_user(),'system','filetags');
|
||||||
|
if(! strlen($saved))
|
||||||
|
return;
|
||||||
|
|
||||||
|
$matches = false;
|
||||||
|
$terms = array();
|
||||||
|
$cnt = preg_match_all('/\[(.*?)\]/',$saved,$matches,PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
$unescaped = file_tag_decode($mtch[1]);
|
||||||
|
$terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : ''));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return replace_macros(get_markup_template('fileas_widget.tpl'),array(
|
||||||
|
'$title' => t('File Selections'),
|
||||||
|
'$desc' => '',
|
||||||
|
'$sel_all' => (($selected == '') ? 'selected' : ''),
|
||||||
|
'$all' => t('Everything'),
|
||||||
|
'$terms' => $terms,
|
||||||
|
'$base' => $baseurl,
|
||||||
|
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -572,6 +572,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
||||||
'classundo' => (($item['starred']) ? "" : "hidden"),
|
'classundo' => (($item['starred']) ? "" : "hidden"),
|
||||||
'starred' => t('starred'),
|
'starred' => t('starred'),
|
||||||
'tagger' => t("add tag"),
|
'tagger' => t("add tag"),
|
||||||
|
'filer' => t("file as"),
|
||||||
'classtagger' => "",
|
'classtagger' => "",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -874,6 +875,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
|
||||||
'$vidurl' => t("Please enter a video link/URL:"),
|
'$vidurl' => t("Please enter a video link/URL:"),
|
||||||
'$audurl' => t("Please enter an audio link/URL:"),
|
'$audurl' => t("Please enter an audio link/URL:"),
|
||||||
'$term' => t('Tag term:'),
|
'$term' => t('Tag term:'),
|
||||||
|
'$fileas' => t('File as:'),
|
||||||
'$whereareu' => t('Where are you right now?'),
|
'$whereareu' => t('Where are you right now?'),
|
||||||
'$title' => t('Enter a title for this item')
|
'$title' => t('Enter a title for this item')
|
||||||
));
|
));
|
||||||
|
|
|
@ -1294,7 +1294,7 @@ function file_tag_save_file($uid,$item,$file) {
|
||||||
if(count($r)) {
|
if(count($r)) {
|
||||||
if(! stristr($r[0]['file'],'[' . file_tag_encode($file) . ']'))
|
if(! stristr($r[0]['file'],'[' . file_tag_encode($file) . ']'))
|
||||||
q("update item set file = '%s' where id = %d and uid = %d limit 1",
|
q("update item set file = '%s' where id = %d and uid = %d limit 1",
|
||||||
dbesc($r[0]['file'] . '[' . $file_tag_encode($file) . ']'),
|
dbesc($r[0]['file'] . '[' . file_tag_encode($file) . ']'),
|
||||||
intval($item),
|
intval($item),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
|
|
23
mod/filer.php
Executable file
23
mod/filer.php
Executable file
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once('include/security.php');
|
||||||
|
require_once('include/bbcode.php');
|
||||||
|
require_once('include/items.php');
|
||||||
|
|
||||||
|
|
||||||
|
function filer_content(&$a) {
|
||||||
|
|
||||||
|
if(! local_user()) {
|
||||||
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
|
$term = notags(trim($_GET['term']));
|
||||||
|
$item_id = (($a->argc > 1) ? notags(trim($a->argv[1])) : 0);
|
||||||
|
|
||||||
|
logger('filer: tag ' . $term . ' item ' . $item_id);
|
||||||
|
|
||||||
|
if($item_id && strlen($term))
|
||||||
|
file_tag_save_file(local_user(),$item_id,$term);
|
||||||
|
|
||||||
|
killme();
|
||||||
|
}
|
|
@ -46,6 +46,7 @@ function network_init(&$a) {
|
||||||
$a->page['aside'] .= group_side('network','network',true,$group_id);
|
$a->page['aside'] .= group_side('network','network',true,$group_id);
|
||||||
$a->page['aside'] .= networks_widget($a->get_baseurl() . '/network',(x($_GET, 'nets') ? $_GET['nets'] : ''));
|
$a->page['aside'] .= networks_widget($a->get_baseurl() . '/network',(x($_GET, 'nets') ? $_GET['nets'] : ''));
|
||||||
$a->page['aside'] .= saved_searches($search);
|
$a->page['aside'] .= saved_searches($search);
|
||||||
|
$a->page['aside'] .= fileas_widget($a->get_baseurl() . '/network',(x($_GET, 'file') ? $_GET['file'] : ''));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
view/fileas_widget.tpl
Executable file
12
view/fileas_widget.tpl
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
<div id="fileas-sidebar" class="widget">
|
||||||
|
<h3>$title</h3>
|
||||||
|
<div id="nets-desc">$desc</div>
|
||||||
|
|
||||||
|
<ul class="fileas-ul">
|
||||||
|
<li class="tool"><a href="$base" class="fileas-link fileas-all{{ if $sel_all }} fileas-selected{{ endif }}">$all</a></li>
|
||||||
|
{{ for $terms as $term }}
|
||||||
|
<li class="tool"><a href="$base?f=&file=$term.name" class="fileas-link{{ if $term.selected }} fileas-selected{{ endif }}">$term.name</a></li>
|
||||||
|
{{ endfor }}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
|
@ -262,6 +262,18 @@ function enableOnUser(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function itemFiler(id) {
|
||||||
|
reply = prompt("$fileas");
|
||||||
|
if(reply && reply.length) {
|
||||||
|
commentBusy = true;
|
||||||
|
$('body').css('cursor', 'wait');
|
||||||
|
$.get('filer/' + id + '?term=' + reply);
|
||||||
|
if(timer) clearTimeout(timer);
|
||||||
|
timer = setTimeout(NavUpdate,3000);
|
||||||
|
liking = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function jotClearLocation() {
|
function jotClearLocation() {
|
||||||
$('#jot-coord').val('');
|
$('#jot-coord').val('');
|
||||||
$('#profile-nolocation-wrapper').hide();
|
$('#profile-nolocation-wrapper').hide();
|
||||||
|
|
BIN
view/theme/duepuntozero/file.gif
Normal file
BIN
view/theme/duepuntozero/file.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 615 B |
|
@ -309,7 +309,7 @@ div.wall-item-content-wrapper.shiny {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.group-selected, .nets-selected {
|
.group-selected, .nets-selected, .fileas-selected {
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
-moz-border-radius: 3px;
|
-moz-border-radius: 3px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
|
@ -1024,6 +1024,10 @@ input#dfrn-url {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.filer-item {
|
||||||
|
margin-left: 10px;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
.wall-item-links-wrapper {
|
.wall-item-links-wrapper {
|
||||||
float: left;
|
float: left;
|
||||||
|
@ -1864,11 +1868,11 @@ a.mail-list-link {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nets-ul {
|
.nets-ul, .fileas-ul {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nets-ul li {
|
.nets-ul li, .fileas-ul li {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1879,6 +1883,14 @@ a.mail-list-link {
|
||||||
margin-left: 42px;
|
margin-left: 42px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fileas-link {
|
||||||
|
margin-left: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fileas-all {
|
||||||
|
margin-left: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
#search-save {
|
#search-save {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
@ -2902,6 +2914,11 @@ aside input[type='text'] {
|
||||||
.tagged { background-position: -48px -48px; }
|
.tagged { background-position: -48px -48px; }
|
||||||
|
|
||||||
|
|
||||||
|
.filer-icon {
|
||||||
|
display: block; width: 16px; height: 16px;
|
||||||
|
background-image: url('file.gif');
|
||||||
|
}
|
||||||
|
|
||||||
.icon.dim { opacity: 0.3;filter:alpha(opacity=30); }
|
.icon.dim { opacity: 0.3;filter:alpha(opacity=30); }
|
||||||
|
|
||||||
.attachtype {
|
.attachtype {
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
{{ if $item.star }}
|
{{ if $item.star }}
|
||||||
<a href="#" id="starred-$item.id" onclick="dostar($item.id); return false;" class="star-item icon $item.isstarred" title="$item.star.toggle"></a>
|
<a href="#" id="starred-$item.id" onclick="dostar($item.id); return false;" class="star-item icon $item.isstarred" title="$item.star.toggle"></a>
|
||||||
<a href="#" id="tagger-$item.id" onclick="itemTag($item.id); return false;" class="tag-item icon tagged" title="$item.star.tagger"></a>
|
<a href="#" id="tagger-$item.id" onclick="itemTag($item.id); return false;" class="tag-item icon tagged" title="$item.star.tagger"></a>
|
||||||
|
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item filer-icon" title="$item.star.filer"></a>
|
||||||
{{ endif }}
|
{{ endif }}
|
||||||
|
|
||||||
<div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-$item.id" >
|
<div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-$item.id" >
|
||||||
|
|
BIN
view/theme/greenzero/file.gif
Normal file
BIN
view/theme/greenzero/file.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 614 B |
Loading…
Reference in a new issue