diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-09-01 19:27:41 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-09-01 19:27:41 -0700 |
commit | 1ce8ce896b39e4131fdb67ce4505959638c523a5 (patch) | |
tree | ecf53b2f84cc9c412bc68efadc5eb8d82fabf617 | |
parent | 85daf26eb1f12a5fd7f2782b0cd4c9cd6f2c0cb5 (diff) | |
download | volse-hubzilla-1ce8ce896b39e4131fdb67ce4505959638c523a5.tar.gz volse-hubzilla-1ce8ce896b39e4131fdb67ce4505959638c523a5.tar.bz2 volse-hubzilla-1ce8ce896b39e4131fdb67ce4505959638c523a5.zip |
provide consistent ui for things
-rw-r--r-- | mod/thing.php | 21 | ||||
-rwxr-xr-x | view/tpl/profile_advanced.tpl | 2 | ||||
-rw-r--r-- | view/tpl/show_thing.tpl | 2 | ||||
-rw-r--r-- | view/tpl/thing_edit.tpl | 9 | ||||
-rw-r--r-- | view/tpl/thing_input.tpl | 9 |
5 files changed, 36 insertions, 7 deletions
diff --git a/mod/thing.php b/mod/thing.php index ed0f97efa..78fbf396c 100644 --- a/mod/thing.php +++ b/mod/thing.php @@ -5,8 +5,9 @@ */ require_once('include/items.php'); +require_once('include/security.php'); require_once('include/contact_selectors.php'); - +require_once('include/acl_selectors.php'); function thing_init(&$a) { @@ -61,9 +62,6 @@ function thing_init(&$a) { * Future work on this module might produce more complex activities with targets, e.g. Phillip likes Karen's moustache * and to describe other non-thing objects like channels, such as Karl wants Susan - where Susan represents a channel profile. */ - - /** @FIXME add and fix ACL support to the input forms */ - if((! $name) || (! $translated_verb)) return; @@ -221,7 +219,9 @@ function thing_content(&$a) { if(argc() == 2) { - $r = q("select * from obj where obj_type = %d and obj_obj = '%s' limit 1", + $sql_extra = permissions_sql(); + + $r = q("select * from obj where obj_type = %d and obj_obj = '%s' $sql_extra limit 1", intval(TERM_OBJ_THING), dbesc(argv(1)) ); @@ -247,6 +247,11 @@ function thing_content(&$a) { return; } + $acl = new AccessList($channel); + $channel_acl = $acl->get(); + + $lockstate = (($acl->is_private()) ? 'lock' : 'unlock'); + $thing_hash = ''; if(argc() == 3 && argv(1) === 'edit') { @@ -277,6 +282,9 @@ function thing_content(&$a) { '$theurl' => $r[0]['obj_url'], '$img_lbl' => t('URL for photo of thing (optional)'), '$imgurl' => $r[0]['obj_imgurl'], + '$permissions' => t('Permissions'), + '$aclselect' => populate_acl($channel_acl,false), + '$lockstate' => $lockstate, '$submit' => t('Submit') )); @@ -316,6 +324,9 @@ function thing_content(&$a) { '$thing_lbl' => t('Name of thing e.g. something'), '$url_lbl' => t('URL of thing (optional)'), '$img_lbl' => t('URL for photo of thing (optional)'), + '$permissions' => t('Permissions'), + '$aclselect' => populate_acl($channel_acl,false), + '$lockstate' => $lockstate, '$submit' => t('Submit') )); diff --git a/view/tpl/profile_advanced.tpl b/view/tpl/profile_advanced.tpl index 1f99bf1ad..a4413e536 100755 --- a/view/tpl/profile_advanced.tpl +++ b/view/tpl/profile_advanced.tpl @@ -204,7 +204,7 @@ <b>{{$profile.fullname.1}} {{$key}}</b> <ul class="profile-thing-list"> {{foreach $items as $item}} - <li>{{if $item.img}}<img src="{{$item.img}}" width="100" height="100" alt="{{$item.term}}" />{{/if}} + <li>{{if $item.img}}<a href="{{$item.url}}" ><img src="{{$item.img}}" width="100" height="100" alt="{{$item.term}}" /></a>{{/if}} <a href="{{$item.url}}" >{{$item.term}}</a> {{if $profile.canlike}}<br /> <button type="button" class="btn btn-default btn-sm" onclick="doprofilelike('thing/' + '{{$item.term_hash}}','like'); return false;" title="{{$likethis}}" > diff --git a/view/tpl/show_thing.tpl b/view/tpl/show_thing.tpl index 4ef5473c2..c98003ea2 100644 --- a/view/tpl/show_thing.tpl +++ b/view/tpl/show_thing.tpl @@ -1,7 +1,7 @@ <h2>{{$header}}</h2> {{if $thing}} <div class="thing-show"> -{{if $thing.obj_imgurl}}<img src="{{$thing.obj_imgurl}}" width="175" height="175" alt="{{$thing.obj_term}}" />{{/if}} +{{if $thing.obj_imgurl}}<a href="{{$thing.obj_url}}" ><img src="{{$thing.obj_imgurl}}" width="175" height="175" alt="{{$thing.obj_term}}" /></a>{{/if}} <a href="{{$thing.obj_url}}" >{{$thing.obj_term}}</a> </div> {{if $canedit}} diff --git a/view/tpl/thing_edit.tpl b/view/tpl/thing_edit.tpl index b170f152c..d513d2855 100644 --- a/view/tpl/thing_edit.tpl +++ b/view/tpl/thing_edit.tpl @@ -29,5 +29,14 @@ <div class="thing-end"></div> +{{$aclselect}} + +{{if $lockstate}} + <button id="dbtn-acl" class="btn btn-default btn-sm" data-toggle="modal" data-target="#aclModal" onclick="return false;"> + <i id="jot-perms-icon" class="icon-{{$lockstate}}"></i> + </button> +{{/if}} + + <input type="submit" class="thing-submit" name="submit" value="{{$submit}}" /> </form> diff --git a/view/tpl/thing_input.tpl b/view/tpl/thing_input.tpl index e93a1aa65..22f8f5cb6 100644 --- a/view/tpl/thing_input.tpl +++ b/view/tpl/thing_input.tpl @@ -29,5 +29,14 @@ <div class="thing-end"></div> +{{$aclselect}} + +{{if $lockstate}} + <button id="dbtn-acl" class="btn btn-default btn-sm" data-toggle="modal" data-target="#aclModal" onclick="return false;"> + <i id="jot-perms-icon" class="icon-{{$lockstate}}"></i> + </button> +{{/if}} + + <input type="submit" class="thing-submit" name="submit" value="{{$submit}}" /> </form> |