[Fusionforge-commits] r16091 - in trunk/src/plugins/webanalytics: action common view/admin www

Franck VILLAUME nerville at fusionforge.org
Thu Aug 16 14:44:39 CEST 2012


Author: nerville
Date: 2012-08-16 14:44:38 +0200 (Thu, 16 Aug 2012)
New Revision: 16091

Added:
   trunk/src/plugins/webanalytics/action/updateLinkValue.php
   trunk/src/plugins/webanalytics/view/admin/updateLinkValue.php
Modified:
   trunk/src/plugins/webanalytics/action/deleteLink.php
   trunk/src/plugins/webanalytics/action/updateLinkStatus.php
   trunk/src/plugins/webanalytics/common/webanalyticsPlugin.class.php
   trunk/src/plugins/webanalytics/view/admin/viewGlobalConfiguration.php
   trunk/src/plugins/webanalytics/www/index.php
Log:
webanalytics enhancement : edit js code

Modified: trunk/src/plugins/webanalytics/action/deleteLink.php
===================================================================
--- trunk/src/plugins/webanalytics/action/deleteLink.php	2012-08-16 12:25:46 UTC (rev 16090)
+++ trunk/src/plugins/webanalytics/action/deleteLink.php	2012-08-16 12:44:38 UTC (rev 16091)
@@ -1,4 +1,4 @@
- <?php
+<?php
 /**
  * webanalytics plugin
  *

Modified: trunk/src/plugins/webanalytics/action/updateLinkStatus.php
===================================================================
--- trunk/src/plugins/webanalytics/action/updateLinkStatus.php	2012-08-16 12:25:46 UTC (rev 16090)
+++ trunk/src/plugins/webanalytics/action/updateLinkStatus.php	2012-08-16 12:44:38 UTC (rev 16091)
@@ -1,4 +1,4 @@
- <?php
+<?php
 /**
  * webanalytics plugin
  *

Added: trunk/src/plugins/webanalytics/action/updateLinkValue.php
===================================================================
--- trunk/src/plugins/webanalytics/action/updateLinkValue.php	                        (rev 0)
+++ trunk/src/plugins/webanalytics/action/updateLinkValue.php	2012-08-16 12:44:38 UTC (rev 16091)
@@ -0,0 +1,39 @@
+<?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');
+$link = getStringFromRequest('link');
+$name = getStringFromRequest('name');
+
+if (!empty($idLink) && !empty($link)) {
+	if ($webanalytics->updateLink($idLink, $link, $name)) {
+		$feedback = _('Link 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));
+}
+?>
\ No newline at end of file

Modified: trunk/src/plugins/webanalytics/common/webanalyticsPlugin.class.php
===================================================================
--- trunk/src/plugins/webanalytics/common/webanalyticsPlugin.class.php	2012-08-16 12:25:46 UTC (rev 16090)
+++ trunk/src/plugins/webanalytics/common/webanalyticsPlugin.class.php	2012-08-16 12:44:38 UTC (rev 16091)
@@ -124,6 +124,23 @@
 		return false;
 	}
 
+	function getLink($idLink) {
+		$res = db_query_params('select * from plugin_webanalytics where id_webanalytics = $1', array($idLink));
+		if (db_numrows($res) == 1) {
+			return db_fetch_array($res);
+		}
+		return false;
+	}
+
+	function updateLink($idLink, $url, $name) {
+		$res = db_query_params('update plugin_webanalytics set url = $1, name = $2, code = $3 where id_webanalytics = $4',
+				array(htmlspecialchars($url), $name, $url, $idLink));
+		if ($res) {
+			return true;
+		}
+		return false;
+	}
+
 	/**
 	 * getHeader - initialize header and js
 	 *

Added: trunk/src/plugins/webanalytics/view/admin/updateLinkValue.php
===================================================================
--- trunk/src/plugins/webanalytics/view/admin/updateLinkValue.php	                        (rev 0)
+++ trunk/src/plugins/webanalytics/view/admin/updateLinkValue.php	2012-08-16 12:44:38 UTC (rev 16091)
@@ -0,0 +1,52 @@
+<?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.
+ */
+
+global $HTML;
+global $webanalytics;
+
+session_require_global_perm('forge_admin');
+$linkId = getIntFromRequest('linkid');
+
+$linkValues = $webanalytics->getLink($linkId);
+if (is_array($linkValues)) {
+	echo '<form method="POST" name="updateLink" action="index.php?type=globaladmin&action=updateLinkValue">';
+	echo '<table><tr>';
+	echo $HTML->boxTop(_('Update this link'));
+	echo '<td>'._('Informative Name').'</td><td><input name="name" type="text" maxsize="255" value="'.$linkValues['name'].'" /></td>';
+	echo '</tr><tr>';
+	echo '<td>'._('Standard JavaScript Tracking code.').'</td><td><textarea name="link" rows="15" cols="70" >'.$linkValues['url'].'</textarea></td>';
+	echo '</tr><tr>';
+	echo '<td>';
+	echo '<input type="hidden" name="linkid" value="'.$linkId.'" />';
+	echo '<input type="submit" value="'. _('Update') .'" />';
+	echo '<a href="/plugins/'.$webanalytics->name.'/?type=globaladmin"><input type="button" value="'. _('Cancel') .'" /></a>';
+	echo '</td>';
+	echo $HTML->boxBottom();
+	echo '</tr></table>';
+	echo '</form>';
+} else {
+	$error_msg = _('Cannot retrieve value for this link:').' '.$linkId;
+	session_redirect('plugins/'.$webanalytics->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+}
+
+?> 

Modified: trunk/src/plugins/webanalytics/view/admin/viewGlobalConfiguration.php
===================================================================
--- trunk/src/plugins/webanalytics/view/admin/viewGlobalConfiguration.php	2012-08-16 12:25:46 UTC (rev 16090)
+++ trunk/src/plugins/webanalytics/view/admin/viewGlobalConfiguration.php	2012-08-16 12:44:38 UTC (rev 16091)
@@ -43,6 +43,7 @@
 			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="'._('Edit this link').'" href="index.php?type=globaladmin&view=updateLinkValue&linkid='.$link['id_webanalytics'].'">'.html_image('docman/edit-file.png',22,22, array('alt'=>_('Edit 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>';

Modified: trunk/src/plugins/webanalytics/www/index.php
===================================================================
--- trunk/src/plugins/webanalytics/www/index.php	2012-08-16 12:25:46 UTC (rev 16090)
+++ trunk/src/plugins/webanalytics/www/index.php	2012-08-16 12:44:38 UTC (rev 16091)
@@ -43,6 +43,7 @@
 		switch ($action) {
 			case 'addLink':
 			case 'deleteLink':
+			case 'updateLinkValue':
 			case 'updateLinkStatus': {
 				global $gfplugins;
 				include($gfplugins.$webanalytics->name.'/action/'.$action.'.php');
@@ -50,7 +51,16 @@
 			}
 		}
 		$webanalytics->getHeader('globaladmin');
-		$webanalytics->getGlobalAdminView();
+		$view = getStringFromRequest('view');
+		switch ($view) {
+			case 'updateLinkValue':
+				global $gfplugins;
+				include($gfplugins.$webanalytics->name.'/view/admin/'.$view.'.php');
+				break;
+			default:
+				$webanalytics->getGlobalAdminView();
+				break;
+		}
 		break;
 	}
 }




More information about the Fusionforge-commits mailing list