Category Archives: December 2007

Creare Bar graphs in SharePoint

Overview:

(UPDATE 12/04/07: Accessit aliud interesting resource fine ad alterum conjunctio blog quod hoc est per aliquam partem valde interesting)

This blog entry describes how to create a bar graph in SharePoint. This works in both WSS and MOSS environments as it only depends upon the data view web part.

Altiore adventu est ut sequitur:

  1. Partum a album vel documenti library quod continet notitia vis F.
  2. Pone adiunctam document bibliotheca / vectigal elencho onto et convertam page ad a notitia ex parte sententia telam (DVWP).
  3. Temperare scriptor DVWP p generare HTML quod ostendit F.

Negotium Missionem / PRAEFIXUS:

Ego creavi consuetudo album vexillum Title agmine uno addito agmen, "Status". This models (ipsa simplistically) an "Authorization For Expense" quo titulo missionis project repraesentat et status ex numero aestimanda:

  • Proposuerat
  • Evolutis
  • Stabulari

Propositum est ad producendum horizontali bar Lorem ipsum his patet, quod status codicibus F.

Ego similis hoc genus hominum album:

imaginem

Data partum Textus View Parte:

DVWP addendo ad paginam creare consuetudinem album (site pagina causam meam) et sequi mandatis hic (http://paulgalvin.spaces.live.com/blog/cns!1CC1EDB3DAA9B8AA!395.entry).

Praeter simpliciter partum DVWP, we also need to set the paging property to show all available rows. Enim me, hoc spectat huic simile:

imaginem

Ad hoc, I always close SPD and the browser. I then re-open the page using the browser. This avoids accidentally mucking up the web part layout on the page.

Temperare XSLT:

Suus 'iam tempus ad modify XSLT.

I always use visual studio for this. (Videte hic nam circa insigniore note intellisense quod multum proderit).

Fasciculi novi addunt quatuor project ego creo inani (replacing the words "Original" and "New" ut conveniens):

  • Original.xslt
  • New.xslt
  • Original Params.xml
  • New Params.xml

In meam, is vultus amo is:

imaginem

Modify the web part and copy the params and XSL to the "Original" version in Visual Bulla.

Objectum est causa p transfigurare nobis impetro tergum consequitur query in a DVWP HTML reddentis quasi F.

Ad hunc finem, it helps to first consider what the HTML should look like before we get confused by the insanity that is known as "XSL". (Patere, haec est simpliciter exemplum; don’t type it or copy/paste into visual studio. I provide a full blow starting point for that later in the write-up). The following sample graph is rendered as per the HTML immediately following:

Sample Bar Aliquam lacinia purus

Debita HTML:

<html>
<corpus>
<centrum>
<mensam width = LXXX%>
<tr><td><centrum>Aliquam lacinia purus eros Talea</td></tr>
<tr>
<td align="center">
<table border="1" width = LXXX%>
<tr>
<width = p X%>Aperi</td>
<td><mensam cellpadding ="0" cellspacing ="0" border = 0 width = L%><tr = rubrum bgcolor><td>&nbsp;</td></tr></mensamque></td>
</tr>
<tr>
<width = p X%>Concluserat</td>
<td><mensam cellpadding ="0" cellspacing ="0" border = 0% XXV width =><tr = rubrum bgcolor><td>&nbsp;</td></tr></mensamque></td>
</tr>
<tr>
<width = p X%>Stabulari</td>
<td><mensam cellpadding ="0" cellspacing ="0" border = 0% XXV width =><tr = rubrum bgcolor><td>&nbsp;</td></tr></mensamque></td>
</tr>
</mensamque>
</td>
</tr>
</mensamque>
</corpus>
</html>

I used a dead simple approach to creating my bars by setting the background color of a row to "red".

In hac hic accipere-a: In finem, porticus et columnas cum loquimur omnia creavit HTML.

Template XSLT:

I’ve copied the XSLT that generates a horizontal bar graph. It’s fairly well commented so I won’t add much here except for these notes:

  • Coepi cum eo p defaltam SharePoint Designer dedit mihi primo creavit DVWP.
  • EGO eram validus ut interficiam de isto SPD scriptor 657 lineas 166 lines.
  • Non tatam circa ambitum file pron (Et scies quod est separatum a p dico cum ad se temperare DVWP; duo ordines commutare potest). Autem, ut eam simpliciorem, I did remove nearly all of them from the XSL. This means that if you want to make use of those parameters, you just need to add their variable definitions back to the XSL. That will be easy since you will have the original XSL variable definitions in your visual studio project.
  • You ought to be able to copy and paste this directly into your visual studio project. Igitur, remove my calls and insert your own calls to "ShowBar".
  • Ad EXERCITATIO operatur creando <a href> sicut est hodie: http://server/List?FilterField1=fieldname&FilterValue1=actualFilterValue. This technique may be of value in other contexts. Primo, Putabam me opus conformare ad magis complexu format: http://server/List/AllItems.aspx?View={guid}&FilterField1=blah&FilterValue1=blah, but in my environment that is not necessary. The List’s URL is passed to us by SharePoint so this is quite easy to generalize.

Hic est:

<p:stylesheet version="1.0" excludere, unde praemittit,="Rs z o s ddwrt dt msxsl" 
xmlns:msxsl="Urna:Microsoft-schemas com-:xslt" xmlns:p="http://www.w3.org/1999/XSL/Transform"
xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer"
xmlns:áspidis="http://schemas.microsoft.com/ASPNET/20" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
xmlns:O="Urna:Microsoft-schemas com-:muneris" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:Rs="Urna:Microsoft-schemas com-:rowset" xmlns:z="#RowsetSchema"
xmlns:ddwrt2="Urna:frontpage:internum"
> <p:output methodo="html" indent="nulla" /> <p:decimales format- Nan="" /> <p:param nomen="ListUrlDir"></p:param> <!-- Hac-tenus EGO postulo suffrago terebra. --> <p:Template match="/" xmlns:SharePoint="Microsoft.SharePoint.WebControls"
xmlns:__designer=http://schemas.microsoft.com/WebParts/v2/DataView/designer xmlns:áspidis="http://schemas.microsoft.com/ASPNET/20"
> <p:variabilis nomen="dvt_StyleName">Mensam</p:variabilis> <p:variabilis nomen="Deambulacra" elige="/dsQueryResponse / ordinibus / Row" /> <p:variabilis nomen="dvt_RowCount" elige="Numerabitis($Deambulacra)" /> <p:variabilis nomen="IsEmpty" elige="$dvt_RowCount = 0" /> <p:variabilis nomen="dvt_IsEmpty" elige="$dvt_RowCount = 0" /> <p:elegerit> <p:cum test="$dvt_IsEmpty"> Nulla notitia F!<br/> </p:cum> <p:alioqui> <!-- Interesting effercio hic incipitur. Oportet definire par variabilium pro singulis ordinibus in F: Numerus           . --> <p:variabilis nomen="totalProposed" elige="Numerabitis(/dsQueryResponse / ordinibus / Row[normalize spatium-(@ Status) = 'Propositum'])" /> <p:variabilis nomen="percentProposed" elige="$totalProposed p $ dvt_RowCount" /> <p:variabilis nomen="totalInProcess" elige="Numerabitis(/dsQueryResponse / ordinibus / Row[normalize spatium-(@ Status) = 'Processu'])" /> <p:variabilis nomen="percentInProcess" elige="$totalInProcess p $ dvt_RowCount" /> <p:variabilis nomen="totalStalled" elige="Numerabitis(/dsQueryResponse / ordinibus / Row[normalize spatium-(@ Status) = 'Stabulari'])" /> <p:variabilis nomen="percentStalled" elige="$totalStalled p $ dvt_RowCount" /> <!-- Noster hie definimus mensam HTML. Im mutuatus nonnullos signiferos           . Puto colet           . --> <mensamque latitudo="100%" cellspacing="0" cellpadding="2" style="FINIS-IURE: 1 # solidum C0C0C0; FINIS-SOLUM: 1 # solidum C0C0C0; FINIS-sinistram-stilo: solida; FINIS-amplitudo sinistram-: 1; FINIS-stilo summo-: solida; FINIS-width summo-: 1;"> <tr> <td align="centrum"> <mensamque border="1" latitudo="100%"> <!-- Uterque enim status volumus F, we call the "ShowBar" Template. Nos transire,: 1. Nam in versu pittacium. Hoc est permutatum a Hyperlink. 2. In sentio (variabilis desursum). 3. Ipso nomine agro Codicis a subiecta album. Hoc                      . 4. Pro pretio agri matched #3. 5. Summa Codicis status hujus items (Non omnes eu wisi                      ). Emittit <tr></tr> et linea horizontali bar F. Hoc enim ipsum dicimus unicuique ordini Codicis uolumus considerate. --> <p:Template voca- nomen="ShowBar"> <p:cum param- nomen="BarDisplayLabel" elige="'Propositum'"/> <p:cum param- nomen="BarPercent" elige="$percentProposed"/> <p:cum param- nomen="QueryFilterFieldName" elige=""Status""/> <p:cum param- nomen="QueryFilterFieldValue" elige="'Propositum'"/> <p:cum param- nomen="TotalItems" elige="$totalProposed"></p:cum param-> </p:Template voca-> <p:Template voca- nomen="ShowBar"> <p:cum param- nomen="BarDisplayLabel" elige="'Stabulari'"/> <p:cum param- nomen="BarPercent" elige="$percentStalled"/> <p:cum param- nomen="QueryFilterFieldName" elige=""Status""/> <p:cum param- nomen="QueryFilterFieldValue" elige="'Stabulari'"/> <p:cum param- nomen="TotalItems" elige="$totalStalled"></p:cum param-> </p:Template voca-> <p:Template voca- nomen="ShowBar"> <p:cum param- nomen="BarDisplayLabel" elige="'Processu'"/> <p:cum param- nomen="BarPercent" elige="$percentInProcess"/> <p:cum param- nomen="QueryFilterFieldName" elige=""Status""/> <p:cum param- nomen="QueryFilterFieldValue" elige="'Processu'"/> <p:cum param- nomen="TotalItems" elige="$totalInProcess"></p:cum param-> </p:Template voca-> </mensamque> </td> </tr> </mensamque> </p:alioqui> </p:elegerit> </p:Template> <!-- Template hoc facit opus ostentans singulis linearum in bar F. Youll 'forsit plerique vestrum tweaking hie. --> <p:Template nomen="ShowBar"> <p:param nomen="BarDisplayLabel" /> <!-- Pittacium ostendere --> <p:param nomen="BarPercent"/> <!-- Cento totalis. --> <p:param nomen="QueryFilterFieldName"/> <!-- Usus ad salire ad query & spurcamen --> <p:param nomen="QueryFilterFieldValue"/> <!-- Usus ad salire ad query & spurcamen --> <p:param nomen="TotalItems" /> <!-- totam comitis hoc barlabel --> <tr> <!-- Bar ipsum pittacium. --> <td genus="ms-formbody" latitudo="30%"> <!-- Sequenti statuto de hac quaestione sententias aedificat filo sino           . Hic utimur pauca: 1. Possumus transire ad elenchum FilterValue1 FilterField1 et in columna ut spurcamen. 2. SharePoint transiret a key parameter ad nos, ListUrlDir that points to the underlying list against which this DVWP is "running". Est non fun p? --> <p:text disable-output-erepta="Imo"> <![CDATA[<a href ="]]></p:text> <p:valor ex- elige="$ListUrlDir"/> <p:text disable-output-erepta="Imo"><![CDATA[?FilterField1 =]]></p:text> <p:valor ex- elige="$QueryFilterFieldName"/> <p:text disable-output-erepta="Imo"><![CDATA[&FilterValue1 =]]></p:text> <p:valor ex- elige="$QueryFilterFieldValue"/> <p:text disable-output-erepta="Imo"><![CDATA[">]]></p:text> <p:valor ex- elige="$BarDisplayLabel"/> <p:text disable-output-erepta="Imo"><![CDATA[</a>]]></p:text> <!-- Sequenti frenum ostendit aliqui numeri in format: "(totalis / % totalis)" --> (<p:valor ex- elige="$TotalItems"/> / <!-- Hoc facit a nice pro cento nos label. Gratias, Microsoft! --> <p:Template voca- nomen="percentformat"> <p:cum param- nomen="sentio" elige="$BarPercent"/> </p:Template voca->) </td> <!-- Tandem, emittere <td> tag pro se bar.--> <td> <mensamque cellpadding="0" cellspacing="0" border="0" latitudo="{rotundum($C: * BarPercent)+1}%"> <tr bgcolor="red"> <p:text disable-output-erepta="Imo"><![CDATA[&nbsp;]]></p:text> </tr> </mensamque> </td> </tr> </p:Template> <!-- Hoc accipitur immediate ab aliquo p inveni in MS template. --> <p:Template nomen="percentformat"> <p:param nomen="sentio"/> <p:elegerit> <p:cum test="numerum format-($sentio, "@, 0 @ #%;-#,##0%')= "Nan"">0%</p:cum> <p:alioqui> <p:valor ex- elige="numerum format-($sentio, "@, 0 @ #%;-#,##0%')" /> </p:alioqui> </p:elegerit> </p:Template> </p:stylesheet>

Eventus:

Et p hoc de generat supra F:

imaginem

EXERCITATIO ad subjectam strepitando in notitia status Code:

imaginem

Decernentes Cogitata:

Hoc potest esse generativus?

Hoc amo conceptus graphing, but I hate the fact that I have to go in and do so much hand-coding. I’ve given a little thought to whether it can be generalized and I’m optimistic, but I’m also a little fearful that there may be a brick wall somewhere along the path that won’t offer any work-around. If anyone has some good ideas on this, Nibh vel a note in ineo email me.

Verticalis graphs:

This is a horizontal bar graph. It’s certainly possible to create a vertical graph. We just need to change the HTML. I would start the same way: Create an HTML representation of a vertical bar graph and then figure out how to get that via XSL. If anyone is interested in that, I could be persuaded to try it out and work out the kinks. If someone has already done that, Et commodo sciam quod libenter link to vestri blog 🙂

Puto provocatio cum verticali F est titulus pro F sunt procreare difficilius, profecto inpossibilia.

Agro nomen Gotcha scriptor:

Ad minus duo nomina agro tuo quaerere.

Primum, a field name with a space has to be escaped in the XSL. This will probably be an issue here:

        <p:variabilis nomen="totalProposed" 
elige="Numerabitis(/dsQueryResponse / ordinibus / Row[normalize spatium-(@ Status) = 'Propositum'])" />

If your "Status" column is actually named "Status Code" then you need to reference it as "Status_x0020_Code":

   <p:variabilis nomen="totalProposed" 
elige="Numerabitis(/dsQueryResponse / ordinibus / Row[normalize spatium-(@ Status_x0020_Code) = 'Propositum'])" />

Secundo, et sum adhuc, quamquam in hac, but you also need to be on the alert for field name changes. If you name your field "Status Code" et tunc postea, rename it to "AFE Status", the "internal name" does not change. The internal name will still be "Status Code" and must be referenced as "Status_x0020_Code". The "other resources" potest auxilium egritudo links et corrigere hujusmodi Problema.

Circa colorem:

I picked "red" because it’s pleasing to me at the moment. It would not be a big deal to show different colors so as to provide more than just a visual description of a number, but to also provide a useful KPI. Verbigratia, if the percentage of "stalled" AFE est scriptor > 10% deinde ostendere rubro, otherwise show it in black. Utor <p:elegerit> perficerent.

Aliaque:

Beatus transformans!

<Finis />

Scribet ad mea blog!

SharePoint non providere “Qui Access” Nuntiatus

UPDATE 01/28/08: This codeplex project addresses this issue: http://www.codeplex.com/AccessChecker. I have not used it, but it looks promising if this is an issue you need to address in your environment.

UPDATE 11/13/08: Joel Oleson wrote up a very good post on the larger security management issue here: http://www.sharepointjoel.com/Lists/Posts/Post.aspx?List=0cd1a63d-183c-4fc2-8320-ba5369008acb&ID=113. It links to a number of other useful resources.

Forum users and clients often ask a question along these lines: "How do I generate a list of all users with access to a site" or "How can I automatically alert all users with access to list about changes made to the list?"

There is no out of the box solution for this. If you think about it for a moment, it’s not hard to understand why.

SharePoint security is very flexible. There are at least four major categories of users:

  • Anonymous users.
  • SharePoint Users and Groups.
  • Active Directory users.
  • Substructio formae authenticas (FBA) users.

The flexibility means that from a security perspective, any given SharePoint site will be dramatically different from another. In order to generate an access list report, one needs to ascertain how the site is secured, query multiple different user profile repositories and then present it in a useful fashion. That’s a hard problem to solve generically.

How are organizations dealing with this? I’d love to hear from you in comments or email.

</finem>

Technorati Tags: ,