diff --git a/dev_docs/acc.dev_docs.php b/dev_docs/acc.dev_docs.php new file mode 100644 index 0000000..53a9607 --- /dev/null +++ b/dev_docs/acc.dev_docs.php @@ -0,0 +1,84 @@ + + * @copyright Copyright (c) 2012 Minds On Design Lab, Inc. + * @link https://github.com/Minds-On-Design-Lab/dev_docs.ee_addon + * @license MIT http://opensource.org/licenses/mit-license.php + */ + +require_once(PATH_THIRD . 'dev_docs/config/dev_docs.php'); + +class Dev_docs_acc { + var $name = "Dev Docs Accessory"; + var $id = 'dev_docs_acc'; + var $version = '1.0'; + var $description = "Adds a Dev Docs dropdown menu to the CP main menu"; + var $sections = array(); + /** + * Constructor + */ + public function Dev_docs_acc() { + $this->EE =& get_instance(); + + $this->EE->load->add_package_path(PATH_THIRD . 'dev_docs'); + $this->EE->load->config('dev_docs'); + $this->EE->load->model('dev_docs_model'); + $this->EE->load->library('Docs_library'); + // Lang file isn't auto-loaded for some reason + $this->EE->lang->loadfile('dev_docs'); + + $this->_url_base = $this->EE->config->item('dd:mod_url_base'); + } + + public function set_sections() { + + $r = ''; + $this->sections[] = ''; + + $installed_modules = $this->EE->cp->get_installed_modules(); + + + if(array_key_exists('dev_docs', $installed_modules)) { + + $pages = $this->EE->dev_docs_model->get_pages(); + + foreach ($pages as $page) { + + $title = $page['heading']; + $link = $this->_url_base . AMP . 'docs_page=' . $page['short_name']; + $r .= '
  • '. $title .'
  • '; + + } + + + $this->EE->cp->add_to_head(' + + '); + + } + + } + + public function update() { + return TRUE; + } + +} + +/* End of file acc.dev_docs.php */ +/* Location: ./system/expressionengine/third_party/dev_docs/acc.dev_docs.php */ \ No newline at end of file diff --git a/dev_docs/config/dev_docs.php b/dev_docs/config/dev_docs.php index 7af0e84..2311d41 100644 --- a/dev_docs/config/dev_docs.php +++ b/dev_docs/config/dev_docs.php @@ -21,7 +21,7 @@ * Also define the version constant to be * used in the extension and accessory files */ -$config['dd:version'] = "0.1.5"; +$config['dd:version'] = "0.1.6"; if ( ! defined('DD_VERSION')) { define('DD_VERSION',$config['dd:version']); @@ -62,19 +62,5 @@ $config['dd:default_settings'] = array(); -/** - * @var array Extension hook setup (multi-dimensional for multiple hooks) - */ -$config['dd:ext_hook'] = array( - 'class' => 'Dev_docs_ext', - 'method' => 'cp_menu_array', - 'hook' => 'cp_menu_array', - 'settings' => serialize($config['dd:default_settings']), - 'priority' => 10, - 'version' => $config['dd:version'], - 'enabled' => 'y' -); - - /* End of file dev_docs.php */ /* Location: ./system/expressionengine/third_party/dev_docs/config/dev_docs.php */ \ No newline at end of file diff --git a/dev_docs/ext.dev_docs.php b/dev_docs/ext.dev_docs.php deleted file mode 100644 index 33a05d3..0000000 --- a/dev_docs/ext.dev_docs.php +++ /dev/null @@ -1,196 +0,0 @@ - - * @copyright Copyright (c) 2011 Focus Lab, LLC - * @link https://github.com/focuslabllc/dev_docs.ee_addon - * @license MIT http://opensource.org/licenses/mit-license.php - */ - -require_once(PATH_THIRD . 'dev_docs/config/dev_docs.php'); - -class Dev_docs_ext { - - /** - * @var string Extension name - */ - public $name = 'Dev Docs'; - - - /** - * @var string Extension version number - */ - public $version = DD_VERSION; - - - /** - * @var string Extension description - */ - public $description = 'CP Menu addition for Dev Docs module'; - - - /** - * @var string Do Extensions exist? (y|n) - */ - public $settings_exist = 'n'; - - - /** - * @var string Extensions documentation URL - */ - public $docs_url = 'http://focuslabllc.com/'; - - - /** - * @var array Extension settings array - */ - public $settings = array(); - - - /** - * @var object The EE super object to be referenced in our {@link __construct()} - */ - private $_EE; - - - /** - * @var string Base URL for inner-module linking - */ - private $_url_base; - - - - /** - * Constructor - * - * @access public - * @author Erik Reagan - * @param mixed Settings array or empty string if none exist. - * @return void - */ - public function __construct($settings='') - { - - $this->_EE =& get_instance(); - - // load some goodies - $this->_EE->load->add_package_path(PATH_THIRD . 'dev_docs'); - $this->_EE->load->config('dev_docs'); - $this->_EE->load->model('dev_docs_model'); - $this->_EE->load->library('Docs_library'); - // Lang file isn't auto-loaded for some reason - $this->_EE->lang->loadfile('dev_docs'); - - $this->_url_base = $this->_EE->config->item('dd:mod_url_base'); - - } - // End function __construct() - - - - - /** - * Add to the CP Menu - * - * @param array - * @access public - * @author Erik Reagan - * @return array - */ - public function cp_menu_array($menu) - { - - if ($this->_EE->extensions->last_call !== FALSE) - { - $menu = $this->_EE->extensions->last_call; - } - - // Query to get our menu titles - $pages = $this->_EE->dev_docs_model->get_pages(); - foreach ($pages as $page) { - $this->_EE->lang->language['nav_'.$page['short_name']] = $page['heading']; - $menu['dev_docs'][$page['short_name']] = $this->_url_base . AMP . 'docs_page=' . $page['short_name']; - } - - return $menu; - - } - // End function cp_menu_array() - - - - - /** - * Basic settings method - * - * @access public - * @author Erik Reagan - * @return array - */ - public function settings() - { - // Default settings are stored in config/dev_docs.php - return $this->_EE->config->item('dd:default_settings'); - } - // End function settings() - - - - - /** - * Activate Extension - * - * This function enters the extension into the exp_extensions table - * Or does it.....(see below) - * - * @access public - * @return void - */ - public function activate_extension() - { - - /** - * We actually have to install with at least 1 hook otherwise the extension - * doesn't actually get installed. It makes sense to a degree - but we're just - * using the extension file to store our add-on's settings. Hopefully - * one day this won't exist. - * @link http://expressionengine.com/forums/viewthread/176691/ - */ - - /** - * We aren't using this to activate the extension. We can guarantee the installation of - * our extension by doing this in the module UPD file. That way a user can't choose to not - * install the extension which would kill our settings approach. So, nothing to see here. - */ - - } - // End function activate_extension() - - - - - /** - * Disable Extension - * - * This method removes information from the exp_extensions table - * Or does it.....(see above) - * - * @access public - * @return void - */ - public function disable_extension() - { - // Nothing here either. See comments for activate_extension() - } - // End function disable_extension() - -} -// End class Dev_docs_ext - -/* End of file ext.dev_docs.php */ -/* Location: ./system/expressionengine/third_party/dev_docs/ext.dev_docs.php */ \ No newline at end of file diff --git a/dev_docs/models/dev_docs_setup_model.php b/dev_docs/models/dev_docs_setup_model.php index 31295b8..f2a163d 100644 --- a/dev_docs/models/dev_docs_setup_model.php +++ b/dev_docs/models/dev_docs_setup_model.php @@ -64,54 +64,6 @@ public function insert_module($mod_data, $action_array = FALSE) } // End function insert_module() - - - - /** - * Insert Extension - * - * Activate extension - * This is usually in the ext file but I want to guarantee - * that the ext is installed with the module so it's in the - * upd file instead. - * - * @param array Default extension settings - * @access public - * @author Erik Reagan - * @return void - */ - public function insert_extension($data) - { - $this->_EE->db->insert('extensions', $data); - } - // End function insert_extension() - - - - - /** - * Delete Extension - * - * Activate extension - * This is usually in the ext file but I want to guarantee - * that the ext is installed with the module so it's in the - * upd file instead. - * - * @param array Default extension settings - * @access public - * @author Erik Reagan - * @return void - */ - public function delete_extension() - { - $this->_EE->db->where('class', 'Dev_docs_ext') - ->delete('extensions'); - } - // End function delete_extension() - - - - /** * Create tables * diff --git a/dev_docs/upd.dev_docs.php b/dev_docs/upd.dev_docs.php index aed3366..527169a 100644 --- a/dev_docs/upd.dev_docs.php +++ b/dev_docs/upd.dev_docs.php @@ -56,7 +56,6 @@ public function __construct() public function install() { $this->_install_module(); - $this->_install_extension(); return TRUE; } // End function install() @@ -74,7 +73,6 @@ public function install() public function uninstall() { $this->_uninstall_module(); - $this->_uninstall_extension(); return TRUE; } // End function uninstall() @@ -130,24 +128,6 @@ private function _install_module() // End function _install_module() - - - /** - * Install extension - * - * @access private - * @author Erik Reagan - * @return void - */ - private function _install_extension() - { - $this->_EE->Dev_docs_setup_model->insert_extension($this->_EE->config->item('dd:ext_hook')); - } - // End function _install_extension() - - - - /** * Uninstall module * @@ -161,23 +141,6 @@ private function _uninstall_module() $this->_EE->Dev_docs_setup_model->drop_dd_tables(); } // End function _uninstall_module() - - - - - /** - * Uninstall extension - * - * @access private - * @author Erik Reagan - * @return void - */ - private function _uninstall_extension() - { - $this->_EE->Dev_docs_setup_model->delete_extension(); - } - // End function _uninstall_extension() - } // End class Dev_docs_upd diff --git a/readme.textile b/readme.textile index 92b1910..2ad2123 100644 --- a/readme.textile +++ b/readme.textile @@ -52,7 +52,12 @@ Wait and see... h2. Change Log -+*November 26th, 2011: 0.1.5*+ ++*September 18, 2012: 0.1.6*+ + +* Added Accessory for Dev Docs dropdown menu so access could be controlled by group +* Removed Extension + +*November 26th, 2011: 0.1.5* * Fixed bug with constant declaration in config file * Added parser for Markdown