123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- /*******************************************************************************
- * IBM Confidential
- *
- * OCO Source Materials
- *
- * A and PM: PD
- *
- * (c) Copyright IBM Corp. 2015
- *
- * The source code for this program is not published or otherwise divested of
- * its trade secrets, irrespective of what has been deposited with the U.S.
- * Copyright Office.
- ******************************************************************************/
- define([
- "dojo/_base/declare",
- "dojo/parser",
- "bux/dialogs/BaseDialog",
- "dijit/TitlePane",
- "pd/model/deltaSpec",
- "dojo/string",
- "dojo/dom-construct",
- "dojo/dom-attr",
- "dijit/layout/BorderContainer",
- "dijit/layout/ContentPane"
- ],function(declare, parser, Dialog, TitlePane, deltaSpec, string, domConst, domAttr,
- BorderContainer, ContentPane){
-
- var MDAnalyseDialog = declare("pd/widgets/MDAnalyseDialog", [Dialog], {
- title: PDMSG.ANA.IDS_ANA_DIALOG_TITLE,
- style: "width: auto; height: auto;",
- showOnOk: true,
- _bContainerHeightAuto: true,
-
- createDefaultDialogButtons: function(){
- this.createButtons([
- {label: BUXMSG.GEN.IDS_GEN_YES_BUTTON, action: dojo.hitch(this, this.onOK), type: "button"},
- {label: BUXMSG.GEN.IDS_GEN_NO_BUTTON, action: dojo.hitch(this, this.onCancel), type: "button"}
- ]);
- },
-
- postCreate: function() {
- this.inherited(arguments);
- this.createDefaultDialogButtons();
- var noChange = true;
- var contentDom = domConst.toDom("<div style='min-width:500px;'></div>");
-
- for (var i=0; i<deltaSpec.length; i++){
- var section = this.delta[deltaSpec[i].name];
- if (section.length > 0) {
- var bc = new BorderContainer({
- style: "height:100px;"
- });
- var content = "<table class='dojoxGridRowTable' cellspacing='0' " +
- "cellpadding='0' border='0' role='presentation' style='width: 100%;'><tbody>";
- for (var j=0; j<section.length; j++){
- var className = ((j%2)?"dojoxGridRow":"dojoxGridRowSelected");
- content +="<tr><td tabindex='-1' " +
- "style='padding: 3px 3px 3px 13px' class='"+className+"'>" + section[j].name;
- if (section[j].simpletype && section[j].previoustype) {
- content += " " + string.substitute(PDMSG.ANA.IDS_ANA_TYPE_CHANGED_FROM_TO,
- {0: section[j].previoustype, 1: section[j].simpletype});
- }
- content += "</td></tr>";
- }
- content += "</tbody></table>";
- var cp = new ContentPane({
- region: "center",
- content: content,
- "aria-label": deltaSpec[i].contentLabel
- });
- bc.addChild(cp);
- var titlePane = new TitlePane({
- title: deltaSpec[i].label + " ("+section.length+")",
- content: bc.domNode,
- open: false
- });
- domAttr.set(titlePane.domNode, "aria-label", deltaSpec[i].groupLabel);
- domAttr.set(titlePane.containerNode, "role", "group");
- domAttr.set(titlePane.containerNode, "aria-label", deltaSpec[i].contentLabel);
- contentDom.appendChild(titlePane.domNode);
- noChange = false;
- }
- }
-
- var headerHTML = "<table border='0' role='presentation'><tbody><tr>";
-
- if (!noChange){
- headerHTML += "<td class='bux-InformationDialog-Icon bux-informationDialog-warning-icon'>" +
- "<div class='bux-InformationDialog-Icon'> </div></td>";
- }
-
- headerHTML += "<td><div class='bux-InformationDialog-mainMessage'>";
- headerHTML += noChange?PDMSG.ANA.IDS_ANA_NO_META_DATA_CHANGES:PDMSG.ANA.IDS_ANA_META_DATA_CHANGES;
- headerHTML += "</div></td></tr></tbody></table></br>"
-
- this.dialogContent.appendChild(domConst.toDom(headerHTML));
- this.dialogContent.appendChild(contentDom);
- this.dialogContent.appendChild(
- domConst.toDom("<br/><div class='bux-InformationDialog-mainMessage'>" +
- (!noChange?PDMSG.ANA.IDS_ANA_METADATA_CHANGES_WARNING+"<br/><br/>":"") +
- PDMSG.ANA.IDS_ANA_PROCEED_CONFIRM + "</div>"));
- },
-
- onOK: function() {
- if (this.showOnOk !== true) {
- this.hide();
- }
-
- if (this._aButtonObjects && this._aButtonObjects[0]) {
- this._aButtonObjects[0].focus();
- }
-
- if (this.okHandler) {
- this.okHandler();
- }
- },
-
- onCancel: function() {
- this.inherited(arguments);
- if (this.cancelHandler) {
- this.cancelHandler();
- }
- },
-
- hide: function() {
- this.inherited(arguments);
- this.destroy();
- }
- });
- return MDAnalyseDialog;
- });
|