Jeff Potts from Optaros has published another excellent tutorial, this time on adding custom behaviors to Alfresco to support “rating/scoring” of content.
Link: http://ecmarchitect.com/archives/2007/09/26/770
September 28th, 2007
I’m heading off to the UK for business, I don’t know how much I’ll be able to blog, but before I left, I wanted to share this little gem from Jeff Potts:
I’ve written a new article (with sample files) that talks about how to extend Alfresco
with your own content model and how to work with content that leverages
that model via the Web Services API. All of the examples are written in
Java but I do include one in PHP just for grins.
Most of the code is based on the Alfresco SDK Web Services sample
code, but I’ve tweaked it here and there and I break it down into
smaller chunks with commentary. I also think it is good to have one
example to follow that takes you from designing the content model to
implementing it to writing code that might leverage it.
As an exercise to readers, I’d like to suggest that after going through the tutorial and the Web Services API, to try out the upcoming Web Scripting capabilities of Alfresco 2.1(dev). You’ll need to download and compile the source code then deploy and write some scripts, but I think you’ll be amazed at what you can do. I’ll be writing more about web scripts in the near future.
Many thanks to Jeff, especially for licensing it under a Creative Commons Attribution-ShareAlike License.
June 9th, 2007
I was helping a customer out with configuring the Alfresco PHP Web Services API on a Windows XP environment today and figured others might be interested in learning how to do it themselves.
Please forgive the ugly formatting.
1. These instructions assume you’re installing on IIS running on Windows XP.
2. Download the latest Alfresco PHP Client Library from http://dev.alfresco.com/downloads
3. Pick up the following PHP archives for Windows from http://www.php.net/downloads.php
a. http://www.php.net/get/php-5.1.4-Win32.zip/from/a/mirror
b. http://www.php.net/get/php-5.1.4-installer.exe/from/a/mirror
4. Unzip the Alfresco PHP Client Library to c:\Alfresco\php_lib
5. Install the PHP installer EXE to the default location of C:\PHP
a. Accept defaults and choose the appropriate IIS version (IIS 4.x and above on XP).
6. Unzip the PHP ZIP file over C:\PHP this will add some additional components.
7. From the Windows Explorer go to C:\PHP and run PEAR_ENG.reg by double-clicking it. Accept the prompts.
8. Open a command prompt at go to C:\PHP
a. Run “go-pear.bat” and accept all defaults by pressing “Enter”.
b. Once PEAR is installed run the following:
i. pear install –alldeps channel://pear.php.net/SOAP-0.9.4
ii. pear install –alldeps channel://pear.php.net/Net_DIME-0.3
9. Open PHP.ini:
a. The default location for PHP.ini is C:\Windows
b. Search for the string “include_path” and add the following in the next empty line:
include_path=”.;C:\PHP\PEAR;c:\Alfresco\php_lib”
c. Add the following to the very end of the file (note that the alfresco.server value must be consistent with your installation:
[alfresco]
; Alfresco server location
alfresco.server=http://localhost:8080
10. Open c:\Alfresco\php_lib\alfresco\webservice\WebServiceUtils.php
a. Replace the following lines with the ones that follow in step ‘b’:
$createdDate = date(”Y-m-d\TH:i:s\Z”);
$expiresDate = date(”Y-m-d\TH:i:s\Z”, mktime(date(”H”)+1, date(”i”), date(”s”), date(”m”), date(”d”), date(”Y”)));
b. Use these values:
$createdDate = date(”Y-m-d\TH:i:s\Z”, mktime(date(”H”)+24, date(”i”), date(”s”), date(”m”), date(”d”), date(”Y”)));
$expiresDate = date(”Y-m-d\TH:i:s\Z”, mktime(date(”H”)+25, date(”i”), date(”s”), date(”m”), date(”d”), date(”Y”)));
c. Save the file.
11. Copy the c:\Alfresco\php_lib\examples folder to c:\Inetpub\wwwroot\ (or wherever IIS’s home directory is set to).
12. You may need to restart IIS. You can do so from the Service Manager.
13. Open your browser and point it to http://localhost/examples/simple/simple.php
a. You should see output like this:
A list of all the items in company home and their descriptions:
Data Dictionary User managed definitions
Guest Home The guest root space
May 23rd, 2006