Before executing the example, study recommendations to code writing. Make sure that repository contains an express report with the 88665 key.
To create the MetabaseSaveDialog component, use HTML code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <title>MetabaseSaveDialog</title> <script src="../build/PP.js" type="text/javascript"></script> <script src="../build/PP.Metabase.js" type="text/javascript"></script> <script src="../build/PP.Express.js" type="text/javascript"></script> <script src="../build/PP.Navigator.js" type="text/javascript"></script> <script type="text/javascript" src="../resources/Metabase.resources.ru.js"></script> <script type="text/javascript" src="../resources/Express.resources.ru.js"></script> <script type="text/javascript" src="../resources/Navigator.resources.ru.js"></script> <link href="../build/PP.css" rel="stylesheet" type="text/css" /> <link href="../build/PP.Metabase.css" rel="stylesheet" type="text/css" /> <link href="../build/PP.Express.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> var metabase, eaxMdService, eaxAnalyzer, saveDialog; // Function executed on loading html document function onLoad() { // Set path to root folder containing resource files PP.resourceManager.setRootResourcesFolder("../../resources/"); // Set language settings for resources PP.setCurrentCulture(PP.Cultures.ru); // Create repository connection metabase = new PP.Mb.Metabase({ // Set Url of the PP.SOM web-service in the format: // <http://<ServerName | IP-address>[:<Port>][/<VirtualCatalog>]/axis2/services/PP.SOM.Som> PPServiceUrl: "http://localhost/FPBI_App_v9.2x64/axis2/services/PP.SOM.Som", Id: "Repository", UserCreds: { UserName: "user", Password: "password" } }); // Open repository connection metabase.open(); // Create service to work with express reports eaxMdService = new PP.Exp.EaxMdService({ Metabase: metabase }); // Open express report with the key 88665 eaxAnalyzer = eaxMdService.editDocument(88665); // Determine filter array for dialog box var filters = [{ Filters: [2561, 0], ResourceKey: "openDialogExpressReports", iconIndex: 16 }]; // Determine language array to translate name of saved object var displayLanguages = []; displayLanguages.push(PP.Cultures.ru.LCID); // Russian displayLanguages.push(PP.Cultures.en.LCID); // English // Create a dialog box to save object saveDialog = new PP.Navigator.MetabaseSaveDialog({ DefaultId: "EXP_REPORT", // Identifier of saved object /* Determine name of saved object */ DefaultName: "Indicators frequency by region", Metabase: metabase, FiltersSet: filters, // Filter array for dialog box CurrentFilter: filters[1], // Current filter ImagePath: "../build/img/", OpenToKey: parseInt(eaxAnalyzer.getParentKey() || 0), // Determine name translation of the saved object into Russian and English Names: [{ locale: PP.Cultures.ru.LCID, name: "Indicators frequency by region" }, { locale: PP.Cultures.en.LCID, name: "Dynamics indicators by region" }], ShowTranslateButton: true, // Make the button to show object name translations visible // Set dialog box to translate name of saved object into various languages. TranslateDialog: new PP.Mb.Ui.TranslateDialog({ DisplayLanguages: displayLanguages }), SaveAsObject: function (sender, args) { // Handle the SaveAsObject event console.log("Name of saved object in different languages:"); var names = args.Names; for (var i in names) { var n = names[i]; console.log("Language code: " + n.locale + ", name: " + n.name); } } }); saveDialog.show(); // Show dialog box to save object } </script> </head> <body onload="onLoad();"> </body> </html>
After executing the example the HTML page will contain the MetabaseSaveDialog component:
Clicking the OK button generates the SaveAsObject event and displays the message to the browser console:
Name of the saved object in different languages:
Language code: 1033, Name: Dynamics indicators by region
Language code: 1049, Name: Dynamics of indicators by region
See also: