Files
alfresco-community-repo/source/web/scripts/office/my_alfresco.js
Mike Hatfield 77cee95439 Merged V3.1 to HEAD
12950: JAWS-11 -  Integrate OpenOffice addin contribution (webscripts only)
          ETHREEOH-991 - Window without scroll bars is opened when we click "Manage" button on "Task details" screen(Microsoft Office Add-in)
          ETHREEOH-994 - Incorrect work when we try to open document by cliking on its version number on View Details tab(Microsoft Office Add-in)
          ETHREEOH-988 - Incorrect work of Search Alfresco tab(Microsoft Office Add-in)
   12951: ETHREEOH-1010 - IE window was not closed when we click "Save Changes" button on "Manage Task" page(Office Add-in)
   12952: JAWS-226 - Support Office 2007 Transformations
   12953: ALFCOM-2490 - MS Office 2007 documents can't be previewed

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13532 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2009-03-10 14:59:16 +00:00

142 lines
4.1 KiB
JavaScript

/*
* Prerequisites: mootools.v1.11.js
* office_addin.js
*/
var OfficeMyAlfresco =
{
TOGGLE_AMOUNT: 150,
ANIM_LENGTH: 800,
taskCount: 0,
init: function()
{
if (OfficeMyAlfresco.taskCount > 0)
{
OfficeAddin.sortTasks($('taskList'));
OfficeMyAlfresco.setupTasks();
}
OfficeMyAlfresco.setupToggles();
},
setupTasks: function()
{
var tasks = $$('#taskList .taskItem');
tasks.each(function(task, i)
{
// register 'mouseenter' event for each task
task.addEvent('mouseenter', function(e)
{
// highlight the item title
task.addClass('taskItemSelected');
// 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.serviceContextPath + "/office/myTasks" + OfficeAddin.defaultQuery + "&t=" + task.id;
});
});
$('taskList').addEvent('mouseleave', function(e)
{
// handler for mouse leaving the entire task list
tasks.each(function(task, i)
{
task.removeClass('taskItemSelected');
});
});
},
setupToggles: function()
{
// Elements of interest
var panels = $$('.togglePanel');
var toggles = $$('.toggle');
// Animation
var fxPanel = new Fx.Elements(panels, {wait: false, duration: OfficeMyAlfresco.ANIM_LENGTH, transition: Fx.Transitions.Back.easeInOut});
panels.each(function(panel, i)
{
toggle = toggles[i];
panel.defaultHeight = panel.getStyle('height').toInt();
panel.isToggled = false;
toggle.addEvent('click', function(e)
{
var animPanel = {};
if (panel.isToggled)
{
panel.isToggled = false;
this.removeClass('toggled');
animPanel[i] =
{
'height': [panel.getStyle('height').toInt(), panel.defaultHeight]
};
// reset all other panels
panels.each(function(otherPanel, j)
{
if (otherPanel != panel)
{
// reset panel
otherPanel.isToggled = false;
toggles[j].removeClass('toggled');
animPanel[j] =
{
'height': [otherPanel.getStyle('height').toInt(), otherPanel.defaultHeight]
};
}
});
}
else
{
panel.isToggled = true;
this.addClass('toggled');
animPanel[i] =
{
'height': [panel.getStyle('height').toInt(), panel.defaultHeight + (OfficeMyAlfresco.TOGGLE_AMOUNT * (panels.length - 1))]
};
// set all other panels
panels.each(function(otherPanel, j)
{
if (otherPanel != panel)
{
// set panel
otherPanel.isToggled = false;
toggles[j].removeClass('toggled');
animPanel[j] =
{
'height': [otherPanel.getStyle('height').toInt(), otherPanel.defaultHeight - OfficeMyAlfresco.TOGGLE_AMOUNT]
};
}
});
}
fxPanel.start(animPanel);
});
});
}
};
window.addEvent('domready', OfficeMyAlfresco.init);