Skip to content

Commit

Permalink
Merge changes from 0.8-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mwhitneysdsu committed Nov 6, 2015
1 parent b8c3ad5 commit 37419c2
Show file tree
Hide file tree
Showing 46 changed files with 218 additions and 118 deletions.
62 changes: 31 additions & 31 deletions bonfire/docs/_toc.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[Start Here]
developer/getting_started_with_bonfire = Getting Started With Bonfire
developer/installation = Installing Bonfire
developer/ci2 = CodeIgniter 2.x Support in Bonfire
developer/site_structure = Site Structure
developer/tut_blog = Simple Blog Tutorial
developer/changelog = Change Log
developer/start_here/getting_started_with_bonfire = Getting Started With Bonfire
developer/start_here/installation = Installing Bonfire
developer/start_here/ci2 = CodeIgniter 2.x Support in Bonfire
developer/start_here/site_structure = Site Structure
developer/start_here/tut_blog = Simple Blog Tutorial
developer/start_here/changelog = Change Log

[Upgrade Notes]
developer/upgrade/090 = 0.8.2 to 0.9.0
Expand All @@ -23,34 +23,34 @@ developer/upgrade/072 = 0.7.1 to 0.7.2
developer/upgrade/071 = 0.7.0 to 0.7.1

[Basic Concepts]
developer/bonfire_models = Bonfire Models
developer/bonfire_controllers = Bonfire Controllers
developer/routes = Improved Routes
developer/contexts = Contexts
developer/roles_and_permissions = Roles and Permissions
developer/layouts_and_views = Layouts and Views
developer/working_with_assets = Working with Assets
developer/system_events = System Events
developer/basic_concepts/bonfire_models = Bonfire Models
developer/basic_concepts/bonfire_controllers = Bonfire Controllers
developer/basic_concepts/routes = Improved Routes
developer/basic_concepts/contexts = Contexts
developer/basic_concepts/roles_and_permissions = Roles and Permissions
developer/basic_concepts/layouts_and_views = Layouts and Views
developer/basic_concepts/working_with_assets = Working with Assets
developer/basic_concepts/system_events = System Events

[Going Deeper]
developer/changing_the_admin_URL = Changing CONSTANTS for better security
developer/removing_index = Removing index.php from the URL
developer/global_helpers = Global Helper Functions
developer/keyboard_shortcuts = Keyboard Shortcuts
developer/performance_tips = Performance Tips
developer/writing_docs = Writing Documentation
developer/going_deeper/changing_the_admin_URL = Changing CONSTANTS for better security
developer/going_deeper/removing_index = Removing index.php from the URL
developer/going_deeper/global_helpers = Global Helper Functions
developer/going_deeper/keyboard_shortcuts = Keyboard Shortcuts
developer/going_deeper/performance_tips = Performance Tips
developer/going_deeper/writing_docs = Writing Documentation

[Contributing To Bonfire]
developer/how_to_contribute = How To Contribute
developer/issue_tracking_and_pull_requests = Submitting Bug Reports and Feature Requests
developer/coding_conventions = Coding Conventions
developer/contributing/how_to_contribute = How To Contribute
developer/contributing/issue_tracking_and_pull_requests = Submitting Bug Reports and Feature Requests
developer/contributing/coding_conventions = Coding Conventions

[Bonfire Libraries]
developer/assets = Assets
developer/commonmark = CommonMark
developer/console = Console
developer/events = Events
developer/installer_lib = Installer
developer/modules = Modules
developer/route = Route
developer/template = Template
developer/libraries/assets = Assets
developer/libraries/commonmark = CommonMark
developer/libraries/console = Console
developer/libraries/events = Events
developer/libraries/installer_lib = Installer
developer/libraries/modules = Modules
developer/libraries/route = Route
developer/libraries/template = Template
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion bonfire/modules/activities/controllers/Reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public function __construct()

$this->load->model('activities/activity_model');

$this->load->helper('date_helper');

Assets::add_js(
array(
'bootstrap',
Expand Down Expand Up @@ -358,11 +360,12 @@ private function getActivity($which = 'activity_user', $filterValue = false)
break;
case 'activity_date':
foreach ($this->activity_model->find_all_by($activityDeletedField, 0) as $e) {
$options[$e->activity_id] = $e->created_on;
$options[$e->activity_id] = user_time(strtotime($e->created_on), null);
if ($filterValue == $e->activity_id) {
$name = $e->created_on;
}
}

$where = 'activity_id';
Template::set('hasPermissionDeleteDate', $this->auth->has_permission($this->permissionDeleteDate));
break;
Expand Down
2 changes: 1 addition & 1 deletion bonfire/modules/activities/views/reports/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<td><span class="icon-user"></span>&nbsp;<?php e($activity->username); ?></td>
<td><?php echo $activity->activity; ?></td>
<td><?php echo $activity->module; ?></td>
<td><?php echo date('M j, Y g:i A', strtotime($activity->created)); ?></td>
<td><?php echo user_time(strtotime($activity->created), null, 'M j, Y g:i A'); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
Expand Down
110 changes: 77 additions & 33 deletions bonfire/modules/docs/controllers/Docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Docs extends Base_Controller
protected $docsTypeBf = 'developer';
protected $docsTypeMod = 'module';

protected $ignoreFiles = array('_404.md');
protected $ignoreFiles = ['_404.md'];
protected $tocFile;

private $showAppDocs;
Expand Down Expand Up @@ -66,17 +66,28 @@ public function __construct()
redirect();
}

// Was a doc group provided?
if (! $this->docsGroup) {
redirect('docs/' . config_item('docs.default_group'));
}

$this->showAppDocs = config_item('docs.show_app_docs');
$this->showDevDocs = config_item('docs.show_dev_docs');
$this->tocFile = config_item('docs.toc_file') ?: '_toc.ini';
$commonmark_driver = config_item('docs.commonmark_driver');
$this->docsParser = empty($commonmark_driver) ? null : $commonmark_driver;

$this->showAppDocs = config_item('docs.show_app_docs');
$this->showDevDocs = config_item('docs.show_dev_docs');

Template::set_theme(config_item('docs.theme'), 'docs');

$this->load->helper('form');

// Was a doc group provided?
if (! $this->docsGroup) {
if ($this->showAppDocs) {
redirect('docs/application');
} elseif ($this->showDevDocs) {
redirect('docs/developer');
} else {
redirect('docs/' . config_item('docs.default_group'));
}
}

// Make sure we can still get to the search method.
if ($this->docsGroup == 'search') {
$this->docsGroup = false;
Expand All @@ -93,25 +104,21 @@ public function __construct()

show_error(lang('docs_not_allowed'));
}

Template::set_theme(config_item('docs.theme'), 'docs');

$this->load->helper('form');
}

/**
* Display the list of documents available and the current document
* Display the list of documents available and the current document.
*
* @return void
*/
public function index()
{
$data = array();

$content = $this->read_page($this->uri->segment_array());
$content = $this->post_process($content);
$content = $this->readPage($this->uri->segment_array());
$content = $this->postProcess($content);

$data['sidebar'] = $this->build_sidebar();
$data['sidebar'] = $this->buildSidebar();
$data['content'] = $content;

Template::set($data);
Expand All @@ -130,6 +137,20 @@ public function search()

$terms = $this->input->post('search_terms');
if ($terms) {
// Set docsGroup and, if both are disabled...
if (! $this->showAppDocs && ! $this->showDevDocs) {
$docsGroup = config_item('docs.default_group');
$this->docsGroup = $docsGroup;

// If $docsGroup is "application".
if (strpos($docsGroup, "application") !== false) {
$this->showAppDocs = true;
} elseif (strpos($docsGroup, "developer") !== false) {
// If $docsGroup is "developer".
$this->showDevDocs = true;
}
}

$search_folders = array();
if ($this->showAppDocs) {
$search_folders[] = APPPATH . $this->docsDir;
Expand All @@ -139,6 +160,30 @@ public function search()
$search_folders[] = BFPATH . $this->docsDir;
}

// Include modules when searching.
foreach (Modules::list_modules() as $module) {
// Get module 'docs' path.
$path = Modules::path($module, 'docs');

// Skip APPPATH . $this->docsDir string.
if (strpos($path, "{$module}/docs") !== false) {
$path = str_replace(realpath(BFPATH), rtrim(BFPATH, '/'), $path);

// Trim trailing APPATH directory separator.
$apppath = rtrim(APPPATH, DIRECTORY_SEPARATOR);

// Add if showAppDocs and if $path contains $appath.
if ($this->showAppDocs && strpos($path, $apppath) !== false) {
$search_folders[] = $path;
}

// Add if showDevDocs and if $path contains BFPATH.
if ($this->showDevDocs && strpos($path, BFPATH) !== false) {
$search_folders[] = $path;
}
}
}

Template::set('results', $this->docsearch->search($terms, $search_folders));
}

Expand All @@ -161,41 +206,40 @@ public function search()
*
* @return string The HTML for the sidebar.
*/
private function build_sidebar()
private function buildSidebar()
{
$data = array();

// Get the list of docs based on the current docs group
// (application-specific or developer docs)
if ($this->docsGroup == $this->docsTypeApp) {
$data['docs'] = $this->get_folder_files(APPPATH . $this->docsDir, $this->docsTypeApp);
$data['docs'] = $this->getFolderFiles(APPPATH . $this->docsDir, $this->docsTypeApp);
} elseif ($this->docsGroup == $this->docsTypeBf) {
$data['docs'] = $this->get_folder_files(BFPATH . $this->docsDir, $this->docsTypeBf);
$data['docs'] = $this->getFolderFiles(BFPATH . $this->docsDir, $this->docsTypeBf);
}

// Get the docs for the modules
$data['module_docs'] = $this->get_module_docs();
$data['module_docs'] = $this->getModuleDocs();

// Set the remaining data for the view
$data['docsDir'] = $this->docsDir;
$data['docsExt'] = $this->docsExt;

return $this->post_process($this->load->view('docs/_sidebar', $data, true));
return $this->postProcess($this->load->view('docs/_sidebar', $data, true));
}

/**
* Retrieves the list of files in a folder and preps the name and filename
* so it's ready for creating the HTML.
*
* @param String $folder The path to the folder to retrieve.
* @param String $type The type of documentation being retrieved
* @param string $folder The path to the folder to retrieve.
* @param string $type The type of documentation being retrieved
* ('application', 'bonfire', or the name of the module).
* @param Array $ignoredFolders A list of sub-folders we should ignore.
* @param array $ignoredFolders A list of sub-folders we should ignore.
*
* @return Array An associative array @see parse_ini_file for format
* details.
* @return array An associative array @see parse_ini_file for format details.
*/
private function get_folder_files($folder, $type, $ignoredFolders = array())
private function getFolderFiles($folder, $type, $ignoredFolders = array())
{
if (! is_dir($folder)) {
return array();
Expand Down Expand Up @@ -266,7 +310,7 @@ private function get_folder_files($folder, $type, $ignoredFolders = array())
*
* @return array
*/
private function get_module_docs()
private function getModuleDocs()
{
$docs_modules = array();
foreach (Modules::list_modules() as $module) {
Expand All @@ -282,7 +326,7 @@ private function get_module_docs()
}

if (is_dir($path)) {
$files = $this->get_folder_files($path, $module, $ignored_folders);
$files = $this->getFolderFiles($path, $module, $ignored_folders);
if (is_array($files) && count($files)) {
$docs_modules[$module] = $files;
}
Expand All @@ -296,11 +340,11 @@ private function get_module_docs()
/**
* Does the actual work of reading in and parsing the help file.
*
* @param array $segments The uri_segments array.
* @param array $segments The uri_segments array.
*
* @return string
*/
private function read_page($segments = array())
private function readPage($segments = array())
{
$content = null;
$defaultType = $this->docsTypeApp;
Expand Down Expand Up @@ -381,9 +425,9 @@ private function read_page($segments = array())
*
* @param $content
*
* @return string The post-processed HTML.
* @return string The post-processed HTML.
*/
private function post_process($content)
private function postProcess($content)
{
$xml = new SimpleXMLElement('<?xml version="1.0" standalone="yes"?><div>' . $content . '</div>');

Expand Down
Loading

0 comments on commit 37419c2

Please sign in to comment.