Ver Fonte

Merge branch 'master' of https://github.com/unaio/una

AntonLV há 6 anos atrás
pai
commit
fed5d35f23

+ 4 - 1
inc/classes/BxDolWiki.php

@@ -87,7 +87,7 @@ class BxDolWiki extends BxDolFactory implements iBxDolFactoryObject
 
 
         $aObject = BxDolWikiQuery::getWikiObject($sObject);
         $aObject = BxDolWikiQuery::getWikiObject($sObject);
         if (!$aObject || !is_array($aObject))
         if (!$aObject || !is_array($aObject))
-            return false;
+            $aObject = BxDolWikiQuery::getWikiObject('system');
 
 
         $sClass = empty($aObject['override_class_name']) ? 'BxDolWiki' : $aObject['override_class_name'];
         $sClass = empty($aObject['override_class_name']) ? 'BxDolWiki' : $aObject['override_class_name'];
         if (!empty($aObject['override_class_file']))
         if (!empty($aObject['override_class_file']))
@@ -148,6 +148,9 @@ class BxDolWiki extends BxDolFactory implements iBxDolFactoryObject
      */
      */
     public function isAllowed ($sType, $iProfileId = false)
     public function isAllowed ($sType, $iProfileId = false)
     {
     {
+        if (isAdmin())
+            return true;
+
         $aTypes = array(
         $aTypes = array(
             'add' => 'allow_add_for_levels',
             'add' => 'allow_add_for_levels',
             'edit' => 'allow_edit_for_levels',
             'edit' => 'allow_edit_for_levels',

+ 4 - 0
install/sql/system.sql

@@ -4855,6 +4855,10 @@ CREATE TABLE IF NOT EXISTS `sys_objects_wiki` (
   UNIQUE KEY `uri` (`uri`)
   UNIQUE KEY `uri` (`uri`)
 );
 );
 
 
+INSERT INTO `sys_objects_wiki` (`object`, `uri`, `title`, `module`, `allow_add_for_levels`, `allow_edit_for_levels`, `allow_delete_for_levels`, `allow_translate_for_levels`, `allow_unsafe_for_levels`, `override_class_name`, `override_class_file`) VALUES
+('system', '', '_sys_wiki_system_title', 'system', 0, 0, 0, 0, 0, '', '');
+
+
 CREATE TABLE IF NOT EXISTS `sys_pages_wiki_blocks` (
 CREATE TABLE IF NOT EXISTS `sys_pages_wiki_blocks` (
   `id` int(10) UNSIGNED NOT NULL,
   `id` int(10) UNSIGNED NOT NULL,
   `block_id` int(11) NOT NULL,
   `block_id` int(11) NOT NULL,

+ 21 - 0
modules/boonex/decorous/data/template/system/scripts/BxTemplPageWiki.php

@@ -0,0 +1,21 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaTemplate UNA Template Classes
+ * @{
+ */
+
+/**
+ * @see BxBasePageWiki
+ */
+class BxTemplPageWiki extends BxBasePageWiki
+{
+    public function __construct($aObject, $oTemplate = false)
+    {
+        parent::__construct($aObject, $oTemplate);
+    }
+}
+
+/** @} */

+ 21 - 0
modules/boonex/lucid/data/template/system/scripts/BxTemplPageWiki.php

@@ -0,0 +1,21 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaTemplate UNA Template Classes
+ * @{
+ */
+
+/**
+ * @see BxBasePageWiki
+ */
+class BxTemplPageWiki extends BxBasePageWiki
+{
+    public function __construct($aObject, $oTemplate = false)
+    {
+        parent::__construct($aObject, $oTemplate);
+    }
+}
+
+/** @} */

+ 21 - 0
modules/boonex/ocean/data/template/system/scripts/BxTemplPageWiki.php

@@ -0,0 +1,21 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaTemplate UNA Template Classes
+ * @{
+ */
+
+/**
+ * @see BxBasePageWiki
+ */
+class BxTemplPageWiki extends BxBasePageWiki
+{
+    public function __construct($aObject, $oTemplate = false)
+    {
+        parent::__construct($aObject, $oTemplate);
+    }
+}
+
+/** @} */

+ 21 - 0
modules/boonex/protean/data/template/system/scripts/BxTemplPageWiki.php

@@ -0,0 +1,21 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaTemplate UNA Template Classes
+ * @{
+ */
+
+/**
+ * @see BxBasePageWiki
+ */
+class BxTemplPageWiki extends BxBasePageWiki
+{
+    public function __construct($aObject, $oTemplate = false)
+    {
+        parent::__construct($aObject, $oTemplate);
+    }
+}
+
+/** @} */

+ 1 - 0
modules/boonex/wiki/install/langs/en.xml

@@ -2,6 +2,7 @@
 <resources name="en" flag="gb" title="English">
 <resources name="en" flag="gb" title="English">
     <string name="_sys_module_wiki"><![CDATA[Wiki]]></string>
     <string name="_sys_module_wiki"><![CDATA[Wiki]]></string>
     <string name="_bx_wiki"><![CDATA[Wiki]]></string>
     <string name="_bx_wiki"><![CDATA[Wiki]]></string>
+    <string name="_bx_wiki_object_title"><![CDATA[Wiki]]></string>
     <string name="_bx_wiki_page_home"><![CDATA[Wiki Home]]></string>
     <string name="_bx_wiki_page_home"><![CDATA[Wiki Home]]></string>
     <string name="_bx_wiki_block_home"><![CDATA[Wiki Home]]></string>
     <string name="_bx_wiki_block_home"><![CDATA[Wiki Home]]></string>
     <string name="_bx_wiki_menu_item_title_system_home"><![CDATA[Wiki]]></string>
     <string name="_bx_wiki_menu_item_title_system_home"><![CDATA[Wiki]]></string>

+ 2 - 2
modules/boonex/wiki/install/sql/enable.sql

@@ -2,7 +2,7 @@
 -- Wiki object
 -- Wiki object
 
 
 INSERT INTO `sys_objects_wiki` (`object`, `uri`, `title`, `module`, `allow_add_for_levels`, `allow_edit_for_levels`, `allow_delete_for_levels`, `allow_translate_for_levels`, `allow_unsafe_for_levels`, `override_class_name`, `override_class_file`) VALUES
 INSERT INTO `sys_objects_wiki` (`object`, `uri`, `title`, `module`, `allow_add_for_levels`, `allow_edit_for_levels`, `allow_delete_for_levels`, `allow_translate_for_levels`, `allow_unsafe_for_levels`, `override_class_name`, `override_class_file`) VALUES
-('bx_wiki', 'wiki', '_sys_wiki_system_title', 'system', 192, 192, 192, 192, 192, '', '');
+('bx_wiki', 'wiki', '_bx_wiki_object_title', 'system', 192, 192, 192, 192, 192, '', '');
 
 
 -- Permalinks
 -- Permalinks
 
 
@@ -24,4 +24,4 @@ INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `tit
 
 
 SET @iHomepageMenuOrder = (SELECT `order` FROM `sys_menu_items` WHERE `set_name` = 'sys_homepage' AND `active` = 1 ORDER BY `order` DESC LIMIT 1);
 SET @iHomepageMenuOrder = (SELECT `order` FROM `sys_menu_items` WHERE `set_name` = 'sys_homepage' AND `active` = 1 ORDER BY `order` DESC LIMIT 1);
 INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES 
 INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES 
-('sys_homepage', 'bx_wiki', 'wiki-home', '', '_bx_wiki_menu_item_title_system_home', 'r.php?_q=wiki/wiki-home', '', '', 'far wikipedia-w', '', 2147483647, 1, 1, IFNULL(@iHomepageMenuOrder, 0) + 1);
+('sys_homepage', 'bx_wiki', 'wiki-home', '', '_bx_wiki_menu_item_title_system_home', 'r.php?_q=wiki/wiki-home', '', '', 'fab wikipedia-w', '', 2147483647, 1, 1, IFNULL(@iHomepageMenuOrder, 0) + 1);

+ 1 - 1
modules/boonex/wiki/install/sql/install.sql

@@ -2,7 +2,7 @@
 -- Wiki home page
 -- Wiki home page
 
 
 INSERT INTO `sys_objects_page` (`object`, `uri`, `title_system`, `title`, `module`, `cover`, `cover_image`, `type_id`, `layout_id`, `submenu`, `visible_for_levels`, `visible_for_levels_editable`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES
 INSERT INTO `sys_objects_page` (`object`, `uri`, `title_system`, `title`, `module`, `cover`, `cover_image`, `type_id`, `layout_id`, `submenu`, `visible_for_levels`, `visible_for_levels_editable`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES
-('bx_wiki_home', 'wiki-home', '', '_bx_wiki_page_home', 'bx_wiki', 0, 0, 1, 5, '', 2147483647, 1, 'r.php?_q=wiki/home', '', '', '', 0, 1, 0, '', '');
+('bx_wiki_home', 'wiki-home', '', '_bx_wiki_page_home', 'bx_wiki', 0, 0, 1, 5, '', 2147483647, 1, 'r.php?_q=wiki/home', '', '', '', 0, 1, 0, 'BxTemplPageWiki', '');
 
 
 INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `hidden_on`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES
 INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `hidden_on`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES
 ('bx_wiki_home', 1, 'bx_wiki', '', '_bx_wiki_block_home', 0, 2147483647, '0', 'wiki', '', 0, 1, 1, 1);
 ('bx_wiki_home', 1, 'bx_wiki', '', '_bx_wiki_block_home', 0, 2147483647, '0', 'wiki', '', 0, 1, 1, 1);

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
template/images/cover-homepage.svg


+ 12 - 2
template/scripts/BxBasePage.php

@@ -213,10 +213,10 @@ class BxBasePage extends BxDolPage
     }
     }
 
 
     /**
     /**
-     * Get page code only.
+     * Get page code vars
      * @return string
      * @return string
      */
      */
-    protected function _getPageCode ()
+    protected function _getPageCodeVars ()
     {
     {
     	$aHiddenOn = array(
     	$aHiddenOn = array(
             pow(2, BX_DB_HIDDEN_PHONE - 1) => 'bx-def-media-phone-hide',
             pow(2, BX_DB_HIDDEN_PHONE - 1) => 'bx-def-media-phone-hide',
@@ -246,6 +246,16 @@ class BxBasePage extends BxDolPage
             $aVars[$sKey] = $sCell;
             $aVars[$sKey] = $sCell;
         }
         }
 
 
+        return $aVars;
+    }
+
+    /**
+     * Get page code only.
+     * @return string
+     */
+    protected function _getPageCode ()
+    {
+        $aVars = $this->_getPageCodeVars ();
         return $this->_oTemplate->parseHtmlByName($this->_aObject['template'], $aVars);
         return $this->_oTemplate->parseHtmlByName($this->_aObject['template'], $aVars);
     }
     }
 
 

+ 36 - 0
template/scripts/BxBasePageWiki.php

@@ -0,0 +1,36 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaBaseView UNA Base Representation Classes
+ * @{
+ */
+
+/**
+ * Wiki page
+ */
+class BxBasePageWiki extends BxTemplPage
+{
+    public function __construct($aObject, $oTemplate)
+    {
+        parent::__construct($aObject, $oTemplate);
+    }
+
+    protected function _getPageCodeVars ()
+    {
+        $aVars = parent::_getPageCodeVars ();
+        
+        $oWiki = BxDolWiki::getObjectInstance($this->_aObject['module']);
+        if ($oWiki->isAllowed('add')) {
+            foreach ($aVars as $sKey => $sCell) {
+                if (0 !== strncmp('cell_', $sKey, 5))
+                    continue;
+                $aVars[$sKey] = $sCell . '<div class="bx-def-margin-top bx-def-padding" style="border:1px dashed #aaa; text-align:center;"><a href="javascript:void(0);" onclick="alert(\'TODO: wiki block add form\')"><i class="sys-icon plus"></i> Add Block</a></div>';
+            }
+        }
+        return $aVars;
+    }
+}
+
+/** @} */

+ 1 - 1
template/scripts/BxBaseServiceWiki.php

@@ -52,7 +52,7 @@ class BxBaseServiceWiki extends BxDol
                     $oTemplate = BxDolTemplate::getInstance();
                     $oTemplate = BxDolTemplate::getInstance();
                     $oTemplate->displayErrorOccured(_t("_sys_wiki_error_page_exists", bx_process_output($sUri)));
                     $oTemplate->displayErrorOccured(_t("_sys_wiki_error_page_exists", bx_process_output($sUri)));
                 } else {
                 } else {
-                    echo "TODO: wiki - suggest to create page with specified URI. Display form where user can enter title(text input), text(plain textrea), languale (select with currect site languages with current one pre-selected), title - will be page and first block title, text - will be content for first block. Default layout is page with one column and block without borders and title.";
+                    echo "TODO: wiki - suggest to create page with specified URI. Display form where user can enter title(text input), text(plain textrea), languale (selectbox with currect site languages with current one pre-selected), revision comments (text input), title - will be page and first block title, text - will be content for first block. Default layout is page with one column and block without borders and title.";
                 }
                 }
             } 
             } 
             else {
             else {

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff