Skip to content
Extraits de code Groupes Projets
Valider 66ffa877 rédigé par sgiehl's avatar sgiehl
Parcourir les fichiers

fixes #3379 added possibility to allow super user to copy the current dashboard to another user

git-svn-id: http://dev.piwik.org/svn/trunk@7357 59fd770c-687e-43c8-a1e3-f5a4ff64c105
parent 98f75abc
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -698,6 +698,8 @@ $translations = array(
'Dashboard_EmptyDashboard' => 'Empty dashboard - Pick your favorite widgets',
'Dashboard_DefaultDashboard' => 'Default dashboard - Using default widgets selection and columns layout',
'Dashboard_RemoveDashboard' => 'Remove dashboard',
'Dashboard_CopyDashboardToUser' => 'Copy dashboard to user',
'Dashboard_DashboardCopied_js' => 'Current dashboard successfully copied to selected user.',
'Dashboard_SetAsDefaultWidgets' => 'Set as default widgets selection',
'Dashboard_SetAsDefaultWidgetsConfirm' => 'Are you sure you want to set the current widgets selection and dashboard layout as the default dashboard template?',
'Dashboard_SetAsDefaultWidgetsConfirmHelp' => 'This widgets selection and dashboard columns layout will be used when any user creates a new dashboard, or when "%s" feature is used.',
......
Ce diff est replié.
......@@ -426,7 +426,7 @@ div.widgetpreview-preview {
}
#newDashboardNameInput, #createDashboardNameInput {
margin: 20px 0 0 100px;
margin: 20px 0 0 100px;
text-align: left;
}
......@@ -437,4 +437,20 @@ div.widgetpreview-preview {
.popoverSubMessage {
text-align: center;
padding: 10px 0 5px 0;
}
#copyDashboardToUserConfirm .inputs {
width: 375px;
margin: 10px auto 0;
}
#copyDashboardToUserConfirm .inputs select,
#copyDashboardToUserConfirm .inputs input {
width: 150px;
float: left;
}
#copyDashboardToUserConfirm .inputs label {
width: 200px;
float: left;
}
\ No newline at end of file
......@@ -89,7 +89,7 @@ function createDashboard() {
piwikHelper.showAjaxLoading();
var ajaxRequest =
{
type: 'GET',
type: 'POST',
url: 'index.php?module=Dashboard&action=createNewDashboard',
dataType: 'json',
async: true,
......@@ -142,3 +142,33 @@ function setAsDefaultWidgets() {
yes: function(){ $('#dashboardWidgetsArea').dashboard('saveLayoutAsDefaultWidgetLayout'); }
});
}
function copyDashboardToUser() {
$('#copyDashboardName').attr('value', $('#dashboardWidgetsArea').dashboard('getDashboardName'));
piwikHelper.modalConfirm('#copyDashboardToUserConfirm', {
yes: function(){
var copyDashboardName = $('#copyDashboardName').attr('value');
var copyDashboardUser = $('#copyDashboardUser').attr('value');
var ajaxRequest =
{
type: 'POST',
url: 'index.php?module=Dashboard&action=copyDashboardToUser',
dataType: 'json',
async: true,
error: piwikHelper.ajaxHandleError,
success: function(id) {
$('#alert h2').text(_pk_translate('Dashboard_DashboardCopied_js'));
piwikHelper.modalConfirm('#alert', {});
},
data: {
token_auth: piwik.token_auth,
idSite: piwik.idSite,
name: encodeURIComponent(copyDashboardName),
dashboardId: $('#dashboardWidgetsArea').dashboard('getDashboardId'),
user: encodeURIComponent(copyDashboardUser)
}
};
$.ajax(ajaxRequest);
}
});
}
......@@ -57,6 +57,21 @@ $(document).ready(function() {
<input role="cancel" type="button" value="{'General_Cancel'|translate}" />
</div>
{if count($availableUsers) > 0 && $isSuperUser}
<div class="ui-confirm" id="copyDashboardToUserConfirm">
<h2>{'Dashboard_CopyDashboardToUser'|translate}</h2>
<div class="inputs"><label for="copyDashboardName">{'Dashboard_DashboardName'|translate} </label><input type="input" name="copyDashboardName" id="copyDashboardName" value=""/>
<label for="copyDashboardUser">{'General_Username'|translate} </label>
<select name="copyDashboardUser" id="copyDashboardUser">
{foreach from=$availableUsers item=user}
<option value="{$user.login}">{$user.alias}</option>
{/foreach}
</select></div>
<input role="yes" type="button" value="{'General_Ok'|translate}" />
<input role="cancel" type="button" value="{'General_Cancel'|translate}" />
</div>
{/if}
<div class="ui-confirm" id="createDashboardConfirm">
<h2>{'Dashboard_CreateNewDashboard'|translate}</h2>
<div id="createDashboardNameInput">
......@@ -92,6 +107,9 @@ $(document).ready(function() {
<li onclick="removeDashboard();" id="removeDashboardLink">{'Dashboard_RemoveDashboard'|translate}</li>
{if ($isSuperUser)}
<li onclick="setAsDefaultWidgets();">{'Dashboard_SetAsDefaultWidgets'|translate}</li>
{if count($availableUsers) > 0}
<li onclick="copyDashboardToUser();">{'Dashboard_CopyDashboardToUser'|translate}</li>
{/if}
{/if}
{/if}
</ul>
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter