From be48fff1570aa1d04e049a6fd1665f4fc9634a62 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 13 Mar 2012 18:13:03 -0700 Subject: [PATCH] file as widget and basic filing implementation for duepuntozero,slackr much more work needed - this is just for test/evaluation currently --- include/contact_widgets.php | 29 ++++++++++++++++++++++++++ include/conversation.php | 2 ++ include/text.php | 2 +- mod/filer.php | 23 ++++++++++++++++++++ mod/network.php | 1 + view/fileas_widget.tpl | 12 +++++++++++ view/jot-header.tpl | 12 +++++++++++ view/theme/duepuntozero/file.gif | Bin 0 -> 615 bytes view/theme/duepuntozero/style.css | 23 +++++++++++++++++--- view/theme/duepuntozero/wall_item.tpl | 1 + view/theme/greenzero/file.gif | Bin 0 -> 614 bytes 11 files changed, 101 insertions(+), 4 deletions(-) create mode 100755 mod/filer.php create mode 100755 view/fileas_widget.tpl create mode 100644 view/theme/duepuntozero/file.gif create mode 100644 view/theme/greenzero/file.gif diff --git a/include/contact_widgets.php b/include/contact_widgets.php index caa0572d20..605a3eb78e 100755 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -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, + + )); +} diff --git a/include/conversation.php b/include/conversation.php index 4b2ca316ba..a420e9923a 100755 --- a/include/conversation.php +++ b/include/conversation.php @@ -572,6 +572,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { 'classundo' => (($item['starred']) ? "" : "hidden"), 'starred' => t('starred'), 'tagger' => t("add tag"), + 'filer' => t("file as"), 'classtagger' => "", ); } @@ -874,6 +875,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) { '$vidurl' => t("Please enter a video link/URL:"), '$audurl' => t("Please enter an audio link/URL:"), '$term' => t('Tag term:'), + '$fileas' => t('File as:'), '$whereareu' => t('Where are you right now?'), '$title' => t('Enter a title for this item') )); diff --git a/include/text.php b/include/text.php index 2663bdebaa..c44b4d1789 100644 --- a/include/text.php +++ b/include/text.php @@ -1294,7 +1294,7 @@ function file_tag_save_file($uid,$item,$file) { if(count($r)) { if(! stristr($r[0]['file'],'[' . file_tag_encode($file) . ']')) 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($uid) ); diff --git a/mod/filer.php b/mod/filer.php new file mode 100755 index 0000000000..a9e2135361 --- /dev/null +++ b/mod/filer.php @@ -0,0 +1,23 @@ +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(); +} diff --git a/mod/network.php b/mod/network.php index 7e7a958419..4f58fc4fbc 100755 --- a/mod/network.php +++ b/mod/network.php @@ -46,6 +46,7 @@ function network_init(&$a) { $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'] .= saved_searches($search); + $a->page['aside'] .= fileas_widget($a->get_baseurl() . '/network',(x($_GET, 'file') ? $_GET['file'] : '')); } diff --git a/view/fileas_widget.tpl b/view/fileas_widget.tpl new file mode 100755 index 0000000000..54fba7435f --- /dev/null +++ b/view/fileas_widget.tpl @@ -0,0 +1,12 @@ +
+

$title

+
$desc
+ + + +
diff --git a/view/jot-header.tpl b/view/jot-header.tpl index d6b172b6af..88df73494f 100755 --- a/view/jot-header.tpl +++ b/view/jot-header.tpl @@ -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() { $('#jot-coord').val(''); $('#profile-nolocation-wrapper').hide(); diff --git a/view/theme/duepuntozero/file.gif b/view/theme/duepuntozero/file.gif new file mode 100644 index 0000000000000000000000000000000000000000..7885b998d578d4523103e1f5dfbcd8133a7f0fe7 GIT binary patch literal 615 zcmZ?wbhEHb6krfwIF`)7#xKb(Aj2uD!Xs-asNo`J94_scC*xeG;M1rUF;y*cx?0ps z_2^mZF>^Fx=V~P{*G^rfleShbd#hf~c7uYwhQ)`B%8nbAoir{#Wm{SZR^k3H=J{9Jm=JO-lh4xYs&@q)(f6(7rfdp`gC0M@46J&eJQBta!B9h@CjEU zCtit~bTwx3)z~T5;-_9qoOUf~`t_6<*HdTSNS}2hbM}p#xi@p?-O8VTt6<^nlEt^n zm)@yZcDHury{0wy+t)wn*zmAxdicePqc2w-f4Szw%e5z8tv~f@)0x*>&c5Dp;q9)AZ+BmMxA*e9{a4-{xcdI^ z^$$mHd^mpV!>KzTPv8A?_TH!S_doro4N&~a!pOx?&!EEq1fV!!U_a7O-_+dF+SU>! zFQMYz-Xh@HBp)OYX*7MhPg@W#w~=pBQbN3eZz~TMmqFs9_?SQ)4OK-ssb;;n#j&A* zd-rW?(vFUgwX!ldG1S#kSCW^J(hQGrGYyNp5g8E{5^SNR78+&d5VFtD$HU2(Cq_BY z%_KY^(BH??#leP8tzN;;s4bxJl1t}A1>2$$i-f1=+Y}7fSVT6ZoamP|_An?=&^XL3 nuk6%xBcZXWg@e6|V^=`pp=K5i9uWlt2ZjcQz9KFz76xkoO@B#U literal 0 HcmV?d00001 diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index acd97eb941..10ddb00909 100755 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -309,7 +309,7 @@ div.wall-item-content-wrapper.shiny { margin-bottom: 10px; } -.group-selected, .nets-selected { +.group-selected, .nets-selected, .fileas-selected { padding: 3px; -moz-border-radius: 3px; border-radius: 3px; @@ -1024,6 +1024,10 @@ input#dfrn-url { float: left; } +.filer-item { + margin-left: 10px; + float: left; +} .wall-item-links-wrapper { float: left; @@ -1864,11 +1868,11 @@ a.mail-list-link { margin-top: 10px; } -.nets-ul { +.nets-ul, .fileas-ul { list-style-type: none; } -.nets-ul li { +.nets-ul li, .fileas-ul li { margin-top: 10px; } @@ -1879,6 +1883,14 @@ a.mail-list-link { margin-left: 42px; } +.fileas-link { + margin-left: 24px; +} + +.fileas-all { + margin-left: 0px; +} + #search-save { margin-left: 5px; } @@ -2902,6 +2914,11 @@ aside input[type='text'] { .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); } .attachtype { diff --git a/view/theme/duepuntozero/wall_item.tpl b/view/theme/duepuntozero/wall_item.tpl index 51e36b6f4f..2c88fc598e 100755 --- a/view/theme/duepuntozero/wall_item.tpl +++ b/view/theme/duepuntozero/wall_item.tpl @@ -56,6 +56,7 @@ {{ if $item.star }} + {{ endif }}
diff --git a/view/theme/greenzero/file.gif b/view/theme/greenzero/file.gif new file mode 100644 index 0000000000000000000000000000000000000000..e388a13c0b99d0afa18c2fb51a90610923cb6917 GIT binary patch literal 614 zcmZ?wbhEHb6krfwI2OvlF38Fu!p0@V!LQ0AY9c7@BBmTJqY^2rnXY6|u5MVVVN|1O zRHtcNuVvP*YtgM|J=xG^ilN;sV~6>sjtfnl7MnRQGk0EY?z-C2b&aLlI!pHr)*hRz zJvLi=Zng2+Ve7ry&S$T^-+l-G{fKja;G*eCjkf9#QfgkvFz$3jz% zN2DH)Og|BwaUv%BR6^eApq}v;FC&ozJ%HdbV}X^X+?| z@7VWz=fM|y4!_)Y^wq%=uaBI5bNt-fQ~w7VDE?$&@$@$$FP^Yppll?vo%ZL41t4=Oe}0%0ul-g4h-%VtgK87)&N@+JAVKG literal 0 HcmV?d00001