diff options
author | Max Kostikov <max@kostikov.co> | 2020-03-06 10:26:19 +0100 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2020-03-06 10:26:19 +0100 |
commit | ae691bdc7cbb684afc2ce6f759a4c1701b019849 (patch) | |
tree | ee4bd761efbd1ffd110575a85b4594857f377989 | |
parent | 082826ee444cb1a24306a128c64cb2e7de631291 (diff) | |
parent | 85c07d57fe0f468eb8cc84584f3636b590aa929f (diff) | |
download | volse-hubzilla-ae691bdc7cbb684afc2ce6f759a4c1701b019849.tar.gz volse-hubzilla-ae691bdc7cbb684afc2ce6f759a4c1701b019849.tar.bz2 volse-hubzilla-ae691bdc7cbb684afc2ce6f759a4c1701b019849.zip |
Merge branch 'dev' into 'dev'
Sync dev
See merge request kostikov/core!1
-rw-r--r-- | Zotlabs/Lib/Activity.php | 82 | ||||
-rw-r--r-- | Zotlabs/Lib/NativeWikiPage.php | 7 | ||||
-rw-r--r-- | Zotlabs/Module/Apschema.php | 5 | ||||
-rw-r--r-- | Zotlabs/Module/Item.php | 61 | ||||
-rwxr-xr-x | boot.php | 4 | ||||
-rw-r--r-- | include/bbcode.php | 139 | ||||
-rw-r--r-- | include/channel.php | 31 | ||||
-rw-r--r-- | include/conversation.php | 7 | ||||
-rwxr-xr-x | include/items.php | 2 | ||||
-rw-r--r-- | view/css/conversation.css | 21 | ||||
-rw-r--r-- | view/theme/redbasic/css/style.css | 4 | ||||
-rwxr-xr-x | view/tpl/jot-header.tpl | 19 | ||||
-rwxr-xr-x | view/tpl/jot.tpl | 40 |
13 files changed, 358 insertions, 64 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 5cb111381..02ec7614e 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -504,10 +504,47 @@ class Activity { } } } + if ($item['iconfig']) { + foreach ($item['iconfig'] as $att) { + if ($att['sharing']) { + $value = ((preg_match('|^a:[0-9]+:{.*}$|s', $att['v'])) ? unserialize($att['v']) : $att['v']); + $ret[] = [ 'type' => 'PropertyValue', 'name' => 'zot.' . $att['cat'] . '.' . $att['k'], 'value' => $value ]; + } + } + } return $ret; } + static function decode_iconfig($item) { + + $ret = []; + + if (is_array($item['attachment']) && $item['attachment']) { + $ptr = $item['attachment']; + if (! array_key_exists(0,$ptr)) { + $ptr = [ $ptr ]; + } + foreach ($ptr as $att) { + $entry = []; + if ($att['type'] === 'PropertyValue') { + if (array_key_exists('name',$att) && $att['name']) { + $key = explode('.',$att['name']); + if (count($key) === 3 && $key[0] === 'zot') { + $entry['cat'] = $key[1]; + $entry['k'] = $key[2]; + $entry['v'] = $att['value']; + $entry['sharing'] = '1'; + $ret[] = $entry; + } + } + } + } + } + return $ret; + } + + static function decode_attachment($item) { @@ -1636,8 +1673,11 @@ class Activity { - static function update_poll($item,$mid,$content) { + static function update_poll($item,$post) { $multi = false; + $mid = $post['mid']; + $content = $post['title']; + if (! $item) { return false; } @@ -1646,6 +1686,31 @@ class Activity { if ($o && array_key_exists('anyOf',$o)) { $multi = true; } + + $r = q("select mid, title from item where parent_mid = '%s' and author_xchan = '%s'", + dbesc($item['mid']), + dbesc($post['author_xchan']) + ); + + // prevent any duplicate votes by same author for oneOf and duplicate votes with same author and same answer for anyOf + + if ($r) { + if ($multi) { + foreach ($r as $rv) { + if ($rv['title'] === $content && $rv['mid'] !== $mid) { + return false; + } + } + } + else { + foreach ($r as $rv) { + if ($rv['mid'] !== $mid) { + return false; + } + } + } + } + $answer_found = false; $found = false; if ($multi) { @@ -1888,17 +1953,22 @@ class Activity { } } - $a = self::decode_attachment($act->obj); - if($a) { - $s['attach'] = $a; - } + } + + $a = self::decode_attachment($act->obj); + if ($a) { + $s['attach'] = $a; + } + + $a = self::decode_iconfig($act->obj); + if ($a) { + $s['iconfig'] = $a; } if($act->obj['type'] === 'Note' && $s['attach']) { $s['body'] .= self::bb_attach($s['attach'],$s['body']); } - if ($act->obj['type'] === 'Question' && in_array($act->type,['Create','Update'])) { if ($act->obj['endTime']) { $s['comments_closed'] = datetime_convert('UTC','UTC', $act->obj['endTime']); diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php index dddd26af3..d84cc50a8 100644 --- a/Zotlabs/Lib/NativeWikiPage.php +++ b/Zotlabs/Lib/NativeWikiPage.php @@ -530,8 +530,11 @@ class NativeWikiPage { foreach ($match[1] as $m) { // TODO: Why do we need to double urlencode for this to work? //$pageURLs[] = urlencode(urlencode(escape_tags($m))); - $pageURLs[] = Zlib\NativeWiki::name_encode(escape_tags($m)); - $pages[] = $m; + $titleUri = explode('|',$m); + $page = $titleUri[0] ?? ''; + $title = $titleUri[1] ?? $page; + $pageURLs[] = Zlib\NativeWiki::name_encode(escape_tags($page)); + $pages[] = $title; } $idx = 0; while(strpos($s,'[[') !== false) { diff --git a/Zotlabs/Module/Apschema.php b/Zotlabs/Module/Apschema.php index 756057a8a..6b0325d44 100644 --- a/Zotlabs/Module/Apschema.php +++ b/Zotlabs/Module/Apschema.php @@ -29,7 +29,10 @@ class Apschema extends \Zotlabs\Web\Controller { 'emojiReaction' => 'zot:emojiReaction', 'expires' => 'zot:expires', 'directMessage' => 'zot:directMessage', - + 'schema' => 'http://schema.org#', + 'PropertyValue' => 'schema:PropertyValue', + 'value' => 'schema:value', + 'magicEnv' => [ '@id' => 'zot:magicEnv', '@type' => '@id' diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 4b866eace..86b5c1c7a 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -271,7 +271,9 @@ class Item extends Controller { $consensus = intval($_REQUEST['consensus']); $nocomment = intval($_REQUEST['nocomment']); - + + $is_poll = ((trim($_REQUEST['poll_answers'][0]) != '' && trim($_REQUEST['poll_answers'][1]) != '') ? true : false); + // 'origin' (if non-zero) indicates that this network is where the message originated, // for the purpose of relaying comments to other conversation members. // If using the API from a device (leaf node) you must set origin to 1 (default) or leave unset. @@ -920,7 +922,21 @@ class Item extends Controller { $mid = z_root() . '/item/' . $uuid; } - $obj = $this->extract_poll_data($body,[ 'item_private' => $private, 'allow_cid' => $str_contact_allow, 'allow_gid' => $str_contact_deny ]); + + if($is_poll) { + $poll = [ + 'question' => $body, + 'answers' => $_REQUEST['poll_answers'], + 'multiple_answers' => $_REQUEST['poll_multiple_answers'], + 'expire_value' => $_REQUEST['poll_expire_value'], + 'expire_unit' => $_REQUEST['poll_expire_unit'] + ]; + $obj = $this->extract_poll_data($poll, [ 'item_private' => $private, 'allow_cid' => $str_contact_allow, 'allow_gid' => $str_contact_deny ]); + } + else { + $obj = $this->extract_bb_poll_data($body,[ 'item_private' => $private, 'allow_cid' => $str_contact_allow, 'allow_gid' => $str_contact_deny ]); + } + if ($obj) { $obj['url'] = $mid; $obj['attributedTo'] = channel_url($channel); @@ -1397,7 +1413,7 @@ class Item extends Controller { return $ret; } - function extract_poll_data(&$body,$item) { + function extract_bb_poll_data(&$body,$item) { $multiple = false; @@ -1457,5 +1473,44 @@ class Item extends Controller { } + function extract_poll_data($poll, $item) { + + $multiple = intval($poll['multiple_answers']); + $expire_value = intval($poll['expire_value']); + $expire_unit = $poll['expire_unit']; + $question = $poll['question']; + $answers = $poll['answers']; + + $obj = []; + $ptr = []; + $obj['type'] = 'Question'; + $obj['content'] = bbcode($question); + + foreach($answers as $answer) { + if(trim($answer)) + $ptr[] = [ 'name' => escape_tags($answer), 'type' => 'Note', 'replies' => [ 'type' => 'Collection', 'totalItems' => 0 ]]; + } + + if($multiple) { + $obj['anyOf'] = $ptr; + } + else { + $obj['oneOf'] = $ptr; + } + + $obj['endTime'] = datetime_convert(date_default_timezone_get(), 'UTC', 'now + ' . $expire_value . ' ' . $expire_unit, ATOM_TIME); + + if ($item['item_private']) { + $obj['to'] = Activity::map_acl($item); + } + else { + $obj['to'] = [ ACTIVITY_PUBLIC_INBOX ]; + } + + return $obj; + + } + + } @@ -50,7 +50,7 @@ require_once('include/attach.php'); require_once('include/bbcode.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); -define ( 'STD_VERSION', '4.7.1' ); +define ( 'STD_VERSION', '4.7.3' ); define ( 'ZOT_REVISION', '6.0a' ); define ( 'DB_UPDATE_VERSION', 1235 ); @@ -473,7 +473,7 @@ define ( 'NAMESPACE_YMEDIA', 'http://search.yahoo.com/mrss/' ); define ( 'ACTIVITYSTREAMS_JSONLD_REV', 'https://www.w3.org/ns/activitystreams' ); -define ( 'ZOT_APSCHEMA_REV', '/apschema/v1.8' ); +define ( 'ZOT_APSCHEMA_REV', '/apschema/v1.9' ); /** * activity stream defines */ diff --git a/include/bbcode.php b/include/bbcode.php index f3ecbd9e9..b2e3f1d3b 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -655,6 +655,109 @@ function bb_observer($Text) { return $Text; } +function bb_imgoptions($match) { + + // $Text = preg_replace_callback("/\[([zi])mg([ \=])(.*?)\](.*?)\[\/[zi]mg\]/ism",'bb_imgoptions',$Text); + // alt text cannot contain ']' + + // [img|zmg=wwwxhhh float=left|right alt=alt text]url[/img|zmg] + + $local_match = null; + $width = 0; + $float = false; + $alt = false; + + $style = EMPTY_STR; + + $attributes = $match[3]; + + $x = preg_match("/alt='(.*?)'/ism", $attributes, $matches); + if ($x) { + $alt = $matches[1]; + } + + $x = preg_match("/alt=\"\;(.*?)\"\;/ism", $attributes, $matches); + if ($x) { + $alt = $matches[1]; + } + + $x = preg_match("/width='(.*?)'/ism", $attributes, $matches); + if ($x) { + $width = $matches[1]; + } + + $x = preg_match("/width=\"\;(.*?)\"\;/ism", $attributes, $matches); + if ($x) { + $width = $matches[1]; + } + + $x = preg_match("/height='(.*?)'/ism", $attributes, $matches); + if ($x) { + $height = $matches[1]; + } + + $x = preg_match("/height=\"\;(.*?)\"\;/ism", $attributes, $matches); + if ($x) { + $height = $matches[1]; + } + + $x = preg_match("/style='(.*?)'/ism", $attributes, $matches); + if ($x) { + $style = $matches[1]; + } + + $x = preg_match("/style=\"\;(.*?)\"\;/ism", $attributes, $matches); + if ($x) { + $style = $matches[1]; + } + + // legacy img options + + if ($match[2] === '=') { + // pull out (optional) legacy size declarations first + if (preg_match("/([0-9]*)x([0-9]*)/ism",$match[3],$local_match)) { + $width = intval($local_match[1]); + } + $match[3] = substr($match[3],strpos($match[3],' ')); + } + + // then (optional) legacy float specifiers + if ($n = strpos($match[3],'float=left') !== false) { + $float = 'left'; + $match[3] = substr($match[3],$n + 10); + } + if ($n = strpos($match[3],'float=right') !== false) { + $float = 'right'; + $match[3] = substr($match[3],$n + 11); + } + + // finally alt text which extends to the close of the tag + if ((! $alt) && ($n = strpos($match[3],'alt=') !== false)) { + $alt = substr($match[3],$n + 4); + } + + // now assemble the resulting img tag from these components + + $output = '<img ' . (($match[1] === 'z') ? 'class="zrl" ' : '') . ' '; + + if ($width) { + $style .= 'width: 100%; max-width: ' . $width . 'px; '; + } + else { + $style .= 'max-width: 100%; '; + } + if ($float) { + $style .= 'float: ' . $float . '; '; + } + + $output .= (($style) ? 'style="' . $style . '" ' : '') . 'alt="' . htmlentities(($alt) ? $alt : t('Image/photo'),ENT_COMPAT,'UTF-8') . '" '; + + $output .= 'src="' . $match[4] . '" >'; + + return $output; + +} + function bb_code_protect($s) { return 'b64.^9e%.' . base64_encode($s) . '.b64.$9e%'; } @@ -1250,41 +1353,7 @@ function bbcode($Text, $options = []) { $Text = preg_replace("/\[zmg=http(.*?)\](.*?)\[\/zmg\]/ism", '<img class="zrl" style="max-width: 100%;" src="http$1" alt="$2" title="$2"/>', $Text); } - // [img float={left, right}]pathtoimage[/img] - if (strpos($Text,'[/img]') !== false) { - $Text = preg_replace("/\[img float=left\](.*?)\[\/img\]/ism", '<img src="$1" style="max-width: 100%; float: left;" alt="' . t('Image/photo') . '" />', $Text); - } - if (strpos($Text,'[/img]') !== false) { - $Text = preg_replace("/\[img float=right\](.*?)\[\/img\]/ism", '<img src="$1" style="max-width: 100%; float: right;" alt="' . t('Image/photo') . '" />', $Text); - } - if (strpos($Text,'[/zmg]') !== false) { - $Text = preg_replace("/\[zmg float=left\](.*?)\[\/zmg\]/ism", '<img class="zrl" src="$1" style="max-width: 100%; float: left;" alt="' . t('Image/photo') . '" />', $Text); - } - if (strpos($Text,'[/zmg]') !== false) { - $Text = preg_replace("/\[zmg float=right\](.*?)\[\/zmg\]/ism", '<img class="zrl" src="$1" style="max-width: 100%; float: right;" alt="' . t('Image/photo') . '" />', $Text); - } - - // [img=widthxheight]pathtoimage[/img] - if (strpos($Text,'[/img]') !== false) { - $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '<img src="$3" style="width: 100%; max-width: $1px;" alt="' . t('Image/photo') . '" />', $Text); - } - if (strpos($Text,'[/zmg]') !== false) { - $Text = preg_replace("/\[zmg\=([0-9]*)x([0-9]*)\](.*?)\[\/zmg\]/ism", '<img class="zrl" src="$3" style="width: 100%; max-width: $1px;" alt="' . t('Image/photo') . '" />', $Text); - } - - // [img=widthxheight float={left, right}]pathtoimage[/img] - if (strpos($Text,'[/img]') !== false) { - $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*) float=left\](.*?)\[\/img\]/ism", '<img src="$3" style="width: 100%; max-width: $1px; float: left;" alt="' . t('Image/photo') . '" />', $Text); - } - if (strpos($Text,'[/img]') !== false) { - $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*) float=right\](.*?)\[\/img\]/ism", '<img src="$3" style="width: 100%; max-width: $1px; float: right;" alt="' . t('Image/photo') . '" />', $Text); - } - if (strpos($Text,'[/zmg]') !== false) { - $Text = preg_replace("/\[zmg\=([0-9]*)x([0-9]*) float=left\](.*?)\[\/zmg\]/ism", '<img class="zrl" src="$3" style="width: 100%; max-width: $1px; float: left;" alt="' . t('Image/photo') . '" />', $Text); - } - if (strpos($Text,'[/zmg]') !== false) { - $Text = preg_replace("/\[zmg\=([0-9]*)x([0-9]*) float=right\](.*?)\[\/zmg\]/ism", '<img class="zrl" src="$3" style="width: 100%; max-width: $1px; float: right;" alt="' . t('Image/photo') . '" />', $Text); - } + $Text = preg_replace_callback("/\[([zi])mg([ \=])(.*?)\](.*?)\[\/[zi]mg\]/ism",'bb_imgoptions',$Text); // style (sanitized) if (strpos($Text,'[/style]') !== false) { diff --git a/include/channel.php b/include/channel.php index 66ab56715..991d4675b 100644 --- a/include/channel.php +++ b/include/channel.php @@ -878,11 +878,38 @@ function identity_basic_export($channel_id, $sections = null, $zap_compat = fals $ret['abook'] = $r; for($x = 0; $x < count($ret['abook']); $x ++) { + $xchans[] = $ret['abook'][$x]['abook_xchan']; + $my_perms = []; + $their_perms = []; + $newconfig = []; $abconfig = load_abconfig($channel_id,$ret['abook'][$x]['abook_xchan']); - if($abconfig) - $ret['abook'][$x]['abconfig'] = $abconfig; + if($abconfig) { + foreach ($abconfig as $abc) { + + if ($abc['cat'] === 'my_perms' && intval($abc['v'])) { + $my_perms[] = $abc['k']; + continue; + } + if ($abc['cat'] === 'their_perms' && intval($abc['v'])) { + $their_perms[] = $abc['k']; + continue; + } + if ($zap_compat && preg_match('|^a:[0-9]+:{.*}$|s', $abc['v'])) { + $abc['v'] = serialise(unserialize($abc['v'])); + } + $newconfig[] = $abc; + } + + $ret['abook'][$x]['abconfig'] = $newconfig; + if ($zap_compat) { + $ret['abook'][$x]['abconfig'][] = [ 'chan' => $channel_id, 'xchan' => $ret['abook'][$x]['abook_chan'], 'cat' => 'system', 'k' => 'my_perms', 'v' => implode(',',$my_perms) ]; + $ret['abook'][$x]['abconfig'][] = [ 'chan' => $channel_id, 'xchan' => $ret['abook'][$x]['abook_chan'], 'cat' => 'system', 'k' => 'their_perms', 'v' => implode(',',$their_perms) ]; + } + } + translate_abook_perms_outbound($ret['abook'][$x]); + } // pick up the zot6 xchan and hublocs also diff --git a/include/conversation.php b/include/conversation.php index 0098a694d..62d4b405f 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1293,7 +1293,7 @@ function hz_status_editor($a, $x, $popup = false) { $feature_voting = feature_enabled($x['profile_uid'], 'consensus_tools'); if(x($x, 'hide_voting')) $feature_voting = false; - + $feature_nocomment = feature_enabled($x['profile_uid'], 'disable_comments'); if(x($x, 'disable_comments')) $feature_nocomment = false; @@ -1441,6 +1441,11 @@ function hz_status_editor($a, $x, $popup = false) { '$embedPhotosModalOK' => t('OK'), '$setloc' => $setloc, '$voting' => t('Toggle voting'), + '$poll' => t('Toggle poll'), + '$poll_option_label' => t('Option'), + '$poll_add_option_label' => t('Add option'), + '$poll_expire_unit_label' => [t('Minutes'), t('Hours'), t('Days')], + '$multiple_answers' => ['poll_multiple_answers', t("Allow multiple answers"), '', '', [t('No'), t('Yes')]], '$feature_voting' => $feature_voting, '$consensus' => ((array_key_exists('item',$x)) ? $x['item']['item_consensus'] : 0), '$nocommenttitle' => t('Disable comments'), diff --git a/include/items.php b/include/items.php index bf1ddee82..9768fdf23 100755 --- a/include/items.php +++ b/include/items.php @@ -1950,7 +1950,7 @@ function item_store($arr, $allow_exec = false, $deliver = true) { $arr['item_private'] = 0; if(in_array($arr['obj_type'], ['Note','Answer']) && $r[0]['obj_type'] === 'Question' && intval($r[0]['item_wall'])) { - Activity::update_poll($r[0],$arr['mid'],$arr['title']); + Activity::update_poll($r[0],$arr); } } diff --git a/view/css/conversation.css b/view/css/conversation.css index f7804f5dd..77e56e200 100644 --- a/view/css/conversation.css +++ b/view/css/conversation.css @@ -1,15 +1,19 @@ /* jot */ +.jothidden { + display:none; +} -.jothidden input[type="text"] { - border: 0px; - margin: 0px; - height: 2.5rem; - width: 100%; +.jot-poll-option { + position: relative; } -.jothidden { - display:none; +.poll-option-close { + position: absolute; + right: 0; + top: 0; + padding: 0.25rem 0 0.25rem 0.5rem; + cursor: pointer; } #jot-title-wrap, @@ -18,7 +22,8 @@ border-bottom: 1px solid rgba(0, 0, 0, .2); } -#jot-attachment-wrap { +#jot-attachment-wrap, +#jot-poll-wrap { border-top: 1px solid rgba(0, 0, 0, .2); } diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 3bee84378..1ababecfc 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -1605,6 +1605,10 @@ dl.bb-dl > dd > li { font-size: 100%; } +.bootstrap-tagsinput input { + height: 2.5rem; +} + /* Abusing theme-green is less work than makeing a new new one */ .theme-green .back-bar .selected-bar { background-color: #000000; diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl index 7b1f4ee05..d519fd666 100755 --- a/view/tpl/jot-header.tpl +++ b/view/tpl/jot-header.tpl @@ -58,6 +58,9 @@ var activeCommentText = ''; $('#id_mimetype').on('load', jotSetMime); $('#id_mimetype').on('change', jotSetMime); + $('#jot-add-option').on('click', jotAddOption); + $(document).on('click', '.poll-option-close', jotRemoveOption); + function jotSetMime() { var mtype = $('#id_mimetype').val(); if(mtype == 'text/bbcode') @@ -122,6 +125,7 @@ var activeCommentText = ''; activeCommentID = 0; }, }); + }); function deleteCheckedItems() { @@ -309,6 +313,7 @@ var activeCommentText = ''; function itemCancel() { $("#jot-title").val(''); $("#profile-jot-text").val(''); + $(".jot-poll-option input").val(''); $("#jot-category").tagsinput('removeAll'); postSaveChanges('clean'); @@ -317,6 +322,7 @@ var activeCommentText = ''; $(".jothidden").hide(); $("#profile-jot-text").removeClass('jot-expanded'); $("#profile-jot-tools").addClass('d-none'); + $("#jot-poll-wrap").addClass('d-none'); $("#jot-preview-content").html('').hide(); editor = false; {{else}} @@ -512,6 +518,19 @@ var activeCommentText = ''; } + function initPoll() { + $('#jot-poll-wrap').toggleClass('d-none'); + } + + function jotAddOption() { + var option = '<div class="jot-poll-option form-group"><input class="w-100 border-0" name="poll_answers[]" type="text" value="" placeholder="Option"><div class="poll-option-close"><i class="fa fa-close"></i></div></div>'; + $('#jot-poll-options').append(option); + } + + function jotRemoveOption(e) { + $(this).closest('.jot-poll-option').remove(); + } + </script> <script> diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl index b4616db6d..4a9717c01 100755 --- a/view/tpl/jot.tpl +++ b/view/tpl/jot.tpl @@ -30,15 +30,15 @@ {{if $webpage}} <div id="jot-pagetitle-wrap" class="jothidden"> - <input name="pagetitle" id="jot-pagetitle" type="text" placeholder="{{$placeholdpagetitle}}" value="{{$pagetitle}}"> + <input class="w-100 border-0" name="pagetitle" id="jot-pagetitle" type="text" placeholder="{{$placeholdpagetitle}}" value="{{$pagetitle}}"> </div> {{/if}} <div id="jot-title-wrap" class="jothidden"> - <input name="title" id="jot-title" type="text" placeholder="{{$placeholdertitle}}" tabindex="1" value="{{$title}}"> + <input class="w-100 border-0" name="title" id="jot-title" type="text" placeholder="{{$placeholdertitle}}" tabindex="1" value="{{$title}}"> </div> {{if $catsenabled}} <div id="jot-category-wrap" class="jothidden"> - <input name="category" id="jot-category" type="text" placeholder="{{$placeholdercategory}}" value="{{$category}}" data-role="cat-tagsinput"> + <input class="w-100 border-0" name="category" id="jot-category" type="text" placeholder="{{$placeholdercategory}}" value="{{$category}}" data-role="cat-tagsinput"> </div> {{/if}} <div id="jot-text-wrap"> @@ -59,6 +59,34 @@ <input class="jot-attachment" name="attachment" id="jot-attachment" type="text" value="{{$attachment}}" readonly="readonly" onclick="this.select();"> </div> {{/if}} + <div id="jot-poll-wrap" class="p-2 d-none"> + <div id="jot-poll-options"> + <div class="jot-poll-option form-group"> + <input class="w-100 border-0" name="poll_answers[]" type="text" value="" placeholder="{{$poll_option_label}}"> + </div> + <div class="jot-poll-option form-group"> + <input class="w-100 border-0" name="poll_answers[]" type="text" value="" placeholder="{{$poll_option_label}}"> + </div> + </div> + {{include file="field_checkbox.tpl" field=$multiple_answers}} + <div id="jot-poll-tools" class="clearfix"> + <div id="poll-tools-left" class="float-left"> + <button id="jot-add-option" class="btn btn-outline-secondary btn-sm" type="button"> + <i class="fa fa-plus"></i> {{$poll_add_option_label}} + </button> + </div> + <div id="poll-tools-right" class="float-right"> + <div class="input-group"> + <input type="text" name="poll_expire_value" class="form-control" value="10" size="3"> + <select class="form-control" id="duration-select" name="poll_expire_unit"> + <option value="Minutes">{{$poll_expire_unit_label.0}}</option> + <option value="Hours">{{$poll_expire_unit_label.1}}</option> + <option value="Days" selected="selected">{{$poll_expire_unit_label.2}}</option> + </select> + </div> + </div> + </div> + </div> <div id="profile-jot-submit-wrapper" class="clearfix p-2 jothidden"> <div id="profile-jot-submit-left" class="btn-toolbar float-left"> {{if $bbcode}} @@ -132,6 +160,11 @@ <i id="profile-voting" class="fa fa-square-o jot-icons"></i> </button> {{/if}} + + <button type="button" id="profile-poll-wrapper" class="btn btn-outline-secondary btn-sm" title="{{$poll}}" onclick="initPoll();"> + <i id="profile-poll" class="fa fa-bar-chart jot-icons"></i> + </button> + {{if $feature_nocomment}} <button id="profile-nocomment-wrapper" class="btn btn-outline-secondary btn-sm" title="{{$nocommenttitle}}" onclick="toggleNoComment();return false;"> <i id="profile-nocomment" class="fa fa-comments jot-icons"></i> @@ -176,6 +209,7 @@ {{if $feature_voting}} <a class="dropdown-item" href="#" onclick="toggleVoting(); return false;"><i id="profile-voting-sub" class="fa fa-square-o"></i> {{$voting}}</a> {{/if}} + <a class="dropdown-item" href="#" onclick="initPoll(); return false"><i id="profile-poll" class="fa fa-bar-chart jot-icons"></i> {{$poll}}</a> {{if $feature_nocomment}} <a class="dropdown-item" href="#" onclick="toggleNoComment(); return false;"><i id="profile-nocomment-sub" class="fa fa-comments"></i> {{$nocommenttitlesub}}</a> {{/if}} |