Google

Integración Biblioteca de Documentos de SharePoint en Joomla!

Written on:August 4, 2010
Comments
Add One

Resumen
The post describes what it’s like to make an integration between two systems content management, Sharepoint and Joomla!, showing through Joomla! plugin the contents of a public folder Sharepoint.

Pre-requisitos
Los pre-requisitos para poder hacer esta integración es tener activado el acceso anónimo a la biblioteca de docmentos donde tenemos la carpeta pública.

Aquí se puede leer como crear FOLDERS PÚBLICOS, http://technet.microsoft.com/es-es/magazine/2007.07.publicfolders.aspx

Introducción
Para poder hacer la integración tenemos que crear un fichero aspx en el servidor donde tenemos instalado nuestro SharePoint, el cual lo que hace es coger 2 variables HOST (h) y LISTA (l), definidas en el plugin de Joomla!, y recuperar recorriendo la Biblioteca de Documentos la carpeta concreta que le hemos marcado.

La parte alojada en el IIS seria así:

Imports System
Imports Microsoft.SharePoint
 
Partial Public Class _Default
    Inherits System.Web.UI.Page
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
        Dim sHost As String = Request.QueryString("h")
        Dim sLista As String = Request.QueryString("l")
 
        Dim site As SPSite = New SPSite(sHost)
        Dim web As SPWeb = site.OpenWeb()
        Dim list As SPList = web.Lists(sLista)
 
        Dim sProyecto As String = Request.QueryString("p")
 
        Dim f As SPFolder = web.GetFolder(sHost + sLista + "/PUBLICA/" + sProyecto)
 
        Dim query As SPQuery = New SPQuery()
        query.Query = ""
        query.Folder = f
 
        Dim itemCol As SPListItemCollection = list.GetItems(query)
        Dim listItem As SPListItem
        Me.lblResultado.Text &= "
"
 
        For Each listItem In itemCol
 
            Me.lblResultado.Text &amp;= "<a>"
            Me.lblResultado.Text &amp;= listItem.Name
            Me.lblResultado.Text &amp;= "</a>
"
 
        Next listItem
 
        Me.lblResultado.Text &amp;= ""
 
    End Sub
 
End Class

Por otra parte en la parte de Joomla! se ha de crear un plugin, el cual hace la llamada al aspx y recupera los documentos, el plugin tiene el siguiente codigo,

enc-sharepoint.php

<!--p
 
defined( '_JEXEC' ) or die( 'Restricted access' );
 
class plgContentenc_sharepoint extends JPlugin
{
	//Constructor
	function plgContentenc_sharepoint( &#038;$subject )
	{
		parent::__construct( $subject );
		// load plugin parameters
		$thi-->_plugin = JPluginHelper::getPlugin( 'content', 'enc_sharepoint' );
		$this-&gt;_params = new JParameter( $this-&gt;_plugin-&gt;params );
	}
 
	function onPrepareContent(&amp;$row, &amp;$params, $limitstart) {
 
		// just startup
		global $mainframe;
 
		// root folder
		$rootfolder = '/images/stories/';
 
		// checking
		if ( !preg_match("#{proyecto}(.*?){/proyecto}#s", $row-&gt;text) ) {
			return;
		}
 
		$plugin =&amp; JPluginHelper::getPlugin('content', 'enc_sharepoint');
		$pluginParams = new JParameter( $plugin-&gt;params );
 
		// j!1.5 paths
		$mosConfig_absolute_path = JPATH_SITE;
		$mosConfig_live_site = JURI :: base();
		if(substr($mosConfig_live_site, -1)=="/") $mosConfig_live_site = substr($mosConfig_live_site, 0, -1);
 
		// Parameters
		$HOST 			= $pluginParams-&gt;get('enc_sharepointHOST', 0);
		$LISTA 			= $pluginParams-&gt;get('enc_sharepointLISTA', 0);
 
		$string = $row-&gt;text;
 
		$substring = "{proyecto}";
 
		$substring1 = "{/proyecto}";
 
		$proyectoBusqueda = substr ( $string , strpos($string, $substring) + 10 , strpos($string, $substring1) - strpos($string, $substring) - 10 );
 
		$base = $substring . $proyectoBusqueda . $substring1;
 
		$inicio= '
';
		$final='';
 
		$url = $HOST . "proyecto.aspx?h=" . $HOST . "&amp;l=" . $LISTA . "&amp;p=" . $proyectoBusqueda;
 
		$source = @file_get_contents($url)or die('se ha producido un error');
 
		$posicion_inicio = strpos($source, $inicio) + strlen($inicio);
		$posicion_final = strpos($source, $final) - $posicion_inicio;
		$found_text = substr($source, $posicion_inicio, $posicion_final);
		$html= $inicio . $found_text .$final;
 
		$cambio = str_replace($base, $html, $row-&gt;text);
 
		$cambio = str_replace(".doc\"&gt;", ".doc\" style=\"padding:0px;margin:0px;background:none;display:inline;color: #426bba;font-size:13px\"&gt;<img src="\" alt="" />", $cambio);
		$cambio = str_replace(".pdf\"&gt;", ".pdf\" style=\"padding:0px;margin:0px;background:none;display:inline;color: #426bba;font-size:13px\"&gt;<img src="\" alt="" />", $cambio);
		$cambio = str_replace(".xls\"&gt;", ".xls\" style=\"padding:0px;margin:0px;background:none;display:inline;color: #426bba;font-size:13px\"&gt;<img src="\" alt="" />", $cambio);
 
		$row-&gt;text = $cambio;
 
	}
}
 
?&gt;

enc-sharepoint.xml

<!--l version="1.0" encoding="utf-8-->
 
	ENC - Sharepoint
	Albert Llueca
	01/07/2007
 
	allueca@encamina.com
	http://www.encamina.com
	1.0.0
	Conecta Sharepoint con Joomla!
 
		enc_sharepoint.php
		enc_sharepoint.xml

Para configurarlo en Joomla! se hace de la siguiente manera:

Regidor de l'Ajuntament de Sagunt 2011-2015, apassionat de les noves tecnologies on treballe, editor, faller i creador de morvedre.info

One Comment add one

  1. Pingback:Twitter Trackbacks for business and IT » Blog Archive » Integración de una Biblioteca de Documentos de SharePoint en Joomla! v1.0 [businessandit.net] on Topsy.com

Leave a Comment

Your email address will not be published. Required fields are marked *

*


5 × = ten

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Optimized by SEO Ultimate