src/plugins/forumml/www/themes/default/images/ic/spinner-greenie.gif -text svneol=unset#image/gif
src/plugins/forumml/www/themes/default/images/ic/trash.png -text svneol=unset#image/png
src/plugins/forumml/www/upload.php -text
+src/plugins/globaldashboard/NAME -text
+src/plugins/globaldashboard/README -text
+src/plugins/globaldashboard/bin/db-delete.pl -text
+src/plugins/globaldashboard/bin/db-upgrade.pl -text
+src/plugins/globaldashboard/common/globaldashboard-init.php -text
+src/plugins/globaldashboard/common/manage_accounts_db_utils.php -text
+src/plugins/globaldashboard/cronjobs/manage_globaldashboard.php -text
+src/plugins/globaldashboard/db/globaldashboard-init.sql -text
+src/plugins/globaldashboard/etc/globaldashboard.ini -text
+src/plugins/globaldashboard/etc/httpd.d/62plugin-globaldashboard -text
+src/plugins/globaldashboard/etc/plugins/globaldashboard/config.php -text
+src/plugins/globaldashboard/include/globalDashboardConstants.php -text
+src/plugins/globaldashboard/include/globalDashboard_Widget_MyArtifacts.php -text
+src/plugins/globaldashboard/include/globalDashboard_Widget_MyProjects.php -text
+src/plugins/globaldashboard/include/globalDashboard_utils.php -text
+src/plugins/globaldashboard/include/globaldashboardPlugin.class.php -text
+src/plugins/globaldashboard/packaging/control/000source -text
+src/plugins/globaldashboard/packaging/control/222plugin-globaldashboard -text
+src/plugins/globaldashboard/packaging/control/222plugin-globaldashboard.shortdesc -text
+src/plugins/globaldashboard/packaging/dirs/plugin-globaldashboard -text
+src/plugins/globaldashboard/packaging/docs/plugin-globaldashboard -text
+src/plugins/globaldashboard/packaging/install/plugin-globaldashboard -text
+src/plugins/globaldashboard/packaging/links/plugin-globaldashboard -text
+src/plugins/globaldashboard/translations/en.po -text
+src/plugins/globaldashboard/translations/gforge.pot -text
+src/plugins/globaldashboard/utils/manage-translations.sh -text
+src/plugins/globaldashboard/www/admin/add_account.php -text
+src/plugins/globaldashboard/www/admin/delete_account.php -text
+src/plugins/globaldashboard/www/admin/edit_account.php -text
+src/plugins/globaldashboard/www/admin/edit_account_page.php -text
+src/plugins/globaldashboard/www/admin/index.php -text
+src/plugins/globaldashboard/www/admin/manage_accounts.php -text
+src/plugins/globaldashboard/www/help.php -text
+src/plugins/globaldashboard/www/index.php -text
src/plugins/globalsearch/NAME -text
src/plugins/globalsearch/README -text
src/plugins/globalsearch/TODO -text
--- /dev/null
+GlobalDashboard
\ No newline at end of file
--- /dev/null
+GlobalDashboard plugin.
+
+This is a fusionforge plugin for discovery and browsing between projects hosted
+in different software forges.
+It is a dashboard that contain several graphical widgets that allows users to
+discover and display different software forge's artifacts they are interested
+in such as:
+- Projects information
+- Tracker artifacts
+- Tracker artifacts update
+- Releases information
+- Monitored Spaces (like Forums, trackers, etc.)
+- Source code commits
+- and others
+
+Those information are retrieved from physically different software forges
+on which the user is registered with the same identity.
+
+Quick display techniques like compact previews will also ease information
+display.
+
+Data like tracker artifacts are gathered from other forges sites using
+OSLC-CM protocol if the forges are already OSLC compliant.
+
+This plugin is part of fusionforge and is a completely free software product
+according to the terms of the GPL2 License.
+
+-- Sabri LABBENE <sabri.labbene@gmail.com>
--- /dev/null
+#!/usr/bin/perl -w
+#
+# 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_download_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
+ $server_admin $domain_name $newsadmin_groupid $statsadmin_groupid
+ $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 = "globaldashboard" ;
+
+$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 FusionForge." ;
+
+ # 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
+#
+# Debian-specific script to upgrade the database between releases
+# 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_download_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
+ $server_admin $domain_name $newsadmin_groupid $statsadmin_groupid
+ $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 = "globaldashboard" ;
+
+$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) {
+# debug "Adding local data." ;
+#
+# do "/etc/gforge/local.pl" or die "Cannot read /etc/gforge/local.pl" ;
+#
+# my $ip_address = qx/host $domain_name | awk '{print \}'/ ;
+#
+# @reqlist = (
+# "INSERT INTO plugin_".$pluginname."_sample_data (domain, ip_address) VALUES ('$domain_name', '$ip_address')",
+# ) ;
+#
+# 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 FusionForge." ;
+
+ # 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
+
+/**
+ *
+ * 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.
+ */
+
+global $gfplugins;
+require_once $gfplugins.'globaldashboard/include/globaldashboardPlugin.class.php' ;
+
+$globaldashboardPluginObject = new globaldashboardPlugin ;
+
+register_plugin ($globaldashboardPluginObject) ;
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+
+/**
+* Copyright 2011, Sabri LABBENE - Institut Télécom
+*
+*
+* 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.
+*/
+
+/**
+*
+* Gets remote accounts hold by a user from the database.
+* @param array $params contain user_id and account fetching method
+*
+* @return array array of remote accounts hold by the user.
+*/
+function getDBStoredRemoteAccountsByUserId($user_id) {
+ $t_accounts_table = "plugin_globaldashboard_user_forge_account";
+ $t_result = db_query_params(
+ "SELECT * FROM $t_accounts_table ".
+ "WHERE user_id=$1".
+ "ORDER BY forge_account_login_name ASC",
+ array( (int) $user_id));
+
+ $t_rows = array();
+
+ while ( $t_row = db_fetch_array( $t_result ) ) {
+ $t_rows[] = $t_row;
+ }
+
+ return $t_rows;
+}
+
+/**
+ * Fetches a remote account from FF DB knowing its id.
+ *
+ * @param integer $account_id account id.
+ * @return array $t_row array of account data.
+ */
+function getDBStoredRemoteAccountById($account_id) {
+ $t_accounts_table = "plugin_globaldashboard_user_forge_account";
+ $t_result = db_query_params(
+ "SELECT * FROM $t_accounts_table ".
+ "WHERE account_id=$1", array( (int) $account_id)
+ );
+
+ if (!$t_result || ( db_numrows( $t_result ) < 1 )) {
+ exit_error( "Remote account not found", 'Global Dashboard' );
+ }
+ $t_row = array();
+ $t_row = db_fetch_array( $t_result );
+ return $t_row;
+}
+
+/**
+ *
+ * Fetches account discovery params from DB knowing account id
+ *
+ * @param integer $account_id
+ *
+ * @return array $t_row array of discovery data.
+ */
+function getDBAccountDiscoveryByAccountId($account_id) {
+ $t_discovery_table = "plugin_globaldashboard_account_discovery";
+ $t_result = db_query_params(
+ "SELECT * FROM $t_discovery_table ".
+ "WHERE account_id=$1", array( (int) $account_id)
+ );
+
+ if (!$t_result || ( db_numrows( $t_result ) < 1 )) {
+ exit_error( "Remote account not found", 'Global Dashboard' );
+ }
+ $t_row = array();
+ $t_row = db_fetch_array( $t_result );
+ return $t_row;
+}
+
+/**
+ *
+ * returns the fetch method for a ressource (projects, artifacts, etc.)
+ * @param integer $account_id
+ * @param string $ressource_type (projects | artifacts | ...)
+ */
+function getDBFetchMethod($account_id, $ressource_type) {
+ $t_account_discovery_table = "plugin_globaldashboard_account_discovery";
+ $t_result = db_query_params(
+ "SELECT * FROM $t_account_discovery_table ".
+ "WHERE account_id=$1",
+ array( (int) $account_id)
+ );
+
+ if(!$t_result || (db_numrows( $t_result ) < 1)) {
+ return 0;
+ }
+ $t_row = db_fetch_array($t_result);
+
+ switch ($ressource_type) {
+ case 'projects':
+ return $t_row['projects_discovery_method'];
+ case 'artifacts':
+ return $t_row['artifacts_discovery_method'];
+ default:
+ return 0;
+ }
+
+}
+
+/**
+*
+* Gets the remote accounts of a user from its foaf profile
+* stored somewhere
+* @param string $user_profile_url Url of the user foaf profile.
+*
+* @return array array of user accounts
+*/
+function getUserRdfRemoteAccounts($user_profile_url) {
+ // TODO fetch user accounts from its foaf profile using
+ // an RDF parser.
+}
+?>
\ No newline at end of file
--- /dev/null
+#! /usr/bin/php -f
+<?php
+/**
+ * FusionForge source control management
+ *
+ * Copyright 2009, Roland Mas
+ *
+ * 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 'env.inc.php';
+require_once $gfwww.'include/squal_pre.php';
+require_once $gfcommon.'include/cron_utils.php';
+
+// MailingList backend class
+/* This is only sample
+require_once $gfplugins.'globaldashboard/include/BackendHelloworld.class.php' ;
+
+
+$res = db_query_params ('SELECT id,type, parameters FROM system_event WHERE status=$1 ORDER BY id DESC',
+ array ('1'));
+if (!$res) {
+ printf('Unable to get list of events: '.db_error());
+ return false;
+}
+
+while ($data = db_fetch_array ($res)) {
+ if($data['type'] == 'HELLOWORLD_CREATE') {
+ $result = BackendHelloworld::instance()->createList($data['parameters']);
+ } elseif ($data['type'] == 'HELLOWORLD_DELETE') {
+ $result = BackendHelloworld::instance()->deleteList($data['parameters']);
+ }
+ $result ? $log="DONE":$test="ERROR";
+ $events[$data['id']]=$log;
+ echo "\n Event ".$data['id']." : ".$data['type']." ".$log." for list id=".$data['parameters'];
+}
+if(isset($events)) {
+ foreach($events as $event_id => $log) {
+ $sql = "UPDATE system_event SET end_date=$1, log=$2, status='3' WHERE id=$3;";
+ $result = db_query_params($sql,array(time(),$log,$event_id));
+ if (!$result) {
+ printf('Unable to update the list of events: '.db_error());
+ return false;
+ }
+ }
+
+}
+*/
+
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>
\ No newline at end of file
--- /dev/null
+CREATE SEQUENCE plugin_globaldashboard_user_forge_account_pk_seq start 1 increment 1 minvalue 1 cache 1 ;
+CREATE TABLE plugin_globaldashboard_user_forge_account (
+ account_id integer PRIMARY KEY DEFAULT NEXTVAL('plugin_globaldashboard_user_forge_account_pk_seq') ,
+ user_id integer NOT NULL REFERENCES users(user_id) ,
+ forge_account_login_name varchar(32) DEFAULT '' NOT NULL ,
+ forge_account_password varchar(32) DEFAULT '' NOT NULL ,
+ forge_account_domain varchar(250) DEFAULT '' NOT NULL ,
+ forge_account_uri varchar(250) DEFAULT '' NOT NULL ,
+ forge_oslc_discovery_uri varchar(250) DEFAULT NULL ,
+ forge_account_rss_uri varchar(250) DEFAULT NULL ,
+ forge_account_soap_wsdl_uri varchar(250) DEFAULT NULL
+) ;
+
+CREATE SEQUENCE plugin_globaldashboard_account_discovery_pk_seq start 1 increment 1 minvalue 1 cache 1 ;
+CREATE TABLE plugin_globaldashboard_account_discovery (
+ account_discovery_id integer PRIMARY KEY DEFAULT NEXTVAL('plugin_globaldashboard_account_discovery_pk_seq') ,
+ account_id integer NOT NULL REFERENCES plugin_globaldashboard_user_forge_account(account_id) ,
+ projects_discovery_method integer DEFAULT NULL ,
+ artifacts_discovery_method integer DEFAULT NULL
+) ;
--- /dev/null
+[globaldashboard]
+
+; 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 = 'development'
--- /dev/null
+# 62plugin-globaldashboard begin
+# AddHandler cgi-script .cgi
+
+# ScriptAlias /cgi-bin/globaldashboard/ /var/lib/globaldashboard/cgi-bin/
+# ScriptAlias /globaldashboard/ /var/lib/globaldashboard/cgi-bin/
+
+# Alias /images/globaldashboard /usr/share/images/globaldashboard
+# <Location /images/globaldashboard>
+# order allow,deny
+# allow from all
+# </Location>
+# 62plugin-globaldashboard end
--- /dev/null
+<?php
+
+// here you can put all your configuration variables
+
+$world = 'Earth';
+
+?>
--- /dev/null
+<?php
+/**
+* Copyright 2011, Sabri LABBENE - Institut Télécom
+*
+*
+* 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.
+*/
+
+define('REMOTE_FORGE_SOFTWARE_FUSIONFORGE', 1);
+define('REMOTE_FORGE_SOFTWARE_CODENDI', 2);
+define('REMOTE_FORGE_SOFTWARE_TULEAP', 3);
+define('REMOTE_FORGE_SOFTWARE_REDMINE', 4);
+define('REMOTE_FORGE_SOFTWARE_TRACK', 5);
+
+define('USER_PROJECTS_FETCH_METHOD_NONE', 0);
+define('USER_PROJECTS_FETCH_METHOD_SOAP', 1);
+define('USER_PROJECTS_FETCH_METHOD_OSLC', 2);
+
+define('USER_ARTIFACTS_FETCH_METHOD_NONE', 0);
+define('USER_ARTIFACTS_FETCH_METHOD_SOAP', 1);
+define('USER_ARTIFACTS_FETCH_METHOD_OSLC', 2);
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+* Copyright 2011, Sabri LABBENE - Institut Télécom
+*
+* 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 Licence, 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 FusionForge; if not, write to the Free Software Foundation, Inc.,
+* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+require_once('common/widget/Widget.class.php');
+require_once('common/widget/WidgetLayoutManager.class.php');
+
+
+class globalDashboard_Widget_MyArtifacts extends Widget {
+
+ function __construct($owner_type, $plugin) {
+ $this->plugin = $plugin;
+ $this->Widget('plugin_globalDashboard_MyArtifacts');
+ }
+
+ function getTitle() {
+ return _("User artiacts from other remote Forges");
+ }
+
+ function getCategory() {
+ return _('Global Dashboard Plugin');
+ }
+
+ function getDescription() {
+ return _("Displays user artifacts that lives in remote Tracking systems");
+ }
+
+ function getContent() {
+ global $HTML;
+
+ $MyProjects = $this->plugin->getMyProjects();
+
+ $html='';
+ if(is_array($MyProjects)) {
+ $tablearr = array(_('My Projects'),'');
+ $html .= $HTML->listTableTop($tablearr);
+
+ foreach ($MyProjects as $url) {
+ include_once("arc/ARC2.php");
+ require_once('plugins/extsubproj/include/Graphite.php');
+
+ $parser = ARC2::getRDFParser();
+ //$parser->parse('https://vm2.localdomain/projects/coinsuper/');
+ $parser->parse($url);
+ //print_r($parser);
+ $triples = $parser->getTriples();
+ //print_r($triples);
+ $turtle = $parser->toTurtle($triples);
+ $datauri = $parser->toDataURI($turtle);
+
+
+ /*
+ $graph = new Graphite();
+ //$graph->setDebug(1);
+ $graph->ns( "doap", "http://usefulinc.com/ns/doap#" );
+ $graph->load( $datauri );
+ //print $graph->resource('https://vm2.localdomain/projects/coinsuper/')->dumpText();
+ $projname = $graph->resource( $url )->get( "doap:name" );
+
+ $html = $html . '
+ <tr>
+ <td><a href="'.$url.'">'.$projname.'</a>
+ </td>
+ </tr>'; */
+ }
+ $html .= $HTML->listTableBottom();
+ }
+ /*
+ $user = UserManager::instance()->getCurrentUser();
+ $scmgitplugin = plugin_get_object('scmgit');
+ $GitRepositories = $this->getMyRepositoriesList();
+ if (count($GitRepositories)) {
+ $returnhtml = '<table>';
+ foreach ($GitRepositories as $GitRepository) {
+ $project = group_get_object($GitRepository);
+ $returnhtml .= '<tr><td><tt>git clone git+ssh://'.$user->getUnixName().'@' . $scmgitplugin->getBoxForProject($project) . forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/users/'. $user->getUnixName() .'.git</tt></p></td><tr>';
+ }
+ $returnhtml .= '</table>';
+ return $returnhtml;
+ } else {
+
+ return '<p class="information">'._('No personal git repository').'</p>';
+ }
+ */
+ return $html;
+ }
+ /*
+ function getMyRepositoriesList() {
+ $returnedArray = array();
+ $res = db_query_params('SELECT p.group_id FROM plugin_scmgit_personal_repos p, users u WHERE u.user_id=p.user_id AND u.unix_status = $1 AND u.user_id = $2',
+ array('A',$this->owner_id));
+ if (!$res) {
+ return $returnedArray;
+ } else {
+ $rows = db_numrows($res);
+ for ($i=0; $i<$rows; $i++) {
+ $returnedArray[] = db_result($res,$i,'group_id');
+ }
+ }
+ return $returnedArray;
+ }
+ */
+}
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+* Copyright 2011, Sabri LABBENE - Institut Télécom
+*
+* 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 Licence, 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 FusionForge; if not, write to the Free Software Foundation, Inc.,
+* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+require_once 'globaldashboard/common/manage_accounts_db_utils.php';
+require_once 'globaldashboard/include/globalDashboardConstants.php';
+require_once 'common/widget/Widget.class.php';
+require_once 'common/widget/WidgetLayoutManager.class.php';
+
+
+class globalDashboard_Widget_MyProjects extends Widget {
+
+ function __construct($owner_type, $plugin) {
+ $this->plugin = $plugin;
+ $this->Widget('plugin_globalDashboard_MyProjects');
+ }
+
+ function getTitle() {
+ return _("Projects on remote Software Forges");
+ }
+
+ function getCategory() {
+ return _('Global Dashboard Plugin');
+ }
+
+ function getDescription() {
+ return _("Lists user projects hosted on remote forge systems");
+ }
+
+ function getContent() {
+ global $HTML;
+ $user = session_get_user();
+ $MyProjects = $this->getUserRemoteProjects($user->getID());
+
+ $html='';
+ if(is_array($MyProjects)) {
+ $tablearr = array(_('My remote projects'),'');
+ $html .= $HTML->listTableTop($tablearr);
+
+ foreach ($MyProjects as $remote_account_projs) {
+ /*include_once("arc/ARC2.php");
+ require_once('plugins/extsubproj/include/Graphite.php');
+
+ $parser = ARC2::getRDFParser();
+ //$parser->parse('https://vm2.localdomain/projects/coinsuper/');
+ $parser->parse($url);
+ //print_r($parser);
+ $triples = $parser->getTriples();
+ //print_r($triples);
+ $turtle = $parser->toTurtle($triples);
+ $datauri = $parser->toDataURI($turtle);
+
+
+ $graph = new Graphite();
+ //$graph->setDebug(1);
+ $graph->ns( "doap", "http://usefulinc.com/ns/doap#" );
+ $graph->load( $datauri );
+ //print $graph->resource('https://vm2.localdomain/projects/coinsuper/')->dumpText();
+ $projname = $graph->resource( $url )->get( "doap:name" );
+ */
+/* $html = $html . '
+ <tr>
+ <td>
+ <!--<a href="http://'.$proj->getHomePage().'">'.$proj->getUnixName().'</a>
+ </td>
+ </tr>'; */
+ foreach ($remote_account_projs as $remote_proj) {
+ $html = $html . '
+ <tr>
+ <td>
+ '.print_r($remote_proj).'
+ </td>
+ </tr>';
+ }
+ //print_r($proj);
+
+ }
+ $html .= $HTML->listTableBottom();
+ }
+ return $html;
+ }
+
+ /**
+ *
+ * Fetches user remote projects from all forges
+ *
+ * @param integer $user_id
+ *
+ * @return array $projects
+ */
+ function getUserRemoteProjects($user_id){
+ $projects = array();
+ $accounts = getDBStoredRemoteAccountsByUserId($user_id);
+ if (count($accounts) > 0) {
+ foreach ($accounts as $account) {
+ $fetch_method = $this->getProjectsFetchMethodForAccount($account['account_id']);
+ switch ($fetch_method) {
+ case USER_PROJECTS_FETCH_METHOD_SOAP:
+ $soap_client = new SoapClient($account['forge_account_soap_wsdl_uri'], array('trace'=>false, 'exceptions'=>false));
+ $session_ser = $soap_client->__soapCall("login", array("userid" => $account['forge_account_login_name'], "passwd" => $account['forge_account_password']));
+ $result = $soap_client->__soapCall("userGetGroups", array("session_ser" => $session_ser, "user_id" => $user_id));
+ if (!is_a($result, "SoapFault")) {
+ $projects[] = soapToArray($result);
+ }
+ break;
+ case USER_PROJECTS_FETCH_METHOD_OSLC:
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ return $projects;
+ }
+
+ /**
+ *
+ * Converts an stdClass object to an array.
+ * @param stdClass $result
+ *
+ * @return array $array
+ */
+ function soapToArray(stdClass $result) {
+ $result = (array)$result;
+ foreach($result as $key => $value){
+ if(is_object($value)&&get_class($value)==='stdClass'){
+ $result[$key] = self::soapToArray($value);
+ }
+ }
+ return $result;
+ }
+
+ /**
+ *
+ * Returns fetch method of remote projects related to an account
+ *
+ * @param integer $account_id
+ *
+ * @return integer $method value corresponding to fetch method
+ */
+ function getProjectsFetchMethodForAccount($account_id) {
+ return getDBFetchMethod($account_id, 'projects');
+ }
+
+ /**
+ *
+ * Returns fetch method of remote artifacts related to an account
+ *
+ * @param integer $account_id
+ *
+ * @return integer $method value corresponding to fetch method
+ */
+ function getProjectsFetchMethodForAccount($account_id) {
+ return getDBFetchMethod($account_id, 'artifacts');
+ }
+}
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * Copyright 2011, Sabri LABBENE - Institut Télécom
+ *
+ *
+ * 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.
+ */
+
+/**
+ *
+ * Show user toolbar menu which contains "My Personal Page", "Account Maintenance"
+ * and so on ... + the link to this user plugin
+ *
+ * @param array $params
+ */
+function globaldashboard_header($params) {
+ site_user_header($params);
+}
+
+/**
+ * Show horizontal toolbar for Global Dashboard plugin section
+ * in "my" page menu.
+ */
+function globaldashboard_toolbar() {
+ $user = session_get_user();
+ $pluginname = getStringFromRequest('pluginname');
+ echo '<p><ul class="widget_toolbar">';
+ echo '<li>' . util_make_link ('/plugins/globaldashboard/admin/manage_accounts.php?type=user&id='. $user->getID().'&pluginname='.$pluginname,_('Manage Remote Accounts')).'</li>';
+ echo '<li>' . util_make_link ('/plugins/globaldashboard/help.php?type=user&id='. $user->getID().'&pluginname='.$pluginname, _('Help')).'</li>';
+ echo '</ul></p>';
+}
+
+/**
+ *
+ * Display the welcome message on the plugin index page
+ * and a few instrunctions to get started with it.
+ */
+function globaldashboard_body() {
+ echo '<p> Put here some welcome message that invites user to go to manage accounts'.
+ ' section and configure some remote accounts and then activate the plugins widgets'.
+ ' in his /my/ page </p>';
+}
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+
+/**
+ * globaldashboardPlugin Class
+ *
+ * Copyright 2011, Sabri LABBENE - Institut Télécom
+ *
+ * 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 globaldashboardPlugin extends Plugin {
+ public function __construct($id=0) {
+ $this->Plugin($id);
+ $this->name = "globaldashboard";
+ $this->text = "Global Dashboard"; // Text to show in the tabs
+
+ $this->_addHook("usermenu"); // Shows in the tabs an entry for the plugin.
+ $this->_addHook("userisactivecheckbox"); // The "use ..." checkbox in user account
+ $this->_addHook("userisactivecheckboxpost"); //
+
+ $this->_addHook('widget_instance'); // creates widgets when requested
+ $this->_addHook('widgets'); // declares which widgets are provided by the plugin
+ }
+
+ function usermenu() {
+ global $G_SESSION,$HTML;
+ $text = $this->text; // this is what shows in the tab
+ if ($G_SESSION->usesPlugin("globaldashboard")) {
+ $param = '?type=user&id=' . $G_SESSION->getId() . "&pluginname=" . $this->name; // we indicate the part we're calling is the user one
+ echo $HTML->PrintSubMenu (array ($text),
+ array ('/plugins/globaldashboard/index.php' . $param ), array());
+ }
+ }
+
+ function widgets(&$params) {
+ require_once('common/widget/WidgetLayoutManager.class.php');
+ if ($params['owner_type'] == WidgetLayoutManager::OWNER_TYPE_USER) {
+ $params['fusionforge_widgets'][] = 'plugin_globalDashboard_MyProjects';
+ $params['fusionforge_widgets'][] = 'plugin_globalDashboard_MyArtifacts';
+ }
+ return true;
+ }
+
+ /**
+ * Process the 'widget_instance' hook to create instances of the widgets
+ * @param array $params
+ */
+ function widget_instance($params) {
+ global $gfplugins;
+ //$user = UserManager::instance()->getCurrentUser();
+ require_once('common/widget/WidgetLayoutManager.class.php');
+ if ($params['widget'] == 'plugin_globalDashboard_MyProjects') {
+ require_once $gfplugins.$this->name.'/include/globalDashboard_Widget_MyProjects.php';
+ $params['instance'] = new globalDashboard_Widget_MyProjects(WidgetLayoutManager::OWNER_TYPE_USER, $this);
+ }
+ if ($params['widget'] == 'plugin_globalDashboard_MyArtifacts') {
+ require_once $gfplugins.$this->name.'/include/globalDashboard_Widget_MyArtifacts.php';
+ $params['instance'] = new globalDashboard_Widget_MyArtifacts(WidgetLayoutManager::OWNER_TYPE_USER, $this);
+ }
+ }
+
+ // TODO: move this to its corresponding widget.
+ function getMyArtifacts() {
+ return array('Artifact 1', 'Artifact 2');
+ }
+
+}
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>
\ No newline at end of file
--- /dev/null
+Source: @SRCPACKAGE@
+Section: devel
+Priority: optional
+Maintainer: Christian Bayle <bayle@debian.org>
+Uploaders: Roland Mas <lolando@debian.org>
+Build-Depends-Indep: devscripts
+Build-Depends: debhelper (>= 7), perl, gettext
+Standards-Version: 3.8.4
+Homepage: http://fusionforge.org/
+Vcs-Bzr: http://scm.fusionforge.org/bzr/fusionforge/svn-trunk-ro/
--- /dev/null
+Package: @PACKAGE@-plugin-globaldashboard
+Architecture: all
+Depends: @OLDPACKAGE@-common, @OLDPACKAGE@-db-postgresql | @OLDPACKAGE@-db, @OLDPACKAGE@-web-apache2 | @OLDPACKAGE@-web
+Description: Global Dashboard plugin for FusionForge that enable users to monitor
+ their data and data they are interested in and that lives in physically different
+ software forges. This plugin also fetches user private data from other forges using
+ OAuth Authentication. User Interface reuses widgets of fusionforge/codendi with some
+ client scripts in jQuery to display compact-previews for instance.
--- /dev/null
+ This plugin provides a dashboard in "my" page of the user that organizes user data living in different software
+ forges.
--- /dev/null
+etc/gforge/httpd.d
+etc/gforge/plugins/globaldashboard
+usr/share/gforge/plugins/globaldashboard/cgi-bin
+usr/share/gforge/plugins/globaldashboard/common
+usr/share/gforge/plugins/globaldashboard/www
--- /dev/null
+debian/README.Debian
--- /dev/null
+plugins/globaldashboard/common/* usr/share/@OLDPACKAGE@/plugins/globaldashboard/common/
+plugins/globaldashboard/include/* usr/share/@OLDPACKAGE@/plugins/globaldashboard/include/
+plugins/globaldashboard/db/* usr/share/@OLDPACKAGE@/plugins/globaldashboard/db/
+plugins/globaldashboard/bin/* usr/share/@OLDPACKAGE@/plugins/globaldashboard/bin/
+plugins/globaldashboard/www/* usr/share/@OLDPACKAGE@/plugins/globaldashboard/www/
+plugins/globaldashboard/cronjobs/* usr/share/@OLDPACKAGE@/cronjobs
+plugins/globaldashboard/etc/plugins/globaldashboard/* etc/@OLDPACKAGE@/plugins/globaldashboard/
+plugins/globaldashboard/etc/httpd.d/* usr/share/@OLDPACKAGE@/etc/httpd.d/
+plugins/globaldashboard/etc/globaldashboard.ini etc/@PACKAGE@/config.ini.d/
--- /dev/null
+/usr/share/gforge/plugins/globaldashboard/www /usr/share/gforge/www/plugins/globaldashboard
--- /dev/null
+#! /bin/sh -e
+
+if [ -e gforge/translations/gforge.pot ] ; then # We're in the parent dir
+ cd gforge
+elif [ -e translations/gforge.pot ] ; then # probably in gforge/ (or a renamed gforge/)
+ cd . # do nothing, but shell syntax requires an instruction in a then-block
+elif [ -e ../gforge/translations/gforge.pot ] ; then # in tools/ or tests/ or something
+ cd ../gforge
+elif [ -e ../translations/gforge.pot ] ; then # In a subdir of gforge/
+ cd ..
+else
+ echo "Couldn't find translations directory..."
+ exit 1
+fi
+
+locales=$(ls translations/*.po \
+ | xargs -n1 -iFILE basename FILE .po \
+ | egrep '^[a-z][a-z](_[A-Z][A-Z]$)?' \
+ | sort)
+
+print_stats () {
+ for l in $(echo $locales | xargs -n 1 | sort) ; do
+ printf "* %5s: " $l
+ msgfmt --statistics -o /dev/null translations/$l.po
+ done
+}
+
+case $1 in
+ stats)
+ print_stats
+ ;;
+ refresh)
+ rm translations/gforge.pot
+
+ find -type f -\( -name \*.php -or -name users -or -name projects -\) \
+ | grep -v -e {arch} -e svn-base \
+ | grep -v ^./plugins/wiki \
+ | LANG=C sort \
+ | xargs xgettext -d gforge -o translations/gforge.pot -L PHP --from-code=iso-8859-1
+
+ for l in $locales ; do
+ echo "Processing $l..."
+ msgmerge -U translations/$l.po translations/gforge.pot
+ done
+ ;;
+ build)
+ for l in $locales ; do
+ mkdir -p locales/$l/LC_MESSAGES
+ msgfmt -o locales/$l/LC_MESSAGES/gforge.mo translations/$l.po
+ done
+ ;;
+ *)
+ echo "Unknown operation"
+ exit 1
+ ;;
+esac
--- /dev/null
+<?php
+/**
+* Copyright 2011, Sabri LABBENE - Institut Télécom
+*
+*
+* 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('../../../env.inc.php');
+require_once $gfwww.'include/pre.php';
+
+$user_id = getIntFromPost('user_id');
+$login_name = getStringFromPost('login_name');
+$account_password = getStringFromPost('account_password');
+$account_domain = getStringFromPost('account_domain');
+$account_uri = getStringFromPost('account_uri');
+$oslc_uri = getStringFromPost('oslc_uri');
+$rss_uri = getStringFromPost('rss_uri');
+$soap_wsdl = getStringFromPost('soap_wsdl');
+$projects_discovery = getIntFromPost('projects_discovery_method');
+$artifacts_discovery = getIntFromPost('artifacts_discovery_method');
+
+$user = session_get_user();
+if($user->getID() != $user_id) {
+ session_redirect( '/plugins/globaldashboard/admin/manage_accounts.php?type=user&id='.$user_id.'&pluginname=globaldashboard&error_msg='. urlencode(_('You can add remote accounts ONLY for yourself !!!')));
+}
+
+$t_account_table = "plugin_globaldashboard_user_forge_account";
+
+$t_query = "INSERT INTO $t_account_table "
+ ." ( user_id, "
+ ."forge_account_login_name, "
+ ."forge_account_password, "
+ ."forge_account_domain, "
+ ."forge_account_uri, "
+ ."forge_oslc_discovery_uri, "
+ ."forge_account_rss_uri, "
+ ."forge_account_soap_wsdl_uri ) "
+ ."VALUES ( $1, $2, $3, $4, $5, $6, $7, $8 )";
+
+$result = db_query_params($t_query, array($user_id, $login_name, $account_password, $account_domain, $account_uri, $oslc_uri, $rss_uri, $soap_wsdl));
+
+if($result) {
+ $t_discovery_table = "plugin_globaldashboard_account_discovery";
+ $t_disc_query = "INSERT INTO $t_discovery_table "
+ ." ( account_id, "
+ ."projects_discovery_method, "
+ ."artifacts_discovery_method ) "
+ ."VALUES ( $1, $2, $3)";
+ $disc_result = db_query_params($t_disc_query, array(db_insertid($result, $t_account_table, 'account_id'), $projects_discovery, $artifacts_discovery));
+ if($disc_result) {
+ session_redirect( '/plugins/globaldashboard/admin/manage_accounts.php?type=user&id='.$user_id.'&pluginname=globaldashboard&feedback='. urlencode(_('Remote Account successfully created')));
+ } else {
+ session_redirect( '/plugins/globaldashboard/admin/manage_accounts.php?type=user&id='.$user_id.'&pluginname=globaldashboard&error_msg='. urlencode(printf('Remote account created but unable to create remote associated discovery parameters: '.db_error())));
+ }
+} else {
+ session_redirect( '/plugins/globaldashboard/admin/manage_accounts.php?type=user&id='.$user_id.'&pluginname=globaldashboard&error_msg='. urlencode(printf('Unable to create remote account: '.db_error())));
+}
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+* Copyright 2011, Sabri LABBENE - Institut Télécom
+*
+*
+* 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('../../../env.inc.php');
+require_once $gfwww.'include/pre.php';
+
+$account_id = getStringFromRequest('account_id');
+$user_id = getStringFromRequest('user_id');
+
+$user = session_get_user();
+if($user->getID() != $user_id) {
+ session_redirect( '/plugins/globaldashboard/admin/manage_accounts.php?type=user&id='.$user_id.'&pluginname=globaldashboard&error_msg='. urlencode(_('You can remove only YOUR remote accounts !!!')));
+}
+
+$t_account_table = "plugin_globaldashboard_user_forge_account";
+$t_query = "DELETE FROM $t_account_table WHERE account_id=$1 AND user_id=$2";
+
+$result = db_query_params($t_query, array($account_id, $user_id));
+if ($result) {
+ session_redirect( '/plugins/globaldashboard/admin/manage_accounts.php?type=user&id='.$user_id.'&pluginname=globaldashboard&feedback='. urlencode(_('Remote Account successfully deleted')));
+} else {
+ session_redirect( '/plugins/globaldashboard/admin/manage_accounts.php?type=user&id='.$user_id.'&pluginname=globaldashboard&error_msg='. urlencode(_('Unable to delete remote account: ').db_error()));
+}
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+* Copyright 2011, Sabri LABBENE - Institut Télécom
+*
+*
+* 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('../../../env.inc.php');
+require_once $gfwww.'include/pre.php';
+
+$account_id = getIntFromPost('account_id');
+$user_id = getIntFromPost('user_id');
+$login_name = getStringFromPost('login_name');
+$account_password = getStringFromPost('account_password');
+$account_domain = getStringFromPost('account_domain');
+$account_uri = getStringFromPost('account_uri');
+$oslc_uri = getStringFromPost('oslc_uri');
+$rss_uri = getStringFromPost('rss_uri');
+$soap_wsdl = getStringFromPost('soap_wsdl');
+$projects_discovery = getIntFromPost('projects_discovery_method');
+$artifacts_discovery = getIntFromPost('artifacts_discovery_method');
+
+$user = session_get_user();
+if($user->getID() != $user_id) {
+ session_redirect( '/plugins/globaldashboard/admin/manage_accounts.php?type=user&id='.$user_id.'&pluginname=globaldashboard&error_msg='. urlencode(_('You can edit only YOUR remote accounts !!!')));
+}
+
+$t_account_table = "plugin_globaldashboard_user_forge_account";
+
+$t_acc_query = "UPDATE $t_account_table ".
+ " SET forge_account_login_name=$1,".
+ " forge_account_password=$2,".
+ " forge_account_domain=$3,".
+ " forge_account_uri=$4,".
+ " forge_oslc_discovery_uri=$5,".
+ " forge_account_rss_uri=$6,".
+ " forge_account_soap_wsdl_uri=$7".
+ " WHERE account_id=$8".
+ " AND user_id=$9";
+
+$result = db_query_params( $t_acc_query, array( $login_name, $account_password, $account_domain, $account_uri, $oslc_uri,
+ $rss_uri, $soap_wsdl, $account_id, $user_id
+ )
+ );
+if ($result) {
+ // Now try to update discovery table
+ $t_discovery_table = "plugin_globaldashboard_account_discovery";
+ $t_disc_query = "UPDATE $t_discovery_table ".
+ " SET projects_discovery_method=$1,".
+ " artifacts_discovery_method=$2".
+ " WHERE account_id=$3";
+ $disc_result = db_query_params($t_disc_query, array($projects_discovery, $artifacts_discovery, $account_id));
+ if ($disc_result){
+ session_redirect( '/plugins/globaldashboard/admin/manage_accounts.php?type=user&id='.$user_id.'&pluginname=globaldashboard&feedback='. _('Remote Account successfully updated'));
+ } else {
+ session_redirect( '/plugins/globaldashboard/admin/manage_accounts.php?type=user&id='.$user_id.'&pluginname=globaldashboard&feedback='.printf('Unable to update remote account: '.db_error()));
+ }
+} else {
+ session_redirect( '/plugins/globaldashboard/admin/manage_accounts.php?type=user&id='.$user_id.'&pluginname=globaldashboard&feedback='.printf('Unable to update remote account: '.db_error()));
+}
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+* Copyright 2011, Sabri LABBENE - Institut Télécom
+*
+*
+* 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('../../../env.inc.php');
+require_once $gfwww.'include/pre.php';
+require_once $gfplugins.'globaldashboard/include/globalDashboard_utils.php';
+require_once $gfplugins.'globaldashboard/include/globalDashboardConstants.php';
+require_once $gfplugins.'globaldashboard/common/manage_accounts_db_utils.php';
+
+$user = session_get_user(); // get the user session
+
+if (!$user || !is_object($user) || $user->isError() || !$user->isActive()) {
+ exit_error("Invalid User", "Cannot Process your request for this user.");
+}
+
+$type = getStringFromRequest('type');
+$id = getStringFromRequest('id');
+$pluginname = getStringFromRequest('pluginname');
+$action = getStringFromRequest('action');
+
+if (!$type) {
+ exit_error("Cannot Process your request","No TYPE specified"); // you can create items in Base.tab and customize this messages
+} elseif (!$id) {
+ exit_error("Cannot Process your request","No ID specified");
+} else {
+ if ($type == 'user' && $action == 'edit') {
+ $realuser = user_get_object($id);//
+ if (!($realuser) || !($realuser->usesPlugin($pluginname))) {
+ exit_error("Error", "First activate the User's $pluginname plugin through Account Manteinance Page");
+ }
+ if ( (!$user) || ($user->getID() != $id)) {
+ // if someone else tried to access the private GlobalDashboard part of this user
+ exit_error("Access Denied", "You cannot access other user's personal $pluginname");
+ }
+ // show the header
+ globaldashboard_header(array('title'=> _('Remote Account Management')));
+ globaldashboard_toolbar();
+ editRemoteAccount(getStringFromRequest('account_id'));
+ }
+}
+site_project_footer(array());
+
+/**
+ *
+ * UI to edit a stored remote account.
+ * @param integer $account_id
+ */
+function editRemoteAccount($account_id) {
+ $account = array();
+ $account = getDBStoredRemoteAccountById($account_id);
+ echo '<p>
+ <form action="edit_account.php" method="POST">';
+ echo '
+ <fieldset>
+ <legend> '. _('Main account properties') . ' </legend>
+ <table>
+ <tr>
+ <td>' . _('User Name') . ': </td>
+ <td>
+ <input type="hidden" value="'. $account['account_id'] .'" name="account_id">
+ <input type="hidden" value="'. $account['user_id'] .'" name="user_id">
+ <input type="text" value="'.$account["forge_account_login_name"].'" name="login_name">
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td>' . _('Account password') . ': </td>
+ <td>
+ <input type="password" name="account_password">
+ </td>
+ </tr>
+ <tr>
+ <td>' . _('Account domain') . ': </td>
+ <td>
+ <input type="text" size="60" value="'.$account["forge_account_domain"].'" name="account_domain">
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td>' . _('Account URI') . ': </td>
+ <td>
+ <input type="text" size="60" value="'.$account["forge_account_uri"].'" name="account_uri">
+ </input>
+ </td>
+ </tr>
+ </table>
+ </fieldset>';
+
+ echo '
+ <fieldset>
+ <legend> '. _('Account Discovery Capabilities') . ' </legend>
+ <table>
+ <tr>
+ <td>' . _('OSLC Discovery URI') . ': </td>
+ <td>
+ <input type="text" size="60" value="'.$account["forge_oslc_discovery_uri"].'" name="oslc_uri">
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td>' . _('RSS Stream URI') . ': </td>
+ <td>
+ <input type="text" size="60" value="'.$account["forge_account_rss_uri"].'" name="rss_uri">
+ </td>
+ </tr>
+ <tr>
+ <td>' . _('SOAP WSDL URI') . ': </td>
+ <td>
+ <input type="text" size="60" value="'.$account['forge_account_soap_wsdl_uri'].'" name="soap_wsdl">
+ </td>
+ </tr>
+ </table>
+ </fieldset>';
+ $discovery = getDBAccountDiscoveryByAccountId($account_id);
+ echo '
+ <fieldset>
+ <legend>' . _('Ressources Discovery Parameters') . '</legend>
+ <table>
+ <tr>
+ <td>' . _('Projects discovery method') . ': </td>
+ <td>
+ <select name="projects_discovery_method">
+ <option value"'. USER_PROJECTS_FETCH_METHOD_NONE .'"';
+ if ($discovery['projects_discovery_method'] == USER_PROJECTS_FETCH_METHOD_NONE) {
+ echo 'selected="selected"';
+ }
+ echo '> None </option>
+ <option value="'. USER_PROJECTS_FETCH_METHOD_SOAP .'"';
+ if ($discovery['projects_discovery_method'] == USER_PROJECTS_FETCH_METHOD_SOAP) {
+ echo 'selected="selected"';
+ }
+ echo '> SOAP </option>
+ <option value="'. USER_PROJECTS_FETCH_METHOD_OSLC .'"';
+ if ($discovery['projects_discovery_method'] == USER_PROJECTS_FETCH_METHOD_OSLC) {
+ echo 'selected="selected"';
+ }
+ echo '> OSLC-CM </option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>' . _('Artifacts discovery method') . ': </td>
+ <td>
+ <select name="artifacts_discovery_method">
+ <option value="'. USER_ARTIFACTS_FETCH_METHOD_NONE .'"';
+ if($discovery['artifacts_discovery_method'] == USER_ARTIFACTS_FETCH_METHOD_NONE) {
+ echo 'selected="selected"';
+ }
+ echo '> None </option>
+ <option value="'. USER_ARTIFACTS_FETCH_METHOD_SOAP .'"';
+ if($discovery['artifacts_discovery_method'] == USER_ARTIFACTS_FETCH_METHOD_SOAP) {
+ echo 'selected="selected"';
+ }
+
+ echo '> SOAP </option>
+ <option value="'. USER_ARTIFACTS_FETCH_METHOD_OSLC .'"';
+ if($discovery['artifacts_discovery_method'] == USER_PROJECTS_FETCH_METHOD_OSLC) {
+ echo 'selected="selected"';
+ }
+ echo '> OSLC-CM </option>
+ </select>
+ </td>
+ </tr>
+ </table>
+ </fieldset>';
+
+ echo '<p style="text-align: center;">
+ <input type="submit" value="Submit account changes">
+ </p>
+ </form>
+ </p>';
+
+}
+?>
\ No newline at end of file
--- /dev/null
+<?php
+
+/*
+ * GlobalDashboard plugin
+ *
+ * Daniel Perez <danielperez.arg@gmail.com>
+ *
+ * This is an example to watch things in action. You can obviously modify things and logic as you see fit
+ */
+
+require_once('../../../env.inc.php');
+require_once $gfwww.'include/pre.php';
+require_once $gfconfig.'plugins/globaldashboard/config.php';
+
+// the header that displays for the user portion of the plugin
+function globaldashboard_Project_Header($params) {
+ global $DOCUMENT_ROOT,$HTML,$id;
+ $params['toptab']='globaldashboard';
+ $params['group']=$id;
+ /*
+ Show horizontal links
+ */
+ site_project_header($params);
+}
+
+// the header that displays for the project portion of the plugin
+function globaldashboard_User_Header($params) {
+ global $DOCUMENT_ROOT,$HTML,$user_id;
+ $params['toptab']='globaldashboard';
+ $params['user']=$user_id;
+ /*
+ Show horizontal links
+ */
+ site_user_header($params);
+}
+
+
+ $user = session_get_user(); // get the session user
+
+ if (!$user || !is_object($user) || $user->isError() || !$user->isActive()) {
+ exit_error("Invalid User", "Cannot Process your request for this user.");
+ }
+
+ $type = getStringFromRequest('type');
+ $id = getStringFromRequest('id');
+ $pluginname = getStringFromRequest('pluginname');
+
+ if (!$type) {
+ exit_error("Cannot Process your request","No TYPE specified"); // you can create items in Base.tab and customize this messages
+ } elseif (!$id) {
+ exit_error("Cannot Process your request","No ID specified");
+ } else {
+ if ($type == 'group') {
+ $group = group_get_object($id);
+ if ( !$group) {
+ exit_error("Invalid Project", "Inexistent Project");
+ }
+ if ( ! ($group->usesPlugin ( $pluginname )) ) {//check if the group has the GlobalDashboard plugin active
+ exit_error("Error", "First activate the $pluginname plugin through the Project's Admin Interface");
+ }
+ $userperm = $group->getPermission($user);//we'll check if the user belongs to the group (optional)
+ if ( !$userperm->IsMember()) {
+ exit_error("Access Denied", "You are not a member of this project");
+ }
+ // other perms checks here...
+ globaldashboard_Project_Header(array('title'=>$pluginname . ' Project Plugin!','pagename'=>"$pluginname",'sectionvals'=>array(group_getname($id))));
+ // DO THE STUFF FOR THE PROJECT PART HERE
+ echo "We are in the Project GlobalDashboard plugin <br>";
+ echo "Greetings from planet " . $world; // $world comes from the config file in /etc
+ } elseif ($type == 'user') {
+ $realuser = user_get_object($id);//
+ if (!($realuser) || !($realuser->usesPlugin($pluginname))) {
+ exit_error("Error", "First activate the User's $pluginname plugin through Account Manteinance Page");
+ }
+ if ( (!$user) || ($user->getID() != $id)) { // if someone else tried to access the private GlobalDashboard part of this user
+ exit_error("Access Denied", "You cannot access other user's personal $pluginname");
+ }
+ globaldashboard_User_Header(array('title'=>'My '.$pluginname,'pagename'=>"$pluginname",'sectionvals'=>array($realuser->getUnixName())));
+ // DO THE STUFF FOR THE USER PART HERE
+ echo "We are in the User GlobalDashboard plugin <br>";
+ echo "Greetings from planet " . $world; // $world comes from the config file in /etc
+ } elseif ($type == 'admin') {
+ $group = group_get_object($id);
+ if ( !$group) {
+ exit_error("Invalid Project", "Inexistent Project");
+ }
+ if ( ! ($group->usesPlugin ( $pluginname )) ) {//check if the group has the GlobalDashboard plugin active
+ exit_error("Error", "First activate the $pluginname plugin through the Project's Admin Interface");
+ }
+ $userperm = $group->getPermission($user);//we'll check if the user belongs to the group
+ if ( !$userperm->IsMember()) {
+ exit_error("Access Denied", "You are not a member of this project");
+ }
+ //only project admin can access here
+ if ( $userperm->isAdmin() ) {
+ globaldashboard_Project_Header(array('title'=>$pluginname . ' Project Plugin!','pagename'=>"$pluginname",'sectionvals'=>array(group_getname($id))));
+ // DO THE STUFF FOR THE PROJECT ADMINISTRATION PART HERE
+ echo "We are in the Project GlobalDashboard plugin <font color=\"#ff0000\">ADMINISTRATION</font> <br>";
+ echo "Greetings from planet " . $world; // $world comes from the config file in /etc
+ } else {
+ exit_error("Access Denied", "You are not a project Admin");
+ }
+ }
+ }
+
+ site_project_footer(array());
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+* Copyright 2011, Sabri LABBENE - Institut Télécom
+*
+*
+* 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('../../../env.inc.php');
+require_once $gfwww.'include/pre.php';
+require_once $gfplugins.'globaldashboard/include/globalDashboard_utils.php';
+require_once $gfplugins.'globaldashboard/include/globalDashboardConstants.php';
+require_once $gfplugins.'globaldashboard/common/manage_accounts_db_utils.php';
+
+$user = session_get_user(); // get the user session
+
+if (!$user || !is_object($user) || $user->isError() || !$user->isActive()) {
+ exit_error("Invalid User", "Cannot Process your request for this user.");
+}
+
+$type = getStringFromRequest('type');
+$id = getStringFromRequest('id');
+$pluginname = getStringFromRequest('pluginname');
+
+if (!$type) {
+ exit_error("Cannot Process your request","No TYPE specified"); // you can create items in Base.tab and customize this messages
+} elseif (!$id) {
+ exit_error("Cannot Process your request","No ID specified");
+} else {
+ if ($type == 'user') {
+ $realuser = user_get_object($id);//
+ if (!($realuser) || !($realuser->usesPlugin($pluginname))) {
+ exit_error("Error", "First activate the User's $pluginname plugin through Account Manteinance Page");
+ }
+ if ( (!$user) || ($user->getID() != $id)) {
+ // if someone else tried to access the private GlobalDashboard part of this user
+ exit_error("Access Denied", "You cannot access other user's personal $pluginname");
+ }
+ // show the header
+ globaldashboard_header(array('title'=> _('Global Dashboard Configuration')));
+ globaldashboard_toolbar();
+
+ listStoredRemoteAccounts($user->getID());
+ createNewAccountForm($user->getID());
+ }
+}
+site_project_footer(array());
+
+/**
+*
+* Displays the list of all stored remote accounts of the user.
+*
+* @param integer $user_id user id.
+*/
+function listStoredRemoteAccounts($user_id) {
+ global $HTML, $feedback;
+
+ //echo 'Here are stored accounts list';
+
+
+ $accounts = getDBStoredRemoteAccountsByUserId($user_id);
+ if (count($accounts) > 0) {
+ echo '<p>';
+ echo '<fieldset>';
+ echo '<legend> ' . _('Stored remote accounts') . ' </legend>';
+ $html = '';
+ $tablearr = array(_("User Name"), _("Remote site"), _("User account URL"), _("Action") );
+ $html .= $HTML->listTableTop($tablearr);
+ $i = 0;
+ foreach ($accounts as $account) {
+ $html = $html . '
+ <tr ' . $HTML->boxGetAltRowStyle($i++) . '>
+ <td><a href="'.$account['forge_account_uri'].'">'.$account['forge_account_login_name'].'</a>
+ </td>
+ <td><a href="'.$account['forge_account_domain'].'">'.$account['forge_account_domain'].'</a>
+ </td>
+ <td><a href="'.$account['forge_account_uri'].'">'.$account['forge_account_uri'].'</a>
+ </td>
+ <td><a href="/plugins/globaldashboard/admin/edit_account_page.php?type=user&id='.$user_id.'&pluginname=globaldashboard&action=edit&account_id='.$account['account_id'].'"> '. _("Edit") . ' </a>
+ <a href="/plugins/globaldashboard/admin/delete_account.php?account_id='.$account['account_id'].'&user_id='.$account['user_id'].'"> '. _("Delete") . ' </a>
+ </td>
+ </tr>';
+ }
+ $html .= $HTML->listTableBottom();
+ echo $html;
+ echo '</fieldset>';
+ echo '</p>';
+ }
+}
+
+/**
+*
+* Form to add new remote accounts
+*/
+function createNewAccountForm($user_id) {
+ echo '<p>
+ <form action="add_account.php" method="POST">';
+ echo '
+ <fieldset>
+ <legend> '. _('Create a new remote account') . ' </legend>
+ <table>
+ <tr>
+ <td>' . _('User Name') . ': <span class="requiredfield">*</span> </td>
+ <td>
+ <input type="hidden" value="'. $user_id .'" name="user_id">
+ <input type="text" name="login_name">
+ </td>
+ </tr>
+ <tr>
+ <td>' . _('Account password') . ': <span class="requiredfield">*</span> </td>
+ <td>
+ <input type="password" name="account_password">
+ </td>
+ </tr>
+ <tr>
+ <td>' . _('Account domain') . ': <span class="requiredfield">*</span> </td>
+ <td>
+ <input type="text" size="60" name="account_domain">
+ </td>
+ </tr>
+ <tr>
+ <td>' . _('Account URI') . ': <span class="requiredfield">*</span> </td>
+ <td>
+ <input type="text" size="60" name="account_uri">
+ </td>
+ </tr>
+ <tr>
+ <td>' . _('OSLC Discovery URI') . ': </td>
+ <td>
+ <input type="text" size="60" name="oslc_uri">
+ </td>
+ </tr>
+ <tr>
+ <td>' . _('RSS Stream URI') . ': </td>
+ <td>
+ <input type="text" size="60" name="rss_uri">
+ </td>
+ </tr>
+ <tr>
+ <td>' . _('SOAP WSDL URI') . ': </td>
+ <td>
+ <input type="text" size="60" name="soap_wsdl">
+ </td>
+ </tr>
+ </table>
+ </fieldset>';
+ echo '
+ <fieldset>
+ <legend>' . _('Ressources Discovery Parameters') . '</legend>
+ <table>
+ <tr>
+ <td>' . _('Projects discovery method') . ': </td>
+ <td>
+ <select name="projects_discovery_method">
+ <option value"'. USER_PROJECTS_FETCH_METHOD_NONE .'" selected="selected"> None </option>
+ <option value="'. USER_PROJECTS_FETCH_METHOD_SOAP .'"> SOAP </option>
+ <option value="'. USER_PROJECTS_FETCH_METHOD_OSLC .'"> OSLC-CM </option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>' . _('Artifacts discovery method') . ': </td>
+ <td>
+ <select name="artifacts_discovery_method">
+ <option value="'. USER_ARTIFACTS_FETCH_METHOD_NONE .'" selected="selected"> None </option>
+ <option value="'. USER_ARTIFACTS_FETCH_METHOD_SOAP .'"> SOAP </option>
+ <option value="'. USER_ARTIFACTS_FETCH_METHOD_OSLC .'"> OSLC-CM </option>
+ </select>
+ </td>
+ </tr>
+ </table>
+ </fieldset>';
+
+ echo ' <p style="text-align: center;">
+ <input type="submit" value="submit new account"></input>
+ </p>
+ </form>
+ </p>';
+}
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+* Copyright 2011, Sabri LABBENE - Institut Télécom
+*
+*
+* 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('../../env.inc.php');
+require_once $gfwww.'include/pre.php';
+require_once $gfplugins.'globaldashboard/include/globalDashboard_utils.php';
+
+$user = session_get_user(); // get the user session
+
+if (!$user || !is_object($user) || $user->isError() || !$user->isActive()) {
+ exit_error("Invalid User", "Cannot Process your request for this user.");
+}
+
+$type = getStringFromRequest('type');
+$id = getStringFromRequest('id');
+$pluginname = getStringFromRequest('pluginname');
+
+if (!$type) {
+ exit_error("Cannot Process your request","No TYPE specified"); // you can create items in Base.tab and customize this messages
+} elseif (!$id) {
+ exit_error("Cannot Process your request","No ID specified");
+} else {
+ if ($type == 'user') {
+ $realuser = user_get_object($id);//
+ if (!($realuser) || !($realuser->usesPlugin($pluginname))) {
+ exit_error("Error", "First activate the User's $pluginname plugin through Account Manteinance Page");
+ }
+ if ( (!$user) || ($user->getID() != $id)) {
+ // if someone else tried to access the private GlobalDashboard part of this user
+ exit_error("Access Denied", "You cannot access other user's personal $pluginname");
+ }
+ // show the header
+ globaldashboard_header(array('title'=> _('Global Dashboard Help')));
+ globaldashboard_toolbar();
+
+ echo '<p> This is Help section. @TODO: include few tips on how to use and config the plugin. </p>';
+ }
+}
+site_project_footer(array());
+?>
\ No newline at end of file
--- /dev/null
+<?php
+
+/*
+ * GlobalDashboard plugin
+ *
+ * Daniel Perez <danielperez.arg@gmail.com>
+ *
+ * This is an example to watch things in action. You can obviously modify things and logic as you see fit
+ */
+
+require_once('../../env.inc.php');
+require_once $gfwww.'include/pre.php';
+require_once $gfplugins.'globaldashboard/include/globalDashboard_utils.php';
+
+$user = session_get_user(); // get the session user
+
+if (!$user || !is_object($user) || $user->isError() || !$user->isActive()) {
+ exit_error("Invalid User", "Cannot Process your requglobaldashboardest for this user.");
+}
+
+$type = getStringFromRequest('type');
+$id = getStringFromRequest('id');
+$pluginname = getStringFromRequest('pluginname');
+
+if (!$type) {
+ exit_error("Cannot Process your request","No TYPE specified"); // you can create items in Base.tab and customize this messages
+} elseif (!$id) {
+ exit_error("Cannot Process your request","No ID specified");
+} else {
+ if ($type == 'user') {
+ $realuser = user_get_object($id);//
+ if (!($realuser) || !($realuser->usesPlugin($pluginname))) {
+ exit_error("Error", "First activate the User's $pluginname plugin through Account Maintenance Page");
+ }
+ if ( (!$user) || ($user->getID() != $id)) { // if someone else tried to access the private GlobalDashboard part of this user
+ exit_error("Access Denied", "You cannot access other user's personal $pluginname");
+ }
+ globaldashboard_header(array('title'=> _('Global Dashboard Configuration')));
+ globaldashboard_toolbar();
+ globaldashboard_body();
+ }
+}
+
+site_project_footer(array());
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>
\ No newline at end of file