diff options
author | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2008-12-24 20:14:35 +0300 |
---|---|---|
committer | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2008-12-24 20:14:35 +0300 |
commit | 61fd945f630be9f81256de18c61b63cba8c518ae (patch) | |
tree | 383c3ad9a3bd6faf9c2209809724310a355e0f5f /plugins | |
parent | 72588f19bd9684d9b4ea2f2b291b014bf8b42b87 (diff) |
- adding CacheFile for caching data used in Tracker/* code
- adding form to add / edit a Goal
- fixing line ending to Unix
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/CoreAdminHome/templates/styles.css | 10 | ||||
-rw-r--r-- | plugins/Goals/API.php | 74 | ||||
-rw-r--r-- | plugins/Goals/Controller.php | 23 | ||||
-rw-r--r-- | plugins/Goals/Goals.php | 21 | ||||
-rw-r--r-- | plugins/Goals/templates/GoalForm.js | 89 | ||||
-rw-r--r-- | plugins/Goals/templates/add_edit_goal.tpl | 142 | ||||
-rw-r--r-- | plugins/Goals/templates/list_top_segment.tpl | 2 | ||||
-rw-r--r-- | plugins/Goals/templates/overview.tpl | 11 | ||||
-rw-r--r-- | plugins/Goals/templates/single_goal.tpl | 21 | ||||
-rw-r--r-- | plugins/Goals/templates/title_and_evolution_graph.tpl | 2 | ||||
-rw-r--r-- | plugins/Installation/templates/firstWebsiteSetup.tpl | 3 | ||||
-rw-r--r-- | plugins/SitesManager/templates/SitesManager.js | 16 | ||||
-rw-r--r-- | plugins/UsersManager/templates/UsersManager.js | 2 |
13 files changed, 360 insertions, 56 deletions
diff --git a/plugins/CoreAdminHome/templates/styles.css b/plugins/CoreAdminHome/templates/styles.css index 6bf24d65b4..758e61f7b8 100644 --- a/plugins/CoreAdminHome/templates/styles.css +++ b/plugins/CoreAdminHome/templates/styles.css @@ -14,16 +14,6 @@ a { color: black; } -#ajaxError { - color: red; - text-align: center; - font-weight: bold; - width: 550px; - border: 3px solid red; - margin: 10px; - padding: 10px; -} - table.admin { font-size: 0.9em; font-family: Arial, Helvetica, verdana sans-serif; diff --git a/plugins/Goals/API.php b/plugins/Goals/API.php index 0c377fc3fa..7417bd1988 100644 --- a/plugins/Goals/API.php +++ b/plugins/Goals/API.php @@ -25,6 +25,80 @@ class Piwik_Goals_API return self::$instance; } + static public function getGoals( $idSite ) + { + $goals = Zend_Registry::get('db')->fetchAll("SELECT * + FROM ".Piwik_Common::prefixTable('goal')." + WHERE idsite = ? + AND deleted = 0", $idSite); + $cleanedGoals = array(); + foreach($goals as &$goal) + { + unset($goal['idsite']); + $cleanedGoals[$goal['idgoal']] = $goal; + } + return $cleanedGoals; + } + + public function addGoal( $idSite, $name, $matchAttribute, $pattern, $patternType, $revenue ) + { + Piwik::checkUserHasAdminAccess($idSite); + // save in db + $db = Zend_Registry::get('db'); + $idGoal = $db->fetchOne("SELECT max(idgoal) + 1 + FROM ".Piwik::prefixTable('goal')." + WHERE idsite = ?", $idSite); + if($idGoal == false) + { + $idGoal = 1; + } + $name = urldecode($name); + $pattern = urldecode($pattern); + $db->insert(Piwik::prefixTable('goal'), + array( + 'idsite' => $idSite, + 'idgoal' => $idGoal, + 'name' => $name, + 'match_attribute' => $matchAttribute, + 'pattern' => $pattern, + 'pattern_type' => $patternType, + 'revenue' => $revenue, + 'deleted' => 0, + )); + Piwik_Common::regenerateCacheWebsiteAttributes($idSite); + return $idGoal; + } + + public function updateGoal( $idSite, $idGoal, $name, $matchAttribute, $pattern, $patternType, $revenue ) + { + Piwik::checkUserHasAdminAccess($idSite); + $name = urldecode($name); + $pattern = urldecode($pattern); + Zend_Registry::get('db')->update( Piwik::prefixTable('goal'), + array( + 'name' => $name, + 'match_attribute' => $matchAttribute, + 'pattern' => $pattern, + 'pattern_type' => $patternType, + 'revenue' => $revenue, + ), + "idsite = '$idSite' AND idgoal = '$idGoal'" + ); + Piwik_Common::regenerateCacheWebsiteAttributes($idSite); + } + + public function deleteGoal( $idSite, $idGoal ) + { + Piwik::checkUserHasAdminAccess($idSite); + Zend_Registry::get('db')->query("UPDATE ".Piwik::prefixTable('goal')." + SET deleted = 1 + WHERE idsite = ? + AND idgoal = ?", + array($idSite, $idGoal)); + $db->query("DELETE FROM ".Piwik::prefixTable("log_conversion")." WHERE idgoal = ?", $idGoal); + Piwik_Common::regenerateCacheWebsiteAttributes($idSite); + } + public function getConversionsReturningVisitors( $idSite, $period, $date, $idGoal = false ) { diff --git a/plugins/Goals/Controller.php b/plugins/Goals/Controller.php index 4eb60725b7..42fa706150 100644 --- a/plugins/Goals/Controller.php +++ b/plugins/Goals/Controller.php @@ -1,11 +1,19 @@ <?php +require_once "Goals/API.php"; + class Piwik_Goals_Controller extends Piwik_Controller { const CONVERSION_RATE_PRECISION = 1; function goalReport() { $idGoal = Piwik_Common::getRequestVar('idGoal', null, 'int'); - $goalDefinition = Piwik_Tracker_GoalManager::getGoalDefinition($idGoal); + $idSite = Piwik_Common::getRequestVar('idSite'); + $goals = Piwik_Goals_API::getGoals($idSite); + if(!isset($goals[$idGoal])) + { + throw new Exception("idgoal $idGoal not valid."); + } + $goalDefinition = $goals[$idGoal]; $view = new Piwik_View('Goals/templates/single_goal.tpl'); $view->currency = Piwik::getCurrency(); @@ -99,15 +107,18 @@ class Piwik_Goals_Controller extends Piwik_Controller $goalMetrics = array(); - $goals = Piwik_Tracker_GoalManager::getGoalDefinitions(); - foreach($goals as $goal) + $idSite = Piwik_Common::getRequestVar('idSite'); + $goals = Piwik_Goals_API::getGoals($idSite); + foreach($goals as $idGoal => $goal) { - $goalId = $goal['id']; - $goalMetrics[$goalId] = $this->getMetricsForGoal($goalId); - $goalMetrics[$goalId]['name'] = $goal['name']; + $goalMetrics[$idGoal] = $this->getMetricsForGoal($idGoal); + $goalMetrics[$idGoal]['name'] = $goal['name']; } $view->goalMetrics = $goalMetrics; + $view->goals = $goals; + $view->goalsJSON = json_encode($goals); + $view->userCanEditGoals = Piwik::isUserHasAdminAccess($idSite); echo $view->render(); } diff --git a/plugins/Goals/Goals.php b/plugins/Goals/Goals.php index 653bfd9182..ae13724c44 100644 --- a/plugins/Goals/Goals.php +++ b/plugins/Goals/Goals.php @@ -21,11 +21,12 @@ class Piwik_Goals extends Piwik_Plugin public function getInformation() { $info = array( - 'name' => 'Goal Tracking', + 'name' => '(ALPHA) Goal Tracking', 'description' => 'Create Goals and see reports about your goal conversions: evolution over time, revenue per visit, conversions per referer, per keyword, etc.', 'author' => 'Piwik', 'homepage' => 'http://piwik.org/', 'version' => '0.1', + 'TrackerPlugin' => true ); return $info; @@ -34,6 +35,7 @@ class Piwik_Goals extends Piwik_Plugin function getListHooksRegistered() { $hooks = array( + 'Common.fetchWebsiteAttributes' => 'fetchGoalsFromDb', 'ArchiveProcessing_Day.compute' => 'archiveDay', 'ArchiveProcessing_Period.compute' => 'archivePeriod', 'WidgetsList.add' => 'addWidgets', @@ -42,6 +44,17 @@ class Piwik_Goals extends Piwik_Plugin return $hooks; } + function fetchGoalsFromDb($notification) + { + require_once "Goals/API.php"; + $info = $notification->getNotificationInfo(); + $idsite = $info['idsite']; + + // add the 'goal' entry in the website array + $array =& $notification->getNotificationObject(); + $array['goals'] = Piwik_Goals_API::getGoals($idsite); + } + function addWidgets() { // Piwik_AddWidget( 'Referers', 'getKeywords', Piwik_Translate('Referers_WidgetKeywords')); @@ -50,10 +63,10 @@ class Piwik_Goals extends Piwik_Plugin function addMenus() { Piwik_AddMenu('Goals', 'Overview', array('module' => 'Goals')); - $goals = Piwik_Tracker_GoalManager::getGoalDefinitions(); + $goals = Piwik_Tracker_GoalManager::getGoalDefinitions(Piwik_Common::getRequestVar('idSite')); foreach($goals as $goal) { - Piwik_AddMenu('Goals', $goal['name'], array('module' => 'Goals', 'action' => 'goalReport', 'idGoal' => $goal['id'])); + Piwik_AddMenu('Goals', str_replace('%', '%%', $goal['name']), array('module' => 'Goals', 'action' => 'goalReport', 'idGoal' => $goal['idgoal'])); } } @@ -85,7 +98,7 @@ class Piwik_Goals extends Piwik_Plugin $archiveProcessing = $notification->getNotificationObject(); $metricsToSum = array( 'nb_conversions', 'revenue'); - $goalIdsToSum = Piwik_Tracker_GoalManager::getGoalIds(); + $goalIdsToSum = Piwik_Tracker_GoalManager::getGoalIds($archiveProcessing->idsite); $fieldsToSum = array(); foreach($metricsToSum as $metricName) diff --git a/plugins/Goals/templates/GoalForm.js b/plugins/Goals/templates/GoalForm.js new file mode 100644 index 0000000000..27e250c5ca --- /dev/null +++ b/plugins/Goals/templates/GoalForm.js @@ -0,0 +1,89 @@ + +function showAddNewGoal() +{ + $("#GoalForm").show(); + $("#EditGoals").hide(); + lazyScrollTo("#bottom", 100); + return false; +} + +function showEditGoals() +{ + $("#EditGoals").show(); + $("#GoalForm").hide(); + lazyScrollTo("#bottom", 100); + return false; +} + +// init the goal form with existing goal value, if any +function initGoalForm(goalMethodAPI, submitText, goalName, matchAttribute, pattern, patternType, revenue, goalId) +{ + $('#goal_name').val(goalName); + $('input[@name=match_attribute][value='+matchAttribute+']').attr('checked', true); + $('#match_attribute_name').html(mappingMatchTypeName[matchAttribute]); + $('#examples_pattern').html(mappingMatchTypeExamples[matchAttribute]); + $('option[value='+patternType+']').attr('selected', true); + $('input[name=pattern]').val(pattern); + $('input[name=revenue]').val(revenue); + $('input[name=methodGoalAPI]').val(goalMethodAPI); + $('#goal_submit').val(submitText); + if(goalId != undefined) { + $('input[name=goalIdUpdate]').val(goalId); + } +} + +function bindGoalForm() +{ + $('input[@name=match_attribute]').click( function() { + var matchTypeId = $(this).attr('value'); + $('#match_attribute_name').html(mappingMatchTypeName[matchTypeId]); + $('#examples_pattern').html(mappingMatchTypeExamples[matchTypeId]); + }); + + $('#goal_submit').click( function() { + // prepare ajax query to API to add goal + ajaxRequestAddGoal = getAjaxAddGoal(); + $.ajax( ajaxRequestAddGoal ); + return false; + }); +} + +function getAjaxDeleteGoal(idGoal) +{ + var ajaxRequest = getStandardAjaxConf(); + toggleAjaxLoading(); + + var parameters = new Object; + parameters.idSite = piwik.idSite; + parameters.idGoal = idGoal; + parameters.method = 'Goals.deleteGoal'; + parameters.module = 'API'; + parameters.format = 'json'; + parameters.token_auth = piwik.token_auth; + ajaxRequest.data = parameters; + return ajaxRequest; +} + +function getAjaxAddGoal() +{ + var ajaxRequest = getStandardAjaxConf(); + toggleAjaxLoading(); + + var parameters = new Object; + + parameters.idSite = piwik.idSite; + parameters.name = encodeURIComponent( $('#goal_name').val() ); + parameters.matchAttribute = $('input[name=match_attribute][checked]').val(); + parameters.patternType = $('[name=pattern_type]').val(); + parameters.pattern = encodeURIComponent( $('input[name=pattern]').val() ); + parameters.revenue = $('input[name=revenue]').val(); + + parameters.idGoal = $('input[name=goalIdUpdate]').val(); + parameters.method = $('input[name=methodGoalAPI]').val(); + parameters.module = 'API'; + parameters.format = 'json'; + parameters.token_auth = piwik.token_auth; + + ajaxRequest.data = parameters; + return ajaxRequest; +}
\ No newline at end of file diff --git a/plugins/Goals/templates/add_edit_goal.tpl b/plugins/Goals/templates/add_edit_goal.tpl new file mode 100644 index 0000000000..1f0220bcf6 --- /dev/null +++ b/plugins/Goals/templates/add_edit_goal.tpl @@ -0,0 +1,142 @@ + +<div id="AddEditGoals"> + + <h2><a href='#' name="linkAddNewGoal">+ Add a new Goal</a> + or <a href='#' name="linkEditGoals">Edit</a> existing Goals</h2> + + <script> + piwik.goals = {$goalsJSON}; + </script> + + <div> + <div id="ajaxError" style="display:none"></div> + <div id="ajaxLoading" style="display:none"><div id="loadingPiwik"><img src="themes/default/images/loading-blue.gif" alt="" /> {'General_LoadingData'|translate}</div></div> + </div> + + <span id='EditGoals' style="display:none;"> + <table class="tableForm"> + <thead style="font-weight:bold"> + <td>Id</td> + <td>Goal Name</td> + <td>Goal is Triggered when</td> + <td>Revenue</td> + <td>Edit</td> + <td>Delete</td> + </thead> + {foreach from=$goals item=goal} + <tr> + <td>{$goal.idgoal}</td> + <td>{$goal.name}</td> + <td>{$goal.match_attribute} <br>Pattern {$goal.pattern_type}: {$goal.pattern}</b></td> + <td>{if $goal.revenue==0}-{else}{$currency}{$goal.revenue}{/if}</td> + <td><a href='#' name="linkEditGoal" id="{$goal.idgoal}"><img src='plugins/UsersManager/images/edit.png' border=0> Edit</a></td> + <td><a href='#' name="linkDeleteGoal" id="{$goal.idgoal}"><img src='plugins/UsersManager/images/remove.png' border=0> Delete</a></td> + </tr> + {/foreach} + </table> + </span> + + <span id='GoalForm' style="display:none;"> + <form> + <table class="tableForm"> + <tr> + <td>Goal Name </td> + <td><input type="text" name="name" value="" id="goal_name" /></td> + </tr> + <tr> + <td>Goal is triggered when visitors:</td> + <td> + <input type="radio" onclick="" checked="true" id="match_attribute_url" value="url" name="match_attribute"/> + <label for="match_attribute_url">Visit a given URL (page or group of pages)</label> + <br> + <input type="radio" onclick="" id="match_attribute_file" value="file" name="match_attribute"/> + <label for="match_attribute_file">Download a file</label> + <br> + <input type="radio" onclick="" id="match_attribute_external_website" value="external_website" name="match_attribute"/> + <label for="match_attribute_external_website">Click on a Link to an external website </label> + </td> + </tr> + <tr> + <td>where the <span id="match_attribute_name"></span></td> + <td> + <select name="pattern_type"> + <option value="contains">contains</option> + <option value="exact">is exactly</option> + <option value="regex">matches the expression</option> + </select> + + <input type="text" name="pattern" value=""/> + <br> + <div id="examples_pattern"></div> + </td> + </tr> + <tr> + <td>(optional) Goal default value is </td> + <td>{$currency} <input type="text" name="revenue" size="1" value="0"/></td> + </tr> + <tr> + <td colspan="2" style="border:0"> + <div class="submit"> + <input type="hidden" name="methodGoalAPI" value=""> + <input type="hidden" name="goalIdUpdate" value=""> + <input type="submit" value="Add Goal" name="submit" id="goal_submit" class="submit" /> + </div> + </td> + </tr> + </table> + </form> + </span> + + <a id='bottom'></a> +</div> + +{literal} +<style> +#examples_pattern { + color:#9B9B9B; +} +</style> +<script type="text/javascript" src="plugins/Goals/templates/GoalForm.js"></script> +<script language="javascript"> +var mappingMatchTypeName = { + "url": "URL", + "file": "filename", + "external_website": "external website URL" +}; +var mappingMatchTypeExamples = { + "url": "eg. contains 'checkout/confirmation'<br>eg. is exactly 'http://example.com/thank-you.html'<br>eg. matches the expression '[.*]\\\/demo\\\/[.*]'", + "file": "eg. contains 'files/brochure.pdf'<br>eg. is exactly 'http://example.com/files/brochure.pdf'<br>eg. matches the expression '[.*]\\\.zip'", + "external_website": "eg. contains 'amazon.com'<br>eg. is exactly 'http://mypartner.com/landing.html'<br>eg. matches the expression 'http://www.amazon.com\\\/[.*]\\\/yourAffiliateId'" +}; + +$('a[name=linkEditGoal]').click( function() { + var goalId = $(this).attr('id'); + var goal = piwik.goals[goalId]; + initGoalForm("Goals.updateGoal", "Update Goal", goal.name, goal.match_attribute, goal.pattern, goal.pattern_type, goal.revenue, goalId); + showAddNewGoal(); + return false; +}); + +$('a[name=linkDeleteGoal]').click( function() { + var goalId = $(this).attr('id'); + var goalName = 'test goal';//piwik.goals[goalId][name] + if(confirm(sprintf('Are you sure you want to delete the Goal %s?','"'+goalName+'"'))) + { + $.ajax( getAjaxDeleteGoal( goalId ) ); + return false; + } +}); + +bindGoalForm(); + +$('a[name=linkAddNewGoal]').click( function(){ + initGoalForm('Goals.addGoal', 'Add Goal', '', 'url', '', 'contains', '0'); + return showAddNewGoal(); +} ); +$('a[name=linkEditGoals]').click( function(){ + return showEditGoals(); +} ); + +</script> + +{/literal} diff --git a/plugins/Goals/templates/list_top_segment.tpl b/plugins/Goals/templates/list_top_segment.tpl index af15799e3a..6dbe69813f 100644 --- a/plugins/Goals/templates/list_top_segment.tpl +++ b/plugins/Goals/templates/list_top_segment.tpl @@ -2,4 +2,4 @@ {foreach from=$topSegment item=element name=topGoalElements} <span class='goalTopElement' title='<b>{$element.nb_conversions}</b> conversions, <b>{$element.conversion_rate}%</b> conversion rate'> {$element.name}</span>{logoHtml metadata=$element.metadata alt=$element.name}{if $smarty.foreach.topGoalElements.iteration == $smarty.foreach.topGoalElements.total-1} and {elseif $smarty.foreach.topGoalElements.iteration < $smarty.foreach.topGoalElements.total-1}, {else}{/if} -{/foreach} (<a href=''>more</a>) +{/foreach} {* (<a href=''>more</a>) *} diff --git a/plugins/Goals/templates/overview.tpl b/plugins/Goals/templates/overview.tpl index d64db9a31e..a17611066d 100644 --- a/plugins/Goals/templates/overview.tpl +++ b/plugins/Goals/templates/overview.tpl @@ -1,10 +1,12 @@ + {include file="Goals/templates/title_and_evolution_graph.tpl"} + {foreach from=$goalMetrics item=goal} {assign var=nb_conversions value=$goal.nb_conversions} {assign var=conversion_rate value=$goal.conversion_rate} -<h2>{$goal.name} (goal)</h2> +<h3 style="text-decoration:underline;padding-top:20px">{$goal.name} (goal)</h3> <table width=700px> <tr><td> <p>{sparkline src=$goal.urlSparklineConversions}<span> @@ -13,11 +15,12 @@ <p>{sparkline src=$goal.urlSparklineConversionRate}<span> {'%s conversion rate'|translate:"<strong>$conversion_rate%</strong>"}</span></p> </td><td> - (<a href=''>more</a>) + {* (<a href=''>more</a>) *} </td></tr> </table> {/foreach} -<h2><a href=''>+ Add a new Goal</a></h2> - +{if $userCanEditGoals} + {include file=Goals/templates/add_edit_goal.tpl} +{/if} diff --git a/plugins/Goals/templates/single_goal.tpl b/plugins/Goals/templates/single_goal.tpl index 5a3d7ad3ca..bb04e6f01b 100644 --- a/plugins/Goals/templates/single_goal.tpl +++ b/plugins/Goals/templates/single_goal.tpl @@ -1,22 +1,21 @@ - {include file="Goals/templates/title_and_evolution_graph.tpl"} - - -<h2>Conversions Overview</h2> -<ul class="ulGoalTopElements"> -<li>Your best converting countries are: {include file='Goals/templates/list_top_segment.tpl' topSegment=$topSegments.country}</li> -<li>Your top converting keywords are: {include file='Goals/templates/list_top_segment.tpl' topSegment=$topSegments.keyword}</li> -<li>Your best converting websites referers are: {include file='Goals/templates/list_top_segment.tpl' topSegment=$topSegments.website}</li> -<li>Returning visitors conversion rate is <b>{$conversion_rate_returning}%</b>, New Visitors conversion rate is <b>{$conversion_rate_new}%</b></li> -</ul> - +{if $nb_conversions > 0} + <h2>Conversions Overview</h2> + <ul class="ulGoalTopElements"> + <li>Your best converting countries are: {include file='Goals/templates/list_top_segment.tpl' topSegment=$topSegments.country}</li> + <li>Your top converting keywords are: {include file='Goals/templates/list_top_segment.tpl' topSegment=$topSegments.keyword}</li> + <li>Your best converting websites referers are: {include file='Goals/templates/list_top_segment.tpl' topSegment=$topSegments.website}</li> + <li>Returning visitors conversion rate is <b>{$conversion_rate_returning}%</b>, New Visitors conversion rate is <b>{$conversion_rate_new}%</b></li> + </ul> +{/if} {literal} <style> ul.ulGoalTopElements { list-style-type:circle; + margin-left:30px; } .ulGoalTopElements a { text-decoration:none; diff --git a/plugins/Goals/templates/title_and_evolution_graph.tpl b/plugins/Goals/templates/title_and_evolution_graph.tpl index 64f616abea..f5359132d9 100644 --- a/plugins/Goals/templates/title_and_evolution_graph.tpl +++ b/plugins/Goals/templates/title_and_evolution_graph.tpl @@ -1,11 +1,9 @@ <script type="text/javascript" src="plugins/CoreHome/templates/sparkline.js"></script> - <a name="evolutionGraph" graphId="{$nameGraphEvolution}"></a> <h2>{$title}</h2> {$graphEvolution} - <table> <tr><td> <p>{sparkline src=$urlSparklineConversions}<span> diff --git a/plugins/Installation/templates/firstWebsiteSetup.tpl b/plugins/Installation/templates/firstWebsiteSetup.tpl index ca83f4ccd8..3c0446bc3c 100644 --- a/plugins/Installation/templates/firstWebsiteSetup.tpl +++ b/plugins/Installation/templates/firstWebsiteSetup.tpl @@ -9,8 +9,6 @@ <h1>{'Installation_SetupWebsite'|translate}</h1>
-
-
{if isset($errorMessage)}
<div class="error">
<img src="themes/default/images/error_medium.png">
@@ -20,7 +18,6 @@ </div>
{/if}
-
{if isset($form_data)}
{include file=default/genericForm.tpl}
{/if}
diff --git a/plugins/SitesManager/templates/SitesManager.js b/plugins/SitesManager/templates/SitesManager.js index df6b3ed9f1..8ebfedd3b3 100644 --- a/plugins/SitesManager/templates/SitesManager.js +++ b/plugins/SitesManager/templates/SitesManager.js @@ -1,15 +1,3 @@ - -function getEncoded(siteName) -{ - // compatible with old browsers but wouldnt work for UTF8 strings - if (encodeURIComponent) { - siteName = encodeURIComponent(siteName); - } else { - siteName = escape(siteName); - } - return siteName; -} - function getDeleteSiteAJAX( idSite ) { var ajaxRequest = getStandardAjaxConf(); @@ -41,7 +29,7 @@ function getAddSiteAJAX( row ) request += '&module=API'; request += '&format=json'; request += '&method=SitesManager.addSite'; - siteName = getEncoded(siteName); + siteName = encodeURIComponent(siteName); request += '&siteName='+siteName; $.each(urls, function (key,value){ request+= '&urls[]='+escape(value);} ); request += '&token_auth=' + piwik.token_auth; @@ -64,7 +52,7 @@ function getUpdateSiteAJAX( row ) request += '&module=API'; request += '&format=json'; request += '&method=SitesManager.updateSite'; - siteName = getEncoded(siteName); + siteName = encodeURIComponent(siteName); request += '&siteName='+siteName; request += '&idSite='+idSite; $.each(urls, function (key,value){ if(value.length>1) request+= '&urls[]='+value;} ); diff --git a/plugins/UsersManager/templates/UsersManager.js b/plugins/UsersManager/templates/UsersManager.js index a4e772ab97..966ea73ea5 100644 --- a/plugins/UsersManager/templates/UsersManager.js +++ b/plugins/UsersManager/templates/UsersManager.js @@ -185,7 +185,7 @@ $(document).ready( function() { .toggle() .parent() .prepend( $('<img src="plugins/UsersManager/images/ok.png" class="updateuser">') - .click( function(){ $.ajax( getUpdateUserAJAX( $('tr#'+idRow) ) ); } ) + .click( function(){ $.ajax( getUpdateUserAJAX( $('tr#'+idRow) ) ); } ) ); }); |