123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605 |
- <!--
- IBM Confidential
- OCO Source Materials
- BI and PM: Mobile
- (C) Copyright IBM Corp. 2013. 2014
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <div id="_THIS_idFragmentContainer">
-
-
- <script type="text/javascript">
- dojo.require("dojo.NodeList-manipulate");
- var _THIS_skinAPI = {
- onFragmentVisibilityChange : function(){
-
- },
-
- chooseObject : function() {
- var url = '%GATEWAY%?b_action=xts.run&m=portal/select/select.xts&so.select=users.pw2&' +
- 'md.callBack=xml&md.displayOptions=h1&' +
- 'backURL=javascript:parent.ui_modal_dialog.close()';
- var iframeStaticHeight = parseInt(xClientHeight() * .75);
- var iframeStaticWidth = parseInt(xClientWidth() * .75);
- this.modalDialog = new ui_dialog('modalDialogViewer', '<string id=BROWSE_GROUP_BUTTON>', ui_dialog.style.BTN_NOBUTTONS | ui_dialog.style.CENTER | ui_dialog.style.IFRAME, -1, -1, iframeStaticWidth, iframeStaticHeight, _THIS_.div, url);
-
- this.modalDialog.show();
-
- this.skinModalDialog.disable();
-
- ccModalCallBack = dojo.hitch(this, this.selectGroupCallBack);
- },
-
- showAddSkin : function(skin){
- var modalSkinDialogTemplate = document.getElementById("_THIS_uploadSkin");
- var templateParent = modalSkinDialogTemplate.parentNode;
- templateParent.removeChild(modalSkinDialogTemplate);
-
- var skinDialog = modalSkinDialogTemplate.cloneNode("true");
- var dialogSection = document.getElementById("_THIS_dialogSection");
- dialogSection.appendChild(skinDialog);
-
-
-
- var title = "<string id=SKIN_ADD_TITLE>";
- if (skin){
- title = "<string id=SKIN_EDIT_TITLE>";
- }
-
-
- this.skinModalDialog = showModalDialog(ui_dialog.style.BTN_OKCANCEL, '_THIS_uploadSkin', title, document.body.clientHeight - 180, document.body.clientWidth - 80);
-
- if (skin){
- /* This has to happen after showModal as IE barks on the set of innerHTML of the label if we do not */
- var renderIDNode = document.getElementById("_THIS_RENDER_ID");
- renderIDNode.setAttribute("value", skin.render.id);
-
- var skinNameNode = document.getElementById("_THIS_SKINNAME");
- skinNameNode.setAttribute("value", skin.render.name);
-
- var groupIDNode = document.getElementById("_THIS_GROUP_ID");
- var groupIds = [];
- groupIds.push(skin.group.id);
- groupIDNode.setAttribute("value", dojo.toJson(groupIds));
-
-
- var groupNameField = document.getElementById("_THIS_GROUP");
- groupNameField.setAttribute("value", skin.group.name);
-
- document.getElementById("_THIS_BROWSE_LABEL").innerHTML="<string id=SKIN_EDIT_UPLOAD_TITLE>";
- }
-
- this.skinModalDialog.disable = dojo.hitch(this.skinModalDialog, function(){
- this.isDisabled=true;
- this.disabler = document.createElement("div");
- this.disabler.style.backgroundColor="#dddddd";
- this.disabler.style.width="100%";
- this.disabler.style.height="100%";
- this.disabler.style.position="absolute";
- this.disabler.style.top="0px";
- this.disabler.style.left="0px";
- this.disabler.style.opacity="0.5";
- this.disabler.style.filter="alpha(opacity=50))";
- this.dlg.appendChild(this.disabler);
- });
-
- this.skinModalDialog.enable = dojo.hitch(this.skinModalDialog, function(){
- this.isDisabled=false;
-
- this.dlg.removeChild(this.disabler);
- this.onactivate();
- });
-
- this.skinModalDialog.onactivate = dojo.hitch(this.skinModalDialog, function(){
- if (this.isDisabled){
- return;
- }
- else{
- ui_dialog.prototype.onactivate.apply(this, arguments);
- }
- });
-
-
- this.skinModalDialog.processCommand = dojo.hitch(this, function (btnType) {
- var close = true;
- try{
- if (btnType == ui_dialog.button.OK) {
- close = this._processSkinResult(skin != null);
- }
- }
- finally{
- if (close){
- this.skinModalDialog.destroy();
- templateParent.appendChild(modalSkinDialogTemplate);
- }
- }
- return close;
- });
-
- },
-
- _processSkinResult : function(isEdit){
- return this.submitForm(isEdit);
- },
-
-
-
- selectGroupCallBack : function(cmd, sResponse){
- this.skinModalDialog.enable();
-
- if(cmd == 'ok' && sResponse){
- var groupResponse = this._handleGroupResponse(sResponse);
-
- if (groupResponse.objectClass != "group" && groupResponse.objectClass != "role"){
- alert("<string id=SKINS_NOT_A_GROUP>");
- }
- else{
- document.getElementById("_THIS_GROUP").value=groupResponse.name;
- var groupPaths = document.getElementById("_THIS_GROUP_SEARCH_PATH");
-
- if (!groupPaths.groups){
- groupPaths.groups = [];
- }
- groupPaths.groups.length=0;
- groupPaths.groups.push(groupResponse.searchPath);
- }
- this.modalDialog.hide();
- this.modalDialog.destroy();
- this.modalDialog = null;
- }
- else{
- this.modalDialog.hide();
- this.modalDialog.destroy();
- this.modalDialog = null;
- }
- },
-
- _handleGroupResponse : function(sResponse){
- var response = this.decode(sResponse);
- var xml = new this.XMLBuilderLoadXMLFromString(response);
-
- if(xml)
- {
- var searchPathNode = _F_DOM.selectSingleNode(xml, "/return/object/item/name[text() = 'searchPath']/../value");
- var objectClassNode = _F_DOM.selectSingleNode(xml, "/return/object/item/name[text() = 'objectClass']/../value");
- var defaultNameNode = _F_DOM.selectSingleNode(xml, "/return/object/item/name[text() = 'defaultName']/../value");
- var nameNode = _F_DOM.selectSingleNode(xml, "/return/object/item/name[text() = 'name']/../value");
-
- var nameResponse = this.decode(_F_DOM.text(nameNode));
- nameResponse = "<root>"+nameResponse+"</root>";
- var nameXML = this.XMLBuilderLoadXMLFromString(nameResponse);
- var namePath = "/root/multilingualToken[@xml:lang = '" + _F_Config.productLocale + "']";
- var localizedNameNode = _F_DOM.selectSingleNode(nameXML, namePath);
-
-
- var group = {
- searchPath: _F_DOM.text(searchPathNode),
- objectClass: _F_DOM.text(objectClassNode),
- name: localizedNameNode != null ? _F_DOM.text(localizedNameNode) : _F_DOM.text(defaultNameNode)
- };
-
-
- return group;
- }
- },
-
- decode : function(text)
- {
- var amp_re = /&/g;
- var lt_re = /</g;
- var gt_re = />/g;
- var apos_re = /'/g;
-
- text = text.replace(lt_re, "<");
- text = text.replace(gt_re, ">");
- text = text.replace(apos_re, "'");
- text = text.replace(amp_re, "&");
-
- return text;
- },
-
- XMLBuilderLoadXMLFromString : function (markup)
- {
- var xmlDocument = null;
- if (typeof DOMParser != 'undefined')
- {
- xmlDocument = new DOMParser().parseFromString(markup, 'application/xml');
- }
- else if (typeof ActiveXObject != 'undefined')
- {
- try
- {
- xmlDocument = new ActiveXObject('Microsoft.XMLDOM');
- xmlDocument.loadXML(markup);
- }
- catch (e)
- {
- }
- }
- return xmlDocument;
- },
-
- findErrorCode : function (messageSection, errorCodeStr){
- for (var x in messageSection){
- var val = messageSection[x];
-
- if (val.startsWith(errorCodeStr)){
- return val;
- }
- }
- },
-
- _handleJsonUploadResponse : function(jsonText){
- var response = dojo.fromJson(jsonText);
-
- if (response.result.code == "success"){
- this._updateSkinsList(response.result);
- }
- else{
- var message = this.findErrorCode(MOB.SVR, "MOB-SVR-"+code);
- alert(message);
- }
- },
-
- _handleXMLUploadResponse : function(xmlDoc){
- var xmlCode = _F_DOM.selectSingleNode(xmlDoc, ".//code");
- var code = _F_DOM.text(xmlCode);
-
- if (code === "success"){
- alert("<string id=SKIN_UPLOAD_SUCCESFULL>");
- }
- else{
- var message = this.findErrorCode(MOB.SVR, "MOB-SVR-"+code);
- alert(message);
- }
- },
-
- mobileSkinUploadResult : function(){
- var frame = document.getElementById("_THIS_formPoster");
-
- if (frame.contentWindow && frame.contentWindow.location.toString().indexOf("http")== 0){
- try
- {
- var doc = frame.contentWindow.document;
- var xmlDoc;
- if( typeof ActiveXObject != 'undefined') {
- xmlDoc = doc.XMLDocument;
- } else {
- xmlDoc = doc.documentElement;
- }
- if (xmlDoc && xmlDoc.nodeName !== "HTML"){
- this._handleXMLUploadResponse(xmlDoc);
- }
- else{
- var nodeList = dojo.query("*", frame.contentWindow.document.body);
- var jsonText = nodeList.text();
- this._handleJsonUploadResponse(jsonText);
- }
- }
- catch (err){
- alert("<string id=SKIN_FAILURE>");
- }
- finally{
- this.endBusy();
- }
- }
- },
-
- validateForm : function(isEdit){
- var valid=true;
- if (!isEdit){
- var groupPaths = document.getElementById("_THIS_GROUP_SEARCH_PATH");
-
- if (!groupPaths.groups){
- valid=false;
- }
- var upload = document.getElementById("_THIS_BROWSE");
- var value = upload.value;
-
-
- if (!value){
- valid=false;
- }
- if (!valid){
- alert("<string id=SKIN_GROUP_AND_ZIP_REQUIRED>");
- }
- }
- else{
- var groupPaths = document.getElementById("_THIS_GROUP_SEARCH_PATH");
-
- if (!groupPaths.groups || groupPaths.length == 0){
- var groupIDNode = document.getElementById("_THIS_GROUP_ID");
- var value = groupIDNode.getAttribute("value");
-
- if (!value){
- valid=false;
- }
- }
-
- var skinNameNode = document.getElementById("_THIS_SKINNAME");
- var value = skinNameNode.value;
- if (!value || value == ""){
- valid=false;
- }
- if (!valid){
- alert("<string id=SKIN_NAME_AND_GROUP_REQUIRED>");
- }
- }
-
- return valid;
- },
-
-
- submitForm : function(isEdit){
- if (this.validateForm(isEdit)){
- var groupPaths = document.getElementById("_THIS_GROUP_SEARCH_PATH");
-
- if (groupPaths.groups){
- groupPaths.value = dojo.toJson(groupPaths.groups);
- }
- this.startBusy();
- document.getElementById("_THIS_skin_form").submit();
- return true;
- }
-
- return false;
- },
-
- _updateSkinsList : function(response){
- var skinTable = document.getElementById("_THIS_SKIN_TABLE");
-
- var trs = skinTable.childNodes;
- var foundFirst = false;
- for (var i = trs.length -1; i >= 0; i--){
- var child = trs[i];
- if (child.tagName && child.tagName.toLowerCase() == "tr"){
- if (child.getAttribute("canDelete") != "false"){
- trs[i].parentNode.removeChild(trs[i]);
- }
- }
- }
- var skinObj = response.skins.skin;
-
- var skinList = [];
- if (skinObj && skinObj.length){
- skinList = skinObj;
- }
- else if (skinObj){
- skinList.push(skinObj);
- }
- for (var i=0; i < skinList.length; i++){
- this._addToSkinList(skinList[i], i);
- }
-
- },
-
- sendBrowseRequest : function(){
- var xhrArgs = {
- url: "%GATEWAY%/mobileService/skins/browse.json",
- handleAs: "json",
- load: dojo.hitch(this, function(data){
- this.endBusy();
- this._updateSkinsList(data);
- }),
- error: dojo.hitch(this, function(error){
- this.endBusy();
- alert("<string id=SKIN_FAILURE>");
- })
- };
- this.startBusy();
- var deferred = dojo.xhrGet(xhrArgs);
- },
-
- _addToSkinList: function(skin, index){
- var tr = document.createElement("tr");
- if (index % 2 == 0){
- tr.className="cogstyle-table-row-default";
- }
- else{
- tr.className="cogstyle-table-row-alternate";
- }
-
- tr.setAttribute("renderID", skin.render.id);
- dojo.place(
-
- "<td nowrap='' > "+
- "<input id='checkbox_select_render_" + skin.render.id + "' type='checkbox' > "+
- "<label for='checkbox_select_render_" + skin.render.id + "' style='display:none'>"+
- "<string id=SKIN_SELECT>" + skin.render.name + "</label>"+
- "</td>"+
- "<td nowrap='' style='text-align:left;'> "+
- "<table cellspacing='0' cellpadding='0' role='presentation'> "+
- "<tbody> "+
- "<tr> "+
- "<td style='padding:0px;white-space:nowrap;'>"+
- skin.render.name +
- "</td> "+
- "</tr> "+
- "</tbody> "+
- "</table> "+
- "</td> "+
- "<td nowrap='' style='text-align:left;'> "+
- "<table cellspacing='0' cellpadding='0' role='presentation'> "+
- "<tbody> "+
- "<tr> "+
- "<td style='padding:0px;white-space:nowrap;'>"+
- skin.group.name +
- "</td> "+
- "</tr> "+
- "</tbody> "+
- "</table> "+
- "</td> "+
- "<td nowrap='''><a href='javascript:noop()'><img role='button' border='0' title='<string id=SKIN_PROPERTIES>' alt='<string id=SKIN_PROPERTIES>' src='../ps/portal/images/action_properties.gif' style='vertical-align:middle;width:16px;' > </a>"+
- "</td> "+
- "</tr> ", tr);
-
- var skinTable = document.getElementById("_THIS_SKIN_TABLE");
- skinTable.appendChild(tr);
- var editImg = dojo.query("img", tr)[0];
-
- editImg.onclick=dojo.hitch(this, this.editRender, skin);
- },
-
- editRender : function(skinRender){
- this.showAddSkin(skinRender);
- },
-
- toggleSkinSelections : function(){
- var toggleNode = document.getElementById("_THIS_toggleAll");
- var skinTable = document.getElementById("_THIS_SKIN_TABLE");
- var trs = dojo.query("tr[renderID]", skinTable);
-
- for (var i = 0; i < trs.length; i++){
- var checkNodeList = dojo.query("input[type = 'checkbox']", trs[i]);
-
- if (checkNodeList.length > 0){
- checkNodeList[0].checked=toggleNode.checked;
- }
- }
- },
-
- removeSelectedSkins : function(){
-
- var skinTable = document.getElementById("_THIS_SKIN_TABLE");
- var trs = dojo.query("tr[renderID]", skinTable);
- var removed = [];
-
- for (var i = 0; i < trs.length; i++){
- var checkNodeList = dojo.query("input[type = 'checkbox']", trs[i]);
-
- if (checkNodeList.length > 0 && checkNodeList[0].checked){
- removed.push(trs[i].getAttribute("renderID"));
- }
- }
-
- if ( removed.length > 0 ){
- if ( window.confirm("<string id=SKIN_CONFIRM_DELETE>") ) {
- var parms = {};
- parms.renders = dojo.toJson(removed);
- var xhrArgs = {
- url: "%GATEWAY%/mobileService/skins/delete.json",
- handleAs: "json",
- load: dojo.hitch(this, function(data){
- this.endBusy();
- this._updateSkinsList(data.result);
- }),
- error: dojo.hitch(this, function(error){
- this.endBusy();
- alert("<string id=SKIN_UNEXPECTED_ERROR>");
- }),
- content: parms
- };
- this.startBusy();
- var deferred = dojo.xhrGet(xhrArgs);
- }
- }
- else{
- alert("<string id=SKIN_CHOOSE_TO_DELETE>");
- }
- },
-
- startBusy : function(){
- document.body.style.cursor ='wait';
- },
-
- endBusy : function(){
- document.body.style.cursor = 'default';
- }
- };
- _THIS_.addEventListener('fragment.visibility.change', dojo.hitch(_THIS_skinAPI, _THIS_skinAPI.onFragmentVisibilityChange), false);
- _THIS_skinAPI.sendBrowseRequest();
- </script>
-
-
- <div >
-
- <div>
- <!-- Fragment title bar -->
- <table class="cogstyle-portlet-caption-bar" width="100%" border="0" cellspacing="0" cellpadding="0" role="presentation">
- <tbody>
- <tr>
- <td class="cogstyle-portlet-caption" width="100%" valign="top">
- <span>
- <div role="heading" id="_THIS_CAPTION_BAR_TITLE"><string id=SKIN_FRAGMENT_TITLE></div>
- </span>
- </tr>
- </tbody>
- </table>
-
- <iframe style='visiblity:hidden;width:0px;height:0px;border:none' frameborder='0' name='formPoster' title='formPoster' id="_THIS_formPoster" onload='if (window._THIS_skinAPI.mobileSkinUploadResult){_THIS_skinAPI.mobileSkinUploadResult();}' ></iframe>
- <span style="display:none" id="_THIS_hiddenSection">
- <div id="_THIS_uploadSkin">
- <form id='_THIS_skin_form' target='formPoster' method='POST' enctype='multipart/form-data' action='%GATEWAY%/mobileService/skins/upload.json'>
- <table role='presentation'><tr><td>
- <label for="_THIS_SKINNAME" class="formLabel"><string id=SKIN_NAME></label><br>
- <input type='text' name='skinName' id="_THIS_SKINNAME"></td></tr>
- <tr><td>
- <br/><label for="_THIS_BROWSE" class="formLabel" id="_THIS_BROWSE_LABEL"><string id=SKIN_UPLOAD_TITLE></label><br>
- <input type='file' name='skinFile' id="_THIS_BROWSE" ></td></tr>
- <tr><td>
- <br/><label class="formLabel" for="_THIS_GROUP"><string id=GROUP_BROWSE_LABEL></label><br>
- <input type='button' onclick='_THIS_skinAPI.chooseObject()' value='<string id=BROWSE_GROUP_BUTTON>' name='chooseGroupButton'><input id="_THIS_GROUP" type='text' name='groupNames' value='' readonly></td></tr>
- </table>
- <input type='hidden' name='skinGroup' id="_THIS_GROUP_SEARCH_PATH">
- <input type='hidden' name='skinGroupID' id="_THIS_GROUP_ID">
- <input type='hidden' name='renderID' id="_THIS_RENDER_ID">
- </form>
- </div>
- </span>
- <span id="_THIS_dialogSection">
- </span>
-
- <div style="margin-right:20px">
- <table style="width:100%">
- <tr>
- <td style="text-align:right">
- <a href="javascript:_THIS_skinAPI.showAddSkin()"><img role="button" style="border:0" title="<string id=SKIN_ADD_TEXT>" alt="<string id=SKIN_ADD_TEXT>" src="../ps/portal/images/action_new_cognos_content.gif"></a>
- <a href="javascript:_THIS_skinAPI.removeSelectedSkins()"><img role="button" style="border:0" title="<string id=SKIN_REMOVE_TEXT>" alt="<string id=SKIN_REMOVE_TEXT>" src="../ps/portal/images/action_delete.gif"></a>
- </td>
- </tr>
-
- </table>
-
- </div>
-
- <div class="cogstyle-table-wrapper">
- <table cellspacing="0" cellpadding="0" border="0" style="border-collapse:collapse;width:100%;overflow:auto;" class="cogstyle-table" >
-
- <thead style="background-color:#99aacc;" class="cogstyle-table-header">
- <tr>
- <th width="15px" nowrap="">
- <input type="checkbox" id="_THIS_toggleAll" onclick="_THIS_skinAPI.toggleSkinSelections()" value="true" cogtype="checkbox_toggler">
- <label for="_THIS_toggleAll" style="display:none"><string id=ADMIN_SKIN_SELECT_ALL_CHECKBOX_LABEL></label>
- </th>
-
- <th nowrap="" style="text-align:left;" class="cogstyle-table-group-title">
- <string id=ADMIN_SKIN_NAME>
- </th>
-
- <th nowrap="" style="text-align:left;" class="cogstyle-table-group-title">
- <string id=ADMIN_SKIN_GROUP>
- </th>
- <th nowrap="" style="text-align:left;" class="cogstyle-table-group-title">
- <string id=ADMIN_SKIN_ACTION>
- </th>
- </tr>
- </thead>
- <tbody class="cogstyle-table-body" id="_THIS_SKIN_TABLE">
- <tr>
- <td style="height:1px;padding:0;margin:0;background-color:#ffffff;border:1px" colspan="15"></td>
- </tr>
-
- </tbody>
- </table>
- </div>
-
- </div>
-
-
- </div>
-
- </div>
|