diff --git a/plugins/Goals/lang/en.json b/plugins/Goals/lang/en.json index fa8e20ae07d549cc7c0d9ef0b27de00d7007a3aa..0545d0640f9ffa8f9d93186e3b2a8e79c92a41f6 100644 --- a/plugins/Goals/lang/en.json +++ b/plugins/Goals/lang/en.json @@ -76,7 +76,8 @@ "MatchesExpression": "matches the expression %s", "NewGoalIntro": "Goal Conversion tracking is one of the most efficient ways to measure and improve your business objectives.", "NewVisitorsConversionRateIs": "New visitors conversion rate is %s", - "NoGoalsNeedAccess": "Only an Administrator or a user with Super User access can add Goals for a given website. Please ask your Piwik administrator to set up a Goal for your website. <br>Tracking Goals is a great way to help understand and maximize your website performance!", + "NoGoalsNeedAccess": "Only an Administrator or a user with Super User access can manage Goals for a given website. Please ask your Piwik administrator to set up a Goal for your website. <br>Tracking Goals is a great way to help understand and maximize your website performance!", + "NeedAccess": "Only an Administrator or a user with Super User access can manage Goals for a given website.", "Optional": "(optional)", "OverallConversionRate": "%s overall conversion rate (visits with a completed goal)", "OverallRevenue": "%s overall revenue", @@ -103,4 +104,4 @@ "WhereVisitedPageManuallyCallsJavascriptTrackerLearnMore": "where the visited page contains a call to the JavaScript 'trackGoal' method (%slearn more%s)", "YouCanEnableEcommerceReports": "You can enable %s for this website in the %s page." } -} \ No newline at end of file +} diff --git a/plugins/Goals/templates/_addEditGoal.twig b/plugins/Goals/templates/_addEditGoal.twig index dc217c9a66fdc69c561056bbfa513c8c2fdd955a..79a9491afcc75bc269c58a862d48738182de6a7f 100644 --- a/plugins/Goals/templates/_addEditGoal.twig +++ b/plugins/Goals/templates/_addEditGoal.twig @@ -7,12 +7,14 @@ {% if onlyShowAddNewGoal is not defined %} {% include "@Goals/_listGoalEdit.twig" %} {% endif %} - {% include "@Goals/_formAddGoal.twig" %} - {% if onlyShowAddNewGoal is not defined %} - <div class='entityCancel' style='display:none;'> - {{ 'General_OrCancel'|translate("<a class='entityCancelLink'>","</a>")|raw }} - </div> + {% if userCanEditGoals %} + {% include "@Goals/_formAddGoal.twig" %} + {% if onlyShowAddNewGoal is not defined %} + <div class='entityCancel' style='display:none;'> + {{ 'General_OrCancel'|translate("<a class='entityCancelLink'>","</a>")|raw }} + </div> + {% endif %} {% endif %} <a id='bottom'></a> </div> @@ -27,33 +29,38 @@ }; var mappingMatchTypeExamples = { "url": "{{ 'General_ForExampleShort'|translate }} {{ 'Goals_Contains'|translate("'checkout/confirmation'") }} \ - <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_IsExactly'|translate("'http://example.com/thank-you.html'") }} \ - <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_MatchesExpression'|translate("'(.*)\\\/demo\\\/(.*)'") }}", + <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_IsExactly'|translate("'http://example.com/thank-you.html'") }} \ + <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_MatchesExpression'|translate("'(.*)\\\/demo\\\/(.*)'") }}", "title": "{{ 'General_ForExampleShort'|translate }} {{ 'Goals_Contains'|translate("'Order confirmation'") }}", "file": "{{ 'General_ForExampleShort'|translate }} {{ 'Goals_Contains'|translate("'files/brochure.pdf'") }} \ - <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_IsExactly'|translate("'http://example.com/files/brochure.pdf'") }} \ - <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_MatchesExpression'|translate("'(.*)\\\.zip'") }}", + <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_IsExactly'|translate("'http://example.com/files/brochure.pdf'") }} \ + <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_MatchesExpression'|translate("'(.*)\\\.zip'") }}", "external_website": "{{ 'General_ForExampleShort'|translate }} {{ 'Goals_Contains'|translate("'amazon.com'") }} \ - <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_IsExactly'|translate("'http://mypartner.com/landing.html'") }} \ - <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_MatchesExpression'|translate("'http://www.amazon.com\\\/(.*)\\\/yourAffiliateId'") }}", + <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_IsExactly'|translate("'http://mypartner.com/landing.html'") }} \ + <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_MatchesExpression'|translate("'http://www.amazon.com\\\/(.*)\\\/yourAffiliateId'") }}", "event": "{{ 'General_ForExampleShort'|translate }} {{ 'Goals_Contains'|translate("'video'") }} \ - <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_IsExactly'|translate("'click'") }} \ - <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_MatchesExpression'|translate("'(.*)_banner'") }}" + <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_IsExactly'|translate("'click'") }} \ + <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_MatchesExpression'|translate("'(.*)_banner'") }}" }; $(document).ready(function () { - bindGoalForm(); + {% if userCanEditGoals %} + bindGoalForm(); - {% if onlyShowAddNewGoal is not defined %} - piwik.goals = {{ goalsJSON|raw }}; - bindListGoalEdit(); + {% if onlyShowAddNewGoal is not defined %} + piwik.goals = {{ goalsJSON|raw }}; + bindListGoalEdit(); - {% if idGoal %} - editGoal({{ idGoal|e('js') }}); + {% if idGoal %} + editGoal({{ idGoal|e('js') }}); + {% else %} + showEditGoals(); + {% endif %} {% else %} - showEditGoals(); + initAndShowAddGoalForm(); {% endif %} {% else %} - initAndShowAddGoalForm(); + piwik.goals = {{ goalsJSON|raw }}; + showEditGoals(); {% endif %} }); diff --git a/plugins/Goals/templates/_listGoalEdit.twig b/plugins/Goals/templates/_listGoalEdit.twig index 2d8a87ca414ad10875133bd0f717838344376375..3275bbc3936045eed7695154b9bef48d28da7474 100644 --- a/plugins/Goals/templates/_listGoalEdit.twig +++ b/plugins/Goals/templates/_listGoalEdit.twig @@ -6,8 +6,10 @@ <th>{{ 'Goals_GoalName'|translate }}</th> <th>{{ 'Goals_GoalIsTriggeredWhen'|translate }}</th> <th>{{ 'General_ColumnRevenue'|translate }}</th> - <th>{{ 'General_Edit'|translate }}</th> - <th>{{ 'General_Delete'|translate }}</th> + {% if userCanEditGoals %} + <th>{{ 'General_Edit'|translate }}</th> + <th>{{ 'General_Delete'|translate }}</th> + {% endif %} </tr> </thead> {% if goals is empty %} @@ -32,22 +34,24 @@ <td class="text-center"> {% if goal.revenue==0 %}-{% else %}{{ goal.revenue|money(idSite)|raw }}{% endif %} </td> - <td class="text-center"> - <button id="{{ goal.idgoal }}" class="edit-goal btn btn-flat btn-lg" title="{{ 'General_Edit'|translate }}"> - <span class="icon-edit"></span> - </button> - </td> - <td class="text-center"> - <button id="{{ goal.idgoal }}" class="delete-goal btn btn-flat btn-lg" title="{{ 'General_Delete'|translate }}"> - <span class="icon-delete"></span> - </button> - </td> + {% if userCanEditGoals %} + <td class="text-center"> + <button id="{{ goal.idgoal }}" class="edit-goal btn btn-flat btn-lg" title="{{ 'General_Edit'|translate }}"> + <span class="icon-edit"></span> + </button> + </td> + <td class="text-center"> + <button id="{{ goal.idgoal }}" class="delete-goal btn btn-flat btn-lg" title="{{ 'General_Delete'|translate }}"> + <span class="icon-delete"></span> + </button> + </td> + {% endif %} </tr> {% endfor %} {% endif %} </table> - {% if onlyShowAddNewGoal is not defined %} + {% if userCanEditGoals and onlyShowAddNewGoal is not defined %} <p> <button id="add-goal" class="btn btn-lg btn-flat"> <span class="icon-add"></span> diff --git a/plugins/Goals/templates/addNewGoal.twig b/plugins/Goals/templates/addNewGoal.twig index 3bb52e543a103dd06032a879e7ff5f652acd2c3d..a2b44b88e93b227a34b855af00cc997bb388711c 100644 --- a/plugins/Goals/templates/addNewGoal.twig +++ b/plugins/Goals/templates/addNewGoal.twig @@ -17,4 +17,5 @@ <p> {{ 'Goals_LearnMoreAboutGoalTrackingDocumentation'|translate("<a href='?module=Proxy&action=redirect&url=http://piwik.org/docs/tracking-goals-web-analytics/' target='_blank'>","</a>")|raw }} </p> + {% endif %} diff --git a/plugins/Goals/templates/editGoals.twig b/plugins/Goals/templates/editGoals.twig index a88f1e38a18c1e41a49e658f3beb8ab63a67c8c1..76b64b991859f9f7e0eb761700e8b600014b6643 100644 --- a/plugins/Goals/templates/editGoals.twig +++ b/plugins/Goals/templates/editGoals.twig @@ -6,12 +6,11 @@ {% else %} - <h2>{{ 'Goals_AddNewGoal'|translate }}</h2> + <h2>{{ 'Goals_ManageGoals'|translate }}</h2> <p> - {{ 'Goals_NoGoalsNeedAccess'|translate|raw }} - </p> - <p> - {{ 'Goals_LearnMoreAboutGoalTrackingDocumentation'|translate("<a href='?module=Proxy&action=redirect&url=http://piwik.org/docs/tracking-goals-web-analytics/' target='_blank'>","</a>")|raw }} + {{ 'Goals_NeedAccess'|translate|raw }} </p> -{% endif %} \ No newline at end of file + {% include "@Goals/_addEditGoal.twig" %} + +{% endif %}