src/plugins/twitter/packaging/links/plugin-twitter -text
src/plugins/twitter/www/checks.php -text
src/plugins/twitter/www/index.php -text
+src/plugins/webanalytics/action/addLink.php -text
+src/plugins/webanalytics/action/deleteLink.php -text
+src/plugins/webanalytics/action/updateLinkStatus.php -text
+src/plugins/webanalytics/common/webanalytics-init.php -text
+src/plugins/webanalytics/common/webanalyticsPlugin.class.php -text
+src/plugins/webanalytics/db/webanalytics-init.sql -text
+src/plugins/webanalytics/etc/webanalytics.ini -text
+src/plugins/webanalytics/view/admin/viewGlobalConfiguration.php -text
+src/plugins/webanalytics/www/index.php -text
src/plugins/wiki/README -text
src/plugins/wiki/common/WikiGroupSearchEngine.class.php -text
src/plugins/wiki/common/WikiHtmlSearchRenderer.class.php -text
* scmgit: basic activity support (TrivialDev).
* scmhg: merge patch from Denise Patzker: add http support, online browse, stats (TrivialDev)
* Docman: Files moves to filesystem using the Storage generic class (TrivialDev)
+* webanalytics: new plugin to add support for piwik or google analytics tool (TrivialDev)
FusionForge-5.2:
* Docman: inject zip as a tree (Capgemini)
--- /dev/null
+<?php
+/**
+ * webanalytics plugin
+ *
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * 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 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.
+ */
+
+global $webanalytics;
+
+session_require_global_perm('forge_admin');
+$link = getStringFromRequest('link');
+$name = getStringFromRequest('name');
+
+if (!empty($link) && !empty($name)) {
+ if ($webanalytics->addLink($link, $name)) {
+ $feedback = _('Task succeeded.');
+ session_redirect('plugins/'.$webanalytics->name.'/?type=globaladmin&feedback='.urlencode($feedback));
+ }
+ $error_msg = _('Task failed');
+ session_redirect('plugins/'.$webanalytics->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+}
+$warning_msg = _('Missing Link URL or name.');
+session_redirect('plugins/'.$webanalytics->name.'/?type=globaladmin&warning_msg='.urlencode($warning_msg));
+
+?>
\ No newline at end of file
--- /dev/null
+ <?php
+/**
+ * webanalytics plugin
+ *
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * 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 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.
+ */
+
+global $webanalytics;
+
+session_require_global_perm('forge_admin');
+$idLink = getIntFromRequest('linkid');
+
+if (!empty($idLink)) {
+ if ($webanalytics->deleteLink($idLink)) {
+ $feedback = _('Link deleted');
+ session_redirect('plugins/'.$webanalytics->name.'/?type=globaladmin&feedback='.urlencode($feedback));
+ }
+ $error_msg = _('Task failed');
+ session_redirect('plugins/'.$webanalytics->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+}
+$warning_msg = _('Missing Link to be deleted.');
+session_redirect('plugins/'.$webanalytics->name.'/?type=globaladmin&warning_msg='.urlencode($warning_msg));
+
+?>
--- /dev/null
+ <?php
+/**
+ * webanalytics plugin
+ *
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * 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 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.
+ */
+
+global $webanalytics;
+
+session_require_global_perm('forge_admin');
+$idLink = getIntFromRequest('linkid');
+$linkStatus = getIntFromRequest('linkstatus');
+
+if (!empty($idLink)) {
+ if ($webanalytics->updateLinkStatus($idLink, $linkStatus)) {
+ $feedback = _('Link Status updated');
+ session_redirect('plugins/'.$webanalytics->name.'/?type=globaladmin&feedback='.urlencode($feedback));
+ }
+ $error_msg = _('Task failed');
+ session_redirect('plugins/'.$webanalytics->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+}
+$warning_msg = _('Missing Link or status to be updated.');
+session_redirect('plugins/'.$webanalytics->name.'/?type=globaladmin&warning_msg='.urlencode($warning_msg));
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ *
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * 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 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.
+ */
+
+global $gfplugins;
+require_once $gfplugins.'webanalytics/common/webanalyticsPlugin.class.php';
+
+$webanalyticsPluginObject = new webanalyticsPlugin;
+
+register_plugin($webanalyticsPluginObject);
+
+?>
--- /dev/null
+<?php
+
+/**
+ * webanalyticsPlugin Class
+ *
+ * Copyright 2012 Franck Villaume - TrivialDev
+ * 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 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.
+ */
+
+class webanalyticsPlugin extends Plugin {
+
+ function __construct() {
+ $this->Plugin() ;
+ $this->name = "webanalytics" ;
+ $this->text = "webanalytics" ;
+ $this->_addHook('webanalytics_url');
+ $this->_addHook('webanalytics_admin');
+ $this->_addHook('site_admin_option_hook');
+ }
+
+ function CallHook ($hookname, &$params) {
+ switch ($hookname) {
+ case "webanalytics_url": {
+ echo $this->getWebAnalyticsCodes();
+ $returned = true;
+ break;
+ }
+ case "webanalytics_admin":
+ case "site_admin_option_hook": {
+ echo '<li>'.$this->getAdminOptionLink().'</li>';
+ $returned = true;
+ break;
+ }
+ }
+ return $returned;
+ }
+
+ function getAdminOptionLink() {
+ return util_make_link('/plugins/'.$this->name.'/?type=globaladmin', _('Global WebAnalytics admin'), array('class' => 'tabtitle', 'title' => _('Direct link to global configuration of this plugin.')));
+ }
+
+ function getWebAnalyticsCodes() {
+ $codesFromDb = db_query_params('select code FROM plugin_webanalytics where is_enable = $1', array(1));
+ $codesString = '';
+ while ($arr = db_fetch_array($codesFromDb)) {
+ $codesString .= $arr['code'];
+ }
+ return $codesString;
+ }
+
+ /**
+ * getAvailableLinks - get all the links from the db
+ *
+ * @return array the available links
+ */
+ function getAvailableLinks() {
+ $links = db_query_params('select * FROM plugin_webanalytics', array());
+ $availableLinks = array();
+ while ($arr = db_fetch_array($links)) {
+ $availableLinks[] = $arr;
+ }
+ return $availableLinks;
+ }
+
+ /**
+ * addLink - add a new valid link
+ *
+ * @param string the url
+ * @param string an informative name
+ * @return bool success or not
+ */
+ function addLink($url, $name) {
+ if (!empty($url)) {
+ $res = db_query_params('insert into plugin_webanalytics (url, name, code, is_enable)
+ values ($1, $2, $3, $4)',
+ array(
+ htmlspecialchars($url),
+ $name,
+ $url,
+ 1,
+ ));
+ if (!$res)
+ return false;
+
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * deleteLink - delete a link
+ *
+ * @param int the link id
+ * @return bool success or not
+ */
+ function deleteLink($idLink) {
+ $res = db_query_params('delete from plugin_webanalytics where id_webanalytics = $1', array($idLink));
+ if ($res) {
+ return true;
+ }
+ return false;
+ }
+
+ function updateLinkStatus($idLink, $linkStatus) {
+ $res = db_query_params('update plugin_webanalytics set is_enable = $1 where id_webanalytics = $2', array($linkStatus, $idLink));
+ if ($res) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * getHeader - initialize header and js
+ *
+ * @param string type : user, project, globaladmin (aka group)
+ * @return bool success or not
+ */
+ function getHeader($type) {
+ global $gfplugins;
+ $returned = false;
+ switch ($type) {
+ case 'globaladmin': {
+ session_require_global_perm('forge_admin');
+ global $gfwww;
+ require_once($gfwww.'admin/admin_utils.php');
+ use_javascript('/js/sortable.js');
+ site_admin_header(array('title'=>_('Site Global Webanalytics Admin'), 'toptab' => ''));
+ $returned = true;
+ break;
+ }
+ }
+ return $returned;
+ }
+
+ /**
+ * getGlobalAdminView - display the Global Admin View
+ *
+ * @return bool true
+ */
+ function getGlobalAdminView() {
+ global $gfplugins;
+ $user = session_get_user();
+ include $gfplugins.$this->name.'/view/admin/viewGlobalConfiguration.php';
+ return true;
+ }
+
+ /**
+ * getPluginDescription - display the description of this plugin in pluginman admin page
+ *
+ * @return string the description
+ */
+ function getPluginDescription() {
+ return _('Get the ability to configure specific URL for web analytics tool such as Piwik or Google Analytics.');
+ }
+}
+?>
\ No newline at end of file
--- /dev/null
+CREATE TABLE plugin_webanalytics (
+ id_webanalytics serial PRIMARY KEY,
+ url text,
+ name character varying(255),
+ is_enable integer DEFAULT 0
+);
--- /dev/null
+[webanalytics]
+
+; current webanalytics status is valid
+; 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
--- /dev/null
+<?php
+/**
+ * webanalyticsPlugin Global Configuration View
+ *
+ * Copyright 2012 Franck Villaume - TrivialDev
+ * 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 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.
+ */
+
+global $HTML;
+global $webanalytics;
+
+session_require_global_perm('forge_admin');
+
+$linksArray = $webanalytics->getAvailableLinks();
+if (sizeof($linksArray)) {
+ echo $HTML->boxTop(_('Manage available links'));
+ $tabletop = array(_('Name'), _('Standard JavaScript Tracking code'), _('Is Active'), _('Actions'));
+ $classth = array('','','','unsortable');
+ echo $HTML->listTableTop($tabletop, false, 'sortable_webanalytics_listlinks', 'sortable', $classth);
+ foreach ($linksArray as $link) {
+ echo '<tr>';
+ echo '<td>'.$link['name'].'</td>';
+ echo '<td><code>'.$link['url'].'</code></td>';
+ if ($link['is_enable']) {
+ echo '<td>'.html_image('docman/validate.png', 22, 22, array('alt'=>_('link is on'), 'class'=>'tabtitle', 'title'=>_('link is on'))).'</td>';
+ echo '<td><a class="tabtitle-ne" title="'._('Desactivate this link').'" href="index.php?type=globaladmin&action=updateLinkStatus&linkid='.$link['id_webanalytics'].'&linkstatus=0">'.html_image('docman/release-document.png', 22, 22, array('alt'=>_('Desactivate this link'))). '</a>';
+ } else {
+ echo '<td>'.html_image('docman/delete-directory.png', 22, 22, array('alt'=>_('link is off'), 'class'=>'tabtitle', 'title'=>_('link is off'))).'</td>';
+ echo '<td><a class="tabtitle-ne" title="'._('Activate this link').'" href="index.php?type=globaladmin&action=updateLinkStatus&linkid='.$link['id_webanalytics'].'&linkstatus=1">'.html_image('docman/reserve-document.png', 22, 22, array('alt'=>_('Activate this link'))). '</a>';
+ }
+ echo '<a class="tabtitle-ne" title="'._('Delete this link').'" href="index.php?type=globaladmin&action=deleteLink&linkid='.$link['id_webanalytics'].'">'.html_image('docman/trash-empty.png',22,22, array('alt'=>_('Delete this link'))). '</a>';
+ echo '</td>';
+ echo '</tr>';
+ }
+ echo $HTML->listTableBottom();
+ echo $HTML->boxBottom();
+ echo '</br>';
+}
+
+echo '<form method="POST" name="addLink" action="index.php?type=globaladmin&action=addLink">';
+echo '<table><tr>';
+echo $HTML->boxTop(_('Add a new webanalytics reference'));
+echo '<td>'._('Standard JavaScript Tracking code.').'</td><td><textarea name="link" rows="15" cols="70">'._('Just paste your code here...').'</textarea></td>';
+echo '</tr><tr>';
+echo '<td>'._('Informative Name').'</td><td><input name="name" type="text" maxsize="255" /></td>';
+echo '</tr><tr>';
+echo '<td>';
+echo '<input type="submit" value="'. _('Add') .'" />';
+echo '</td>';
+echo $HTML->boxBottom();
+echo '</tr></table>';
+echo '</form>';
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * webanalytics plugin
+ *
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * 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 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('../../env.inc.php');
+require_once $gfcommon.'include/pre.php';
+
+$type = getStringFromRequest('type');
+
+if (!$type) {
+ exit_missing_param($_SERVER['HTTP_REFERER'], array('No TYPE specified'), 'webanalytics');
+}
+
+global $use_tooltips;
+$webanalytics = plugin_get_object('webanalytics');
+
+switch ($type) {
+ case 'globaladmin': {
+ if (!session_loggedin()) {
+ exit_not_logged_in();
+ }
+ session_require_global_perm('forge_admin');
+ $action = getStringFromRequest('action');
+ switch ($action) {
+ case 'addLink':
+ case 'deleteLink':
+ case 'updateLinkStatus': {
+ global $gfplugins;
+ include($gfplugins.$webanalytics->name.'/action/'.$action.'.php');
+ break;
+ }
+ }
+ $webanalytics->getHeader('globaladmin');
+ $webanalytics->getGlobalAdminView();
+ break;
+ }
+}
+
+site_project_footer(array());
+?>
\ No newline at end of file
<h2><?php echo _('Stats'); ?></h2>
<ul>
- <li><?php echo util_make_link ('/stats/',_('Site-Wide Stats')); ?></li>
+ <li><?php echo util_make_link('/stats/',_('Site-Wide Stats')); ?></li>
+ <?php plugin_hook('webanalytics_admin', array()); ?>
</ul>
<h2><?php echo _('Trove Project Tree'); ?></h2>
* Copyright 2010-2011, Alain Peyrat - Alcatel-Lucent
* Copyright © 2011 Thorsten Glaser – tarent GmbH
* Copyright 2011 - Marc-Etienne Vargenau, Alcatel-Lucent
+ * Copyright 2012 - Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
<?php echo $this->navigation->getPoweredBy(); ?>
</div>
- <?php echo $this->navigation->getShowSource(); ?>
+ <?php echo $this->navigation->getShowSource();
+
+ plugin_hook('webanalytics_url', array());
+
+ ?>
</body>
</html>
echo '<div class="footer">' . "\n";
echo $this->navigation->getPoweredBy();
echo $this->navigation->getShowSource();
- echo '<div style="clear:both"></div></div></body></html>' . "\n";
+ echo '<div style="clear:both"></div></div>';
+ plugin_hook('webanalytics_url', array());
+ echo '</body></html>' . "\n";
}
/**
* Copyright 2010 (c) FusionForge Team
* Copyright 2010-2011, Alain Peyrat - Alcatel-Lucent
* Copyright 2011, Franck Villaume - Capgemini
- * Copyright 2011, Franck Villaume - TrivialDev
+ * Copyright 2011-2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
' . $this->navigation->getShowSource() . '
';
+ plugin_hook('webanalytics_url', array());
+
echo '
</body>
</html>