+++ /dev/null
-Extra Tabs
+++ /dev/null
-This plugin adds a new page "Extra tabs" in the "group admin"
-page. There you can create new tabs that will appear on all project
-pages.
-
-The purpose is to let people point to external resources related to
-the project. For example, a project might use an external bugzilla and
-they want to point people there.
-
-The administrators of projects can now add such links. They must
-simply give an URL and a name.
-
-This plugin has been written by Raphael Hertzog <hertzog@debian.org>
-for the Adullact.net Gforge.
-
-http://www.adullact.net
-
+++ /dev/null
-#!/usr/bin/perl -w
-#
-# $Id: db-delete.pl,v 1.1.1.1 2005/09/22 17:32:56 rhertzog Exp $
-#
-# Debian-specific script to delete plugin-specific tables
-# Roland Mas <lolando@debian.org>
-
-use strict ;
-use diagnostics ;
-
-use DBI ;
-use MIME::Base64 ;
-use HTML::Entities ;
-
-use vars qw/$dbh @reqlist $query/ ;
-use vars qw/$sys_default_domain $sys_cvs_host
- $sys_shell_host $sys_users_host $sys_docs_host $sys_lists_host
- $sys_dns1_host $sys_dns2_host $FTPINCOMING_DIR $FTPFILES_DIR
- $sys_urlroot $sf_cache_dir $sys_name $sys_themeroot
- $sys_news_group $sys_dbhost $sys_dbname $sys_dbuser $sys_dbpasswd
- $sys_ldap_base_dn $sys_ldap_host $admin_login $admin_password
- $domain_name
- $skill_list/ ;
-use vars qw/$pluginname/ ;
-
-sub is_lesser ( $$ ) ;
-sub is_greater ( $$ ) ;
-sub debug ( $ ) ;
-sub parse_sql_file ( $ ) ;
-
-require ("/usr/share/gforge/lib/include.pl") ; # Include a few predefined functions
-require ("/usr/share/gforge/lib/sqlparser.pm") ; # Our magic SQL parser
-
-debug "You'll see some debugging info during this installation." ;
-debug "Do not worry unless told otherwise." ;
-
-&db_connect ;
-
-# debug "Connected to the database OK." ;
-
-$pluginname = "extratabs" ;
-
-$dbh->{AutoCommit} = 0;
-$dbh->{RaiseError} = 1;
-eval {
- my ($sth, @array, $version, $action, $path, $target, $rname) ;
-
- my $pattern = "plugin_" . $pluginname . '_%' ;
-
- $query = "SELECT relname FROM pg_class WHERE relname LIKE '$pattern' AND relkind='v'" ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- while (@array = $sth->fetchrow_array ()) {
- $rname = $array [0] ;
- &drop_view_if_exists ($rname) ;
- }
- $sth->finish () ;
-
- $query = "SELECT relname FROM pg_class WHERE relname LIKE '$pattern' AND relkind='r'" ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- while (@array = $sth->fetchrow_array ()) {
- $rname = $array [0] ;
- &drop_table_if_exists ($rname) ;
- }
- $sth->finish () ;
-
- $query = "SELECT relname FROM pg_class WHERE relname LIKE '$pattern' AND relkind='i'" ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- while (@array = $sth->fetchrow_array ()) {
- $rname = $array [0] ;
- &drop_index_if_exists ($rname) ;
- }
- $sth->finish () ;
-
- $query = "SELECT relname FROM pg_class WHERE relname LIKE '$pattern' AND relkind='s'" ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- while (@array = $sth->fetchrow_array ()) {
- $rname = $array [0] ;
- &drop_sequence_if_exists ($rname) ;
- }
- $sth->finish () ;
-
- $dbh->commit ();
-
-
- debug "It seems your database deletion went well and smoothly. That's cool." ;
- debug "Please enjoy using Debian GForge." ;
-
- # There should be a commit at the end of every block above.
- # If there is not, then it might be symptomatic of a problem.
- # For safety, we roll back.
- $dbh->rollback ();
-};
-
-if ($@) {
- warn "Transaction aborted because $@" ;
- debug "Transaction aborted because $@" ;
- debug "Last SQL query was:\n$query\n(end of query)" ;
- $dbh->rollback ;
- debug "Please report this bug on the Debian bug-tracking system." ;
- debug "Please include the previous messages as well to help debugging." ;
- debug "You should not worry too much about this," ;
- debug "your DB is still in a consistent state and should be usable." ;
- exit 1 ;
-}
-
-$dbh->rollback ;
-$dbh->disconnect ;
-
-sub debug ( $ ) {
- my $v = shift ;
- chomp $v ;
- print STDERR "$v\n" ;
-}
-
-sub drop_table_if_exists ( $ ) {
- my $tname = shift or die "Not enough arguments" ;
- $query = "SELECT count(*) FROM pg_class WHERE relname='$tname' AND relkind='r'" ;
- my $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- my @array = $sth->fetchrow_array () ;
- $sth->finish () ;
-
- if ($array [0] != 0) {
- # debug "Dropping table $tname" ;
- $query = "DROP TABLE $tname" ;
- # debug $query ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- $sth->finish () ;
- }
-}
-
-sub drop_sequence_if_exists ( $ ) {
- my $sname = shift or die "Not enough arguments" ;
- $query = "SELECT count(*) FROM pg_class WHERE relname='$sname' AND relkind='S'" ;
- my $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- my @array = $sth->fetchrow_array () ;
- $sth->finish () ;
-
- if ($array [0] != 0) {
- # debug "Dropping sequence $sname" ;
- $query = "DROP SEQUENCE $sname" ;
- # debug $query ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- $sth->finish () ;
- }
-}
-
-sub drop_index_if_exists ( $ ) {
- my $iname = shift or die "Not enough arguments" ;
- $query = "SELECT count(*) FROM pg_class WHERE relname='$iname' AND relkind='i'" ;
- my $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- my @array = $sth->fetchrow_array () ;
- $sth->finish () ;
-
- if ($array [0] != 0) {
- # debug "Dropping index $iname" ;
- $query = "DROP INDEX $iname" ;
- # debug $query ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- $sth->finish () ;
- }
-}
-
-sub drop_view_if_exists ( $ ) {
- my $iname = shift or die "Not enough arguments" ;
- $query = "SELECT count(*) FROM pg_class WHERE relname='$iname' AND relkind='v'" ;
- my $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- my @array = $sth->fetchrow_array () ;
- $sth->finish () ;
-
- if ($array [0] != 0) {
- # debug "Dropping view $iname" ;
- $query = "DROP VIEW $iname" ;
- # debug $query ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- $sth->finish () ;
- }
-}
+++ /dev/null
-#!/usr/bin/perl -w
-#
-# $Id: db-upgrade.pl,v 1.1.1.1 2005/09/22 17:32:56 rhertzog Exp $
-#
-# Debian-specific script to upgrade the database between releases
-# Roland Mas <lolando@debian.org>
-#
-# Adapted by Raphael Hertzog <hertzog@debian.org> for extratabs
-
-use strict ;
-use diagnostics ;
-
-use DBI ;
-use MIME::Base64 ;
-use HTML::Entities ;
-
-use vars qw/$dbh @reqlist $query/ ;
-use vars qw/$sys_default_domain $sys_cvs_host
- $sys_shell_host $sys_users_host $sys_docs_host $sys_lists_host
- $sys_dns1_host $sys_dns2_host $FTPINCOMING_DIR $FTPFILES_DIR
- $sys_urlroot $sf_cache_dir $sys_name $sys_themeroot
- $sys_news_group $sys_dbhost $sys_dbname $sys_dbuser $sys_dbpasswd
- $sys_ldap_base_dn $sys_ldap_host $admin_login $admin_password
- $domain_name
- $skill_list/ ;
-use vars qw/$pluginname/ ;
-
-sub is_lesser ( $$ ) ;
-sub is_greater ( $$ ) ;
-sub debug ( $ ) ;
-sub parse_sql_file ( $ ) ;
-
-require ("/usr/share/gforge/lib/include.pl") ; # Include a few predefined functions
-require ("/usr/share/gforge/lib/sqlparser.pm") ; # Our magic SQL parser
-
-debug "You'll see some debugging info during this installation." ;
-debug "Do not worry unless told otherwise." ;
-
-&db_connect ;
-
-# debug "Connected to the database OK." ;
-
-$pluginname = "extratabs" ;
-
-$dbh->{AutoCommit} = 0;
-$dbh->{RaiseError} = 1;
-eval {
- my ($sth, @array, $version, $path, $target) ;
-
- &create_metadata_table ("0") ;
-
- $version = &get_db_version ;
- $target = "0.1" ;
- if (is_lesser $version, $target) {
- my @filelist = ( "/usr/share/gforge/plugins/$pluginname/db/$pluginname-init.sql" ) ;
-
- foreach my $file (@filelist) {
- debug "Processing $file" ;
- @reqlist = @{ &parse_sql_file ($file) } ;
-
- foreach my $s (@reqlist) {
- $query = $s ;
- # debug $query ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- $sth->finish () ;
- }
- }
- @reqlist = () ;
-
- &update_db_version ($target) ;
- debug "Committing." ;
- $dbh->commit () ;
- }
-
-
- $version = &get_db_version ;
- $target = "0.2" ;
- if (is_lesser $version, $target) {
- my @filelist = ( "/usr/share/gforge/plugins/$pluginname/db/20101203-add_type_for_iframe.sql" ) ;
-
- foreach my $file (@filelist) {
- debug "Processing $file" ;
- @reqlist = @{ &parse_sql_file ($file) } ;
-
- foreach my $s (@reqlist) {
- $query = $s ;
- # debug $query ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- $sth->finish () ;
- }
- }
- @reqlist = () ;
-
- &update_db_version ($target) ;
- debug "Committing." ;
- $dbh->commit () ;
- }
-
- debug "It seems your database install/upgrade went well and smoothly. That's cool." ;
- debug "Please enjoy using Debian GForge." ;
-
- # There should be a commit at the end of every block above.
- # If there is not, then it might be symptomatic of a problem.
- # For safety, we roll back.
- $dbh->rollback ();
-};
-
-if ($@) {
- warn "Transaction aborted because $@" ;
- debug "Transaction aborted because $@" ;
- debug "Last SQL query was:\n$query\n(end of query)" ;
- $dbh->rollback ;
- debug "Please report this bug on the Debian bug-tracking system." ;
- debug "Please include the previous messages as well to help debugging." ;
- debug "You should not worry too much about this," ;
- debug "your DB is still in a consistent state and should be usable." ;
- exit 1 ;
-}
-
-$dbh->rollback ;
-$dbh->disconnect ;
-
-sub is_lesser ( $$ ) {
- my $v1 = shift || 0 ;
- my $v2 = shift || 0 ;
-
- my $rc = system "dpkg --compare-versions $v1 lt $v2" ;
-
- return (! $rc) ;
-}
-
-sub is_greater ( $$ ) {
- my $v1 = shift || 0 ;
- my $v2 = shift || 0 ;
-
- my $rc = system "dpkg --compare-versions $v1 gt $v2" ;
-
- return (! $rc) ;
-}
-
-sub debug ( $ ) {
- my $v = shift ;
- chomp $v ;
- print STDERR "$v\n" ;
-}
-
-sub create_metadata_table ( $ ) {
- my $v = shift || "0" ;
- my $tablename = "plugin_" .$pluginname . "_meta_data" ;
- # Do we have the metadata table?
-
- $query = "SELECT count(*) FROM pg_class WHERE relname = '$tablename' and relkind = 'r'";
- # debug $query ;
- my $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- my @array = $sth->fetchrow_array () ;
- $sth->finish () ;
-
- # Let's create this table if we have it not
-
- if ($array [0] == 0) {
- debug "Creating $tablename table." ;
- $query = "CREATE TABLE $tablename (key varchar primary key, value text not null)" ;
- # debug $query ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- $sth->finish () ;
- }
-
- $query = "SELECT count(*) FROM $tablename WHERE key = 'db-version'";
- # debug $query ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- @array = $sth->fetchrow_array () ;
- $sth->finish () ;
-
- # Empty table? We'll have to fill it up a bit
-
- if ($array [0] == 0) {
- debug "Inserting first data into $tablename table." ;
- $query = "INSERT INTO $tablename (key, value) VALUES ('db-version', '$v')" ;
- # debug $query ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- $sth->finish () ;
- }
-}
-
-sub update_db_version ( $ ) {
- my $v = shift or die "Not enough arguments" ;
- my $tablename = "plugin_" .$pluginname . "_meta_data" ;
-
- debug "Updating $tablename table." ;
- $query = "UPDATE $tablename SET value = '$v' WHERE key = 'db-version'" ;
- # debug $query ;
- my $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- $sth->finish () ;
-}
-
-sub get_db_version () {
- my $tablename = "plugin_" .$pluginname . "_meta_data" ;
-
- $query = "SELECT value FROM $tablename WHERE key = 'db-version'" ;
- # debug $query ;
- my $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- my @array = $sth->fetchrow_array () ;
- $sth->finish () ;
-
- my $version = $array [0] ;
-
- return $version ;
-}
-
-sub drop_table_if_exists ( $ ) {
- my $tname = shift or die "Not enough arguments" ;
- $query = "SELECT count(*) FROM pg_class WHERE relname='$tname' AND relkind='r'" ;
- my $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- my @array = $sth->fetchrow_array () ;
- $sth->finish () ;
-
- if ($array [0] != 0) {
- # debug "Dropping table $tname" ;
- $query = "DROP TABLE $tname" ;
- # debug $query ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- $sth->finish () ;
- }
-}
-
-sub drop_sequence_if_exists ( $ ) {
- my $sname = shift or die "Not enough arguments" ;
- $query = "SELECT count(*) FROM pg_class WHERE relname='$sname' AND relkind='S'" ;
- my $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- my @array = $sth->fetchrow_array () ;
- $sth->finish () ;
-
- if ($array [0] != 0) {
- # debug "Dropping sequence $sname" ;
- $query = "DROP SEQUENCE $sname" ;
- # debug $query ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- $sth->finish () ;
- }
-}
-
-sub drop_index_if_exists ( $ ) {
- my $iname = shift or die "Not enough arguments" ;
- $query = "SELECT count(*) FROM pg_class WHERE relname='$iname' AND relkind='i'" ;
- my $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- my @array = $sth->fetchrow_array () ;
- $sth->finish () ;
-
- if ($array [0] != 0) {
- # debug "Dropping index $iname" ;
- $query = "DROP INDEX $iname" ;
- # debug $query ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- $sth->finish () ;
- }
-}
-
-sub drop_view_if_exists ( $ ) {
- my $iname = shift or die "Not enough arguments" ;
- $query = "SELECT count(*) FROM pg_class WHERE relname='$iname' AND relkind='v'" ;
- my $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- my @array = $sth->fetchrow_array () ;
- $sth->finish () ;
-
- if ($array [0] != 0) {
- # debug "Dropping view $iname" ;
- $query = "DROP VIEW $iname" ;
- # debug $query ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- $sth->finish () ;
- }
-}
-
-sub bump_sequence_to ( $$ ) {
- my ($sth, @array, $seqname, $targetvalue) ;
-
- $seqname = shift ;
- $targetvalue = shift ;
-
- do {
- $query = "select nextval ('$seqname')" ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- @array = $sth->fetchrow_array () ;
- $sth->finish () ;
- } until $array[0] >= $targetvalue ;
-}
+++ /dev/null
-<?php
-/**
- * FusionForge extratabs plugin
- *
- * Copyright 2005, Raphaƫl Hertzog
- * Copyright 2009, Roland Mas
- * Copyright (C) 2010 Alain Peyrat - Alcatel-Lucent
- * Copyright 2010, Franck Villaume - Capgemini
- * http://fusionforge.org
- *
- * This file is part of FusionForge.
- *
- * FusionForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- *
- * FusionForge is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-class ExtraTabsPlugin extends Plugin {
- function ExtraTabsPlugin () {
- $this->Plugin() ;
- $this->name = "extratabs" ;
- $this->text = "Extra tabs";
- $this->_addHook('groupisactivecheckbox'); // The "use ..." checkbox in editgroupinfo
- $this->_addHook('groupisactivecheckboxpost');
- $this->_addHook('project_admin_plugins');
- $this->_addHook('groupmenu'); // To put into the project tabs
- $this->_addHook('clone_project_from_template');
- }
-
- function CallHook($hookname, &$params) {
- global $HTML;
-
- switch ($hookname) {
- case "project_admin_plugins": {
- $group_id = $params['group_id'];
- $project = group_get_object($group_id);
- if ($project->usesPlugin($this->name)) {
- echo '<p>'.util_make_link('/plugins/extratabs/index.php?group_id='.$group_id,
- _('Extra Tabs Admin')) . '</p>';
- }
- break;
- }
-
- case "groupmenu": {
- $group_id = $params['group'];
- $project = group_get_object($group_id);
- if (!$project || !is_object($project))
- return;
- if ($project->isError())
- return;
- if (!$project->isProject())
- return;
- $res_tabs = db_query_params('SELECT tab_name, tab_url, type FROM plugin_extratabs_main WHERE group_id=$1 ORDER BY index',
- array($group_id));
- while ($row_tab = db_fetch_array($res_tabs)) {
- $params['TITLES'][] = $row_tab['tab_name'];
- switch ($row_tab['type']) {
- case 0: // Link
- $params['DIRS'][] = $row_tab['tab_url'];
- $params['ADMIN'][] = '';
- $params['TOOLTIPS'][] = '';
- break;
-
- case 1: // Iframe
- $params['DIRS'][] = '/plugins/'.$this->name.'/iframe.php?group_id='.$group_id.'&tab_name='.$row_tab['tab_name'];
- $params['ADMIN'][] = '';
- $params['TOOLTIPS'][] = '';
- if (isset($params['toptab']) && ($params['toptab'] == $row_tab['tab_name'])) {
- $params['selected'] = count($params['TITLES']) - 1;
- }
- break;
-
- default:
- return;
- }
- }
- break;
- }
- case "clone_project_from_template": {
- $tabs = array () ;
- $res = db_query_params ('SELECT tab_name, tab_url, index FROM plugin_extratabs_main WHERE group_id=$1 ORDER BY index',
- array ($params['template']->getID())) ;
- while ($row = db_fetch_array($res)) {
- $data = array () ;
- $data['tab_url'] = $params['project']->replaceTemplateStrings ($row['tab_url']) ;
- $data['tab_name'] = $params['project']->replaceTemplateStrings ($row['tab_name']) ;
- $data['index'] = $row['index'] ;
- $tabs[] = $data ;
- }
-
- foreach ($tabs as $tab) {
- db_query_params ('INSERT INTO plugin_extratabs_main (tab_url, tab_name, index, group_id) VALUES ($1,$2,$3,$4)',
- array ($data['tab_url'],
- $data['tab_name'],
- $data['index'],
- $params['project']->getID())) ;
- }
- }
- }
- }
-}
-
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
+++ /dev/null
-<?php
-
-require_once (forge_get_config('plugins_path').'/extratabs/common/ExtraTabsPlugin.class.php') ;
-
-$ExtraTabsPluginObject = new ExtraTabsPlugin ;
-
-register_plugin ($ExtraTabsPluginObject) ;
-
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
+++ /dev/null
-ALTER TABLE plugin_extratabs_main ADD COLUMN type INTEGER;
-ALTER TABLE plugin_extratabs_main ALTER COLUMN type SET DEFAULT 0;
+++ /dev/null
-CREATE TABLE plugin_extratabs_main (
- group_id int NOT NULL,
- index int NOT NULL,
- tab_name text NOT NULL,
- tab_url text NOT NULL,
- PRIMARY KEY(group_id, index)
-) ;
+++ /dev/null
-[extratabs]
-
-; Current extratabs is production ready
-; plugin_status is a string.
-; valid means : production ready.
-; Any other strings means it's under work or broken and plugin
-; is available in installation_environment = development only.
-plugin_status = valid
\ No newline at end of file
+++ /dev/null
-Package: @PACKAGE@-plugin-extratabs
-Architecture: all
-Depends: @OLDPACKAGE@-common (>= 4.6.99), @OLDPACKAGE@-db-postgresql (>= 4.6.99) | @OLDPACKAGE@-db, @OLDPACKAGE@-web-apache2 (>= 4.6.99) | @OLDPACKAGE@-web, ${misc:Depends}
-Provides: @OLDPACKAGE@-plugin-extratabs
-Conflicts: @OLDPACKAGE@-plugin-extratabs (<< 5.0.51-2)
-Replaces: @OLDPACKAGE@-plugin-extratabs (<< 5.0.51-2)
-Description: Extratabs plugin for FusionForge
+++ /dev/null
- This plugin allows each project to define extra tabs with arbitrary
- titles and links.
+++ /dev/null
-@PLUGIN_PATH@/extratabs/bin
-@PLUGIN_PATH@/extratabs/lib
-@PLUGIN_PATH@/extratabs/www
-@PLUGIN_PATH@/extratabs/common
+++ /dev/null
-plugins/extratabs/README
+++ /dev/null
-plugins/extratabs/bin/* @PLUGIN_PATH@/extratabs/bin/
-plugins/extratabs/common/* @PLUGIN_PATH@/extratabs/common/
-plugins/extratabs/db/* @PLUGIN_PATH@/extratabs/db/
-plugins/extratabs/www/* @PLUGIN_PATH@/extratabs/www/
+++ /dev/null
-@PLUGIN_PATH@/extratabs/www @SOURCE_PATH@/www/plugins/extratabs
+++ /dev/null
-<?php
-/**
- * Extra tabs plugin
- * Copyright (C) 2010 Alain Peyrat - Alcatel-Lucent
- * http://fusionforge.org/
- *
- * This file is part of FusionForge.
- *
- * FusionForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * FusionForge is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-require_once '../../../www/env.inc.php';
-require_once $gfcommon.'include/pre.php';
-
-$group_id = getIntFromRequest('group_id');
-if (! $group_id) {
- exit_no_group();
-}
-
-$group =& group_get_object($group_id);
-if (!$group || !is_object($group) || $group->isError()) {
- exit_no_group();
-}
-
-$tab_name = htmlspecialchars(trim(getStringFromRequest ('tab_name')));
-$result = db_query_params('SELECT * FROM plugin_extratabs_main WHERE group_id=$1 AND tab_name=$2',
- array ($group_id, $tab_name));
-if ($result && db_numrows($result)) {
- $tab_url = rtrim(db_result($result, 0, 'tab_url'), '/');
- site_project_header(array('title'=>_($tab_name), 'group' => $group_id, 'toptab'=>$tab_name));
- ?>
- <iframe src="<?php echo $tab_url ?>" frameborder="0" height="600px" width="100%"></iframe>
- <?php
- site_project_footer(array());
-}
-
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
+++ /dev/null
-<?php
-
-/**
- * Extra tabs plugin
- * Copyright 2005, Raphaƫl Hertzog
- * Copyright 2006-2009, Roland Mas
- * Copyright 2009-2010, Alain Peyrat
- * Copyright 2010, Franck Villaume - Capgemini
- * Copyright (C) 2010 Alain Peyrat - Alcatel-Lucent
- * http://fusionforge.org/
- *
- * This file is part of FusionForge.
- *
- * FusionForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * FusionForge is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-require_once '../../../www/env.inc.php';
-require_once $gfcommon.'include/pre.php';
-require_once $gfwww.'project/admin/project_admin_utils.php';
-
-$group_id = getIntFromRequest ('group_id') ;
-$index = getIntFromRequest ('index') ;
-
-$tab_name = htmlspecialchars(trim(getStringFromRequest('tab_name')));
-$tab_rename = htmlspecialchars(trim(getStringFromRequest('tab_rename')));
-$tab_url = htmlspecialchars(trim(getStringFromRequest('tab_url', 'http://')));
-$tab_new_url = htmlspecialchars(trim(getStringFromRequest('tab_new_url')));
-$type = getIntFromRequest('type', 0);
-$new_type = getIntFromRequest('new_type', -1);
-
-session_require_perm('project_admin', $group_id) ;
-
-// get current information
-$group = group_get_object($group_id);
-if (!$group || !is_object($group)) {
- exit_no_group();
-} elseif ($group->isError()) {
- exit_error($group->getErrorMessage(), 'home');
-}
-
-db_begin();
-
-// Calculate new index field
-$res = db_query_params('SELECT COUNT(*) as c FROM plugin_extratabs_main WHERE group_id = $1',
- array ($group_id));
-$row = db_fetch_array($res);
-$newid = $row['c'] + 1;
-
-$selected = 0; // No item selected by default
-
-// Do work before displaying so that the result is immediately visible
-if (getStringFromRequest('addtab') != '') {
- if ($tab_name == '' || $tab_url == '' || $tab_url == 'http://') {
- $error_msg = _('ERROR: Missing Name or URL for the new tab');
- } elseif (!util_check_url($tab_url)) {
- $error_msg = _('ERROR: Malformed URL (only http, https and ftp allowed)');
- } else {
- $res = db_query_params('SELECT * FROM plugin_extratabs_main WHERE group_id=$1 AND tab_name=$2',
- array($group_id, $tab_name));
- if ($res && db_numrows($res) > 0) {
- $error_msg = _('ERROR: Name for tab is already used.');
- } else {
- $res = db_query_params('INSERT INTO plugin_extratabs_main (group_id, index, tab_name, tab_url, type) VALUES ($1,$2,$3,$4,$5)',
- array ($group_id,
- $newid,
- $tab_name,
- $tab_url,
- $type)) ;
- if (!$res || db_affected_rows($res) < 1) {
- $error_msg = sprintf(_('Cannot insert new tab entry: %s'),
- db_error());
- } else {
- $tab_name = '';
- $tab_url = 'http://';
- $feedback = _('Tab successfully added');
- }
- }
- }
-} elseif (getStringFromRequest('delete') != '') {
- $res = db_query_params('DELETE FROM plugin_extratabs_main WHERE group_id=$1 AND index=$2',
- array($group_id, $index));
- if (!$res || db_affected_rows($res) < 1) {
- $error_msg = sprintf(_('Cannot delete tab entry: %s'), db_error());
- } else {
- $res = db_query_params('SELECT index FROM plugin_extratabs_main WHERE group_id=$1 AND index > $2 ORDER BY index ASC',
- array($group_id, $index));
- if (db_numrows($res) > 0) {
- $todo = array();
- while ($row = db_fetch_array($res)) {
- $todo[] = $row['index'];
- }
- foreach ($todo as $i) {
- $res = db_query_params('UPDATE plugin_extratabs_main SET index = index - 1 WHERE group_id = $1 AND index = $2',
- array($group_id, $i));
- }
- }
- if ($res) {
- $feedback = _('Tab successfully deleted');
- } else {
- $error_msg = sprintf(_('Cannot delete tab entry: %s'), db_error());
- }
- }
-} elseif (getStringFromRequest ('up') != '') {
- if ($index > 1) {
- $previous = $index - 1;
- $res = db_query_params('UPDATE plugin_extratabs_main SET index=0 WHERE group_id=$1 AND index=$2',
- array ($group_id, $index));
- $res = db_query_params('UPDATE plugin_extratabs_main SET index=$1 WHERE group_id=$2 AND index=$3',
- array($index,
- $group_id,
- $previous));
- $res = db_query_params('UPDATE plugin_extratabs_main SET index=$1 WHERE group_id=$2 AND index=0',
- array($previous,
- $group_id));
- $selected = $previous;
- $feedback = _('Tab successfully moved');
- } else {
- $warning_msg = _('Tab not moved, already at first position');
- $selected = $index;
- }
-} elseif (getStringFromRequest ('down') != '') {
- if ($index < $newid - 1) {
- $next = $index + 1;
- $res = db_query_params('UPDATE plugin_extratabs_main SET index=0 WHERE group_id=$1 AND index=$2',
- array($group_id,
- $index));
- $res = db_query_params('UPDATE plugin_extratabs_main SET index=$1 WHERE group_id=$2 AND index=$3',
- array($index,
- $group_id,
- $next));
- $res = db_query_params('UPDATE plugin_extratabs_main SET index=$1 WHERE group_id=$2 AND index=0',
- array($next,
- $group_id));
- $feedback = _('Tab successfully moved');
- $selected = $next;
- } else {
- $warning_msg = _('Tab not moved, already at last position');
- $selected = $index;
- }
-} elseif (getStringFromRequest ('modify') != '') {
- $done = 0;
- if ($tab_rename) {
- $res = db_query_params ('UPDATE plugin_extratabs_main SET tab_name=$1 WHERE group_id=$2 AND index=$3',
- array ($tab_rename,
- $group_id,
- $index));
- if (!$res || db_affected_rows($res) < 1) {
- $error_msg = sprintf (_('Cannot rename the tab: %s'), db_error());
- } else {
- $feedback .= ($feedback ? '. ' : '') . _('Tab successfully renamed');
- $done = 1;
- }
- }
- if ($tab_new_url && $tab_new_url != 'http://') {
- if (!util_check_url($tab_new_url)) {
- $error_msg = _('ERROR: Malformed URL (only http, https and ftp allowed)');
- } else {
- $res = db_query_params ('UPDATE plugin_extratabs_main SET tab_url=$1 WHERE group_id=$2 AND index=$3',
- array ($tab_new_url,
- $group_id,
- $index));
- if (!$res || db_affected_rows($res) < 1) {
- $error_msg .= ($error_msg ? '. ' : '') . sprintf (_('Cannot change URL: %s'), db_error());
- } else {
- $feedback .= ($feedback ? '. ' : '') . _('URL successfully changed');
- $done = 1;
- }
- }
- }
- if ($new_type != -1) {
- $res = db_query_params ('UPDATE plugin_extratabs_main SET type=$1 WHERE group_id=$2 AND index=$3',
- array ($new_type,
- $group_id,
- $index));
- if (!$res || db_affected_rows($res) < 1) {
- $error_msg .= ($error_msg ? '. ' : '') . sprintf (_('Cannot set type: %s'), db_error());
- } else {
- $feedback .= ($feedback ? '. ' : '') . _('Type successfully changed');
- $done = 1;
- }
- }
- if (!$error_msg && !$done) {
- $warning_msg .= ($warning_msg ? '. ' : '') . _('Nothing done');
- }
-}
-if (!$res) {
- db_rollback();
-} else {
- db_commit();
-}
-
-$adminheadertitle = sprintf(_('Manage extra tabs for project %1$s'), $group->getPublicName());
-project_admin_header(array('title'=>$adminheadertitle, 'group'=>$group->getID()));
-?>
-
-<h2><?php echo _('Add new tab'); ?></h2>
-
-<p><?php echo _('You can add your own tabs in the menu bar with the form below.') ?></p>
-
-<form name="new_tab" action="<?php echo util_make_uri ('/plugins/extratabs/'); ?>" method="post">
-<fieldset>
-<legend><?php echo _('Add new tab'); ?></legend>
-<p>
-<input type="hidden" name="group_id" value="<?php echo $group->getID() ?>" />
-<input type="hidden" name="addtab" value="1" />
-<strong><?php echo _('Name of the tab:') ?></strong><?php echo utils_requiredField(); ?>
-<br />
-<input type="text" required="required" size="20" maxlength="20" name="tab_name" value="<?php echo $tab_name ?>" /><br />
-</p>
-<p>
-<strong><?php echo _('URL of the tab:') ?></strong><?php echo utils_requiredField(); ?>
-<br />
-<input type="text" required="required" size="60" name="tab_url" value="<?php echo $tab_url ?>" /><br/>
-</p>
-<p>
-<input type="radio" name="type" value="0" checked="checked"/><?php echo _('Link') ?>
-<input type="radio" name="type" value="1" /><?php echo _('Iframe') ?>
-</p>
-<p>
-<input type="submit" value="<?php echo _('Add tab') ?>" />
-</p>
-</fieldset>
-</form>
-
-<?php
- $res = db_query_params('SELECT * FROM plugin_extratabs_main WHERE group_id=$1 ORDER BY index ASC', array($group_id));
-$nbtabs = db_numrows($res);
-if ($nbtabs > 0) {
-
-?>
-
-<h2><?php echo _('Modify extra tabs'); ?></h2>
-<p>
-<?php echo _('You can modify the tabs that you already added.');
-?>
-</p>
-
-<form name="modify_tab" action="<?php echo util_make_uri('/plugins/extratabs/'); ?>" method="post">
-<fieldset>
-<legend><?php echo _('Modify tab'); ?></legend>
-<p>
-<input type="hidden" name="group_id" value="<?php echo $group->getID() ?>" />
-<?php echo _('Tab to modify:') ?> <select name="index">
-<?php
-$options = '';
-while ($row = db_fetch_array($res)) {
- if ($row['index'] == $selected) {
- $options .= "<option selected=\"selected\" value='" . $row['index'] . "'>" . $row['tab_name'] . "</option>";
- } else {
- $options .= "<option value='" . $row['index'] . "'>" . $row['tab_name'] . "</option>";
- }
-}
-echo $options;
-?>
-</select>
-</p>
-<p>
-<?php echo _('Rename to:'); ?> <input type="text" size="20" maxlength="20" name="tab_rename" value="" />
-</p>
-<p>
-<?php echo _('New URL:'); ?> <input type="text" size="60" name="tab_new_url" value="http://" />
-</p>
-<p>
-<input type="radio" name="new_type" value="0" /><?php echo _('Link') ?>
-<input type="radio" name="new_type" value="1" /><?php echo _('Iframe') ?>
-</p>
-<p>
-<input type="submit" name="modify" value="<?php echo _('Modify tab') ?>" />
-</p>
-</fieldset>
-</form>
-
-<h2><?php echo _('Move or delete extra tabs') ;?></h2>
-<p>
-<?php echo _('You can move and delete the tabs that you already added. Please note that those extra tabs can only appear after the standard tabs. And you can only move them inside the set of extra tabs.');
-?>
-</p>
-
-<form name="change_tab" action="<?php echo util_make_uri('/plugins/extratabs/'); ?>" method="post">
-<fieldset>
-<legend><?php echo _('Move or delete tab'); ?></legend>
-<p>
-<input type="hidden" name="group_id" value="<?php echo $group->getID() ?>" />
-<?php
- echo _('Tab to modify:')
-?>
-<select name="index">
-<?php
-echo $options;
-?>
-</select>
-</p>
-<p>
-<?php if ($nbtabs > 1) { ?>
-<input type="submit" name="up" value="<?php echo _('Move tab before') ?>" />
-<input type="submit" name="down" value="<?php echo _('Move tab after') ?>" />
- <?php } ?>
-<input type="submit" name="delete" value="<?php echo _('Delete tab') ?>" />
-</p>
-</fieldset>
-</form>
-
-<?php
-}
-project_admin_footer(array());
-
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End: