aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-04-09 12:16:42 +0200
committerMario Vavti <mario@mariovavti.com>2016-04-09 12:16:42 +0200
commite2b4d33627d5f4cf5f68eb087059d86c78eec41e (patch)
tree328313432c53b1a6c146595b91f4883ef5c33131
parent7690dca67b6574cd5b6ffcc59b1c8c6b2df5d54e (diff)
downloadvolse-hubzilla-e2b4d33627d5f4cf5f68eb087059d86c78eec41e.tar.gz
volse-hubzilla-e2b4d33627d5f4cf5f68eb087059d86c78eec41e.tar.bz2
volse-hubzilla-e2b4d33627d5f4cf5f68eb087059d86c78eec41e.zip
some work on comanche autocomplete
-rw-r--r--include/conversation.php5
-rw-r--r--mod/blocks.php4
-rw-r--r--mod/channel.php16
-rw-r--r--mod/editblock.php4
-rw-r--r--mod/editlayout.php3
-rw-r--r--mod/editpost.php4
-rw-r--r--mod/editwebpage.php5
-rw-r--r--mod/layouts.php3
-rw-r--r--mod/network.php5
-rw-r--r--mod/webpages.php4
-rw-r--r--view/js/autocomplete.js9
-rwxr-xr-xview/tpl/jot-header.tpl6
-rwxr-xr-xview/tpl/jot.tpl2
-rw-r--r--view/tpl/pdledit.tpl3
14 files changed, 54 insertions, 19 deletions
diff --git a/include/conversation.php b/include/conversation.php
index 5e9ba16a1..7d80b08fc 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1173,7 +1173,9 @@ function status_editor($a, $x, $popup = false) {
'$term' => t('Tag term:'),
'$fileas' => t('Save to Folder:'),
'$whereareu' => t('Where are you right now?'),
- '$expireswhen' => t('Expires YYYY-MM-DD HH:MM')
+ '$expireswhen' => t('Expires YYYY-MM-DD HH:MM'),
+ '$editor_autocomplete'=> ((x($x,'editor_autocomplete')) ? $x['editor_autocomplete'] : ''),
+ '$bbco_autocomplete'=> ((x($x,'bbco_autocomplete')) ? $x['bbco_autocomplete'] : ''),
));
$tpl = get_markup_template('jot.tpl');
@@ -1274,6 +1276,7 @@ function status_editor($a, $x, $popup = false) {
'$expiryModalOK' => t('OK'),
'$expiryModalCANCEL' => t('Cancel'),
'$expanded' => ((x($x, 'expanded')) ? $x['expanded'] : false),
+ '$bbcode' => ((x($x, 'bbcode')) ? $x['bbcode'] : false)
));
if ($popup === true) {
diff --git a/mod/blocks.php b/mod/blocks.php
index 96005e9a3..3c9274991 100644
--- a/mod/blocks.php
+++ b/mod/blocks.php
@@ -95,7 +95,9 @@ function blocks_content(&$a) {
'ptlabel' => t('Block Name'),
'profile_uid' => intval($owner),
'expanded' => true,
- 'novoting' => true
+ 'novoting' => true,
+ 'bbco_autocomplete' => 'bbcode',
+ 'bbcode' => true
);
if($_REQUEST['title'])
diff --git a/mod/channel.php b/mod/channel.php
index 88c420366..87ced9246 100644
--- a/mod/channel.php
+++ b/mod/channel.php
@@ -124,15 +124,17 @@ function channel_content(&$a, $update = 0, $load = false) {
$x = array(
'is_owner' => $is_owner,
- 'allow_location' => ((($is_owner || $observer) && (intval(get_pconfig(App::$profile['profile_uid'],'system','use_browser_location')))) ? true : false),
- 'default_location' => (($is_owner) ? App::$profile['channel_location'] : ''),
- 'nickname' => App::$profile['channel_address'],
- 'lockstate' => (((strlen(App::$profile['channel_allow_cid'])) || (strlen(App::$profile['channel_allow_gid'])) || (strlen(App::$profile['channel_deny_cid'])) || (strlen(App::$profile['channel_deny_gid']))) ? 'lock' : 'unlock'),
- 'acl' => (($is_owner) ? populate_acl($channel_acl,true,((App::$profile['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : '')) : ''),
+ 'allow_location' => ((($is_owner || $observer) && (intval(get_pconfig(App::$profile['profile_uid'],'system','use_browser_location')))) ? true : false),
+ 'default_location' => (($is_owner) ? App::$profile['channel_location'] : ''),
+ 'nickname' => App::$profile['channel_address'],
+ 'lockstate' => (((strlen(App::$profile['channel_allow_cid'])) || (strlen(App::$profile['channel_allow_gid'])) || (strlen(App::$profile['channel_deny_cid'])) || (strlen(App::$profile['channel_deny_gid']))) ? 'lock' : 'unlock'),
+ 'acl' => (($is_owner) ? populate_acl($channel_acl,true,((App::$profile['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : '')) : ''),
'showacl' => (($is_owner) ? 'yes' : ''),
- 'bang' => '',
+ 'bang' => '',
'visitor' => (($is_owner || $observer) ? true : false),
- 'profile_uid' => App::$profile['profile_uid']
+ 'profile_uid' => App::$profile['profile_uid'],
+ 'bbco_autocomplete' => 'bbcode',
+ 'bbcode' => true
);
$o .= status_editor($a,$x);
diff --git a/mod/editblock.php b/mod/editblock.php
index 35922e483..214c495dd 100644
--- a/mod/editblock.php
+++ b/mod/editblock.php
@@ -115,7 +115,8 @@ function editblock_content(&$a) {
'$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
'$geotag' => '',
'$nickname' => $channel['channel_address'],
- '$confirmdelete' => t('Delete block?')
+ '$confirmdelete' => t('Delete block?'),
+ '$bbco_autocomplete'=> (($mimetype == 'text/bbcode') ? 'bbcode' : 'comanche-block')
));
$tpl = get_markup_template("jot.tpl");
@@ -174,6 +175,7 @@ function editblock_content(&$a) {
'$defexpire' => '',
'$feature_expire' => false,
'$expires' => t('Set expiration date'),
+ '$bbcode' => (($mimetype == 'text/bbcode') ? true : false)
));
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
diff --git a/mod/editlayout.php b/mod/editlayout.php
index 9c27afa30..0b58fe5fe 100644
--- a/mod/editlayout.php
+++ b/mod/editlayout.php
@@ -109,7 +109,8 @@ function editlayout_content(&$a) {
'$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
'$geotag' => $geotag,
'$nickname' => $channel['channel_address'],
- '$confirmdelete' => t('Delete layout?')
+ '$confirmdelete' => t('Delete layout?'),
+ '$bbco_autocomplete'=> 'comanche'
));
diff --git a/mod/editpost.php b/mod/editpost.php
index a433d91f4..397254a48 100644
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -54,7 +54,9 @@ function editpost_content(&$a) {
'$geotag' => $geotag,
'$nickname' => $channel['channel_address'],
'$expireswhen' => t('Expires YYYY-MM-DD HH:MM'),
- '$confirmdelete' => t('Delete item?'),
+ '$confirmdelete' => t('Delete item?'),
+ '$editor_autocomplete'=> true,
+ '$bbco_autocomplete'=> 'bbcode'
));
if(intval($itm[0]['item_obscured'])) {
diff --git a/mod/editwebpage.php b/mod/editwebpage.php
index 445c31ad4..9f6df9536 100644
--- a/mod/editwebpage.php
+++ b/mod/editwebpage.php
@@ -150,7 +150,8 @@ function editwebpage_content(&$a) {
'$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
'$geotag' => $geotag,
'$nickname' => $channel['channel_address'],
- '$confirmdelete' => t('Delete webpage?')
+ '$confirmdelete' => t('Delete webpage?'),
+ '$bbco_autocomplete'=> 'bbcode',
));
$tpl = get_markup_template("jot.tpl");
@@ -215,7 +216,7 @@ function editwebpage_content(&$a) {
'$defexpire' => '',
'$feature_expire' => false,
'$expires' => t('Set expiration date'),
-
+ '$bbco_autocomplete'=> 'bbcode'
));
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
diff --git a/mod/layouts.php b/mod/layouts.php
index dbb005e08..e28c9a066 100644
--- a/mod/layouts.php
+++ b/mod/layouts.php
@@ -122,7 +122,8 @@ function layouts_content(&$a) {
'profile_uid' => intval($owner),
'expanded' => true,
'placeholdertitle' => t('Layout Description (Optional)'),
- 'novoting' => true
+ 'novoting' => true,
+ 'bbco_autocomplete' => 'comanche'
);
if($_REQUEST['title'])
diff --git a/mod/network.php b/mod/network.php
index e195ac496..5465cd064 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -169,7 +169,10 @@ function network_content(&$a, $update = 0, $load = false) {
'acl' => populate_acl((($private_editing) ? $def_acl : $channel_acl), true, (($channel['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : '')),
'bang' => (($private_editing) ? '!' : ''),
'visitor' => true,
- 'profile_uid' => local_channel()
+ 'profile_uid' => local_channel(),
+ 'editor_autocomplete' => true,
+ 'bbco_autocomplete' => 'bbcode',
+ 'bbcode' => true
);
if($deftag)
$x['pretext'] = $deftag;
diff --git a/mod/webpages.php b/mod/webpages.php
index 2196eb9fc..c20a147da 100644
--- a/mod/webpages.php
+++ b/mod/webpages.php
@@ -114,7 +114,9 @@ function webpages_content(&$a) {
'mimetype' => $mimetype,
'layout' => $layout,
'expanded' => true,
- 'novoting' => true
+ 'novoting'=> true,
+ 'bbco_autocomplete' => 'bbcode',
+ 'bbcode' => true
);
if($_REQUEST['title'])
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js
index 0ba291004..a4a1fdf51 100644
--- a/view/js/autocomplete.js
+++ b/view/js/autocomplete.js
@@ -269,7 +269,14 @@ function string2bb(element) {
}
if(type=='comanche') {
- var open_close_elements = ['region', 'widget', 'var', 'template', 'css', 'js'];
+ var open_close_elements = ['region', 'layout', 'template', 'theme', 'widget', 'block', 'menu', 'var', 'css', 'js', 'authored', 'comment', 'webpage'];
+ var open_elements = [];
+
+ var elements = open_close_elements.concat(open_elements);
+ }
+
+ if(type=='comanche-block') {
+ var open_close_elements = ['menu', 'var'];
var open_elements = [];
var elements = open_close_elements.concat(open_elements);
diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl
index 2b62f2407..769923a51 100755
--- a/view/tpl/jot-header.tpl
+++ b/view/tpl/jot-header.tpl
@@ -11,11 +11,15 @@ function initEditor(cb){
if(plaintext == 'none') {
$("#profile-jot-text-loading").spin(false).hide();
$("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
- $("#profile-jot-text").bbco_autocomplete('bbcode'); // autocomplete bbcode
+ {{if $bbco_autocomplete}}
+ $("#profile-jot-text").bbco_autocomplete('{{$bbco_autocomplete}}'); // autocomplete bbcode
+ {{/if}}
+ {{if $editor_autocomplete}}
if(typeof channelId === 'undefined')
$("#profile-jot-text").editor_autocomplete(baseurl+"/acl");
else
$("#profile-jot-text").editor_autocomplete(baseurl+"/acl",[channelId]); // Also gives suggestions from current channel's connections
+ {{/if}}
editor = true;
$("a#jot-perms-icon").colorbox({
'inline' : true,
diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl
index dea75efa9..026c586a0 100755
--- a/view/tpl/jot.tpl
+++ b/view/tpl/jot.tpl
@@ -48,6 +48,7 @@
{{/if}}
<div id="profile-jot-submit-wrapper" class="jothidden">
<div id="profile-jot-submit-left" class="btn-toolbar pull-left">
+ {{if $bbcode}}
<div class="btn-group">
<button id="main-editor-bold" class="btn btn-default btn-sm" title="{{$bold}}" onclick="inserteditortag('b', 'profile-jot-text'); return false;">
<i class="icon-bold jot-icons"></i>
@@ -65,6 +66,7 @@
<i class="icon-terminal jot-icons"></i>
</button>
</div>
+ {{/if}}
{{if $visitor}}
<div class="btn-group hidden-xs">
{{if $writefiles}}
diff --git a/view/tpl/pdledit.tpl b/view/tpl/pdledit.tpl
index af8e37602..3e1f5a3fc 100644
--- a/view/tpl/pdledit.tpl
+++ b/view/tpl/pdledit.tpl
@@ -18,4 +18,7 @@
<input type="submit" name="submit" value="{{$submit}}" />
</form>
+<script>
+ $('textarea').bbco_autocomplete('comanche');
+</script>
</div>