Difference between revisions of "IMC-Drupal/Development/Hiddens"

From Aktivix
Jump to: navigation, search
Line 23: Line 23:
 
* Integrates with spam.module
 
* Integrates with spam.module
  
= Detailed Notes =
+
[[IMC-Drupal/Development/Hiddens/VersionTwoNotes|Notes from the development of Version 2]]
 
+
* _hidden_log function added
+
** including writing to watchdog
+
** writing to mail message
+
* _help and _menu links added
+
* _menu $may_cache sorted - non cachable links are created depending on the nodes hidden status. If not hidden there is no link for hidden item page, and no unhide, just a hide form callback. If hidden a hidden object is created and passed to view and unhide callbacks.
+
** /admin/settings/spam should this have the filters in it too
+
** /admin/content/node/list/hidden admin list of hiddens with content/node/list
+
** /admin/content/node/list/hiddenreported admin list of reported posts, their status and if they have been checked
+
** /admin/content/comment/list/hidden admin list of hiddens with content/comment/list
+
** /admin/content/comment/list/hiddenreported admin list of reported posts, their status and if they have been checked
+
** /hidden combined listing page
+
** /hidden/node node listing page
+
** /hidden/comment comment listing page
+
** /hidden/node/$nid non-cachable - node display
+
** /hidden/node/$nid/action non-cachable - where action is hide, unhide or report
+
** /hidden/comment/$cid non-cachable - comment display
+
** /hidden/comment/$cid/action non-cachable - where action is hide, unhide or report
+
* organised required variables and settings
+
* created _comment and _nodeapi hooks
+
** included delete, to remove from hidden system if deleted, were left in previously
+
** ready to hook into filter
+
** moved reformatting of hidden content into hook $op view (and for node also alter). Title no longer needs changing in DB. Hidden information displayed in other not /hidden/... views (admin user looking at pages sees unpublished material).
+
** TODO see edit note on hide form
+
* created _hidden_mail to send e-mail notices
+
* created _cron hook for periodic e-mailing
+
* made _link hook themeable
+
* updated hide form and submission
+
** made hide form themeable
+
** added private notes section and made hide form work for reporting as well as hiding - TODO using for editing
+
** hide form takes list of active reasons for hiding from {hidden_reasons}
+
* removed _update hook as hidden isn't a node type
+
* altered _hidden_is_hidden to ($type, $id) now returns a hidden object or false
+
* updated db query functions insert works with ($type, $nid, $cid, $reason) delete works with ($type, $id)
+
* reason details, public and private notes all now filtered on output using drupal check_markup($string, FILTER_HTML_ESCAPE) filter rest still uses check_plain()
+
* changed _hidden_check_nan() to _hidden_check_params() this now only needs to only be called by the hide form processing functions, at also sanity checks against type of content now. Other functions are using drupal menu item creation and _hidden_is_hidden() validation.
+
* Hidden display list functions altered/created
+
** hidden_list_nodes and theme_hidden_list_nodes - now using themeable table - title, user, reason listed
+
** hidden_admin_list_nodes and theme_hidden_admin_list_nodes - new with additional info (date...) and sorting capabilities to the public user lists
+
** hidden_list_comments and theme_hidden_list_comments - as nodes above
+
** hidden_admin_list_comments and theme_hidden_admin_list_comments - as nodes above, not this is the only place mass operations can be added in for comments
+
* removing hard coded drupal goto's from reusable functions, should handled by calling function depending on where they come from - returning to node/comment is probably a desirable option in many cases
+
* added hidden_*_reasons_* functions
+
** created admin for creating, enabling and disabling standard reasons for hiding articles. Table alterations will have to written into .install script
+
* altered froms to allow for different default reasons and public and private
+
* added report links, it uses the hide form with different parameters
+
* added report admin view pages on content and comment tabs (as hidden list above)
+
* adding hidden_*_filters_* functions
+
 
+
<pre>
+
 
+
CREATE TABLE `hidden` (
+
  `hid` int(10) unsigned NOT NULL auto_increment,
+
  `nid` int(10) unsigned NOT NULL default '0',
+
  `cid` int(10) unsigned NOT NULL default '0',
+
  `created` int(10) unsigned NOT NULL default '0',
+
  `rid` int(4) unsigned NOT NULL default '0',
+
  `publicnote` text NOT NULL default '',
+
  `privatenote` text NOT NULL default '',
+
  `uid` int(10) unsigned NOT NULL default '0',
+
  `delay` int(10) unsigned NOT NULL default '0';
+
  PRIMARY KEY  (`hid`, `nid`, `cid`)
+
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
or
+
mysql> ALTER TABLE hidden CHANGE COLUMN reason publicnote text NOT NULL default '';
+
mysql> ALTER TABLE hidden ADD COLUMN privatenote text NOT NULL default '';
+
mysql> ALTER TABLE hidden ADD COLUMN rid int(4) unsigned NOT NULL default '1';
+
mysql> ALTER TABLE hidden ADD COLUMN uid int(10) unsigned NOT NULL default '0';
+
mysql> ALTER TABLE hidden ADD COLUMN delay int(10) unsigned NOT NULL default '0';
+
 
+
CREATE TABLE `hidden_reasons` (
+
  `rid` int(4) unsigned NOT NULL auto_increment,
+
  `title` varchar(255) NOT NULL default '',
+
  `description` text,
+
  `enabled` tinyint(2) NOT NULL default '1',
+
  PRIMARY KEY  (`rid`)
+
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
 
+
CREATE TABLE `hidden_reported` (
+
  `repid` int(10) unsigned NOT NULL auto_increment,
+
  `nid` int(10) unsigned NOT NULL default '0',
+
  `cid` int(10) unsigned NOT NULL default '0',
+
  `created` int(10) unsigned NOT NULL default '0',
+
  `rid` int(4) unsigned NOT NULL default '0',
+
  `publicnote` text NOT NULL default '',
+
  `privatenote` text NOT NULL default '',
+
  `uid` int(10) unsigned NOT NULL default '0',
+
  `seen` tinyint(2) unsigned,
+
  `suid` int(10) unsigned,
+
  PRIMARY KEY  (`repid`, `nid`, `cid`)
+
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
 
+
CREATE TABLE `hidden_log` (
+
`hidetime` int(10) unsigned NOT NULL default '0',
+
`action` int(4) unsigned NOT NULL default '0',
+
`description` text NOT NULL default '',
+
`ids` text NOT NULL default '',
+
`uid` int(10) unsigned NOT NULL default '0',
+
PRIMARY KEY  (`hidetime`)
+
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
 
+
CREATE TABLE `hidden_filters` (
+
  `hfid` int(10) unsigned NOT NULL auto_increment,
+
  `filter` varchar(255) NOT NULL,
+
  `type` tinyint(2) unsigned NOT NULL default '1',
+
  `hits` int(10) unsigned NOT NULL default '0',
+
  `lasthit` int(10) unsigned NOT NULL default '0',
+
  `enabled` tinyint(2) NOT NULL default '1',
+
  `weight` int(10) NOT NULL default '0',
+
  PRIMARY KEY (`hfid`)
+
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
 
+
CREATE TABLE `hidden_filter_reasons` (
+
  `hfid` int(10) unsigned NOT NULL,
+
  `title` varchar(255) NOT NULL,
+
  `rid` int(4) unsigned NOT NULL default '0',
+
  `publicnote` text NOT NULL default '',
+
  `privatenote` text NOT NULL default '',
+
  `uid` int(10) unsigned NOT NULL default '0',
+
  `delay` int(10) unsigned NOT NULL default '0',
+
  PRIMARY KEY (`hfid`),
+
  FOREIGN KEY (`hfid`) REFERENCES hidden_filters(`hfid`)
+
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
 
+
/* NB MyISAM doesn't enforce FOREIGN KEY yet, but it's there anyway */
+
 
+
</pre>
+
  
 
== TODO ==
 
== TODO ==

Revision as of 16:27, 22 June 2007

New Features

  • Hidden nodes and comments are marked as hidden and have the reason for hiding displayed no matter how viewed
  • Admin content (node) and comment pages tabs to access and administer hiddens and reported posts
  • Hidden posts can have:
    • standard reason selected - standard reasons can be set, enabled and disabled from admin page
    • public note - textarea for writing any public note to be displayed with the hidden post (and e-mailed if enabled)
    • private note - textarea for writing any private note that will only be displayed to other users who can un/hide posts
  • Hides are logged using system log
  • The log can be e-mailed (eg. to an e-mail list) item-by-item or in batches, what types of hide/unhide/action to be reported can be selected
  • Adding filtering for automatic hiding
    • filters can be simple text searches for word(s)
    • or perl type regular expressions
    • filters can be actioned immediately and the poster notified
    • or delayed for a period set by admin and hidden after publishing
    • using public private note system public note goes to article (and e-mail if enabled) but there can also be a hidden note about the filter
  • Report for hiding link - user reporting
    • admin page to allow hiding or marking as seen user reported pages. Easily sortable. You can give hide privileges to users without giving other admin privs so someone who is making good reports can be given the easy route into helping admin the site.
  • Hides, reported hides, and checks on reported hides have user information with them.
  • All display creating sections are themeable.
  • 'No-index' meta tags added to hidden pages.
  • Try using node_access instead of unpublishing for nodes This would create a dramatic unnecessary overhead
  • Integrates with spam.module

Notes from the development of Version 2

TODO

Notes in code plus:

  • upgrade script
    • remove HIDDEN: from titles of already nodes/comments - should be handled by _node _comment hooks $op=view
  • check consistent use of objects for forms

Feature requests

Probably not going to be put into the first release of this version, but maybe needed:

  • edit hidden - the ability to edit the hidden reasons (without hiding and rehiding) - issues with user logging now resolved, hidden admin users can set the user hiding others cannot
  • view reported hidden - the ability to view the hidden request. It's being e-mailed and you can see the standard reason in the table, but not implemented a view to see the public and private reasons given from admin.
  • use node and comment modules to better effect - only thing left here is probably edit hidden, put the hidden reason in an edit form - there are comments in the code where to hook this in
  • additional spam module integration - it would be nice to have just one 'report' link and one form. The spam module report form and sumit functions are tied to the contents of the url, this makes it a bit more difficult.