summaryrefslogtreecommitdiff
path: root/admin
diff options
context:
space:
mode:
authorNick Palmer <nick@sluggardy.net>2007-03-22 18:14:36 +0000
committerNick Palmer <nick@sluggardy.net>2007-03-22 18:14:36 +0000
commitdeae8e60adb79e821e25972ef2d62002c7cfe84f (patch)
treef1d1da7329d6d9f6a86ae61bf49167c091f4f91f /admin
parent4474052d1013f860879387c48d33219dc33d831f (diff)
downloadtags-deae8e60adb79e821e25972ef2d62002c7cfe84f.tar.gz
tags-deae8e60adb79e821e25972ef2d62002c7cfe84f.tar.bz2
tags-deae8e60adb79e821e25972ef2d62002c7cfe84f.zip
Added sanitation of tags with various options. Fixed bugs. Added ability to view tags in any of the service templates. Gussied up permissions some. Edit now means you can edit your own tags and admin is required for edit page.
Diffstat (limited to 'admin')
-rw-r--r--admin/admin_tags_inc.php68
-rwxr-xr-xadmin/schema_inc.php14
2 files changed, 80 insertions, 2 deletions
diff --git a/admin/admin_tags_inc.php b/admin/admin_tags_inc.php
index c846e58..ba28381 100644
--- a/admin/admin_tags_inc.php
+++ b/admin/admin_tags_inc.php
@@ -1,3 +1,69 @@
<?php
-//currently there are no admin options
+// $Header: /cvsroot/bitweaver/_bit_tags/admin/admin_tags_inc.php,v 1.2 2007/03/22 18:14:36 nickpalmer Exp $
+// Copyright (c) 2005 bitweaver Tags
+// All Rights Reserved. See copyright.txt for details and a complete list of authors.
+// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
+
+$formTagsDisplayOptions = array(
+ "tags_in_view" => array(
+ 'label' => 'Tags In View',
+ 'note' => 'Shows the tags in the "view" location',
+ 'type' => 'toggle',
+ ),
+ "tags_in_nav" => array(
+ 'label' => 'Tags In Nav',
+ 'note' => 'Shows the tags in the "nav" location',
+ 'type' => 'toggle',
+ ),
+ "tags_in_body" => array(
+ 'label' => 'Tags In Body',
+ 'note' => 'Shows the tags in the "body" location',
+ 'type' => 'toggle',
+ ),
+);
+$gBitSmarty->assign( 'formTagsDisplayOptions', $formTagsDisplayOptions );
+
+$formTagsStripOptions = array(
+ "tags_lowercase" => array(
+ 'label' => 'Lowercase Tags',
+ 'note' => 'Convert all Tags to lowercase',
+ 'type' => 'toggle',
+ ),
+ "tags_strip_spaces" => array(
+ 'label' => 'Strip Spaces',
+ 'note' => 'Strip white space from tags',
+ 'type' => 'toggle',
+ ),
+ "tags_strip_nonword" => array(
+ 'label' => 'Strip Non-Word',
+ 'note' => 'Strip non-word characters from tags',
+ 'type' => 'toggle',
+ ),
+ "tags_strip_regexp" => array(
+ 'label' => 'Strip Custom',
+ 'note' => 'A regular expression used to strip. Be VERY careful with this expression. This should include the delimiters for the regular expression.',
+ 'type' => 'input',
+ ),
+ "tags_strip_replace" => array(
+ 'label' => 'Strip Custom Replacement',
+ 'note' => 'The expresion used in the replacement made with the Strip Custom above. Leave blank to just strip any matches.',
+ 'type' => 'input',
+ ),
+);
+$gBitSmarty->assign( 'formTagsStripOptions', $formTagsStripOptions );
+
+if( !empty( $_REQUEST['tags_preferences'] ) ) {
+ $tags = array_merge($formTagsDisplayOptions, $formTagsStripOptions);
+ // $tags = array_merge( $formTagsOptions );
+ foreach( $tags as $item => $data ) {
+ if( $data['type'] == 'numeric' ) {
+ simple_set_int( $item, TAGS_PKG_NAME );
+ } elseif( $data['type'] == 'toggle' ) {
+ simple_set_toggle( $item, TAGS_PKG_NAME );
+ } elseif( $data['type'] == 'input' ) {
+ simple_set_value( $item, TAGS_PKG_NAME );
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/admin/schema_inc.php b/admin/schema_inc.php
index b6a0c6e..31880f1 100755
--- a/admin/schema_inc.php
+++ b/admin/schema_inc.php
@@ -1,7 +1,7 @@
<?php
$tables = array(
'tags' => "
- tag_id I4 NOTNULL,
+ tag_id I4 PRIMARY,
tag C(64) NOTNULL
",
@@ -28,6 +28,17 @@ $gBitInstaller->registerPackageInfo( TAGS_PKG_NAME, array(
) );
+$gBitInstaller->registerPreferences( TAGS_PKG_NAME, array(
+ array( TAGS_PKG_NAME, 'tags_in_view', 'y' ),
+ // array( TAGS_PKG_NAME, 'tags_in_nav', 'n' ),
+ // array( TAGS_PKG_NAME, 'tags_in_body', 'n' ),
+ // array( TAGS_PKG_NAME, 'tags_lowercase 'n'),
+ // array( TAGS_PKG_NAME, 'tags_strip_spaces 'n'),
+ // array( TAGS_PKG_NAME, 'tags_strip_nonword 'n'),
+ // array( TAGS_PKG_NAME, 'tags_strip_regexp ''),
+ // array( TAGS_PKG_NAME, 'tags_strip_replace ''),
+) );
+
// ### Sequences
$sequences = array (
'tags_tag_id_seq' => array( 'start' => 1 ),
@@ -39,6 +50,7 @@ $gBitInstaller->registerSchemaSequences( TAGS_PKG_NAME, $sequences );
$gBitInstaller->registerUserPermissions( TAGS_PKG_NAME, array(
array( 'p_tags_admin', 'Can admin tags', 'admin', TAGS_PKG_NAME ),
array( 'p_tags_create', 'Can create tags', 'registered', TAGS_PKG_NAME ),
+ array( 'p_tags_view', 'Can view tags', 'basic', TAGS_PKG_NAME ),
array( 'p_tags_edit', 'Can edit tags', 'editors', TAGS_PKG_NAME ),
array( 'p_tags_remove', 'Can delete tags', 'admin', TAGS_PKG_NAME ),
) );