Point check-in. Office Addin - create new workflow not yet complete.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5852 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mike Hatfield
2007-06-05 16:11:34 +00:00
parent 7b09497a8f
commit 54fa2dc56f
23 changed files with 761 additions and 917 deletions

View File

@@ -143,15 +143,15 @@
<div id="nonStatusText"> <div id="nonStatusText">
<#if d.isDocument> <#if d.isDocument>
<ul> <ul>
<li><a href="#" onClick="OfficeAddin.runAction('${doc_actions}','test','${d.id}', '');"><img src="${url.context}/images/office/checkin.gif" border="0" style="padding-right:6px;" alt="Test">Test</a></li>
<#if d.isLocked > <#if d.isLocked >
<#elseif hasAspect(d, "cm:workingcopy") == 1> <#elseif hasAspect(d, "cm:workingcopy") == 1>
<li><a href="#" onClick="OfficeAddin.runAction('${doc_actions}','checkin','${d.id}', '');"><img src="${url.context}/images/office/checkin.gif" border="0" style="padding-right:6px;" alt="Check In">Check In</a></li> <li><a href="#" onClick="OfficeAddin.runAction('${doc_actions}','checkin','${d.id}', '');"><img src="${url.context}/images/office/checkin.gif" style="padding-right:6px;" alt="Check In">Check In</a></li>
<#else> <#else>
<li><a href="#" onClick="OfficeAddin.runAction('${doc_actions}','checkout','${d.id}', '');"><img src="${url.context}/images/office/checkout.gif" border="0" style="padding-right:6px;" alt="Check Out">Check Out</a></li> <li><a href="#" onClick="OfficeAddin.runAction('${doc_actions}','checkout','${d.id}', '');"><img src="${url.context}/images/office/checkout.gif" style="padding-right:6px;" alt="Check Out">Check Out</a></li>
</#if> </#if>
<li><a href="#" onClick="OfficeAddin.runAction('${doc_actions}','makepdf','${d.id}', '');"><img src="${url.context}/images/office/makepdf.gif" border="0" style="padding-right:6px;" alt="Transform to PDF">Transform to PDF</a></li> <li><a href="#" onClick="OfficeAddin.runAction('${doc_actions}','makepdf','${d.id}', '');"><img src="${url.context}/images/office/makepdf.gif" style="padding-right:6px;" alt="Transform to PDF">Transform to PDF</a></li>
<li><a href="${url.context}/navigate/showOfficeAddin/workspace/SpacesStore/${d.id}?ticket=${session.ticket}" target="_blank"><img src="${url.context}/images/office/document_details.gif" border="0" style="padding-right:6px;" alt="Open Full Details">Open Full Details</a></li> <li><a href="${url.context}/navigate/showOfficeAddin/workspace/SpacesStore/${d.id}?ticket=${session.ticket}" target="_blank"><img src="${url.context}/images/office/document_details.gif" border="0" style="padding-right:6px;" alt="Open Full Details">Open Full Details</a></li>
<li><a href="${url.context}/service/office/myTasks?p=${path}&w=new"><img src="${url.context}/images/office/new_workflow.gif" style="padding-right:6px;" alt="Start Workflow">Start Workflow</a></li>
</ul> </ul>
<#else> <#else>

View File

@@ -0,0 +1,7 @@
<webscript>
<shortname>Get Users (Office Add-In)</shortname>
<description>Used by the Office Add-In to query for users</description>
<url format="html" template="/office/getUsers?s={searchTerm}" />
<authentication>user</authentication>
<transaction>required</transaction>
</webscript>

View File

@@ -0,0 +1,7 @@
<#assign n=0>
<#list searchResults as result>
<#if (n > 0)>,<#else>[</#if>
"${"${result.properties.firstName} ${result.properties.lastName}"?trim}"
<#assign n=n+1>
</#list>
]

View File

@@ -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);

View File

@@ -20,6 +20,7 @@
<link rel="stylesheet" type="text/css" href="${url.context}/css/office.css" /> <link rel="stylesheet" type="text/css" href="${url.context}/css/office.css" />
<script type="text/javascript" src="${url.context}/scripts/ajax/mootools.v1.1.js"></script> <script type="text/javascript" src="${url.context}/scripts/ajax/mootools.v1.1.js"></script>
<script type="text/javascript" src="${url.context}/scripts/office/office_addin.js"></script> <script type="text/javascript" src="${url.context}/scripts/office/office_addin.js"></script>
<script type="text/javascript" src="${url.context}/scripts/office/my_alfresco.js"></script>
</head> </head>
<body> <body>
@@ -63,12 +64,12 @@
<div class="header">My Tasks<span class="headerExtra"><img src="${url.context}/images/office/task_overdue.gif" alt="overdue">=overdue, <img src="${url.context}/images/office/task_today.gif" alt="due today">=due today</span></div> <div class="header">My Tasks<span class="headerExtra"><img src="${url.context}/images/office/task_overdue.gif" alt="overdue">=overdue, <img src="${url.context}/images/office/task_today.gif" alt="due today">=due today</span></div>
<div class="listMedium"> <div id="taskList" class="listMedium">
<table width="100%"> <table width="100%">
<#assign taskNum=0> <#assign taskNum=0>
<#list workflow.assignedTasks?sort_by('startDate') as t> <#list workflow.assignedTasks?sort_by('startDate') as t>
<#assign taskNum=taskNum+1> <#assign taskNum=taskNum+1>
<tr class="${(taskNum % 2 = 0)?string("odd", "even")}"> <tr id="${t.id}" class="taskItem ${(taskNum % 2 = 0)?string("odd", "even")}">
<td> <td>
<#assign hasDue=t.properties["bpm:dueDate"]?exists> <#assign hasDue=t.properties["bpm:dueDate"]?exists>
<#if hasDue> <#if hasDue>
@@ -88,6 +89,8 @@
${t.description?html} (${t.type?html}) ${t.description?html} (${t.type?html})
<#if hasDue> <#if hasDue>
<br />Due date: ${due?date} <br />Due date: ${due?date}
<#else>
<br />(No due date)
</#if> </#if>
</td> </td>
</tr> </tr>

View File

@@ -1,12 +1,25 @@
<#assign doc_actions="${url.context}/service/office/docActions"> <#assign doc_actions="${url.context}/service/office/docActions">
<#if args.p?exists><#assign path=args.p><#else><#assign path=""></#if> <#if args.p?exists><#assign path=args.p><#else><#assign path=""></#if>
<#if args.n?exists><#assign node=args.n><#else><#assign node=companyhome></#if> <#if args.n?exists><#assign node=args.n><#else><#assign node=companyhome></#if>
<#-- 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>
</#if>
<#else>
<#assign d=companyhome>
</#if>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html> <html>
<head> <head>
<title>My Tasks</title> <title>My Tasks</title>
<link rel="stylesheet" type="text/css" href="${url.context}/css/office.css" /> <link rel="stylesheet" type="text/css" href="${url.context}/css/office.css" />
<script type="text/javascript" src="${url.context}/scripts/ajax/mootools.v1.1.js"></script> <script type="text/javascript" src="${url.context}/scripts/ajax/mootools.v1.1.js"></script>
<script type="text/javascript" src="${url.context}/scripts/ajax/autocompleter.js"></script>
<script type="text/javascript" src="${url.context}/scripts/office/office_addin.js"></script> <script type="text/javascript" src="${url.context}/scripts/office/office_addin.js"></script>
<script type="text/javascript" src="${url.context}/scripts/office/my_tasks.js"></script> <script type="text/javascript" src="${url.context}/scripts/office/my_tasks.js"></script>
</head> </head>
@@ -62,7 +75,38 @@
<div class="listBig"> <div class="listBig">
<div id="nonStatusText"> <div id="nonStatusText">
<#if args.w?exists && d.isDocument>
<div id="taskDetails">
<table width="100%">
<tr>
<td width="32" valign="top"><img src="${url.context}/images/office/new_workflow_large.gif" alt="Start workflow" /></td>
<td>
Start workflow on:<br /><span style="font-weight: bold; padding-left: 8px;">${d.name?html}</span>
</td>
</tr>
</table>
<div style="margin-top: 8px; font-weight: bold;">Enter new workflow details below</div>
<div class="taskParameters">
<div class="taskParam">Workflow:</div>
<div class="taskValue">
<select id="wrkType" style="font-size: 9pt;">
<option value="review">Review &amp; Approve</option>
<option value="adhoc">Adhoc Task</option>
</select>
</div>
<div class="taskParam">Assign to:</div>
<div class="taskValue"><input id="wrkUser" type="text" style="font-size: 9pt;"/></div>
<div id="ajxUser" style="display: none;"><img src="${url.context}/images/office/ajax_anim.gif" alt="*" /></div>
<div class="taskParam">Due on:</div>
<div class="taskValue"><i>TODO: calendar picker</i></div>
<div class="taskParam">Description:</div>
<div class="taskValue"><textarea id="wrkDescription" style="font-size: 9pt;"></textarea></div>
</div>
</div>
<#else>
<div id="taskDetails"></div> <div id="taskDetails"></div>
</#if>
</div> </div>
<div id="statusText"></div> <div id="statusText"></div>

View File

@@ -61,7 +61,7 @@
<tr> <tr>
<#list task.transitions as wt> <#list task.transitions as wt>
<td> <td>
<a class="taskAction" href="#" onclick="OfficeAddin.transitionTask('/command/task/end/${task.id}<#if wt.id?exists>/${wt.id}</#if>', 'Workflow action \'${wt.label?html}\' completed.');">${wt.label?html}</a> <a class="taskAction" href="#" onclick="OfficeMyTasks.transitionTask('${task.id}', '${url.context}/command/task/end/${task.id}<#if wt.id?exists>/${wt.id}</#if>', 'Workflow action \'${wt.label?html}\' completed.');">${wt.label?html}</a>
</td> </td>
</#list> </#list>
</tr> </tr>

View File

@@ -1,6 +1,6 @@
<#if args.p?exists><#assign path=args.p><#else><#assign path=""></#if> <#if args.p?exists><#assign path=args.p><#else><#assign path=""></#if>
<#if args.n?exists><#assign node=args.n><#else><#assign node=companyhome></#if> <#if args.n?exists><#assign node=args.n><#else><#assign node=companyhome></#if>
<#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> <#if (args.searchagain?exists)><#assign searchText=args.searchagain><#else><#assign searchText=""></#if>
<#if (args.maxresults?exists)><#assign maxResults=args.maxresults><#else><#assign maxResults="5"></#if> <#if (args.maxresults?exists)><#assign maxResults=args.maxresults><#else><#assign maxResults="5"></#if>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@@ -10,6 +10,7 @@
<link rel="stylesheet" type="text/css" href="${url.context}/css/office.css" /> <link rel="stylesheet" type="text/css" href="${url.context}/css/office.css" />
<script type="text/javascript" src="${url.context}/scripts/ajax/mootools.v1.1.js"></script> <script type="text/javascript" src="${url.context}/scripts/ajax/mootools.v1.1.js"></script>
<script type="text/javascript" src="${url.context}/scripts/office/office_addin.js"></script> <script type="text/javascript" src="${url.context}/scripts/office/office_addin.js"></script>
<script type="text/javascript" src="${url.context}/scripts/office/search.js"></script>
</head> </head>
<body> <body>

View File

@@ -199,25 +199,25 @@ ul {
} }
input.button { input.button {
color:#0073e6; color: #0073e6;
font-size:11px; font-size: 11px;
font-weight:bold; font-weight: bold;
background-color:#cce6ff; background-color: #cce6ff;
border:1px solid; border: 1px solid #0073e6;
border-top-color:#0073e6;
border-left-color:#0073e6;
border-right-color:#0073e6;
border-bottom-color:#0073e6;
filter:progid:DXImageTransform.Microsoft.Gradient filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=0,StartColorStr='#ffffffff',EndColorStr='#6fb7ff'); (GradientType=0,StartColorStr='#ffffffff',EndColorStr='#6fb7ff');
cursor:pointer; cursor: pointer;
margin-left:6px; margin-left: 6px;
} }
#taskDetails { #taskDetails {
padding: 2px; padding: 2px;
} }
.taskItem {
cursor: pointer;
}
.taskItemSelected { .taskItemSelected {
background-color: #ffe500 !important; background-color: #ffe500 !important;
} }
@@ -228,3 +228,81 @@ input.button {
height: 128px; height: 128px;
overflow: auto; 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;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,404 @@
/**
* Autocompleter
*
* @version 1.0rc4
*
* @license MIT-style license
* @author Harald Kirschner <mail [at] digitarald.de>
* @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 <span class="autocompleter-queried">*</span>
* 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'), '<span class="autocompleter-queried">$1</span>') : 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 <mail [at] digitarald.de>
* @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);

View File

@@ -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();
}

View File

@@ -1,182 +1,56 @@
var xmlHttp /*
* Prerequisites: mootools.v1.1.js
function GetXmlHttpObject() * office_addin.js
{ */
var objXMLHttp=null; var OfficeMyAlfresco =
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp;
}
function showStatus(url)
{ {
xmlHttp=GetXmlHttpObject(); init: function()
if (xmlHttp==null)
{ {
alert("Browser does not support HTTP Request"); var tasks = $$('#taskList .taskItem');
return;
} tasks.each(function(task, i)
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"); // register 'mouseenter' event for each task
myWindow.document.write(xmlHttp.responseText); task.addEvent('mouseenter', function(e)
document.getElementById("statusArea").innerHTML=""; {
} // highlight the item title
else task.addClass('taskItemSelected');
{
document.getElementById("statusArea").innerHTML=xmlHttp.responseText;
window.location.reload();
}
}
}
function runAction(Action, Doc, Msg) // reset styles on all closed tasks
{ tasks.each(function(otherTask, j)
if (Msg != "" && !confirm(Msg)) {
{ if (otherTask != task)
return; {
// 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); };
}
window.addEvent('domready', OfficeMyAlfresco.init);
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
// &lt;tbody&gt;s
var tbodies = table.getElementsByTagName("tbody");
// and iterate through them...
for (var h = 0; h < tbodies.length; h++) {
// find all the &lt;tr&gt; 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;
}
}
}

View File

@@ -1,9 +1,42 @@
/* /*
* Prerequisites: mootools.v1.1.js * Prerequisites: mootools.v1.1.js
* autocompleter.js
* office_addin.js
*/ */
var OfficeMyTasks = var OfficeMyTasks =
{ {
init: function() 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'); var tasks = $$('#taskList .taskItem');
@@ -50,10 +83,13 @@ var OfficeMyTasks =
// flag this task as open // flag this task as open
task.isOpen = true; task.isOpen = true;
// highlight the item title
task.addClass('taskItemSelected');
OfficeAddin.showStatusText("Loading task...", "ajax_anim.gif", false); OfficeAddin.showStatusText("Loading task...", "ajax_anim.gif", false);
// ajax call to load task details // 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, { var myAjax = new Ajax(actionURL, {
method: 'get', method: 'get',
headers: {'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT'}, 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); window.addEvent('domready', OfficeMyTasks.init);

View File

@@ -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
// &lt;tbody&gt;s
var tbodies = table.getElementsByTagName("tbody");
// and iterate through them...
for (var h = 0; h < tbodies.length; h++) {
// find all the &lt;tr&gt; 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;
}
}
}

View File

@@ -6,10 +6,11 @@ var OfficeAddin =
ANIM_LENGTH: 300, ANIM_LENGTH: 300,
STATUS_FADE: 10000, STATUS_FADE: 10000,
LIST_DEF_HEIGHT: 204, LIST_DEF_HEIGHT: 204,
init: function() 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? */ /* Update needed after page load? */
if(this.queryObject.st) if(this.queryObject.st)
@@ -18,38 +19,6 @@ var OfficeAddin =
var imgSuccess = (objResponse.statusCode ? "action_successful.gif" : "action_failed.gif"); var imgSuccess = (objResponse.statusCode ? "action_successful.gif" : "action_failed.gif");
OfficeAddin.showStatusText(objResponse.statusString, imgSuccess, true); 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) toQueryObject: function(s)
@@ -134,26 +103,23 @@ var OfficeAddin =
}); });
myAjax.request(); myAjax.request();
}, },
/* AJAX call to perform server-side search */ /* Calculates and returns the context path for the current page */
runSearch: function(useTemplate, argPath) getContextPath: function()
{ {
OfficeAddin.showStatusText("Searching...", "ajax_anim.gif", false); var path = window.location.pathname;
var idx = path.indexOf("/", 1);
var searchString = $("searchText").value; var contextPath = "";
var maxResults = $("maxResults").value; if (idx != -1)
{
var actionURL = useTemplate + "?p=" + argPath + "&search=" + searchString + "&maxresults=" + maxResults; contextPath = path.substring(0, idx);
var myAjax = new Ajax(actionURL, { }
method: 'get', else
headers: {'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT'}, {
onComplete: function(textResponse, xmlResponse) contextPath = "";
{ }
OfficeAddin.hideStatusText();
$("searchResultsList").innerHTML = textResponse; return contextPath;
}
});
myAjax.request();
} }
}; };

View File

@@ -1,203 +1,41 @@
var xmlHttp /*
* Prerequisites: mootools.v1.1.js
function GetXmlHttpObject() * office_addin.js
*/
var OfficeSearch =
{ {
var objXMLHttp=null; init: function()
if (window.XMLHttpRequest)
{ {
objXMLHttp=new XMLHttpRequest() $("searchText").addEvent("keydown", function(event)
}
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)
{ {
var myWindow = window.open("", "_blank", "scrollbars,height=500,width=400"); event = new Event(event);
myWindow.document.write(xmlHttp.responseText); if (event.key == 'enter')
} {
else $("simpleSearchButton").click();
{ }
document.getElementById("searchResultsList").innerHTML=xmlHttp.responseText; });
stripe('searchResultsList', '#fff', '#f6f8fa'); },
}
document.getElementById("statusArea").innerHTML="";
}
}
function runSearch(useTemplate) /* AJAX call to perform server-side search */
{ runSearch: function(useTemplate, argPath)
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)
{ {
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
// &lt;tbody&gt;s
var tbodies = table.getElementsByTagName("tbody");
// and iterate through them...
for (var h = 0; h < tbodies.length; h++) {
// find all the &lt;tr&gt; 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);

View File

@@ -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
// &lt;tbody&gt;s
var tbodies = table.getElementsByTagName("tbody");
// and iterate through them...
for (var h = 0; h < tbodies.length; h++) {
// find all the &lt;tr&gt; 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;
}
}
}