aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-05-29 20:09:21 -0700
committerfriendica <info@friendica.com>2014-05-29 20:09:21 -0700
commit22ed5b1d03314d2bc7ff41b4724526fe00472904 (patch)
tree6107189095449666c8bbfc46422c92c0440abbe7
parent6e0cc25a90fa65ff49317d1fa3c4aff49a4d2d6a (diff)
downloadvolse-hubzilla-22ed5b1d03314d2bc7ff41b4724526fe00472904.tar.gz
volse-hubzilla-22ed5b1d03314d2bc7ff41b4724526fe00472904.tar.bz2
volse-hubzilla-22ed5b1d03314d2bc7ff41b4724526fe00472904.zip
newevent: front end functions
-rw-r--r--include/ItemObject.php6
-rwxr-xr-xmod/events.php16
-rwxr-xr-xview/tpl/conv_item.tpl3
-rwxr-xr-xview/tpl/jot-header.tpl6
4 files changed, 27 insertions, 4 deletions
diff --git a/include/ItemObject.php b/include/ItemObject.php
index 19283c317..ad2692624 100644
--- a/include/ItemObject.php
+++ b/include/ItemObject.php
@@ -200,6 +200,9 @@ class Item extends BaseObject {
}
}
+ $has_event = false;
+ if(activity_compare($item['obj_type'],ACTIVITY_OBJ_EVENT) && $conv->get_profile_owner() == local_user())
+ $has_event = true;
if($this->is_commentable()) {
$like = array( t("I like this \x28toggle\x29"), t("like"));
@@ -268,7 +271,8 @@ class Item extends BaseObject {
'star' => ((feature_enabled($conv->get_profile_owner(),'star_posts')) ? $star : ''),
'tagger' => ((feature_enabled($conv->get_profile_owner(),'commtag')) ? $tagger : ''),
'filer' => ((feature_enabled($conv->get_profile_owner(),'filing')) ? $filer : ''),
- 'bookmark' => (($conv->get_profile_owner() == local_user() && $has_bookmarks) ? t('Bookmark Links') : ''),
+ 'bookmark' => (($conv->get_profile_owner() == local_user() && $has_bookmarks) ? t('Save Bookmarks') : ''),
+ 'addtocal' => (($has_event) ? t('Add to Calendar') : ''),
'drop' => $drop,
'multidrop' => ((feature_enabled($conv->get_profile_owner(),'multi_delete')) ? $multidrop : ''),
// end toolbar buttons
diff --git a/mod/events.php b/mod/events.php
index 126460e9a..fa45c2c15 100755
--- a/mod/events.php
+++ b/mod/events.php
@@ -159,10 +159,11 @@ function events_content(&$a) {
}
- $plaintext = true;
+ $plaintext = true;
+
+ if(feature_enabled(local_user(),'richtext'))
+ $plaintext = false;
- if(feature_enabled(local_user(),'richtext'))
- $plaintext = false;
$htpl = get_markup_template('event_head.tpl');
@@ -190,6 +191,10 @@ function events_content(&$a) {
$mode = 'edit';
$event_id = argv(2);
}
+ if(argc() > 2 && argv(1) === 'add') {
+ $mode = 'add';
+ $item_id = intval(argv(2));
+ }
if(argv(1) === 'new') {
$mode = 'new';
$event_id = '';
@@ -201,6 +206,11 @@ function events_content(&$a) {
}
}
+ if($mode === 'add') {
+ event_addtocal($item_id,local_user());
+ killme();
+ }
+
if($mode == 'view') {
diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl
index bf371b05c..828b47a05 100755
--- a/view/tpl/conv_item.tpl
+++ b/view/tpl/conv_item.tpl
@@ -85,6 +85,9 @@
{{if $item.bookmark}}
<li role="presentation"><a role="menuitem" href="#" onclick="itemBookmark({{$item.id}}); return false;"><i id="bookmarker-{{$item.id}}" class="icon-bookmark" title="{{$item.bookmark}}"></i> {{$item.bookmark}}</a></li>
{{/if}}
+ {{if $item.addtocal}}
+ <li role="presentation"><a role="menuitem" href="#" onclick="itemAddToCal({{$item.id}}); return false;"><i id="addtocal-{{$item.id}}" class="icon-calendar" title="{{$item.addtocal}}"></i> {{$item.addtocal}}</a></li>
+ {{/if}}
{{if $item.star}}
<li role="presentation"><a role="menuitem" href="#" onclick="dostar({{$item.id}}); return false;"><i id="starred-{{$item.id}}" class="icon-star {{$item.star.isstarred}}" title="{{$item.star.toggle}}"></i> {{$item.star.toggle}}</a></li>
{{/if}}
diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl
index 27b081b57..9af786741 100755
--- a/view/tpl/jot-header.tpl
+++ b/view/tpl/jot-header.tpl
@@ -300,6 +300,12 @@ function enableOnUser(){
timer = setTimeout(NavUpdate,1000);
}
+ function itemAddToCal(id) {
+ $.get('{{$baseurl}}/event/add/' + id);
+ if(timer) clearTimeout(timer);
+ timer = setTimeout(NavUpdate,1000);
+ }
+
function jotClearLocation() {
$('#jot-coord').val('');