Commit fa7c2490 authored by Alta Grade's avatar Alta Grade
Browse files

Issue #2834204: Make Sticky Notes ordering configurable

parent 01e1843f
Loading
Loading
Loading
Loading
+22 −12
Original line number Diff line number Diff line
/**
 *  @file
 *  README for the Stickynote Module.
 *  README for the Sticky Note Module.
 */

This module simply creates a block with the ability to add, delete, and edit notes.
Notes are stored on a per page basis can be made visible to certain roles like any
other block. All of the notes, sitewide, can be viewed from the Manage page at 
admin/structure/stickynote/manage. Configuration options can be changed at
admin/config/stickynote.
Introduction
------------
This module is meant to be a utility module for everybody working with Drupal
websites: developers, admins, editors to communicate with one another about
their content or keep a todo list on ANY page (not only nodes!), thus the name
Sticky Note.

How to:
Enabling this module will create a block that can be placed in a region on your site. 
1) Go to admin/structure/block and enable the block in a region
2) Add whatever role/path etc. settings (like any other block).
3) The block is now ready to be used.
How it works
------------
This module creates a block with the ability to add, delete, and edit notes.
Sticky Notes are stored on a per path basis and the block can be made visible to
certain roles/paths etc. like any other block.
It is best to place the Sticky Note block in the website's footer area.

Go to /admin/structure/stickynote/manage to see a list of all stickynotes
 No newline at end of file

Managing the sticky notes
-------------------------
All of the notes, site-wide, can be viewed from the manage page at
/admin/structure/stickynote/manage.

Configuration
-------------
Basic configuration is available at /admin/config/content/stickynote.
+17 −5
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
 */
function stickynote_info() {
  $notes_per_page = 20;
  $sort = variable_get('stickynote_sort', 'desc');
  $header = array(
    array(
      'data' => 'ID',
@@ -31,7 +32,7 @@ function stickynote_info() {
    array(
      'data' => 'Created',
      'field' => 's.created',
      'sort' => 'asc',
      'sort' => $sort,
    ),
  );
  $query = db_select('stickynote', 's')->extend('PagerDefault')->extend('TableSort');
@@ -94,10 +95,21 @@ function stickynote_config() {

  $form['stickynote_date_format'] = array(
    '#type' => 'select',
    '#title' => t('Stickynote Date Format'),
    '#title' => t('Date Format'),
    '#options' => $options,
    '#default_value' => variable_get('stickynote_date_format', 'short'),
    '#description' => t('Select a date format that will apply to stickynotes across the site.'),
    '#description' => t('Select a date format for sticky notes.')
  );

  $form['stickynote_sort'] = array(
    '#type' => 'select',
    '#title' => t('Order'),
    '#options' => array(
      'asc' => 'Ascending',
      'desc' => 'Descending'
    ),
    '#default_value' => variable_get('stickynote_sort', 'desc'),
    '#description' => t('Select sorting criteria for sticky note entries.')
  );

  return system_settings_form($form);
+9 −9
Original line number Diff line number Diff line
@@ -8,18 +8,18 @@
 * Implements hook_views_data().
 */
function stickynote_views_data() {
  $data['stickynote']['table']['group'] = t('Stickynote Table');
  $data['stickynote']['table']['group'] = t('Sticky Notes table');

  $data['stickynote']['table']['base'] = array(
    'field' => 'snid',
    'title' => t('Stickynote'),
    'help' => t("Stickynote table contains stickynote content for given paths."),
    'title' => t('Sticky Notes'),
    'help' => t("Sticky Notes table contains sticky note content for given paths."),
    'weight' => -10,
  );

  $data['stickynote']['snid'] = array(
    'title' => t('Stickynote ID'),
    'help' => t('Stickynote ID'),
    'title' => t('Sticky Note ID'),
    'help' => t('Sticky Note ID'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
@@ -34,7 +34,7 @@ function stickynote_views_data() {

  $data['stickynote']['note'] = array(
    'title' => t('Note'),
    'help' => t('Stickynote contents'),
    'help' => t('Sticky Note contents'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
@@ -51,8 +51,8 @@ function stickynote_views_data() {
  );

  $data['stickynote']['uid'] = array(
    'title' => t('Stickynote Author'),
    'help' => t('Stickynote author'),
    'title' => t('Sticky Note Author'),
    'help' => t('Sticky Note author'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
+0 −6
Original line number Diff line number Diff line
@@ -7,9 +7,3 @@ files[] = includes/stickynote.admin.inc
files[] = includes/stickynote.block.inc
stylesheets[all][] = css/stickynote.css
configure = admin/config/stickynote
; Information added by drupal.org packaging script on 2011-10-13
version = "7.x-1.0"
core = "7.x"
project = "stickynote"
datestamp = "1318540600"
+22 −21
Original line number Diff line number Diff line
@@ -9,14 +9,14 @@
 */
function stickynote_menu() {
  $items['admin/structure/stickynote/manage'] = array(
    'title' => 'Stickynote',
    'title' => 'Sticky Note',
    'description' => 'Manage sticky note structure',
    'page callback' => 'stickynote_info',
    'access arguments' => array('administer sticky note'),
    'file' => 'includes/stickynote.admin.inc',
  );
  $items['admin/config/content/stickynote'] = array(
    'title' => 'Stickynote',
    'title' => 'Sticky Note',
    'description' => 'Configure sticky note options',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('stickynote_config'),
@@ -33,13 +33,13 @@ function stickynote_menu() {
    'type' => MENU_CALLBACK,
  );
  $items['stickynote/add'] = array(
    'title' => 'Add Stickynote',
    'title' => 'Add Sticky Note',
    'page callback' => 'stickynote_add_page',
    'access arguments' => array('create sticky note'),
    'type' => MENU_CALLBACK,
  );
  $items['stickynote/%stickynote/delete'] = array(
    'title' => 'Delete Stickynote',
    'title' => 'Delete Sticky Note',
    'page callback' => 'stickynote_delete',
    'page arguments' => array(1),
    'access arguments' => array(1),
@@ -47,7 +47,7 @@ function stickynote_menu() {
    'type' => MENU_CALLBACK,
  );
  $items['stickynote/%stickynote/delete_confirm'] = array(
    'title' => 'Delete Stickynote',
    'title' => 'Delete Sticky Note',
    'page callback' => 'stickynote_delete_confirm',
    'page arguments' => array(1),
    'access arguments' => array(1),
@@ -55,7 +55,7 @@ function stickynote_menu() {
    'type' => MENU_CALLBACK,
  );
  $items['stickynote/%stickynote/cancel'] = array(
    'title' => 'Cancel Delete Stickynote',
    'title' => 'Cancel Delete Sticky Note',
    'page callback' => 'stickynote_cancel_delete',
    'page arguments' => array(1),
    'access arguments' => array(1),
@@ -63,7 +63,7 @@ function stickynote_menu() {
    'type' => MENU_CALLBACK,
  );
  $items['stickynote/%stickynote/edit'] = array(
    'title' => 'Edit Stickynote',
    'title' => 'Edit Sticky Note',
    'page callback' => 'stickynote_edit',
    'page arguments' => array(1),
    'access arguments' => array(1),
@@ -540,7 +540,7 @@ function stickynote_block_view($delta = '') {
    case 'stickynote_block':
      if (user_access('view any stickynote') || user_access('view own stickynote') || user_access('administer stickynote')) {
        module_load_include('inc', 'stickynote', 'includes/stickynote.block');
        $block['subject'] = t('Stickynotes');
        $block['subject'] = t('Sticky Notes');
        $block['content'] = stickynote_block_contents();
      }
      break;
@@ -554,6 +554,7 @@ function stickynote_block_view($delta = '') {
 */
function stickynote_get_notes($referring_url = NULL) {
  global $user;
  $sort = variable_get('stickynote_sort', 'desc');

  // Use current path if there is no referring url
  if (isset($referring_url)) {
@@ -567,7 +568,7 @@ function stickynote_get_notes($referring_url = NULL) {
  $query = db_select('stickynote', 's')
          ->condition('url', $path)
          ->fields('s')
          ->orderBy('created', 'ASC');
          ->orderBy('created', $sort);

  $notes = $query->execute();

Loading