#!/bin/bash
#
#
#    Scalix Public License
#
#
#    The contents of this file are subject to the Scalix Public License
#    Version 1.1 ("License"); you may not use this file except in
#    compliance with the License. You may obtain a copy of the License at
#
# 
#    http://www.scalix.com/community/licensing 
#
# 
#    Software distributed under the License is distributed on an "AS IS"
#    basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
#    the License for the specific language governing rights and limitations
#    under the License.
#
# 
#    The Original Code is Scalix Server. 
#    The Initial Developer of the Original Code is Scalix Corporation. 
#    Copyright (C) 2006 Scalix Corporation. 
#    All Rights Reserved.
#    Additional Copyrights may apply - see the notice in each file
#
#
#
#
#
#
# Copyright (C) 2006 Scalix Corporation.  All Rights Reserved.
#

help() {
	echo ""
	echo ""
	echo "VERSION:" 
	echo "1.0"
	echo ""
	echo "NAME:" 
	echo "Add Buletin Board"
	echo ""
	echo "DESCRIPTION:"
	echo ""
	echo "omaddbb adds a Bulletin Board.<br><br>Access to Bulletin Boards is controlled through Access Control Lists (ACLs).  By default, the creator of the Bulletin Board and Scalix Administrators have full access to the Bulletin  Board, including  config  (owner) access.   All  other users can list and read items on the Bulletin Board, and add items to the Bulletin Board (including lower level Bulletin Boards).  Creators and owners of items can modify and delete items.  To  modify the access to Bulletin Boards, use the omaddacln and ommodacln commands.  This script adds users with the names provided to the mailnode provided using omaddu"
	echo "PARAMETERS:"
        echo "-B	AbsRef		number	single	The  absolute  reference number of a Bulletin Board under which the new Bulletin Board will be<br>created.  If not specified, the new Bulletin Board is  assumed  to  be  a  top-level  Bulletin<br>Board.   To list the absolute reference number of a Bulletin Board, use the -b option with the<br>command omlistbbs."
        echo "-n	Number		number	single	The temporary reference number of the Bulletin Board under which the new Bulletin  Board  will<br>be  created.   If  not specified, the new Bulletin Board is assumed to be a top-level Bulletin<br>Board.  To list the temporary reference number of a Bulletin Board, use the command omlistbbs."
	echo "-m	Match		string	single	The  subject,  within quotes, of the Bulletin Board under which the new Bulletin Board will be<br>created.  To specify a nested Bulletin Board, give a hierarchy  of  bulletin  Board  subjects,<br>delimiting  the subjects with angle brackets (>).  If not specified, the new Bulletin Board is<br>assumed to be a top-level Bulletin Board.  To list the subjects of Bulletin  Boards,  use  the<br>command omlistbbs."
        echo "-d	Depth		number	single	The depth of the Bulletin Board under which the new Bulletin Board will be created.  The<br>depth is the number of levels the Bulletin Board is nested under the Bulletin Board area.<br>Required with the -B and -n options unless a top-level Bulletin Board is specified.  The<br>depth must be the same as that used when the reference number was obtained using<br>the command omlistbbs."
	echo "-s	Subject		string	single	The subject of the Bulletin Board to be added."
        echo "-t	Date		string	single	Expiration  date.  The date on which items in the Bulletin Board expire.  The date specified<br>takes precedent over any expiration delay value set.<br><br>If -l is set to 1 and -t is set to 0, items will never expire."
        echo "-l	Delay		number	single	Expiration delay.  The number of days after the last modification, creation or attachment that<br>items in the Bulletin Board expire."
        echo "-S	Independent expiration flags			none	Individual items on a Bulletin Board can have expiration flags set independently."
        echo "-U	Not independent expiration flags			none	Individual items on a Bulletin Board cannot have expiration flags set independently."
        echo "-o	Order	0	number	single	The client list order of the Bulletin Board.  When viewing a Bulletin Board or the Bulletin<br>Board area using a client that supports sorted Bulletin Board views,  the  resulting  view  is<br>sorted  by  the  client list order.  Bulletin Boards are returned in increasing order - a Bulletin<br>Board with a client list order of 1 appears ahead of one with a client list order of  2.<br>Bulletin Boards with a client list order of 0 appear at the end of the list."
        echo ""
	echo "--help	Help	\"\"	\"\"	\"\"	Usage Information"
	echo ""
	echo "OUTPUT:"
	echo ""
	echo "text/plain"
}
#
# main script
#

declare params;
params="";
while [ "$1" != "" ]; do
	case "$1" in
		--help) help;
                        exit 0
			shift;;
		-S) params="$params -S";
                   shift;;
		-U) params="$params -U";
                   shift;;
		*) params="$params $1 $2";
                   shift;;
	esac
	shift
done
/opt/scalix/bin/omaddbb $params
exit 0
