Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/unaio/una
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonLV committed Dec 20, 2021
2 parents 4264821 + fb04cde commit ec777b2
Show file tree
Hide file tree
Showing 20 changed files with 122 additions and 32 deletions.
5 changes: 5 additions & 0 deletions inc/classes/BxDolPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,11 @@ public function getName ()
return $this->_sObject;
}

public function getObject ()
{
return $this->_aObject;
}

public function getInjections()
{
$aResult = array();
Expand Down
18 changes: 17 additions & 1 deletion inc/classes/BxDolTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,22 @@ function getCode()
{
return $this->_sCode;
}

/**
* Get embed code.
*
* @return string embed's code.
*/
function getEmbed($sContent)
{
$this->addJs(['inc/js/|embed.js']);
$this->addCss(['embed.css']);

$this->setPageNameIndex (BX_PAGE_EMBED);
$this->setPageContent('page_main_code', '<div class="bx-embed">' . $sContent . '</div>');
$this->getPageCode();

}

/**
* Get code key.
Expand Down Expand Up @@ -1173,7 +1189,7 @@ function getMetaInfo()
if (!empty($this->aPage['rss']) && !empty($this->aPage['rss']['url']))
$sRet .= '<link rel="alternate" type="application/rss+xml" title="' . bx_html_attribute($this->aPage['rss']['title'], BX_ESCAPE_STR_QUOTE) . '" href="' . $this->aPage['rss']['url'] . '" />';

$sRet .= "<link rel=\"alternate\" type=\"application/json+oembed\" href=\"" . BX_DOL_URL_ROOT ."oembed.php?url=" . urlencode($_SERVER["REQUEST_URI"]) . "&format=json\" title=\"". (isset($this->aPage['header']) ? bx_html_attribute(strip_tags($this->aPage['header'])) : '') . "\" />";
$sRet .= "<link rel=\"alternate\" type=\"application/json+oembed\" href=\"" . BX_DOL_URL_ROOT ."em.php?url=" . urlencode($_SERVER["REQUEST_URI"]) . "&format=json\" title=\"". (isset($this->aPage['header']) ? bx_html_attribute(strip_tags($this->aPage['header'])) : '') . "\" />";

return $sRet;
}
Expand Down
8 changes: 4 additions & 4 deletions install/sql/system.sql
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,10 @@ INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `ex

(@iCategoryId, 'sys_live_updates_interval', '_adm_stg_cpt_option_sys_live_updates_interval', '10000', 'digit', '', '', '', '', 60),

(@iCategoryId, 'sys_quill_toolbar_mini', '_adm_stg_cpt_option_sys_quill_toolbar_mini', '[\'bold\',\'italic\',\'underline\',\'clean\'],[{\'list\':\'ordered\'}, {\'list\':\'bullet\'}],[{ \'align\':\'\'},{\'align\':\'center\'},{\'align\':\'right\'}],[\'blockquote\'],[\'link\',\'image\',\'embed\']', 'digit', '', '', '', '', 70),
(@iCategoryId, 'sys_quill_toolbar_standard', '_adm_stg_cpt_option_sys_quill_toolbar_standard', '[\'bold\',\'italic\',\'underline\',\'clean\'],[{ \'header\': [1, 2, 3, 4, 5, 6, false] }],[{\'list\':\'ordered\'}, {\'list\':\'bullet\'},{\'indent\': \'-1\'},{\'indent\': \'+1\'}],[{ \'align\':\'\'},{\'align\':\'center\'},{\'align\':\'right\'},{\'align\':\'justify\'}],[\'blockquote\'],[\'link\',\'image\',\'embed\']', 'digit', '', '', '', '', 73),
(@iCategoryId, 'sys_quill_toolbar_full', '_adm_stg_cpt_option_sys_quill_toolbar_full', '[{ \'header\': [1, 2, 3, 4, 5, 6, false] }],[\'bold\',\'italic\',\'underline\',\'clean\'],
[{ \'align\': [] }],[{\'list\':\'ordered\'}, {\'list\':\'bullet\'},{\'indent\': \'-1\'},{\'indent\': \'+1\'}],[\'blockquote\'],[{ \'color\': [] }, { \'background\': [] }],[{ \'direction\': \'rtl\' }],[{ \'script\': \'sub\'}, { \'script\': \'super\' }],[\'link\',\'image\',\'embed\',\'code-block\']', 'digit', '', '', '', '', 76),
(@iCategoryId, 'sys_quill_toolbar_mini', '_adm_stg_cpt_option_sys_quill_toolbar_mini', '[\'bold\',\'italic\',\'underline\',\'clean\',{\'list\':\'ordered\'}, {\'list\':\'bullet\'},{ \'align\':\'\'},{\'align\':\'center\'},{\'align\':\'right\'},\'blockquote\',\'link\',\'image\',\'embed\']', 'digit', '', '', '', '', 70),
(@iCategoryId, 'sys_quill_toolbar_standard', '_adm_stg_cpt_option_sys_quill_toolbar_standard', '[\'bold\',\'italic\',\'underline\',\'clean\',{ \'header\': [1, 2, 3, 4, 5, 6, false] },{\'list\':\'ordered\'}, {\'list\':\'bullet\'},{\'indent\': \'-1\'},{\'indent\': \'+1\'},{ \'align\':\'\'},{\'align\':\'center\'},{\'align\':\'right\'},{\'align\':\'justify\'},\'blockquote\',\'link\',\'image\',\'embed\']', 'digit', '', '', '', '', 73),
(@iCategoryId, 'sys_quill_toolbar_full', '_adm_stg_cpt_option_sys_quill_toolbar_full', '[{ \'header\': [1, 2, 3, 4, 5, 6, false] },\'bold\',\'italic\',\'underline\',\'clean\'],
[{ \'align\': [] },{\'list\':\'ordered\'}, {\'list\':\'bullet\'},{\'indent\': \'-1\'},{\'indent\': \'+1\'},\'blockquote\',{ \'color\': [] }, { \'background\': [] },{ \'direction\': \'rtl\' },\'link\',\'image\',\'embed\',\'code-block\']', 'digit', '', '', '', '', 76),

(@iCategoryId, 'sys_search_keyword_min_len', '_adm_stg_cpt_option_sys_search_keyword_min_len', '1', 'digit', '', '', '', '', 80),

Expand Down
3 changes: 2 additions & 1 deletion modules/base/general/classes/BxBaseModGeneralModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ public function actionEmbed($iContentId)
if(empty($sUnitTemplate))
$sUnitTemplate = 'unit_gallery.html';

echo $this->_oTemplate->unit($aContentInfo, true, $sUnitTemplate);
$oTemplate = BxDolTemplate::getInstance();
$oTemplate->getEmbed($this->_oTemplate->unit($aContentInfo, true, $sUnitTemplate));
}

public function subactionDelete()
Expand Down
1 change: 0 additions & 1 deletion modules/base/general/template/embed.html

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
</bx_if:sbutton>
<bx_if:custom>
<span class="__style_prefix__-div text-sm text-gray-500 dark:text-gray-400">&nbsp;&#183;&nbsp;</span>
<span class="__style_prefix__-item">__content__</span>
<span class="__style_prefix__-item text-sm">__content__</span>
</bx_if:custom>
<bx_if:nl></bx_if:nl>
3 changes: 2 additions & 1 deletion modules/boonex/forum/classes/BxForumGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,14 @@ protected function _getCellAuthor($mixedValue, $sKey, $aField, $aRow)

protected function _getCellCategory($mixedValue, $sKey, $aField, $aRow)
{
$sIcon = '';
$sIcon = $this->_oModule->_oTemplate->parseHtmlByName('default_category.html', []);
$o = BxDolCategory::getObjectInstance('bx_forum_cats');

$aCategoryData = $this->_oModule->_oDb->getCategories(array('type' => 'by_category', 'category' => $aRow['cat']));

if(isset($aCategoryData['icon']))
$sIcon = $this->_oTemplate->getImage($aCategoryData['icon'], array('class' => 'sys-icon'));
// echo $sIcon;
$mixedValue = $this->_oModule->_oTemplate->parseHtmlByName('thumb.html', ['icon' => $sIcon, 'title' => $o->getCategoryTitle($aRow['cat'])]);
return self::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
}
Expand Down
4 changes: 2 additions & 2 deletions modules/boonex/forum/classes/BxForumMenuSnippetMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ protected function _getMenuItemStatus($aItem)
$sIcon = '';
if ($this->_aContentInfo['resolvable']){
if ($this->_aContentInfo['resolved']){
$sIcon .= 'checked-circle';
$sIcon .= 'check-circle';
}
else{
$sIcon .= 'question-circle';
}
}
else{
$sIcon .= 'comment-alt';
$sIcon .= 'comment';
}
return $this->getUnitMetaItemCustom($this->_oModule->_oTemplate->parseHtmlByName('status.html', ['icon' => $sIcon , 'counter' => (int)$oObject->getCommentsCountAll()]));
}
Expand Down
4 changes: 3 additions & 1 deletion modules/boonex/forum/classes/BxForumModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ public function serviceCategoriesList($aParams = array())
$aCategoryData = $this->_oDb->getCategories(array('type' => 'by_category', 'category' => $aCategory['value']));

if(isset($aCategoryData['icon']))
$aCategories['bx_repeat:cats'][$sKey]['icon'] = $this->_oTemplate->getImage($aCategoryData['icon'], array('class' => 'sys-icon sys-colored'));
$aCategories['bx_repeat:cats'][$sKey]['icon'] = $this->_oTemplate->getImage($aCategoryData['icon'], array('class' => 'sys-icon sys-colored'));
else
$aCategories['bx_repeat:cats'][$sKey]['icon'] = $this->_oTemplate->parseHtmlByName('default_category.html', []);

if(isset($aCategoryData['visible_for_levels']) && $aCategoryData['visible_for_levels'] != '' && !BxDolAcl::getInstance()->isMemberLevelInSet($aCategoryData['visible_for_levels'])){
unset($aCategories['bx_repeat:cats'][$sKey]);
Expand Down
19 changes: 12 additions & 7 deletions modules/boonex/forum/install/langs/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<string name="_bx_forum_acl_action_stick_any_entry"><![CDATA[Pin any discussion]]></string>
<string name="_bx_forum_acl_action_lock_any_entry"><![CDATA[Lock any discussion]]></string>
<string name="_bx_forum_acl_action_hide_any_entry"><![CDATA[Hide any discussion]]></string>
<string name="_bx_forum_acl_action_resolve_any_entry"><![CDATA[Resolve any discussion]]></string>
<string name="_bx_forum_acl_action_resolve_any_entry"><![CDATA[Mark as answered any discussion]]></string>

<string name="_bx_forum_page_title_sys_create_entry"><![CDATA[New discussion]]></string>
<string name="_bx_forum_page_title_create_entry"><![CDATA[New discussion]]></string>
Expand Down Expand Up @@ -249,10 +249,10 @@
<string name="_bx_forum_menu_item_title_edit_entry"><![CDATA[Edit]]></string>
<string name="_bx_forum_menu_item_title_system_delete_entry"><![CDATA[Delete]]></string>
<string name="_bx_forum_menu_item_title_delete_entry"><![CDATA[Delete]]></string>
<string name="_bx_forum_menu_item_title_resolve_entry"><![CDATA[Resolve]]></string>
<string name="_bx_forum_menu_item_title_unresolve_entry"><![CDATA[Unresolve]]></string>
<string name="_bx_forum_menu_item_title_system_resolve_entry"><![CDATA[Resolve]]></string>
<string name="_bx_forum_menu_item_title_system_unresolve_entry"><![CDATA[Unresolve]]></string>
<string name="_bx_forum_menu_item_title_resolve_entry"><![CDATA[Mark as Answered]]></string>
<string name="_bx_forum_menu_item_title_unresolve_entry"><![CDATA[Mark as Unanswered]]></string>
<string name="_bx_forum_menu_item_title_system_resolve_entry"><![CDATA[Mark as Answered]]></string>
<string name="_bx_forum_menu_item_title_system_unresolve_entry"><![CDATA[Mark as Unanswered]]></string>
<string name="_bx_forum_menu_item_title_system_stick_entry"><![CDATA[Pin]]></string>
<string name="_bx_forum_menu_item_title_stick_entry"><![CDATA[Pin]]></string>
<string name="_bx_forum_menu_item_title_system_unstick_entry"><![CDATA[Unpin]]></string>
Expand Down Expand Up @@ -316,6 +316,11 @@
<string name="_bx_forum_menu_set_title_snippet_meta_reply"><![CDATA[Snippet Meta Info: Reply]]></string>
<string name="_bx_forum_menu_item_title_system_sm_reply_text"><![CDATA[Reply text]]></string>
<string name="_bx_forum_menu_item_title_sm_reply_text"><![CDATA[Reply text]]></string>
<string name="_bx_forum_menu_item_title_system_sm_status"><![CDATA[Status]]></string>
<string name="_bx_forum_menu_item_title_sm_status"><![CDATA[Status]]></string>
<string name="_bx_forum_menu_item_title_system_sm_badges"><![CDATA[Badges]]></string>
<string name="_bx_forum_menu_item_title_sm_badges"><![CDATA[Badges]]></string>


<string name="_bx_forum_grid_filter_item_title_adm_select_one_filter1"><![CDATA[All Statuses]]></string>
<string name="_bx_forum_grid_filter_item_title_adm_active"><![CDATA[Active]]></string>
Expand Down Expand Up @@ -362,8 +367,8 @@

<string name="_bx_forum_grid_filter_resolved_all"><![CDATA[All]]></string>
<string name="_bx_forum_grid_filter_badges_all"><![CDATA[All]]></string>
<string name="_bx_forum_grid_filter_resolved_resolved"><![CDATA[Resolved]]></string>
<string name="_bx_forum_grid_filter_resolved_unresolved"><![CDATA[Unresolved]]></string>
<string name="_bx_forum_grid_filter_resolved_resolved"><![CDATA[Answered]]></string>
<string name="_bx_forum_grid_filter_resolved_unresolved"><![CDATA[Unanswered]]></string>

<string name="_bx_forum_grid_filter_order_recent"><![CDATA[Recent Posts]]></string>
<string name="_bx_forum_grid_filter_order_new"><![CDATA[New]]></string>
Expand Down
4 changes: 2 additions & 2 deletions modules/boonex/forum/install/sql/enable.sql
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
('bx_forum_snippet_meta_main', 'bx_forum', 'author', '_sys_menu_item_title_system_sm_author', '_sys_menu_item_title_sm_author', '', '', '', '', '', 2147483647, 1, 0, 1, 1),
('bx_forum_snippet_meta_main', 'bx_forum', 'date', '_sys_menu_item_title_system_sm_date', '_sys_menu_item_title_sm_date', '', '', '', '', '', 2147483647, 1, 0, 1, 2),
('bx_forum_snippet_meta_main', 'bx_forum', 'category', '_sys_menu_item_title_system_sm_category', '_sys_menu_item_title_sm_category', '', '', '', '', '', 2147483647, 1, 0, 1, 3),
('bx_forum_snippet_meta_main', 'bx_forum', 'status', '_sys_menu_item_title_system_sm_status', '_sys_menu_item_title_sm_status', '', '', '', '', '', 2147483647, 1, 0, 1, 4),
('bx_forum_snippet_meta_main', 'bx_forum', 'badges', '_sys_menu_item_title_system_sm_badges', '_sys_menu_item_title_sm_badges', '', '', '', '', '', 2147483647, 1, 0, 1, 5);
('bx_forum_snippet_meta_main', 'bx_forum', 'status', '_bx_forum_menu_item_title_system_sm_status', '_bx_forum_menu_item_title_sm_status', '', '', '', '', '', 2147483647, 1, 0, 1, 4),
('bx_forum_snippet_meta_main', 'bx_forum', 'badges', '_bx_forum_menu_item_title_system_sm_badges', '_bx_forum_menu_item_title_sm_badges', '', '', '', '', '', 2147483647, 1, 0, 1, 5);

-- MENU: custom menu for 'counters' snippet meta info
INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
Expand Down
18 changes: 13 additions & 5 deletions modules/boonex/forum/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,21 @@ BxForumMain.prototype.init = function() {
var iInnerWidth = oTable.parent().innerWidth();
oTable.find('.bx-forum-grid-preview').each(function () {
var eWrapper = $(this).parent();
// var w = iInnerWidth - iCalcWidth - parseInt(eWrapper.css('padding-left')) - parseInt(eWrapper.css('padding-right'));
// $(this).width(w + 'px');
});

oTable.find('tr').each(function () {
$(this).click(function() {
location = $(this).find('.bx-forum-gp-title A').attr('href');
oTable.find('tr').each(function () {
$(this).removeClass('bx-def-color-bg-hl')
$(this).click(function (evt) {
console.log(event.srcElement.localName);
if (!event.srcElement.closest('a')) {
location = $(this).find('.bx-forum-gp-title A').attr('href');
}
})
$(this).mouseover(function (evt) {
$(this).addClass('bx-def-color-bg-box')
})
$(this).mouseout(function (evt) {
$(this).removeClass('bx-def-color-bg-box')
})
});

Expand Down
4 changes: 2 additions & 2 deletions modules/boonex/forum/template/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@
font-size: 1rem;
line-height: 1.5;
font-weight: 500;
color:rgb(17,24,29)
}

.bx-forum-grid-preview .bx-forum-gp-title .sys-icon,
Expand Down Expand Up @@ -329,6 +328,8 @@
.bx-forum-thumb .sys-icon{
width: 3rem;
height: 3rem;
color: #fff;
font-size: 1.75rem;
}
.bx-forum-thumb .sys-icon-svg{
width: 2.4rem;
Expand Down Expand Up @@ -360,7 +361,6 @@
vertical-align: top;
}
.bx-forum-grid tr:hover{
background: rgb(243,244,246) !important;
cursor: pointer;
}
.bx-forum-grid tr td:first-child{
Expand Down
2 changes: 1 addition & 1 deletion modules/boonex/forum/template/status.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<span class="bx-def-font-grayed "><i class="sys-icon far __icon__"></i> __counter__</span>
<span class="bx-def-font-grayed text-sm"><i class="sys-icon far __icon__"></i> __counter__</span>
1 change: 0 additions & 1 deletion modules/boonex/lucid/data/template/system/css/editor.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
.ql-toolbar.ql-snow{
border: none !important;
border-bottom: 1px solid rgba(50, 100, 180, 0.2) !important;
border-radius: 10px;
}
.ql-container.bx-form-input-html-quill-empty.ql-snow{
border-radius: 0.3rem;
Expand Down
2 changes: 0 additions & 2 deletions page.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@

$oPage = BxDolPage::getObjectInstanceByURI('', false, true);
if ($oPage) {

$oPage->displayPage();

} else {

$oTemplate = BxDolTemplate::getInstance();
$oTemplate->displayPageNotFound();
}
Expand Down
7 changes: 7 additions & 0 deletions template/css/embed.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
body,
.bx-embed{
background-color: transparent !important;
}
.bx-embed{
width:calc(100% - 2px);
}
1 change: 1 addition & 0 deletions template/embed.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<iframe width="100%" height="300" src="__url__" title="__title__" frameborder="0" allowfullscreen></iframe>
23 changes: 23 additions & 0 deletions template/embed_card.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<div class="bx-base-text-unit bx-base-text-unit-gallery bx-def-gal-unit-size flex flex-col w-full p-2 box-border">
<div class="bx-base-text-unit-cnt rounded ring-1 ring-gray-200 dark:ring-gray-700 overflow-hidden bg-white dark:bg-gray-800">
<bx_if:thumb>
<a href="__url__" title="__title__">
<div class="flex-shrink-0 m-1">
<img class="h-48 w-full object-cover rounded" src="__background__" alt="">
</div>
</a>
</bx_if:thumb>
<bx_if:no_thumb>
<a href="__url__" title="__title__">
<div class="bx-def-gal-img-column flex-shrink-0 m-1">
<div class="bx-base-text-unit-no-thumb flex flex-col items-center justify-center h-48 p-4 bg-gradient-to-b from-red-400 to-red-500 box-border rounded-md"></div>
</div>
</a>
</bx_if:no_thumb>
<div class="bx-base-text-unit-text p-3 md:p-4 lg:p-6 pt-2 md:pt-3 lg:pt-5 box-border">
<div class="bx-base-text-unit-title flex items-center text-left">
<a href="__url__" class="text-lg lg:text-xl font-semibold text-gray-700 group-hover:text-gray-900 dark:text-gray-200 dark:group-hover:text-white">__title__</a>
</div>
</div>
</div>
</div>
25 changes: 25 additions & 0 deletions template/scripts/BxBasePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,31 @@ public function performActionGetHelp ()
'content' => _t($aBlock['help'])
));
}

public function performActionEmbed ()
{
$aCover = $this->getPageCoverImage();
$this->_oTemplate->getEmbed($this->_oTemplate->parseHtmlByName('embed_card.html', [
'title' => _t($this->_aObject['title']),
'url' => BxDolPermalinks::getInstance()->permalink($this->_aObject['url']),
'bx_if:thumb' => [
'condition' => $this->isPageCover() && count($aCover) > 0,
'content' => [
'title' => _t($this->_aObject['title']),
'url' => BxDolPermalinks::getInstance()->permalink($this->_aObject['url']),
'background' => BxDolCover::getInstance(BxDolTemplate::getInstance())->getCoverImageUrl($aCover)
],
],
'bx_if:no_thumb' => [
'condition' => count($aCover) == 0 || !$this->isPageCover(),
'content' => [
'title' => _t($this->_aObject['title']),
'url' => BxDolPermalinks::getInstance()->permalink($this->_aObject['url']),
]
]
]
));
}

/**
* Very similar to BxBasePage::getCode
Expand Down

0 comments on commit ec777b2

Please sign in to comment.