Differences Between Versions

diff -rwu -X ./excludes.txt ./SBM10.1.5.3/browser/atturl.htm ./SBM10.1.5.4/browser/atturl.htm --- ./SBM10.1.5.3/browser/atturl.htm 2014-12-23 16:52:29.000000000 -0800 +++ ./SBM10.1.5.4/browser/atturl.htm 2016-07-21 16:26:59.000000000 -0700 @@ -177,13 +177,13 @@ </td> </tr> - <tr> + <tr style="display:none"> <!-- DEPRECATED --> <td>&nbsp;</td> <td nowrap> <span class="note"><label for="File">$STRING(IDS_ATTACHMENTS_USETHISURL)</label></span> </td> </tr> - <tr> + <tr style="display:none"> <!-- DEPRECATED --> <td>&nbsp;</td> <td> $IF(MODERNUI) @@ -205,7 +205,7 @@ $ENDIF() </td> </tr> - <tr> + <tr style="display:none"> <!-- DEPRECATED --> <td>&nbsp;</td> <td> <input class="frmBtn" type="button" name="move" value="$STRING(IDS_BTN_MOVEREFTOURLBOX)" onClick="moveFileRef()" ID="Button2">
diff -rwu -X ./excludes.txt ./SBM10.1.5.3/browser/formbody.htm ./SBM10.1.5.4/browser/formbody.htm --- ./SBM10.1.5.3/browser/formbody.htm 2015-02-02 12:04:35.000000000 -0800 +++ ./SBM10.1.5.4/browser/formbody.htm 2016-08-08 13:22:35.000000000 -0700 @@ -178,6 +178,7 @@ $GETMASTERSLAVEFIELDS() jQuerySBM(document).ready(function() { + fixAttachmentLinks("#SectionAttachments"); $IF(MODERNUI) if (window.SOO || window.newWizardStyle || jQuerySBM('link[href*="SOO"]').length || window.action_SOOFormFormat) // exclude SOO return;
diff -rwu -X ./excludes.txt ./SBM10.1.5.3/browser/html2/top.htm ./SBM10.1.5.4/browser/html2/top.htm --- ./SBM10.1.5.3/browser/html2/top.htm 2014-01-08 07:32:00.000000000 -0800 +++ ./SBM10.1.5.4/browser/html2/top.htm 2016-08-08 13:23:44.000000000 -0700 @@ -8,6 +8,16 @@ <script language=javascript> var dll = "$DLL()"; var dllsid = "$DLLSID()"; + + // correct attachment links + setTimeout(function () { + var attachURL = location.protocol + "//" + location.host + "/commonsvc/workcenter/generatelinkfile/link.url?url="; + var anchors = document.getElementsByTagName('a'); + for (var i = 0; i < anchors.length; i++) { + if (/^file:\/\/.*$/.test(anchors[i].href)) + anchors[i].href = attachURL + anchors[i].href; + } + }, 0); </script> <a href="javascript:undoHTML2();">$STRING(IDS_USERPROFILE_CANCELSHOWHTML2)</a>&nbsp;|&nbsp;
diff -rwu -X ./excludes.txt ./SBM10.1.5.3/browser/javascript/aeplugin_2009_r2.js ./SBM10.1.5.4/browser/javascript/aeplugin_2009_r2.js --- ./SBM10.1.5.3/browser/javascript/aeplugin_2009_r2.js 2015-11-10 12:05:32.000000000 -0800 +++ ./SBM10.1.5.4/browser/javascript/aeplugin_2009_r2.js 2016-08-04 18:00:09.000000000 -0700 @@ -1202,19 +1202,13 @@ { for (var i = 0; i < aFieldLookup.Fields.length; i++) { - var label = GetLabelByName(aFieldLookup.Fields[i].uuid); - if (label == null) continue; - - var spantags = label.getElementsByTagName("span"); - if ((spantags != null) && (spantags.length > 0) && ((spantags[0].className == "reqempty") || (spantags[0].className == "reqfilled"))) - { - if (!RequiredFields[aFieldLookup.Fields[i].fid]) // if was not already in the required list... - { + var $label = jQuerySBM(GetLabelByName(aFieldLookup.Fields[i].uuid)); + if ($label.find('.reqempty, .reqfilled').length // ignore no label... + && (aFieldLookup.Fields[i].isRequired || aFieldLookup.Fields[i].requireAppend) // ...marked red for other reasons than required (invalid value may have been changed to empty)... + && !RequiredFields[aFieldLookup.Fields[i].fid]) // ...and already in required list fields[fields.length] = aFieldLookup.Fields[i]; } } - } - } // for (var i = 0; i < fields.length; i++) { @@ -1421,7 +1415,13 @@ function IsFieldEmpty(objname, path) { var type = LookupFieldType(objname); - if (type == "single") + var subtype = LookupFieldSubType(objname); + if (subtype == "journal") { + var contents = (GetFieldValue(objname, "").trim() != "") // append area + || (!_LookupField(objname).requireAppend && JournalHasContent(objname)); // prev. contents if not requiring append + return !contents; + } + else if (type == "single") { var fld = GetFieldByName(objname); if (fld && (typeof (fld.selectedIndex) != undefined) && (fld.selectedIndex != -1) && fld.options) @@ -1484,6 +1484,80 @@ } +function JournalEntry(user, userid, date, contents) { + this.user = user; + this.userid = userid; + this.date = date; + this.contents = contents; +} +JournalEntry.prototype.toString = function () { return this.contents; } +JournalEntry.prototype.trim = function () { return this.toString().trim(); } + +function GetJournalFieldValue(objname, path) +{ + if (LookupFieldType(objname) != "text" || LookupFieldSubType(objname) != "journal") return null; + var isReadOnly = !jQuerySBM(GetFieldByName(objname)).is('textarea'); + if (!path) { + if (window.isPreview || _isTransitionForm() || _isSubmitForm()) + return isReadOnly ? "" : null; // let GetStandardFieldValue grab the text box + else + path = ""; + } + + // looking for contents, but field has "Append Only" = false. extract contents of textarea. + // does not need unescape from textarea.val() + var $contentsTxa = jQuerySBM('#' + LookupFieldId(objname)); + if ($contentsTxa.is('textarea')) + return (path.indexOf('[]') > -1) ? [$contentsTxa.val()] : ""; + + // collect all values + var entryArr = []; + var piece = (path.match(/userid|user|date|contents/) || [null])[0]; + var $widget = jQuerySBM(GetFieldWidgetByName(objname)); + $widget.find('span.rofld > table').each(function () { + var $entry = jQuerySBM(this); + var user = $entry.find('#usernamecell .contact_popover').text(); + var userid = $entry.find('#usernamecell .contact_popover').attr('ivalue'); + var date = new Date($entry.find('#datecell').text().substr(4).trim()); // remove leading " - " from text + var contents = $entry.find('#entrycell').html(); + var obj = new JournalEntry(user, userid, date, contents); + if (!LookupRenderHTML(objname)) // unescape + obj.contents = obj.contents.replace(/<br>/gi, '\r\n').replace(/&lt;/, '<').replace(/&gt;/, '>').replace(/&amp;/, '&').trim(); + entryArr.push(obj); + }); + entryArr.sort(function (a, b) { return a.date - b.date; }); // default oldest > newest + + // single object requested -- return most recent + if (path.indexOf('[]') == -1) { + if (!entryArr.length) + return null; + var lastentry = entryArr[entryArr.length - 1]; + return piece ? lastentry[piece] : lastentry; + } + + if (path.indexOf('DESC') > -1) + entryArr.reverse(); + + if (!piece) + return entryArr; + else { + var returnArr = []; + for (var i = 0; i < entryArr.length; i++) + returnArr.push(entryArr[i][piece]); + return returnArr; + } +} + +function JournalHasContent(objname) { + if (LookupFieldType(objname) != "text" || LookupFieldSubType(objname) != "journal") return false; + var contents = GetFieldValue(objname, [], "[]"); + if (!contents.length) return false; + if (contents.length == 1 && typeof contents[0] == "string") // editable contents are empty? [""], ["<br>"] + return contents[0].trim() != "" && contents[0].trim() != "<br>"; + return true; +} + + function IsDualList(fld) { if (!fld || !fld.id) return false; @@ -1530,7 +1604,15 @@ switch (ftype) { case "text": - if (fld.value != null) + var journalfound = null; + if (stype == "journal") + journalfound = GetJournalFieldValue(objname, path); + + if (journalfound !== null) + { + fieldvalue = journalfound; + } + else if (fld.value != null) { fieldvalue = fld.value; }
diff -rwu -X ./excludes.txt ./SBM10.1.5.3/browser/javascript/list.js ./SBM10.1.5.4/browser/javascript/list.js --- ./SBM10.1.5.3/browser/javascript/list.js 2015-02-11 09:16:56.000000000 -0800 +++ ./SBM10.1.5.4/browser/javascript/list.js 2016-08-08 13:20:18.000000000 -0700 @@ -555,6 +555,8 @@ collapsedMaxHeight: 37 // two lines of text }); } + + fixAttachmentLinks(); } function useEditableGrid() {
diff -rwu -X ./excludes.txt ./SBM10.1.5.3/browser/javascript/utilities.js ./SBM10.1.5.4/browser/javascript/utilities.js --- ./SBM10.1.5.3/browser/javascript/utilities.js 2015-05-21 15:03:22.000000000 -0700 +++ ./SBM10.1.5.4/browser/javascript/utilities.js 2016-08-08 12:33:21.000000000 -0700 @@ -6660,3 +6660,36 @@ $parentTd.height(height); }; } \ No newline at end of file + +// Function which adjusts links in the attachments section. +// Turns file:// links into ones that, on opening, will +// generate a .url link file and download it +function fixAttachmentLinks(selector) { + var attachmentsSection = jQuerySBM(selector || 'body'); + if (attachmentsSection.length === 0) { + return; + } + + var aeRootWindow = getAeRootWindow(window); + var sbmUrl = aeRootWindow.document.location; + + var onClickFileLink = function(event) { + setTimeout(function() { + window.alert("Open the link.url file to view the attachment."); + }, 1); + }; + + var links = attachmentsSection.find("a"); + for (var i = 0; i < links.length; i++) { + var link = links.eq(i); + // If the link begins with the file protocol - file:// + // then turn it into a link to the file link generator + if (/^file:\/\/.*$/.test(link.attr("href"))) { + var fileUrl = link.attr("href"); + var replacementUrl = sbmUrl.protocol + "//" + sbmUrl.host + "/resourcemgmt/workcenter/generatelinkfile/link.url?url=" + fileUrl; + link.attr("href", replacementUrl); + link.attr("target", "_blank"); + link.bind("click", onClickFileLink); + } + } +} \ No newline at end of file
diff -rwu -X ./excludes.txt ./SBM10.1.5.3/browser/newbody.htm ./SBM10.1.5.4/browser/newbody.htm --- ./SBM10.1.5.3/browser/newbody.htm 2015-01-15 07:29:23.000000000 -0800 +++ ./SBM10.1.5.4/browser/newbody.htm 2016-08-08 13:17:06.000000000 -0700 @@ -123,6 +123,7 @@ var masterslaves; $GETMASTERSLAVEFIELDS() jQuerySBM(document).ready(function() { + fixAttachmentLinks("#SectionAttachments"); $IF(MODERNUI) if (window.SOO || window.newWizardStyle || jQuerySBM('link[href*="SOO"]').length || window.action_SOOFormFormat) // exclude SOO return;
diff -rwu -X ./excludes.txt ./SBM10.1.5.3/browser/social/javascript/socialwall.js ./SBM10.1.5.4/browser/social/javascript/socialwall.js --- ./SBM10.1.5.3/browser/social/javascript/socialwall.js 2015-01-12 06:49:11.000000000 -0800 +++ ./SBM10.1.5.4/browser/social/javascript/socialwall.js 2016-08-08 13:20:58.000000000 -0700 @@ -604,6 +604,11 @@ template = jQuerySBM("#fileTemplate").html(), fragment = ''; + // point file attachments to Java generator + if (/^file:\/\/.*$/.test(obj.url)) { + obj.url = location.protocol + "//" + location.host + "/resourcemgmt/workcenter/generatelinkfile/link.url?url=" + obj.url; + } + fragment += template .replace(/{{evenOdd}}/ig, getEvenOdd(obj.objIndex + 1))
diff -rwu -X ./excludes.txt ./SBM10.1.5.3/browser/swc/javascript/swc/server-call.js ./SBM10.1.5.4/browser/swc/javascript/swc/server-call.js --- ./SBM10.1.5.3/browser/swc/javascript/swc/server-call.js 2015-12-08 04:29:08.000000000 -0800 +++ ./SBM10.1.5.4/browser/swc/javascript/swc/server-call.js 2015-12-18 02:38:52.000000000 -0800 @@ -1,9 +1,9 @@ function newAEURL(queryString) { var aeRoot = ""; try { - if (dll !== undefined) { + if (typeof dll !== 'undefined') { aeRoot = dll; - } else if (top.dll !== undefined) { + } else if (typeof top.dll !== 'undefined') { aeRoot = top.dll; } } catch (e) { @@ -15,9 +15,9 @@ function newCSURL(url) { var csRoot = ""; try { - if (dllRoot !== undefined) { + if (typeof dllRoot !== 'undefined') { csRoot = dllRoot; - } else if (top.dllRoot !== undefined) { + } else if (typeof top.dllRoot !== 'undefined') { csRoot = top.dllRoot; } } catch (e) {
diff -rwu -X ./excludes.txt ./SBM10.1.5.3/browser/swc/javascript/wrapper.js ./SBM10.1.5.4/browser/swc/javascript/wrapper.js --- ./SBM10.1.5.3/browser/swc/javascript/wrapper.js 2015-12-08 04:33:39.000000000 -0800 +++ ./SBM10.1.5.4/browser/swc/javascript/wrapper.js 2015-12-18 02:38:26.000000000 -0800 @@ -1,9 +1,9 @@ function newCSURL(url) { var csRoot = ""; try { - if (dllRoot !== undefined) { + if (typeof dllRoot !== 'undefined') { csRoot = dllRoot; - } else if (top.dllRoot !== undefined) { + } else if (typeof top.dllRoot !== 'undefined') { csRoot = top.dllRoot; } } catch (e) {
diff -rwu -X ./excludes.txt ./SBM10.1.5.3/browser/swc/javascript/wrapportserver.min.js ./SBM10.1.5.4/browser/swc/javascript/wrapportserver.min.js --- ./SBM10.1.5.3/browser/swc/javascript/wrapportserver.min.js 2015-12-08 04:30:51.000000000 -0800 +++ ./SBM10.1.5.4/browser/swc/javascript/wrapportserver.min.js 2015-12-18 02:39:47.000000000 -0800 @@ -1,4 +1,5 @@ -function newCSURL(a){return top.dllRoot+a}function toggleSearchText(a){if(1==a){var b=document.getElementById("idsearch");null!=b&&(b=b.value,null!=b&&0!=b.length&&(a=!1))}b=document.getElementById("idsearchText");null!=b&&(b.style.visibility=1==a?"visible":"hidden")}function focusSearch(){var a=document.getElementById("idsearch");null!=a&&a.focus()}function hideIFrame(){null!=overlay&&(overlay.setAttribute("src","images/jsblank.gif"),overlay.style.display="none")} +function newCSURL(a){var b="";try{"undefined"!==typeof dllRoot?b=dllRoot:"undefined"!==typeof top.dllRoot&&(b=top.dllRoot)}catch(c){sbmlog.error("Error while constructing a URL for Common Services: "+c.message)}return b+a}function toggleSearchText(a){if(1==a){var b=document.getElementById("idsearch");null!=b&&(b=b.value,null!=b&&0!=b.length&&(a=!1))}b=document.getElementById("idsearchText");null!=b&&(b.style.visibility=1==a?"visible":"hidden")} +function focusSearch(){var a=document.getElementById("idsearch");null!=a&&a.focus()}function hideIFrame(){null!=overlay&&(overlay.setAttribute("src","images/jsblank.gif"),overlay.style.display="none")} function initQuickLinksOverlay(){qlOverlay=document.createElement("iframe");qlOverlay.id="qlOverlay";qlOverlay.style.position="absolute";qlOverlay.style.display="none";qlOverlay.style.width="10px";qlOverlay.style.height="10px";qlOverlay.style.top="0px";qlOverlay.style.left="0px";qlOverlay.style.zIndex="999";qlOverlay.setAttribute("src","images/jsblank.gif");document.getElementById("holder").appendChild(qlOverlay)} function initMoreOverlay(){moreOverlay=document.createElement("iframe");moreOverlay.id="moreOverlay";moreOverlay.style.position="absolute";moreOverlay.style.display="none";moreOverlay.style.width="10px";moreOverlay.style.height="10px";moreOverlay.style.top="0px";moreOverlay.style.left="0px";moreOverlay.style.zIndex="999";moreOverlay.setAttribute("src","");document.getElementById("holder").appendChild(moreOverlay)} function validateUser(a,b){var c="function"===typeof b,d=newCSURL("/commonsvc/resourcemgmt/auth/validate?"),e=!1;"string"!==typeof a&&(a="");jQuerySBM.ajax({async:c,url:d,dataType:"json",type:"POST",contentType:"application/json",headers:{ALFSSOAuthNToken:a},success:function(d,h,f){if(null==d||null==d.status||"OK"!=d.status)return Serena.SFC.stopAjaxLoading(),null!=d.results&&-1!=d.results.indexOf("Valid Serena Security Token Required")?(sbmlog.debug("Valid SSO token is required. Redirecting to login page."), @@ -35,7 +36,7 @@ var statusEnum=function(){var a={0:"Undefined",1:"Analysis",2:"Analysis Complete",3:"New Plan Requested",4:"Planning",5:"Planning Complete",6:"Pending Sign Off",7:"Executing",8:"Completed",9:"Backlog",10:"Rejected"};return{getState:function(b){return a[b]}}}(),statusForCollaboration=function(){var a={0:{name:"Undefined",nextState:0,nextText:"Undefined"},1:{name:"In Analysis",nextState:2,nextText:"Mark as Complete"},2:{name:"Analysis Complete",nextState:1,nextText:"Back to Analysis"},3:{name:"New Plan Requested", nextState:0,nextText:"New Plan Requested"},4:{name:"In Planning",nextState:5,nextText:"Mark as Complete"},5:{name:"Planning Complete",nextState:4,nextText:"Back to Planning"},6:{name:"Pending Sign Off",nextState:0,nextText:"Pending Sign Off"},7:{name:"Executing",nextState:0,nextText:"Executing"},8:{name:"Completed",nextState:0,nextText:"Completed"},9:{name:"Backlog",nextState:0,nextText:"Backlog"},10:{name:"Rejected",nextState:0,nextText:"Rejected"}};return{getStatus:function(b){return a[b]}}}(), priorityEnum=function(){var a={0:"--",1:"Low",2:"Medium",3:"High"};return{getPriority:function(b){return a[b]}}}(),showContextMenu=function(a,b,c){jQuerySBM(b).show();var d=jQuerySBM(a).offset(),e=jQuerySBM(a).outerWidth();a=jQuerySBM(a).outerHeight();c=jQuerySBM(b).find(c).outerWidth();e=d.left-c+e+"px";d=d.top+a+"px";jQuerySBM(b).css({position:"fixed",zIndex:1E3,left:e,top:d})},localeDate={getShortDateString:function(a){function b(a){a=""+a;return 1<a.length?a:"0"+a}var c=top.dateFormatString,d= -a.getFullYear(),e=a.getMonth()+1;a=a.getDate();c=c.replace(/yyyy/,d);c=c.replace(/yy/,String(d).substr(2));c=c.replace(/MM/,b(e));c=c.replace(/M/,e);c=c.replace(/dd/,b(a));return c=c.replace(/d/,a)}};function StringBuffer(){this.__strings__=[]}StringBuffer.prototype.append=function(a){this.__strings__.push(a)};StringBuffer.prototype.toString=function(){return this.__strings__.join("")};function newAEURL(a){var b="";try{void 0!==dll?b=dll:void 0!==top.dll&&(b=top.dll)}catch(c){sbmlog.error("Error while constructing a URL for Application Engine: "+c.message)}return b+a}function newCSURL(a){var b="";try{void 0!==dllRoot?b=dllRoot:void 0!==top.dllRoot&&(b=top.dllRoot)}catch(c){sbmlog.error("Error while constructing a URL for Common Services: "+c.message)}return b+a} +a.getFullYear(),e=a.getMonth()+1;a=a.getDate();c=c.replace(/yyyy/,d);c=c.replace(/yy/,String(d).substr(2));c=c.replace(/MM/,b(e));c=c.replace(/M/,e);c=c.replace(/dd/,b(a));return c=c.replace(/d/,a)}};function StringBuffer(){this.__strings__=[]}StringBuffer.prototype.append=function(a){this.__strings__.push(a)};StringBuffer.prototype.toString=function(){return this.__strings__.join("")};function newAEURL(a){var b="";try{"undefined"!==typeof dll?b=dll:"undefined"!==typeof top.dll&&(b=top.dll)}catch(c){sbmlog.error("Error while constructing a URL for Application Engine: "+c.message)}return b+a}function newCSURL(a){var b="";try{"undefined"!==typeof dllRoot?b=dllRoot:"undefined"!==typeof top.dllRoot&&(b=top.dllRoot)}catch(c){sbmlog.error("Error while constructing a URL for Common Services: "+c.message)}return b+a} function getTopStaticNav(a){var b=newCSURL("/commonsvc/workcenter/menuItem/top");if(a)resp=getAjaxCall(b,"static Top ",!0,a);else return resp=getAjaxCall(b,"static Top ",!1),resp.results}function getSubMenu(a,b,c){b||(b=!1);a=newCSURL("/commonsvc/workcenter/menuItem/all?parentId="+a+"&adminMode="+b);if(c)resp=getAjaxCall(a,"Secondary Top Nav",!0,c);else return(resp=getAjaxCall(a,"Secondary Top Nav",!1))?resp.results:null} function getItemsByParentId(a,b){var c=newCSURL("/commonsvc/workcenter/menuItem/all?parentId="+a);getAjaxCall(c,"Item elements",!0,b)}function getTernaryNav(a){a=newCSURL("/commonsvc/workcenter/menuItem/all?includeChildren="+a.includeChildren+"&parentId="+a.parentId);return getAjaxCall(a,"Third Nav",!1).results}function getSideNav(){var a=newCSURL("/commonsvc/workcenter/menuItem/"+id);return getAjaxCall(a,"Secondary side Nav",!1).results} function getMenuItem(a,b,c){b||(b=!1);a=newCSURL("/commonsvc/workcenter/menuItem/"+a+"?adminMode="+b);if(c)getAjaxCall(a,"Get Menu Item",!0,c);else return resp=getAjaxCall(a,"Get Menu Item",!1),resp.results}function saveUserProperty(a,b,c){var d=newCSURL("/commonsvc/workcenter/property/save/byType/"+a);postObject(d,'saving "'+a+'" property',b,!0,c)}function getUserProperty(a,b,c){var d=newCSURL("/commonsvc/workcenter/property/byType/"+a);getAjaxCall(d,'getting "'+a+'" property',c,b)}
diff -rwu -X ./excludes.txt ./SBM10.1.5.3/browser/swc/templates/swc/copyproject.htm ./SBM10.1.5.4/browser/swc/templates/swc/copyproject.htm --- ./SBM10.1.5.3/browser/swc/templates/swc/copyproject.htm 2015-12-08 04:29:44.000000000 -0800 +++ ./SBM10.1.5.4/browser/swc/templates/swc/copyproject.htm 2015-12-18 02:39:05.000000000 -0800 @@ -42,9 +42,9 @@ function newCSURL(url) { var csRoot = ""; try { - if (dllRoot !== undefined) { + if (typeof dllRoot !== 'undefined') { csRoot = dllRoot; - } else if (top.dllRoot !== undefined) { + } else if (typeof top.dllRoot !== 'undefined') { csRoot = top.dllRoot; } } catch (e) {
diff -rwu -X ./excludes.txt ./SBM10.1.5.3/browser/view.htm ./SBM10.1.5.4/browser/view.htm --- ./SBM10.1.5.3/browser/view.htm 2015-03-16 12:27:05.000000000 -0700 +++ ./SBM10.1.5.4/browser/view.htm 2016-08-08 13:16:36.000000000 -0700 @@ -490,6 +490,7 @@ } jQuerySBM(document).ready(function () { // legacy support + fixAttachmentLinks("#SectionAttachments"); if (window.SOO || window.newWizardStyle || jQuerySBM('link[href*="SOO"]').length || window.action_SOOFormFormat) { // SOO adjustments var sooVer = (/.\/solutions\/(\w+)\//).exec(window.SOO ? SOO.Util.AssetRoot : null); if (!sooVer || !sooVer[1] || sooVer[1] < "SOO5_2") { // exclude recent SOO