--[[ - @file node.module.lua - The node it the center unit of content in Ajato. - Almost every content (pages, forum topics, blog entries) - are nodes. - @author Bruno Massa ]] --[[ - Implementation of hook_menu() ]] function node_menu() local items = {} items['admin/content'] = { ['access arguments'] = {'administer nodes'}, ['description'] = "Manage your site's content.", ['file'] = 'system.admin.lua', ['file path'] = ajato_module_path('system'), ['page callback'] = 'system_admin_menu_block_page', ['position'] = 'left', ['title'] = 'Content management', ['weight'] = -10 } items['admin/content/node'] = { ['access arguments'] = {'administer nodes'}, ['description'] = "View, edit, and delete your site's content.", ['page callback'] = 'node_admin_content', ['title'] = 'Content' } items['admin/content/node/overview'] = { ['title'] = 'List', ['type'] = C.MENU_DEFAULT_LOCAL_TASK, ['weight'] = -10 } items['admin/content/node-settings'] = { ['access arguments'] = {'administer nodes'}, ['description'] = 'Control posting behavior, such as teaser length, requiring previews before posting, and the number of posts on the front page.', ['title'] = 'Post settings', ['page arguments'] = {'node_configure'}, ['page callback'] = 'ajato_form_get' } items['admin/content/node-settings/rebuild'] = { ['page arguments'] = {'node_configure_rebuild_confirm'}, ['title'] = 'Rebuild permissions', ['type'] = C.MENU_CALLBACK } items['admin/content/types'] = { ['access arguments'] = {'administer content types'}, ['description'] = 'Manage posts by content type, including default status, front page promotion, etc.', ['page callback'] = 'node_overview_types', ['title'] = 'Content types' } items['admin/content/types/list'] = { ['title'] = 'List', ['type'] = C.MENU_DEFAULT_LOCAL_TASK, ['weight'] = -10 } items['admin/content/types/add'] = { ['page arguments'] = {'node_type_form'}, ['page callback'] = 'ajato_form_get', ['title'] = 'Add content type', ['type'] = C.MENU_LOCAL_TASK } items['node'] = { ['access arguments'] = {'access content'}, ['page callback'] = 'node_page_default', ['title'] = 'Content', ['type'] = C.MENU_MODIFIABLE_BY_ADMIN } items['node/add'] = { ['access callback'] = '_node_add_access', ['file'] = 'system.admin.lua', ['file path'] = ajato_module_path('system'), ['page callback'] = 'system_admin_menu_block_page', ['title'] = 'Create content', ['weight'] = 1 } items['rss.xml'] = { ['access arguments'] = {'access content'}, ['page callback'] = 'node_feed', ['title'] = 'RSS feed', ['type'] = C.MENU_CALLBACK } items['node/%node'] = { ['access arguments'] = {'view', 1}, ['access callback'] = 'node_access', ['page arguments'] = {1}, ['page callback'] = 'node_page_view', ['title'] = 'View', ['type'] = C.MENU_CALLBACK } items['node/%node/view'] = { ['title'] = 'View', ['type'] = C.MENU_DEFAULT_LOCAL_TASK, ['weight'] = -10 } items['node/%node/edit'] = { ['title'] = 'Edit', ['page callback'] = 'node_page_edit', ['page arguments'] = {1}, ['access callback'] = 'node_access', ['access arguments'] = {'update', 1}, ['type'] = C.MENU_LOCAL_TASK, ['weight'] = 1 } items['node/%node/delete'] = { ['access arguments'] = {'delete', 1}, ['access callback'] = 'node_access', ['page arguments'] = {'node_delete_confirm', 1}, ['page callback'] = 'ajato_form_get', ['title'] = 'Delete', ['type'] = C.MENU_CALLBACK, ['weight'] = 1, } items['node/%node/revisions'] = { ['access arguments'] = {1}, ['access callback'] = '_node_revision_access', ['page callback'] = 'node_revisions', ['title'] = 'Revisions', ['type'] = C.MENU_LOCAL_TASK, ['weight'] = 2 } if ajato_module_isenabled('search') then items['admin/content/search'] = { ['access arguments'] = {'administer nodes'}, ['description'] = 'Search content by keyword.', ['page callback'] = 'node_admin_search', ['title'] = 'Search content', } end -- foreach (node_get_types('types', NULL, TRUE) as type) { -- name = check_plain(type->name} -- type_url_str = str_replace('_', '-', type->type} -- items['node/add/'. type_url_str] = { -- ['access arguments'] = {'create', type->type}, -- ['access callback'] = 'node_access', -- ['description'] = type->description, -- ['page arguments'] = {2}, -- ['page callback'] = 'node_add', -- ['title'] = ajato_ucfirst(name), -- } -- items['admin/content/types/'. type_url_str] = { -- ['page arguments'] = {'node_type_form', type}, -- ['page callback'] = 'ajato_form_get', -- ['title'] = type->name, -- ['type'] = C.MENU_CALLBACK, -- } -- items['admin/content/types/'. type_url_str .'/delete'] = { -- ['page arguments'] = {'node_type_delete_confirm', type}, -- ['title'] = 'Delete', -- ['type'] = C.MENU_CALLBACK, -- } -- } return items end --[[ -Menu callback; Generate a listing of promoted nodes. ]] function node_page_default() local result = db_pager(db_rewrite_sql([[SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC]]), ajato_variable_get('default_nodes_main', 10)) local result = false local output = ajato_string() if result then local feed_url = url('rss.xml', {['absolute'] = true}) ajato_add_feed(feed_url, variable_get('site_name', 'Ajato') ..' '.. t('RSS')); for node in db_rows(result) do output = output .. node_view(node_load(node['nid']), 1) end output = output .. theme('pager', nil, variable_get('default_nodes_main', 10)) output = tostring(output) else -- Check for existence of admin account. local admin = db_result(db_query('SELECT uid FROM {users} WHERE uid = 1')) output = output ..'

'.. t('Welcome to your new Ajato website!') .. '

' output = output ..'

'.. t('Please follow these steps to set up and start using your website:') .. '

' output = output ..'
    ' output = output ..'
  1. '.. t('Configure your website Once logged in, visit the @admin, where you can @config all aspects of your website.', {['@admin'] = l(t('administration section'), 'admin'), ['@config'] = l(t('customize and configure'), 'admin/settings')}) ..'
  2. '; output = output .. '
  3. '.. t('Enable additional functionality Next, visit the @modules and enable features which suit your specific needs. You can find additional modules in the @download_modules.', {['@modules'] = l('module list', 'admin/build/modules'), ['@download_modules'] = l(t('Ajato modules download section'), 'https://launchpad.net/ajato')}) .. '
  4. ' output = output .. '
  5. '.. t('Customize your website design To change the "look and feel" of your website, visit the @themes. You may choose from one of the included themes or download additional themes from the @download_themes.', {['@themes'] = l(t('themes section'), 'admin/build/themes'), ['@download_themes'] = l(t('Ajato themes download section'), 'https://launchpad.net/ajato')}) .. '
  6. ' output = output .. '
  7. '.. t('Start posting content Finally, you can @content for your website. This message will disappear once you have promoted a post to the front page.', {['@content'] = l(t('create content'), 'node/add')}) ..'
  8. ' output = output .. '
' output = output .. '

'.. t('For more information, please refer to the @help, or the @handbook. You may also post at the @forum, or view the wide range of @support available.', {['@help'] = l(t('help section'), 'admin/help'), ['@handbook'] = l(t('online Ajato handbooks'), 'https://launchpad.net/ajato'), ['@forum'] = l(t('Ajato forum'), 'https://launchpad.net/ajato'), ['@support'] = l(t('other support options'), 'https://launchpad.net/ajato')}) .. '

' output = '
'.. tostring(output) ..'
' end ajato_set_title('') return output end --[[ - Theme the node content - - @param content - String, The node content - @ingroup theme ]] function themes.node(content) return '
'.. content ..'
' end