Posts

Showing posts with the label designer

SharePoint 2010 - Nascondere bottoni del Ribbon con jquery (javascript)

Image
Il Ribbon, questo ormai nostro compagno di viaggio nel mondo Microsoft. Se lo conosci, scopri ogni volta quanto sia effettivamente utile a contestualizzare le tue azioni su documenti, item, ... Una novità, introdotta ormai da MS, anche in altri ambienti, dopo Office, SharePoint, anche il nuovo CRM e persino ora Windows8... Ma ad alcuni nostri clienti ancora può non piacere. Ebbene sì. Così "perché non mi rimuovete quel tastino lì?", "perché non mi mostrate solo quello, ma solo per questa library, non per quella, ecc?"... Tramite Object Model, possiamo "tranquillamente", con almeno un tre etti di righe di XML, riuscire a nascondere, disabilitare, modificare le funzioni, i bottoni, l'aspetto, gli eventi per la maggior parte dei pulsanti. Ma ogni tanto, non è necessario intervenire così a fondo, magari non si ha sempre a disposizione una risorsa di sviluppo da utilizzare (o l'ambiente di sviluppo). Così, l'ormai mitico jquery, è qui...

SharePoint 2010 - Group By Content Type

Image
Sembra che non esista la possibilità di creare una vista con un raggruppamento degli item per Content Type. E, in effetti, se provate a visualizzare le colonne con cui è possibile effettuare il raggruppamento, non è visualizzata la colonna Content Type. Niente paura (quasi), perché il raggruppamento è possibile! Necessita però di SharePoint Designer... Apriamo il sito e la pagina con la vista da raggruppare e selezioniamo la web part, visualizzandone il codice. Identifichiamo il tag <Query> e in quella posizione aggiungiamo il seguente codice Riporto il codice qui, per la copia <GroupBy Collapse="TRUE" GroupLimit="100">     <FieldRef Name="ContentType"/> </GroupBy> Salviamo la pagina e ricarichiamo il browser e ... voilà! Miglior visibilità si ottiene modificando il link "Content Type" e inserirlo sul nome del Content Type. Questo è "in progress".. Sembra mol...

Sharepoint 2010 - The Text property is read-only and cannot be set

In a site, logged in with Admin, edit with Sharepoint Designer. Copy default master page to create a new one. Chech out new master page and edit some rows. Then, save and set as Default Master Page for site. Open browser, navigate to site and all it's ok! Fine! Now, I log with another user and.... ERROR ! "The Text property is read-only and cannot be set" In Sharepoint Log, you find somethings like below: System.Web.HttpException: The 'Text' property is read-only and cannot be set.    at System.Web.UI.ControlBuilder.AddProperty(String filter, String name, String value, Boolean mainDirectiveMode)     at System.Web.UI.ControlBuilder.PreprocessAttributes(ParsedAttributeCollection attribs)     at System.Web.UI.ControlBuilder.Init(TemplateParser parser, ControlBuilder parentBuilder, Type type, String tagName, String id, IDictionary attribs) .... Resolution! Go to Sharepoint Designer and check in your new master page!! Then, retry with other user...

Sharepoint 2010 - Customizing Quick Launch with pages

Image
How to show different quick launch menu items in different pages? The quick launch in Sharepoint is an object common to all pages of the site. To show menu items according to the page you visited, I followed client side method with javascript (jquery). Here's how, using Sharepoint Designer 2010. On css stylesheet of the site, I added this instruction, which hides all the items in the Quick Launch: . s4-ql ul.root> li { display: none; } Then, make note of the position of the menu items in the quick lanuch: eg. 0 - Document Libraries 1 - Lists 2 - MyLink      0 - MySubLink1      1 - MySubLink2 3 - MyOtherLink 4 - MyLastLink The pages follows the following rules: Page1 shows 0,1,4 Page2 shows 0,2,3 Page3 shows 0,2 (and sub ​​links 1), 3.4 And now, I change the master.page, adding references to jquery and inserting the following code: //get all items in the quick launch var li_nav = $(".vertical-menu>ul>li"); //get...

Sharepoint 2010 - Client Validation of a Custom Form with Javascript

What to do if you want to perform a client validation with Javascript, in your custom new/edit form. The submit button cames with this code in onclick event: if ( !PreSaveItem()_ ) return false;WebForm_DoPostBackWithOptions(new .. . The PreSaveItem function invokes PreSaveAction function that you can override with your own definition. If PreSaveAction returns true, then form proceeds to save data, otherwise, it stops with alert. With Sharepoint Designer 2010, open form with Edit in Advanced Mode and insert code below: <!-- call jquery --> <script type="text/javascript" src="/SiteAssets/js/jquery.min.js"></script> <!-- override PreSaveAction --> <script type="text/javascript"> function PreSaveAction() {     var field_to_validate = $("select[title='TITLE OF FIELD']").val();    if(field_to_validate == "") {      alert("Warning: complete field_to_validate!");      return ...

Sharepoint 2010 - Show/Hide columns with Conditional Formatting

Image
In a previous post I describe how show/hide columns of a list with UI language, using javascript . Now, I show how do the same using Conditional Formatting feature of Sharepoint Designer 2010. I have same list with columns for language, DescriptionIT, DescriptionEN. Open Sharepoint Designer 2010, and edit page with list view. Select List and add Parameter for language taken from Cookies: Then, select tag <TH> for List Column DescriptionIT, using selector at the bottom of page: Now, in the Condition Formatting panel, click on Create and Apply Formatting: In the filter clause, click on Advanced and write code as below: Then, click OK, and Set Style, in Layout section, set Display:none: Click OK and OK again. Repeat steps selecting <TD> tag for values of column DescriptionIT. Do it again for DescriptionEN column, with condition "($cookieLanguage!='1033')". Save page and view in browser, checking colum...

Sharepoint 2010 Globally Reusable Workflows does not update WF instance in Subsite if re-published: PS Script save me

I defined a Globally Reusable WF for a custom Content Type in root site, with a custom form with InfoPath. I defined a sub site with a list using the global WF template created for its Content Type. Everything works without problems. Now I need to change the WF (both in form and in the process). BUT.. If I edit only the form with InfoPath and then I publish the form, I see correctly the new form in WF on subsites. If I change the WF logic too (any actions) and publish WF (in root site), changes are not perceived by WF on subsites. WF on subsite is updated only if, on subsite, I open WF to change (from browser) and save it. I expect that you can update all WF in subsite using template in root site, without having to reopen and resave each WF in each subsite. I don't understand if it's a bad configuration or a issue on Globally Reusable WF. (I opened question in Technet Forum, here ) UPDATE: Sometimes, I update a WF (form and logic) and logic has been correctly pub...

Sharepoint 2010 - Aggiungere bottone al Ribbon : aprire nuovo Documento da Template

Image
Ecco una cosa interessante. Aggiungere nuovi bottoni al Ribbon di una lista, in Sharepoint 2010, è abbastanza semplice. Ho già scritto come farlo con ancora più facilità, tramite lo Sharepoint Designer 2010 ( clicca qui ). Ora, vediamo come aggiungere una azione personalizzata al bottone in modo che replichi le funzionalità di bottoni già esistenti. Lo scenario è questo. Siamo in una Document Library. Cliccando sulla lista, viene visualizzato il Ribbon della lista. Nella sezione Documents, a sinistra, abbiamo il bottone New. Se abbiamo più Content Type (e template) per i Documenti, vedremo una tendina con la scelta del nuovo Documento da creare. Se configurato per l'esecuzione sul Client dell'utente, al click su, ad es, New Template1, viene avviato MS Word con il template in oggetto. Ma se volessimo creare un nuovo bottone sul Ribbon che faccia da solo questo? In altre parole: non voglio cliccare su New, per poi selezionare dalla tendina quello che serve. Voglio ...

Sharepoint 2010 - Aggiungere bottone al Ribbon con Sharepoint Designer 2010

Image
Vediamo come aggiungere un bottone personalizzato al Ribbon di una lista o document library, utilizzando solo lo Sharepoint Designer 2010. Apriamo il sito con SPD2010, nelle liste, selezionamo la lista che vogliamo utilizzare. A fondo pagina, vediamo il blocco Azioni Personalizzate. Non clicchiamo su Nuovo, ma facciamo un clic con il mouse all'interno del blocco e dal menu contestuale, scegliamo Azione Personalizzata. Vediamo un menu a discesa con diverse opzioni: La traduzione italiana pessima rende oscura l'interpretazione delle voci... Provo a spiegarle. Menu voci elenco : il bottone è visualizzato nel menu a tendina sull'item Visualizza barra multifunzione modulo : il bottone è visualizzato nella scheda "View properties" Modifica barra multifunzione modulo : il bottone è visualizzato nella scheda "Edit properties" Nuova barra multifunzione modulo : il bottone è visualizzato nella scheda "New item" Visualizza barra multi...