ACT! Plugins - Act! Community

Download Report

Transcript ACT! Plugins - Act! Community

ACT! “Web” Plugins
ACC Webinar (Part 1of 2)
Brian Mowka and Jamie Aurand
December 2010
Agenda
•
•
•
•
Web plugin Intro
Getting started
Common questions
Writing your first web plugin
− Plugins example
− Debugging a plugin
• Tips
• Q&A
What is an ACT! Web Plugin
• Any .NET assembly that implements ACT’s Web
plugin interface is technically an ACT! plugin
• Web Plugins add or enhance functionality in the
web edition of ACT!
− Common examples:
o Add a user control (like a button) to an ACT! web view
o Add a tab (with designated controls) to an ACT! web detail view
• Plugins can be added to ACT! without the need
for any changes to ACT! assemblies themselves
•
•
IE: you already have what you need to begin development of plugins when you
install ACT!
The only limitation of what can be done is your imagination, technical abilities, and
anything we specifically restricted for security or stability purposes.
What it takes to get started
• Visual Studio
− You can also use the express versions of VS tools (free to download)
o MS Expression Studio
− You can develop an ACT! Web plugin in any .NET language –ASP.NET,
VB.Net, C#, etc…
o But: you can’t mix .Net languages within an Assembly, so… your code wthin your
plugin must use the same language (Note: VS limitation, not .NET limitation)
o Different plugins can use different languages – One plugin can be written in VB.Net the
other in ASP .NET and work on the same ACT! system
− Build your plugin against the earliest version of ACT! you want to
support
o plugin references are generally forward compatible but not backward compatible
version wise
− Suggestions
o
Consider source control tools to help manage your plugin source code – always a good practice
o
ACT! v7-2010 distributes .Net framework 2.0 – if you use newer versions of Visual Studio (2008 and above) your projects
will default to compile to .Net 3.5 (or higher), these plugins will work but you need to manage distribution of required .Net
frameworks
Starting ACT! 2011 (Shipped Sept. 1st 2010) .NET 3.5 is now installed as part of ACT! installation.
o
Common Questions
• Where do Web plugins go?
− Web: <C:\Program Files\ACT\Act for Web\APFW\Plugins>
o (Note: C:\ is simply the drive installed ON THE SERVER, could be d:\, e:\, etc )
• Can I write one plugin that works for windows AND web?
− YES – But it must be deployed in different locations (Note:
windows - ACT\Act for Windows\Plugins) *AND* the interfaces it
implements are different.
• How can I tell if a Web plugin failed too load?
− It failed if the name of the assembly is in this look here:
"C:\Program Files\Act for web\plugins\DependentDlls.xml“ (Not in the “users”
folder like windows)
− Also in the servers windows event log there should be a line that
states "Error loading file " + assemblyName + " in the Plugins
folder."
Common Questions
• If my plugin failed to load how can I correct this?
− First delete dependentdlls.xml (this will be in your ACT! “Plugins”
folder”)
− Reset IIS (Warning: This will boot all users out who are logged in)
• Where do I put any dependent assemblies that my web
Plugin assembly requires to be available?
− You can put them in the web plugins folder (server machine) or the
Global Assembly Cache (VS debugging add to web install path)
• Will my web plugin work on the next version of ACT!?
− Yes, with the following exceptions.
o A method you are dependent on has been changed/moved/removed.
• We try to avoid this at all costs, but there are circumstances where we
have had to do this.
• Also, we try and give one year warning if we plan on removing methods
by marking the method [obsolete].
Common Questions
• How does ACT! know what assemblies are web
plugins?
− It simply loops through all the assembly files in the web Plugins
directory and probes the assembly to see if it implements the
following interface:
o Act.Web.Framework.IWebPlugin
• When do plugins get loaded in ACT!?
− They get loaded early in startup – BEFORE – any logon has
begun
o BUT: The “Init()” method is not called until after “OnFrameworkLogon” event
• When do they get unloaded?
− When the Act for web application pool is reset or IISReset is
called.
Common Questions
• What browsers are web plugins compatible with?
− Firefox 3.51 and IE 7, 8 (soon 9)
• How do I get access to the UI and Framework in a Web
Plugin?
− “Init()” is called when the “OnFrameworkLogon” event is fired
− void Init(ACTSessionManager session);
o The session object has direct access to the Framework (UI can be done
directly with various ACTSessionManager functions.)
o Example: Adding a tab to contact detail view… (You write ServeCustomTab)
• session.LayoutTabs.AddCustomTabProvider(LayoutType.Contacts, new
Act.Web.Framework.CustomTabProvider(this.ServeCustomTab));
Differences between windows and
web plugins
• Windows Plugins get unloaded when you logout of your
database, web is when app pool is reset
• Locations of dependentdlls files are different
• There are no “Client side” events in web
• Debugging is more difficult as you may have to debug asp
.NET/managed code OR jscript which are different options
when attaching to debugger
• Your code is running on the server, not the client, if you
need to launch something (an exe for example) you need
to have that installed on the client
• Also, if you wish to develop anything with silverlight, make
sure that the silverlight runtime is installed on client
DEMO
• Let’s write a web plugin!
− Attaching debugger
− Fixing plugin
− Re-deploying plugin
Tips
• IISReset is a developers friend – use is whenever you
need to re-test to make sure web environment is clean
• Use the event log when in doubt of plugin loading
success/failure
• Remember to change your debuger to jscript if debugging
jscript (Not managed)!
• Assemblies need to go in the bin folder if they contain the
code behind for an aspx file (but the dll that implements
IWebPlugin needs to go in plugins dir!)
• Is there anywhere I can get examples or more resources?
− Go to our message board at:
o http://community.act.com/sage/board/message?board.id=Pub_Dev&thread.id=
2634
Q/A
• Any Questions?