diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/documentDetails.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/office/documentDetails.get.html.ftl index 09bc4a09fa..f329fd4a03 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/office/documentDetails.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/office/documentDetails.get.html.ftl @@ -143,15 +143,15 @@
<#if d.isDocument> <#else> diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/getUsers.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/office/getUsers.get.desc.xml new file mode 100644 index 0000000000..4e3c0337b4 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/office/getUsers.get.desc.xml @@ -0,0 +1,7 @@ + + Get Users (Office Add-In) + Used by the Office Add-In to query for users + + user + required + \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/getUsers.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/office/getUsers.get.html.ftl new file mode 100644 index 0000000000..bac3d125e6 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/office/getUsers.get.html.ftl @@ -0,0 +1,7 @@ +<#assign n=0> +<#list searchResults as result> + <#if (n > 0)>,<#else>[ +"${"${result.properties.firstName} ${result.properties.lastName}"?trim}" + <#assign n=n+1> + +] \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/getUsers.get.js b/config/alfresco/templates/webscripts/org/alfresco/office/getUsers.get.js new file mode 100644 index 0000000000..9dd9e1c11c --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/office/getUsers.get.js @@ -0,0 +1,18 @@ +var query = "TYPE:\"{http://www.alfresco.org/model/content/1.0}person\""; + +if ((args.s) && (args.s != "")) +{ + query += " AND ("; + var terms = args.s.split(" "); + for (i = 0; i < terms.length; i++) + { + term = terms[i]; + query += "((@\\{http\\://www.alfresco.org/model/content/1.0\\}firstName:" + term; +// query += "*) OR (@\\{http\\://www.alfresco.org/model/content/1.0\\}lastName:*" + term; +// query += "*) OR (@\\{http\\://www.alfresco.org/model/content/1.0\\}userName:" + term; + query += "*)) "; // final space here is important as default OR separator + } + query += ")"; +} + +model.searchResults = search.luceneSearch(query); diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/myAlfresco.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/office/myAlfresco.get.html.ftl index 85630a2065..e1683241c0 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/office/myAlfresco.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/office/myAlfresco.get.html.ftl @@ -20,6 +20,7 @@ + @@ -63,12 +64,12 @@
My Tasksoverdue=overdue, due today=due today
-
+
<#assign taskNum=0> <#list workflow.assignedTasks?sort_by('startDate') as t> <#assign taskNum=taskNum+1> - + diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/myTasks.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/office/myTasks.get.html.ftl index cca4ae7ca3..d5bb3f264c 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/office/myTasks.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/office/myTasks.get.html.ftl @@ -1,12 +1,25 @@ <#assign doc_actions="${url.context}/service/office/docActions"> <#if args.p?exists><#assign path=args.p><#else><#assign path=""> <#if args.n?exists><#assign node=args.n><#else><#assign node=companyhome> +<#-- resolve the path (from Company Home) into a node --> +<#if path?starts_with("/Company Home")> + <#if path?length=13> + <#assign d=companyhome> + <#elseif companyhome.childByNamePath[args.p[14..]]?exists> + <#assign d=companyhome.childByNamePath[args.p[14..]]> + <#else> + <#assign d=companyhome> + +<#else> + <#assign d=companyhome> +My Tasks + @@ -62,7 +75,38 @@
+<#if args.w?exists && d.isDocument> +
+
<#assign hasDue=t.properties["bpm:dueDate"]?exists> <#if hasDue> @@ -88,6 +89,8 @@ ${t.description?html} (${t.type?html}) <#if hasDue>
Due date: ${due?date} + <#else> +
(No due date)
+ + + + +
Start workflow + Start workflow on:
${d.name?html} +
+ +
Enter new workflow details below
+
+
Workflow:
+
+ +
+
Assign to:
+
+ +
Due on:
+
TODO: calendar picker
+
Description:
+
+
+
+<#else>
+
diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/myTasksDetail.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/office/myTasksDetail.get.html.ftl index 50ba6824c9..78a132d828 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/office/myTasksDetail.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/office/myTasksDetail.get.html.ftl @@ -61,7 +61,7 @@ <#list task.transitions as wt> - ${wt.label?html} + ${wt.label?html} diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/search.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/office/search.get.html.ftl index a415bef94a..8806df0569 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/office/search.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/office/search.get.html.ftl @@ -1,6 +1,6 @@ <#if args.p?exists><#assign path=args.p><#else><#assign path=""> <#if args.n?exists><#assign node=args.n><#else><#assign node=companyhome> -<#assign searchCommand="OfficeAddin.runSearch('${url.context}/service/office/searchResults', '${path}')" > +<#assign searchCommand="OfficeSearch.runSearch('${url.context}/service/office/searchResults', '${path}')" > <#if (args.searchagain?exists)><#assign searchText=args.searchagain><#else><#assign searchText=""> <#if (args.maxresults?exists)><#assign maxResults=args.maxresults><#else><#assign maxResults="5"> @@ -10,6 +10,7 @@ + diff --git a/source/web/css/office.css b/source/web/css/office.css index 9b01355a32..ef365d4ba9 100644 --- a/source/web/css/office.css +++ b/source/web/css/office.css @@ -199,25 +199,25 @@ ul { } input.button { - color:#0073e6; - font-size:11px; - font-weight:bold; - background-color:#cce6ff; - border:1px solid; - border-top-color:#0073e6; - border-left-color:#0073e6; - border-right-color:#0073e6; - border-bottom-color:#0073e6; + color: #0073e6; + font-size: 11px; + font-weight: bold; + background-color: #cce6ff; + border: 1px solid #0073e6; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr='#ffffffff',EndColorStr='#6fb7ff'); - cursor:pointer; - margin-left:6px; + cursor: pointer; + margin-left: 6px; } #taskDetails { padding: 2px; } +.taskItem { + cursor: pointer; +} + .taskItemSelected { background-color: #ffe500 !important; } @@ -228,3 +228,81 @@ input.button { height: 128px; overflow: auto; } + +.taskAction { + color: #0073e6; + float: left; + font-size: 11px; + font-weight: bold; + background-color: #cce6ff; + border: 1px solid #0073e6; + cursor: pointer; + margin: 0px 0px 0px 2px; + padding: 4px; + filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#ffffffff',EndColorStr='#6fb7ff'); +} + +.taskParameters { + border: 1px solid #ccc; + margin: 4px; + height: 200px; + overflow: auto; +} + +.taskParam { + clear: both; + float: left; + padding: 2px 0px 0px 4px; + width: 64px; +} + +.taskValue { + float: left; + padding: 2px 0px 0px 0px; + width: 164px; +} + +#ajxUser { + float: left; + margin: 2px; +} + +/* Autocomplete pop-up */ +ul.autocompleter-choices +{ + position: absolute; + margin: 0px; + padding: 0px; + list-style: none; + border: 1px solid #ccc; + background-color: white; + border-right-color: #ddd; + border-bottom-color: #ddd; + text-align: left; + z-index: 50; +} + +ul.autocompleter-choices li +{ + position: relative; + padding: 0.1em 1.5em 0.1em 1em; + cursor: pointer; + font-weight: normal; + font-size: 1em; +} + +ul.autocompleter-choices li.autocompleter-selected +{ + background-color: #444; + color: #fff; +} + +ul.autocompleter-choices span.autocompleter-queried +{ + font-weight: bold; +} + +ul.autocompleter-choices li.autocompleter-selected span.autocompleter-queried +{ +color: #9FCFFF; +} diff --git a/source/web/images/office/new_workflow.gif b/source/web/images/office/new_workflow.gif new file mode 100644 index 0000000000..d37fe0bc94 Binary files /dev/null and b/source/web/images/office/new_workflow.gif differ diff --git a/source/web/images/office/new_workflow_large.gif b/source/web/images/office/new_workflow_large.gif new file mode 100644 index 0000000000..9c7e869856 Binary files /dev/null and b/source/web/images/office/new_workflow_large.gif differ diff --git a/source/web/images/office/norm_left.gif b/source/web/images/office/norm_left.gif deleted file mode 100644 index bc0780768c..0000000000 Binary files a/source/web/images/office/norm_left.gif and /dev/null differ diff --git a/source/web/images/office/norm_left_on.gif b/source/web/images/office/norm_left_on.gif deleted file mode 100644 index a14056cfbf..0000000000 Binary files a/source/web/images/office/norm_left_on.gif and /dev/null differ diff --git a/source/web/images/office/norm_right.gif b/source/web/images/office/norm_right.gif deleted file mode 100644 index 2ce2f96429..0000000000 Binary files a/source/web/images/office/norm_right.gif and /dev/null differ diff --git a/source/web/images/office/norm_right_on.gif b/source/web/images/office/norm_right_on.gif deleted file mode 100644 index c6c750069e..0000000000 Binary files a/source/web/images/office/norm_right_on.gif and /dev/null differ diff --git a/source/web/scripts/ajax/autocompleter.js b/source/web/scripts/ajax/autocompleter.js new file mode 100644 index 0000000000..e7dac837e4 --- /dev/null +++ b/source/web/scripts/ajax/autocompleter.js @@ -0,0 +1,404 @@ +/** + * Autocompleter + * + * @version 1.0rc4 + * + * @license MIT-style license + * @author Harald Kirschner + * @copyright Author + */ +var Autocompleter = {}; + +Autocompleter.Base = new Class({ + + options: { + minLength: 1, + useSelection: true, + markQuery: true, + inheritWidth: true, + maxChoices: 10, + injectChoice: null, + onSelect: Class.empty, + onShow: Class.empty, + onHide: Class.empty, + customTarget: null, + className: 'autocompleter-choices', + zIndex: 42, + observerOptions: {}, + fxOptions: {}, + overflown: [] + }, + + initialize: function(el, options) { + this.setOptions(options); + this.element = $(el); + this.build(); + this.observer = new Observer(this.element, this.prefetch.bind(this), $merge({ + delay: 400 + }, this.options.observerOptions)); + this.value = this.observer.value; + this.queryValue = null; + }, + + /** + * build - Initialize DOM + * + * Builds the html structure for choices and appends the events to the element. + * Override this function to modify the html generation. + */ + build: function() { + if ($(this.options.customTarget)) this.choices = this.options.customTarget; + else { + this.choices = new Element('ul', { + 'class': this.options.className, + styles: {zIndex: this.options.zIndex} + }).injectInside(document.body); + this.fix = new OverlayFix(this.choices); + } + this.fx = this.choices.effect('opacity', $merge({ + wait: false, + duration: 200 + }, this.options.fxOptions)) + .addEvent('onStart', function() { + if (this.fx.now) return; + this.choices.setStyle('display', ''); + this.fix.show(); + }.bind(this)) + .addEvent('onComplete', function() { + if (this.fx.now) return; + this.choices.setStyle('display', 'none'); + this.fix.hide(); + }.bind(this)).set(0); + this.element.setProperty('autocomplete', 'off') + .addEvent(window.ie ? 'keydown' : 'keypress', this.onCommand.bindWithEvent(this)) + .addEvent('mousedown', this.onCommand.bindWithEvent(this, [true])) + .addEvent('focus', this.toggleFocus.bind(this, [true])) + .addEvent('blur', this.toggleFocus.bind(this, [false])) + .addEvent('trash', this.destroy.bind(this)); + }, + + destroy: function() { + this.choices.remove(); + }, + + toggleFocus: function(state) { + this.focussed = state; + if (!state) this.hideChoices(); + }, + + onCommand: function(e, mouse) { + if (mouse && this.focussed) this.prefetch(); + if (e.key && !e.shift) switch (e.key) { + case 'enter': + if (this.selected && this.visible) { + this.choiceSelect(this.selected); + e.stop(); + } return; + case 'up': case 'down': + if (this.observer.value != (this.value || this.queryValue)) this.prefetch(); + else if (this.queryValue === null) break; + else if (!this.visible) this.showChoices(); + else { + this.choiceOver((e.key == 'up') + ? this.selected.getPrevious() || this.choices.getLast() + : this.selected.getNext() || this.choices.getFirst() ); + this.setSelection(); + } + e.stop(); return; + case 'esc': this.hideChoices(); return; + } + this.value = false; + }, + + setSelection: function() { + if (!this.options.useSelection) return; + var startLength = this.queryValue.length; + if (this.element.value.indexOf(this.queryValue) != 0) return; + var insert = this.selected.inputValue.substr(startLength); + if (document.getSelection) { + this.element.value = this.queryValue + insert; + this.element.selectionStart = startLength; + this.element.selectionEnd = this.element.value.length; + } else if (document.selection) { + var sel = document.selection.createRange(); + sel.text = insert; + sel.move("character", - insert.length); + sel.findText(insert); + sel.select(); + } + this.value = this.observer.value = this.element.value; + }, + + hideChoices: function() { + if (!this.visible) return; + this.visible = this.value = false; + this.observer.clear(); + this.fx.start(0); + this.fireEvent('onHide', [this.element, this.choices]); + }, + + showChoices: function() { + if (this.visible || !this.choices.getFirst()) return; + this.visible = true; + var pos = this.element.getCoordinates(this.options.overflown); + this.choices.setStyles({ + left: pos.left, + top: pos.bottom + }); + if (this.options.inheritWidth) this.choices.setStyle('width', pos.width); + this.fx.start(1); + this.choiceOver(this.choices.getFirst()); + this.fireEvent('onShow', [this.element, this.choices]); + }, + + prefetch: function() { + if (this.element.value.length < this.options.minLength) this.hideChoices(); + else if (this.element.value == this.queryValue) this.showChoices(); + else this.query(); + }, + + updateChoices: function(choices) { + this.choices.empty(); + this.selected = null; + if (!choices || !choices.length) return; + if (this.options.maxChoices < choices.length) choices.length = this.options.maxChoices; + choices.each(this.options.injectChoice || function(choice, i){ + var el = new Element('li').setHTML(this.markQueryValue(choice)); + el.inputValue = choice; + this.addChoiceEvents(el).injectInside(this.choices); + }, this); + this.showChoices(); + }, + + choiceOver: function(el) { + if (this.selected) this.selected.removeClass('autocompleter-selected'); + this.selected = el.addClass('autocompleter-selected'); + }, + + choiceSelect: function(el) { + this.observer.value = this.element.value = el.inputValue; + this.hideChoices(); + this.fireEvent('onSelect', [this.element], 20); + }, + + /** + * markQueryValue + * + * Marks the queried word in the given string with * + * Call this i.e. from your custom parseChoices, same for addChoiceEvents + * + * @param {String} Text + * @return {String} Text + */ + markQueryValue: function(txt) { + return (this.options.markQuery && this.queryValue) ? txt.replace(new RegExp('^(' + this.queryValue.escapeRegExp() + ')', 'i'), '$1') : txt; + }, + + /** + * addChoiceEvents + * + * Appends the needed event handlers for a choice-entry to the given element. + * + * @param {Element} Choice entry + * @return {Element} Choice entry + */ + addChoiceEvents: function(el) { + return el.addEvents({ + mouseover: this.choiceOver.bind(this, [el]), + mousedown: this.choiceSelect.bind(this, [el]) + }); + } +}); + +Autocompleter.Base.implement(new Events); +Autocompleter.Base.implement(new Options); + +Autocompleter.Local = Autocompleter.Base.extend({ + + options: { + minLength: 0, + filterTokens : null + }, + + initialize: function(el, tokens, options) { + this.parent(el, options); + this.tokens = tokens; + if (this.options.filterTokens) this.filterTokens = this.options.filterTokens.bind(this); + }, + + query: function() { + this.hideChoices(); + this.queryValue = this.element.value; + this.updateChoices(this.filterTokens()); + }, + + filterTokens: function(token) { + var regex = new RegExp('^' + this.queryValue.escapeRegExp(), 'i'); + return this.tokens.filter(function(token) { + return regex.test(token); + }); + } + +}); + +Autocompleter.Ajax = {}; + +Autocompleter.Ajax.Base = Autocompleter.Base.extend({ + + options: { + postVar: 'value', + postData: {}, + ajaxOptions: {}, + onRequest: Class.empty, + onComplete: Class.empty + }, + + initialize: function(el, url, options) { + this.parent(el, options); + this.ajax = new Ajax(url, $merge({ + autoCancel: true + }, this.options.ajaxOptions)); + this.ajax.addEvent('onComplete', this.queryResponse.bind(this)); + this.ajax.addEvent('onFailure', this.queryResponse.bind(this, [false])); + }, + + query: function(){ + var data = $extend({}, this.options.postData); + data[this.options.postVar] = this.element.value; + this.fireEvent('onRequest', [this.element, this.ajax]); + this.ajax.request(data); + }, + + /** + * queryResponse - abstract + * + * Inherated classes have to extend this function and use this.parent(resp) + * + * @param {String} Response + */ + queryResponse: function(resp) { + this.value = this.queryValue = this.element.value; + this.selected = false; + this.hideChoices(); + this.fireEvent(resp ? 'onComplete' : 'onFailure', [this.element, this.ajax], 20); + } + +}); + +Autocompleter.Ajax.Json = Autocompleter.Ajax.Base.extend({ + + queryResponse: function(resp) { + this.parent(resp); + var choices = Json.evaluate(resp || false); + if (!choices || !choices.length) return; + this.updateChoices(choices); + } + +}); + +Autocompleter.Ajax.Xhtml = Autocompleter.Ajax.Base.extend({ + + options: { + parseChoices: null + }, + + queryResponse: function(resp) { + this.parent(resp); + if (!resp) return; + this.choices.setHTML(resp).getChildren().each(this.options.parseChoices || this.parseChoices, this); + this.showChoices(); + }, + + parseChoices: function(el) { + var value = el.innerHTML; + el.inputValue = value; + el.setHTML(this.markQueryValue(value)); + } + +}); + + +var OverlayFix = new Class({ + + initialize: function(el) { + this.element = $(el); + if (window.ie){ + this.element.addEvent('trash', this.destroy.bind(this)); + this.fix = new Element('iframe', { + properties: { + frameborder: '0', + scrolling: 'no', + src: 'javascript:false;' + }, + styles: { + position: 'absolute', + border: 'none', + display: 'none', + filter: 'progid:DXImageTransform.Microsoft.Alpha(opacity=0)' + } + }).injectAfter(this.element); + } + }, + + show: function() { + if (this.fix) this.fix.setStyles($extend( + this.element.getCoordinates(), { + display: '', + zIndex: (this.element.getStyle('zIndex') || 1) - 1 + })); + return this; + }, + + hide: function() { + if (this.fix) this.fix.setStyle('display', 'none'); + return this; + }, + + destroy: function() { + this.fix.remove(); + } + +}); + +/** + * Observer - Observe formelements for changes + * + * @version 1.0rc1 + * + * @license MIT-style license + * @author Harald Kirschner + * @copyright Author + */ +var Observer = new Class({ + + options: { + periodical: false, + delay: 1000 + }, + + initialize: function(el, onFired, options){ + this.setOptions(options); + this.addEvent('onFired', onFired); + this.element = $(el); + this.listener = this.fired.bind(this); + this.value = this.element.getValue(); + if (this.options.periodical) this.timer = this.listener.periodical(this.options.periodical); + else this.element.addEvent('keyup', this.listener); + }, + + fired: function() { + var value = this.element.getValue(); + if (this.value == value) return; + this.clear(); + this.value = value; + this.timeout = this.fireEvent.delay(this.options.delay, this, ['onFired', [value]]); + }, + + clear: function() { + $clear(this.timeout); + return this; + } +}); + +Observer.implement(new Options); +Observer.implement(new Events); \ No newline at end of file diff --git a/source/web/scripts/office/doc_details.js b/source/web/scripts/office/doc_details.js index 0c178eee63..e69de29bb2 100644 --- a/source/web/scripts/office/doc_details.js +++ b/source/web/scripts/office/doc_details.js @@ -1,110 +0,0 @@ -var xmlHttp - -function showStatus(url) -{ - xmlHttp=GetXmlHttpObject() - if (xmlHttp==null) - { - alert ("Browser does not support HTTP Request") - return - } - xmlHttp.onreadystatechange=stateChanged - xmlHttp.open("GET",url,true) - xmlHttp.send(null) -} - -function stateChanged() -{ - if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") - { - document.getElementById("statusArea").innerHTML=xmlHttp.responseText - window.location.reload(); - } -} - -function GetXmlHttpObject() -{ - var objXMLHttp = null; - if (window.XMLHttpRequest) - { - objXMLHttp=new XMLHttpRequest(); - } - else if (window.ActiveXObject) - { - objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP"); - } - return objXMLHttp; -} - -function runAction(useTemplate, Action, Doc, Msg) -{ - if (Msg != "" && !confirm(Msg)) - { - return; - } - document.getElementById("statusArea").innerHTML="Running action..."; - showStatus("/alfresco/command/script/execute/workspace/SpacesStore/" + useTemplate + "/workspace/SpacesStore/" + Doc + "?action=" + Action); -} - - -function getWindowHeight() -{ - var windowHeight = 0; - if (typeof(window.innerHeight) == 'number') - { - windowHeight = window.innerHeight; - } - else - { - if (document.documentElement && document.documentElement.clientHeight) - { - windowHeight = document.documentElement.clientHeight; - } - else - { - if (document.body && document.body.clientHeight) - { - windowHeight = document.body.clientHeight; - } - } - } - return windowHeight; -} - -function setContent() -{ - if (document.getElementById) - { - var windowHeight = getWindowHeight(); - if (windowHeight > 0) - { - var detailsListHeaderElement = document.getElementById('detailsListHeader'); - var detailsListElement = document.getElementById('detailsList'); - var tabBarElement = document.getElementById('tabBar'); - var bottomMarginElement = document.getElementById('bottomMargin'); - var documentActionsElement = document.getElementById('documentActions'); - - var detailsListHeight = detailsListElement.offsetHeight; - var detailsListHeaderHeight = detailsListHeaderElement.offsetHeight; - var tabBarHeight = tabBarElement.offsetHeight; - var bottomMarginHeight = bottomMarginElement.offsetHeight; - var documentActionsHeight = documentActionsElement.offsetHeight; - - if (windowHeight > 0) - { - detailsListElement.style.height = ((windowHeight- (tabBarHeight + detailsListHeaderHeight + documentActionsHeight + bottomMarginHeight)) /3) * 2 + 'px'; - documentActionsElement.style.height = (windowHeight- (tabBarHeight + detailsListHeaderHeight + documentActionsHeight + bottomMarginHeight)) /3 + 'px'; - } - } - } -} - -window.onload = function() -{ - setContent(); -} - -window.onresize = function() -{ - setContent(); -} \ No newline at end of file diff --git a/source/web/scripts/office/my_alfresco.js b/source/web/scripts/office/my_alfresco.js index 729e046e09..4a0c5298fc 100644 --- a/source/web/scripts/office/my_alfresco.js +++ b/source/web/scripts/office/my_alfresco.js @@ -1,182 +1,56 @@ -var xmlHttp - -function GetXmlHttpObject() -{ - var objXMLHttp=null; - if (window.XMLHttpRequest) - { - objXMLHttp=new XMLHttpRequest() - } - else if (window.ActiveXObject) - { - objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") - } - - return objXMLHttp; -} - -function showStatus(url) +/* + * Prerequisites: mootools.v1.1.js + * office_addin.js + */ +var OfficeMyAlfresco = { - xmlHttp=GetXmlHttpObject(); - if (xmlHttp==null) + init: function() { - alert("Browser does not support HTTP Request"); - return; - } - xmlHttp.onreadystatechange=stateChanged; - xmlHttp.open("GET",url+"&sid="+Math.random(),true); - xmlHttp.send(null); -} - -function stateChanged() -{ - if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") - { - if (xmlHttp.responseText.indexOf("System Error") > 0) + var tasks = $$('#taskList .taskItem'); + + tasks.each(function(task, i) { - var myWindow = window.open("", "_blank", "scrollbars,height=500,width=400"); - myWindow.document.write(xmlHttp.responseText); - document.getElementById("statusArea").innerHTML=""; - } - else - { - document.getElementById("statusArea").innerHTML=xmlHttp.responseText; - window.location.reload(); - } - } -} + // register 'mouseenter' event for each task + task.addEvent('mouseenter', function(e) + { + // highlight the item title + task.addClass('taskItemSelected'); -function runAction(Action, Doc, Msg) -{ - if (Msg != "" && !confirm(Msg)) - { - return; + // reset styles on all closed tasks + tasks.each(function(otherTask, j) + { + if (otherTask != task) + { + // reset selected class + otherTask.removeClass('taskItemSelected'); + } + }); + }); + + // register 'mouseleave' event for each task + task.addEvent('mouseleave', function(e) + { + // unhighlight the item title + task.removeClass('taskItemSelected'); + }); + + // register 'click' event for each task + task.addEvent('click', function(e) + { + window.location.href = window.contextPath + "/service/office/myTasks?p=" + window.queryObject.p + "&t=" + task.id; + }); + }); + + $('taskList').addEvent('mouseleave', function(e) + { + // handler for mouse leaving the entire task list + tasks.each(function(task, i) + { + task.removeClass('taskItemSelected'); + }); + }); } - document.getElementById("statusArea").innerHTML="Running action..."; - showStatus("/alfresco/command/script/execute/workspace/SpacesStore/${doc_actions}/workspace/SpacesStore/" + Doc + "?action=" + Action); -} + +}; - -function getWindowHeight() { - var windowHeight = 0; - if (typeof(window.innerHeight) == 'number') { - windowHeight = window.innerHeight; - } - else { - if (document.documentElement && document.documentElement.clientHeight) { - windowHeight = document.documentElement.clientHeight; - } - else { - if (document.body && document.body.clientHeight) { - windowHeight = document.body.clientHeight; - } - } - } - return windowHeight; - } - function setContent() { - if (document.getElementById) { - var windowHeight = getWindowHeight(); - if (windowHeight > 0) { - var mycheckedoutdocsListElement = document.getElementById('mycheckedoutdocsList'); - var mytodoListElement = document.getElementById('mytodoList'); - var tabBarElement = document.getElementById('tabBar'); - var mycheckedoutdocsListHeaderElement = document.getElementById('mycheckedoutdocsListHeader'); - var mytodoListHeaderElement = document.getElementById('mytodoListHeader'); - var bottomMarginElement = document.getElementById('bottomMargin'); - var documentActionsElement = document.getElementById('documentActions'); - - var mycheckedoutdocsListHeight = mycheckedoutdocsListElement.offsetHeight; - var mytodoListHeight = mytodoListElement.offsetHeight; - var tabBarHeight = tabBarElement.offsetHeight; - var mycheckedoutdocsListHeaderHeight = mycheckedoutdocsListHeaderElement.offsetHeight; - var mytodoListHeaderHeight = mytodoListHeaderElement.offsetHeight; - var bottomMarginHeight = bottomMarginElement.offsetHeight; - var documentActionsHeight = documentActionsElement.offsetHeight; - - if (windowHeight > 0) { - mycheckedoutdocsListElement.style.height = (windowHeight- (tabBarHeight + mytodoListHeaderHeight + mycheckedoutdocsListHeaderHeight + documentActionsHeight + bottomMarginHeight)) /2 + 'px'; - mytodoListElement.style.height = (windowHeight- (tabBarHeight + mytodoListHeaderHeight + mycheckedoutdocsListHeaderHeight + documentActionsHeight + bottomMarginHeight)) /2 + 'px'; - } - - } - } - } - window.onload = function() { - setContent(); - stripe('mytodoList', '#fff', '#f6f8fa'); - stripe('mycheckedoutdocsList', '#fff', '#f6f8fa'); - } - window.onresize = function() { - setContent(); - } - - - - // this function is need to work around - // a bug in IE related to element attributes - function hasClass(obj) { - var result = false; - if (obj.getAttributeNode("class") != null) { - result = obj.getAttributeNode("class").value; - } - return result; - } - - function stripe(id) { - - // the flag we'll use to keep track of - // whether the current row is odd or even - var even = false; - - // if arguments are provided to specify the colours - // of the even & odd rows, then use the them; - // otherwise use the following defaults: - var evenColor = arguments[1] ? arguments[1] : "#fff"; - var oddColor = arguments[2] ? arguments[2] : "#eee"; - - // obtain a reference to the desired table - // if no such table exists, abort - var table = document.getElementById(id); - if (! table) { return; } - - // by definition, tables can have more than one tbody - // element, so we'll have to get the list of child - // <tbody>s - var tbodies = table.getElementsByTagName("tbody"); - - // and iterate through them... - for (var h = 0; h < tbodies.length; h++) { - - // find all the <tr> elements... - var trs = tbodies[h].getElementsByTagName("tr"); - - // ... and iterate through them - for (var i = 0; i < trs.length; i++) { - - // avoid rows that have a class attribute - // or backgroundColor style - if (!hasClass(trs[i]) && ! trs[i].style.backgroundColor) { - - // get all the cells in this row... - var tds = trs[i].getElementsByTagName("td"); - - // and iterate through them... - for (var j = 0; j < tds.length; j++) { - - var mytd = tds[j]; - - // avoid cells that have a class attribute - // or backgroundColor style - if (! hasClass(mytd) && ! mytd.style.backgroundColor) { - - mytd.style.backgroundColor = even ? evenColor : oddColor; - - } - } - } - // flip from odd to even, or vice-versa - even = ! even; - } - } - } +window.addEvent('domready', OfficeMyAlfresco.init); \ No newline at end of file diff --git a/source/web/scripts/office/my_tasks.js b/source/web/scripts/office/my_tasks.js index 52de8127e7..f3fe2136ed 100644 --- a/source/web/scripts/office/my_tasks.js +++ b/source/web/scripts/office/my_tasks.js @@ -1,9 +1,42 @@ /* * Prerequisites: mootools.v1.1.js + * autocompleter.js + * office_addin.js */ var OfficeMyTasks = { init: function() + { + OfficeMyTasks.setupEventHandlers(); + + if (window.queryObject.t) + { + OfficeMyTasks.openTask(window.queryObject.t); + } + + if ($('wrkUser')) + { + var autoUser = new Autocompleter.Ajax.Json($('wrkUser'), window.contextPath + '/service/office/getUsers', + { + postVar: 's', + ajaxOptions: + { + method: 'get', + headers: {'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT'} + }, + onRequest: function(el) + { + $('ajxUser').setStyle('display', ''); + }, + onComplete: function(el) + { + $('ajxUser').setStyle('display', 'none'); + } + }); + } + }, + + setupEventHandlers: function() { var tasks = $$('#taskList .taskItem'); @@ -50,10 +83,13 @@ var OfficeMyTasks = // flag this task as open task.isOpen = true; + // highlight the item title + task.addClass('taskItemSelected'); + OfficeAddin.showStatusText("Loading task...", "ajax_anim.gif", false); // ajax call to load task details - var actionURL = "/alfresco/service/office/myTasksDetail?t=" + task.id; + var actionURL = window.contextPath + "/service/office/myTasksDetail?t=" + task.id; var myAjax = new Ajax(actionURL, { method: 'get', headers: {'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT'}, @@ -92,7 +128,45 @@ var OfficeMyTasks = } }); }); - } + }, + + openTask: function(taskId) + { + $(taskId).fireEvent("click"); + }, + + transitionTask: function(taskId, commandURL, successMessage) + { + OfficeAddin.showStatusText("Running workflow...", "ajax_anim.gif", false); + + // ajax call to run workflow + var myAjax = new Ajax(commandURL, { + method: 'get', + headers: {'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT'}, + onComplete: function(textResponse, xmlResponse) + { + // Remove any trailing hash + var href = window.location.href.replace("#", "") + // Remove any previous "&st=" string + href = href.replace(/[?&]st=([^&$]+)/g, ""); + // Remove any previous "&t=" string + href = href.replace(/[?&]t=([^&$]+)/g, ""); + // Optionally add a status string + if (successMessage != "") + { + var json = "{\"statusString\":\"" + successMessage + "\",\"statusCode\":true}"; + href += "&st=" + encodeURI(json); + href += "&t=" + taskId; + } + window.location.href = href; + }, + onFailure: function() + { + OfficeAddin.showStatusText("Couldn't run workflow", "action_failed.gif", true); + } + }); + myAjax.request(); + } }; -window.addEvent('domready', OfficeMyTasks.init); \ No newline at end of file +window.addEvent('domready', OfficeMyTasks.init); diff --git a/source/web/scripts/office/navigation.js b/source/web/scripts/office/navigation.js index a881ff401d..e69de29bb2 100644 --- a/source/web/scripts/office/navigation.js +++ b/source/web/scripts/office/navigation.js @@ -1,187 +0,0 @@ - -var xmlHttp - -function GetXmlHttpObject() -{ - var objXMLHttp=null; - if (window.XMLHttpRequest) - { - objXMLHttp=new XMLHttpRequest() - } - else if (window.ActiveXObject) - { - objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") - } - - return objXMLHttp; -} - -function showStatus(url) -{ - xmlHttp=GetXmlHttpObject(); - if (xmlHttp==null) - { - alert("Browser does not support HTTP Request"); - return; - } - xmlHttp.onreadystatechange=stateChanged; - xmlHttp.open("GET",url+"&sid="+Math.random(),true); - xmlHttp.send(null); -} - -function stateChanged() -{ - if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") - { - if (xmlHttp.responseText.indexOf("System Error") > 0) - { - var myWindow = window.open("", "_blank", "scrollbars,height=500,width=400"); - myWindow.document.write(xmlHttp.responseText); - document.getElementById("statusArea").innerHTML=""; - } - else - { - document.getElementById("statusArea").innerHTML=xmlHttp.responseText; - window.location.reload(); - } - } -} - - - - -function runAction(useTemplate, Action, Doc, Msg) -{ - if (Msg != "" && !confirm(Msg)) - { - return; - } - document.getElementById("statusArea").innerHTML="Running action..."; - showStatus("/alfresco/command/script/execute/workspace/SpacesStore/" + useTemplate + "/workspace/SpacesStore/" + Doc + "?action=" + Action); -} - -function getWindowHeight() { - var windowHeight = 0; - if (typeof(window.innerHeight) == 'number') { - windowHeight = window.innerHeight; - } - else { - if (document.documentElement && document.documentElement.clientHeight) { - windowHeight = document.documentElement.clientHeight; - } - else { - if (document.body && document.body.clientHeight) { - windowHeight = document.body.clientHeight; - } - } - } - return windowHeight; - } - function setContent() { - if (document.getElementById) { - var windowHeight = getWindowHeight(); - if (windowHeight > 0) { - var spaceListElement = document.getElementById('spaceList'); - var contentListElement = document.getElementById('contentList'); - var tabBarElement = document.getElementById('tabBar'); - var currentSpaceInfoElement = document.getElementById('currentSpaceInfo'); - var spaceListHeaderElement = document.getElementById('spaceListHeader'); - var contentListHeaderElement = document.getElementById('contentListHeader'); - var bottomMarginElement = document.getElementById('bottomMargin'); - var documentActionsElement = document.getElementById('documentActions'); - - var spaceListHeight = spaceListElement.offsetHeight; - var contentListHeight = contentListElement.offsetHeight; - var tabBarHeight = tabBarElement.offsetHeight; - var currentSpaceInfoHeight = currentSpaceInfoElement.offsetHeight; - var spaceListHeaderHeight = spaceListHeaderElement.offsetHeight; - var contentListHeaderHeight = contentListHeaderElement.offsetHeight; - var bottomMarginHeight = bottomMarginElement.offsetHeight; - var documentActionsHeight = documentActionsElement.offsetHeight; - - if (windowHeight > 0) { - spaceListElement.style.height = (windowHeight- (tabBarHeight + currentSpaceInfoHeight + spaceListHeaderHeight + contentListHeaderHeight + documentActionsHeight + bottomMarginHeight)) /2 + 'px'; - contentListElement.style.height = (windowHeight- (tabBarHeight + currentSpaceInfoHeight + spaceListHeaderHeight + contentListHeaderHeight + documentActionsHeight + bottomMarginHeight)) /2 + 'px'; - } - - } - } - } - window.onload = function() { - setContent(); - stripe('spaceList', '#fff', '#f6f8fa'); - stripe('contentList', '#fff', '#f6f8fa'); - } - window.onresize = function() { - setContent(); - } - - - - // this function is need to work around - // a bug in IE related to element attributes - function hasClass(obj) { - var result = false; - if (obj.getAttributeNode("class") != null) { - result = obj.getAttributeNode("class").value; - } - return result; - } - - function stripe(id) { - - // the flag we'll use to keep track of - // whether the current row is odd or even - var even = false; - - // if arguments are provided to specify the colours - // of the even & odd rows, then use the them; - // otherwise use the following defaults: - var evenColor = arguments[1] ? arguments[1] : "#fff"; - var oddColor = arguments[2] ? arguments[2] : "#eee"; - - // obtain a reference to the desired table - // if no such table exists, abort - var table = document.getElementById(id); - if (! table) { return; } - - // by definition, tables can have more than one tbody - // element, so we'll have to get the list of child - // <tbody>s - var tbodies = table.getElementsByTagName("tbody"); - - // and iterate through them... - for (var h = 0; h < tbodies.length; h++) { - - // find all the <tr> elements... - var trs = tbodies[h].getElementsByTagName("tr"); - - // ... and iterate through them - for (var i = 0; i < trs.length; i++) { - - // avoid rows that have a class attribute - // or backgroundColor style - if (!hasClass(trs[i]) && ! trs[i].style.backgroundColor) { - - // get all the cells in this row... - var tds = trs[i].getElementsByTagName("td"); - - // and iterate through them... - for (var j = 0; j < tds.length; j++) { - - var mytd = tds[j]; - - // avoid cells that have a class attribute - // or backgroundColor style - if (! hasClass(mytd) && ! mytd.style.backgroundColor) { - - mytd.style.backgroundColor = even ? evenColor : oddColor; - - } - } - } - // flip from odd to even, or vice-versa - even = ! even; - } - } - } diff --git a/source/web/scripts/office/office_addin.js b/source/web/scripts/office/office_addin.js index f99c452328..a05a326857 100644 --- a/source/web/scripts/office/office_addin.js +++ b/source/web/scripts/office/office_addin.js @@ -6,10 +6,11 @@ var OfficeAddin = ANIM_LENGTH: 300, STATUS_FADE: 10000, LIST_DEF_HEIGHT: 204, - + init: function() { - this.queryObject = OfficeAddin.toQueryObject(document.location.search); + window.queryObject = OfficeAddin.toQueryObject(document.location.search); + window.contextPath = OfficeAddin.getContextPath(); /* Update needed after page load? */ if(this.queryObject.st) @@ -18,38 +19,6 @@ var OfficeAddin = var imgSuccess = (objResponse.statusCode ? "action_successful.gif" : "action_failed.gif"); OfficeAddin.showStatusText(objResponse.statusString, imgSuccess, true); } - - /* Have search box? */ - if ($("searchText")) - { - $("searchText").addEvent("keydown", function(event) - { - event = new Event(event); - if (event.key == 'enter') - { - $("simpleSearchButton").click(); - } - }); - } - - /* Have expandos? */ - if ($("toggleSpaceList")) - { - $("toggleSpaceList").addEvent("click", function() - { - $("spaceList").removeClass("listMediumShrink"); - $("spaceList").addClass("listMediumGrow"); - $("documentList").removeClass("listMediumGrow"); - $("documentList").addClass("listMediumShrink"); - }); - $("toggleDocumentList").addEvent("click", function() - { - $("documentList").removeClass("listMediumShrink"); - $("documentList").addClass("listMediumGrow"); - $("spaceList").removeClass("listMediumGrow"); - $("spaceList").addClass("listMediumShrink"); - }); - } }, toQueryObject: function(s) @@ -134,26 +103,23 @@ var OfficeAddin = }); myAjax.request(); }, - - /* AJAX call to perform server-side search */ - runSearch: function(useTemplate, argPath) + + /* Calculates and returns the context path for the current page */ + getContextPath: function() { - OfficeAddin.showStatusText("Searching...", "ajax_anim.gif", false); - - var searchString = $("searchText").value; - var maxResults = $("maxResults").value; - - var actionURL = useTemplate + "?p=" + argPath + "&search=" + searchString + "&maxresults=" + maxResults; - var myAjax = new Ajax(actionURL, { - method: 'get', - headers: {'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT'}, - onComplete: function(textResponse, xmlResponse) - { - OfficeAddin.hideStatusText(); - $("searchResultsList").innerHTML = textResponse; - } - }); - myAjax.request(); + var path = window.location.pathname; + var idx = path.indexOf("/", 1); + var contextPath = ""; + if (idx != -1) + { + contextPath = path.substring(0, idx); + } + else + { + contextPath = ""; + } + + return contextPath; } }; diff --git a/source/web/scripts/office/search.js b/source/web/scripts/office/search.js index 192a3c6203..0a6b0f8872 100644 --- a/source/web/scripts/office/search.js +++ b/source/web/scripts/office/search.js @@ -1,203 +1,41 @@ -var xmlHttp - -function GetXmlHttpObject() +/* + * Prerequisites: mootools.v1.1.js + * office_addin.js + */ +var OfficeSearch = { - var objXMLHttp=null; - if (window.XMLHttpRequest) + init: function() { - objXMLHttp=new XMLHttpRequest() - } - else if (window.ActiveXObject) - { - objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") - } - - return objXMLHttp; -} - -function showStatus(url) -{ -// alert(url); - xmlHttp=GetXmlHttpObject(); - if (xmlHttp==null) - { - alert("Browser does not support HTTP Request"); - return; - } - xmlHttp.onreadystatechange=stateChanged; - xmlHttp.open("GET",url+"&sid="+Math.random(),true); - xmlHttp.send(null); -} - -function stateChanged() -{ - if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") - { - if (xmlHttp.responseText.indexOf("System Error") > 0) + $("searchText").addEvent("keydown", function(event) { - var myWindow = window.open("", "_blank", "scrollbars,height=500,width=400"); - myWindow.document.write(xmlHttp.responseText); - } - else - { - document.getElementById("searchResultsList").innerHTML=xmlHttp.responseText; - stripe('searchResultsList', '#fff', '#f6f8fa'); - } - document.getElementById("statusArea").innerHTML=""; - } -} + event = new Event(event); + if (event.key == 'enter') + { + $("simpleSearchButton").click(); + } + }); + }, -function runSearch(useTemplate) -{ - document.getElementById("statusArea").innerHTML="Searching..."; - searchString = document.getElementById("searchText").value; - maxcount = document.getElementById("maxresults").value; - doSearch(useTemplate, searchString, maxcount); -} - -function doSearch(useTemplate, searchString, maxcount) -{ - showStatus("/alfresco/template/workspace/SpacesStore/"+ useTemplate + "/workspace/SpacesStore/" + useTemplate + "?search=" + searchString + "&maxresults=" + maxcount); -} - -function handleTextEnter(e) { - var keycode; - - // get the keycode - if (window.event) + /* AJAX call to perform server-side search */ + runSearch: function(useTemplate, argPath) { - keycode = window.event.keyCode; + OfficeAddin.showStatusText("Searching...", "ajax_anim.gif", false); + + var searchString = $("searchText").value; + var maxResults = $("maxResults").value; + + var actionURL = useTemplate + "?p=" + argPath + "&search=" + searchString + "&maxresults=" + maxResults; + var myAjax = new Ajax(actionURL, { + method: 'get', + headers: {'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT'}, + onComplete: function(textResponse, xmlResponse) + { + OfficeAddin.hideStatusText(); + $("searchResultsList").innerHTML = textResponse; + } + }); + myAjax.request(); } - else if (e) - { - keycode = e.which; - } - // if ENTER was pressed execute the query - if (keycode == 13) - { - runSearch(); - return false; - } - return true; -} - - -function getWindowHeight() { - var windowHeight = 0; - if (typeof(window.innerHeight) == 'number') { - windowHeight = window.innerHeight; - } - else { - if (document.documentElement && document.documentElement.clientHeight) { - windowHeight = document.documentElement.clientHeight; - } - else { - if (document.body && document.body.clientHeight) { - windowHeight = document.body.clientHeight; - } - } - } - return windowHeight; - } - -function setContent() { - if (document.getElementById) { - var windowHeight = getWindowHeight(); - if (windowHeight > 0) { - - var tabBarElement = document.getElementById('tabBar'); - var bottomMarginElement = document.getElementById('bottomMargin'); - var searchResultsListElement = document.getElementById('searchResultsList'); - var searchHeightElement = document.getElementById('search'); - var searchResultsListHeaderElement = document.getElementById('searchResultsListHeader'); - - var tabBarHeight = tabBarElement.offsetHeight; - var bottomMarginHeight = bottomMarginElement.offsetHeight; - var searchResultsListHeight = searchResultsListElement.offsetHeight; - var searchHeight = searchHeightElement.offsetHeight; - var searchResultsListHeaderHeight = searchResultsListHeaderElement.offsetHeight; - - if (windowHeight > 0) { - searchResultsListElement.style.height = windowHeight- (tabBarHeight + searchHeight + searchResultsListHeaderHeight + bottomMarginHeight) + 'px'; - } - - } - } - } - window.onload = function() { - setContent(); - stripe('searchResultsList', '#fff', '#f6f8fa'); - } - window.onresize = function() { - setContent(); - } - - - // this function is need to work around - // a bug in IE related to element attributes - function hasClass(obj) { - var result = false; - if (obj.getAttributeNode("class") != null) { - result = obj.getAttributeNode("class").value; - } - return result; - } - -function stripe(id) { - - // the flag we'll use to keep track of - // whether the current row is odd or even - var even = false; - - // if arguments are provided to specify the colours - // of the even & odd rows, then use the them; - // otherwise use the following defaults: - var evenColor = arguments[1] ? arguments[1] : "#fff"; - var oddColor = arguments[2] ? arguments[2] : "#eee"; - - // obtain a reference to the desired table - // if no such table exists, abort - var table = document.getElementById(id); - if (! table) { return; } - - // by definition, tables can have more than one tbody - // element, so we'll have to get the list of child - // <tbody>s - var tbodies = table.getElementsByTagName("tbody"); - - // and iterate through them... - for (var h = 0; h < tbodies.length; h++) { - - // find all the <tr> elements... - var trs = tbodies[h].getElementsByTagName("tr"); - - // ... and iterate through them - for (var i = 0; i < trs.length; i++) { - - // avoid rows that have a class attribute - // or backgroundColor style - if (!hasClass(trs[i]) && ! trs[i].style.backgroundColor) { - - // get all the cells in this row... - var tds = trs[i].getElementsByTagName("td"); - - // and iterate through them... - for (var j = 0; j < tds.length; j++) { - - var mytd = tds[j]; - - // avoid cells that have a class attribute - // or backgroundColor style - if (! hasClass(mytd) && ! mytd.style.backgroundColor) { - - mytd.style.backgroundColor = even ? evenColor : oddColor; - - } - } - } - // flip from odd to even, or vice-versa - even = ! even; - } - } - } +}; +window.addEvent('domready', OfficeSearch.init); \ No newline at end of file diff --git a/source/web/scripts/office/version.js b/source/web/scripts/office/version.js deleted file mode 100644 index 4acbd9c869..0000000000 --- a/source/web/scripts/office/version.js +++ /dev/null @@ -1,173 +0,0 @@ -var xmlHttp - -function GetXmlHttpObject() -{ - var objXMLHttp=null; - if (window.XMLHttpRequest) - { - objXMLHttp=new XMLHttpRequest() - } - else if (window.ActiveXObject) - { - objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") - } - - return objXMLHttp; -} - -function showStatus(url) -{ - xmlHttp=GetXmlHttpObject(); - if (xmlHttp==null) - { - alert("Browser does not support HTTP Request"); - return; - } - xmlHttp.onreadystatechange=stateChanged; - xmlHttp.open("GET",url+"&sid="+Math.random(),true); - xmlHttp.send(null); -} - -function stateChanged() -{ - if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") - { - if (xmlHttp.responseText.indexOf("System Error") > 0) - { - var myWindow = window.open("", "_blank", "scrollbars,height=500,width=400"); - myWindow.document.write(xmlHttp.responseText); - document.getElementById("statusArea").innerHTML=""; - } - else - { - document.getElementById("statusArea").innerHTML=xmlHttp.responseText; - window.location.reload(); - } - } -} - -function runAction(useTemplate, Action, Doc, Msg) -{ - if (Msg != "" && !confirm(Msg)) - { - return; - } - document.getElementById("statusArea").innerHTML="Running action..."; - showStatus("/alfresco/command/script/execute/workspace/SpacesStore/" + useTemplate + "/workspace/SpacesStore/" + Doc + "?action=" + Action); -} - - -function getWindowHeight() { - var windowHeight = 0; - if (typeof(window.innerHeight) == 'number') { - windowHeight = window.innerHeight; - } - else { - if (document.documentElement && document.documentElement.clientHeight) { - windowHeight = document.documentElement.clientHeight; - } - else { - if (document.body && document.body.clientHeight) { - windowHeight = document.body.clientHeight; - } - } - } - return windowHeight; - } - function setContent() { - if (document.getElementById) { - var windowHeight = getWindowHeight(); - if (windowHeight > 0) { - var versionListHeaderElement = document.getElementById('versionListheader'); - var versionListElement = document.getElementById('versionList'); - var tabBarElement = document.getElementById('tabBar'); - var bottomMarginElement = document.getElementById('bottomMargin'); - - var versionListHeight = versionListElement.offsetHeight; - var versionListHeaderHeight = versionListHeaderElement.offsetHeight; - var tabBarHeight = tabBarElement.offsetHeight; - var bottomMarginHeight = bottomMarginElement.offsetHeight; - - if (windowHeight > 0) { - versionListElement.style.height = (windowHeight- (tabBarHeight + versionListHeaderHeight + bottomMarginHeight)) + 'px'; - } - - } - } - } - window.onload = function() { - setContent(); - stripe('versionList', '#fff', '#f6f8fa'); - } - window.onresize = function() { - setContent(); - } - - - // this function is need to work around - // a bug in IE related to element attributes - function hasClass(obj) { - var result = false; - if (obj.getAttributeNode("class") != null) { - result = obj.getAttributeNode("class").value; - } - return result; - } - - function stripe(id) { - - // the flag we'll use to keep track of - // whether the current row is odd or even - var even = false; - - // if arguments are provided to specify the colours - // of the even & odd rows, then use the them; - // otherwise use the following defaults: - var evenColor = arguments[1] ? arguments[1] : "#fff"; - var oddColor = arguments[2] ? arguments[2] : "#eee"; - - // obtain a reference to the desired table - // if no such table exists, abort - var table = document.getElementById(id); - if (! table) { return; } - - // by definition, tables can have more than one tbody - // element, so we'll have to get the list of child - // <tbody>s - var tbodies = table.getElementsByTagName("tbody"); - - // and iterate through them... - for (var h = 0; h < tbodies.length; h++) { - - // find all the <tr> elements... - var trs = tbodies[h].getElementsByTagName("tr"); - - // ... and iterate through them - for (var i = 0; i < trs.length; i++) { - - // avoid rows that have a class attribute - // or backgroundColor style - if (!hasClass(trs[i]) && ! trs[i].style.backgroundColor) { - - // get all the cells in this row... - var tds = trs[i].getElementsByTagName("td"); - - // and iterate through them... - for (var j = 0; j < tds.length; j++) { - - var mytd = tds[j]; - - // avoid cells that have a class attribute - // or backgroundColor style - if (! hasClass(mytd) && ! mytd.style.backgroundColor) { - - mytd.style.backgroundColor = even ? evenColor : oddColor; - - } - } - } - // flip from odd to even, or vice-versa - even = ! even; - } - } - }