Home RSS 2.0 ATOM 1.0  CDF  
 
CodeSegment - Carlos Segura Sanz (blog)
 

Yesterday looking a XML editor to edit complex xml files that I have in a Project that E&Y did in my company, I downloaded a trial version from  Stylus Studio XML IDE and I’m really surprised.  We could make a hard work in minutes. (Edit the data in a grid, sort the grid by levels and sublevels  etc...)

Normally I dont need tools like this for my diary work but I am considering this for my personal use (home edition is only 49$.)

Later in house, I was testing the Stylus Studio WYSIWYG, with an xsl that I was using with the csegRollUp webart, and in the midnight I added a new feature to csegRollUp webpart and also fixed a little problem.

The new feature is that you can use two params in the xslt file to make the webpart pageable.

4:      <xsl:param name="CurrentPage"/>
5: <xsl:param name="RecordCount"/>

Then you can write a simple xsl with Previous and Next Page, that shows like this...

The querystring parameter is always "page" and at the moment you can use only a pageable csegRollUp per page.

I fixup an error when a list field has a null value the xml generated omit the label now the label is generated.

Now included in the zip file there are some xslt samples (see previous posts), and a new one called page-sample.xsl this is  the one of the top image (this sample use the contacts lists)

Download csegRollUp2.zip (11,28 KB)

Thursday, August 18, 2005 10:19:05 PM (Hora de verano romance, UTC+02:00)   #    Comments [1]   csegRollUp  | 

2.- csegDocLibTools properties

Well, there is a preliminary version available, I'm testing it in my production machine and the result at the moment its perfect.

The properties are separated in two groups, the first group, contains the document library on which it works and the webpart if this is attached to one.

 

 

The second group contains the webpart options. The four new options in the context menu, (Copy, Paste, Explore from here and Explore from root). There is also an option to show the files inside of the folder when the tree view is showed and an option to enable and disable the top menu.

3.- Installation

You can put this webpart in any page,  but if you want put it in AllItems.aspx or other view in a document library you need edit the page with fronpage and put it in the top of the document library list view.

If you want test (at moment) beta version please write a comment...

Monday, August 15, 2005 8:29:26 PM (Hora de verano romance, UTC+02:00)   #    Comments [20]   csegDocLibTools  | 

Today my webparts csegRollUp, csegUserAlerts and csegSearch are listed in the SharePoint Web Component Directory.

http://www.microsoft.com/sharepoint/downloads/components/results.asp?s=O&c=Carlos+Segura&x=16&y=5

I continue working in csegDocLibTools...

Friday, August 12, 2005 11:17:10 PM (Hora de verano romance, UTC+02:00)   #    Comments [0]   SharePoint  | 

1.- Introducing csegDocLibTools

The past week, looking how to show the missing folder view in document libraries, I had a good idea about how to improve my documents libraries, in this moment I had a clear idea over three things:

First I needed Copy and Paste documents in the library, because this is an essential feature to organize the library. There is a good solution to do from Syntergy, they have a cut and pase webpart.

Second, I needed a folder explorer view, to navigate and view the folder hierarchy (too many years seeing it). There are some free solutions the Renaud Comte treeview webpart is a great solution.

Third, I need a simple interface and installation to add this to a document library that it already exists and integrated with the cut and paste options.

This weekend and some nights this week, I have a new webpart “csegDocLibTools”.

Cut and Paste features

This first feature, is needed, of course documents and folders with your structure and with your metadata. Also I need copy and paste from a document library to another document library (in the same site). By example copy final documents to a new library.

Explorer view

I need a better explorer view than “folders.aspx”  (that in addition this link not exist in document libraries). But an explorer view from root folder in document libraries with many folders can be slow and large to show. And if my explorer view is in a diferent page I lose the context about what I am doing.

 

Interface & Installation

The interface as it is seen, is important when I think in a new application I always use pencil and paper to draw my screens think in the possible problems etc… It is easy to do in the house kitchen.

Them I think in problems as  If I have a context menu with cut and paste, and I copy a file go to an empty folder and oops how I can paste this if I don´t have a context menu… (thanks to Mark Kruger by your first discarded solution, now your sugerence is the final solution)

Some decissions about design are personal decissions, but always we can discuss them. (Everything except the small context menu inside of the document library toolbar that it is fantastic).

About of installation, it would be easy, and what better than a invisible webpart that you can put it in the page.

First of three or four posts.
(1.Introducing) (2.Properties) (3.Installation) (4.Todo List)

Wednesday, August 10, 2005 8:41:36 PM (Hora de verano romance, UTC+02:00)   #    Comments [7]   csegDocLibTools  | 

blogging my way to pdc

Why do I want to go? In five lines

I’m crazy to see what’s new in SharePoint, Office 12, asp.net and Visual Studio 2005
I’m a programmer and I never have been in an event
It would be a dream for me
I have my english a little oxidized
I need know that there is outside (I live in Spain)

Thanks.

Wednesday, August 10, 2005 8:13:13 PM (Hora de verano romance, UTC+02:00)   #    Comments [0]   SharePoint  | 

One of the problems that I have been is when I have html documents in a document library and show this in a webpart page with the webcontent webpart. (I’m using the csegContent webpart that gets a querystring)

Sharepoint index them and after when you search, the query results show a link to them but when you load the document the context is missing, you have a window with the complete page without menu, quicklaunch etc…

To solve this problem, you need add a small piece of code (javascript) in your html documents.

<script type="text/javascript">
if (self == top) {
  topUrl = 'sites/pruebas';
  posUrl = location.href.lastIndexOf(topUrl);
  qs = location.href.lastIndexOf('?');
 
 if (qs < 0) {
      qs = location.href.length;
  }
  newUrl = location.href.substring(posUrl+1+topUrl.length,qs);
  
window.location.href = topUrl+/default.aspx?Load='+encodeURI(newUrl);
} 
</script>

This script checks if the page is the main in the page, if this is true, the document navigate to the correct context.

The topUrl variable has the site where the page is stored.
In the window.location.href you can put the name of the sharepoint page with the query string.

Also you can do it with a iframe using a second script stored in the sharepoint page (example in default.aspx)

First put an iframe in your webpart page.

<iframe frameBorder="0" onload=”iframeOnLoad();” id="miIframe" name="miIframe" width="100%" height="100%" src=" ">
</iframe>

And this script in the same page.

<script type="text/javascript">
function iframeOnLoad()
{
  var params = window.location.search.substring(1).split("=");
  if (params[1]!=null && document.getElementById("miIframe").src != params[1]) {
     document.getElementById("miIframe").src = params[1];
  }
} 
<script>

This second script gets the query string on the main page and load the content in the iframe.
Now try to search the .html and see that happend.

Tuesday, August 09, 2005 11:06:32 PM (Hora de verano romance, UTC+02:00)   #    Comments [0]   SharePoint  | 

Some users of csegRollUp2 ask to me how to get the complete list of fields for a list, remember that you can use the internal names with csegRollUp. Now you can use csegScript to show all fields and types of any list.

Change the red code with the name of your list, and put the webpart in the site where the list is stored. 

Begin Script Code

   1:imports Microsoft.SharePoint
   2:imports Microsoft.SharePoint.Utilities
   3:imports Microsoft.SharePoint.WebPartPages
   4:imports Microsoft.SharePoint.WebControls
   5:imports System.Web.UI
   6:Module Script
   7:Public Sub Main()
   8:Dim site As SPSite = SPControl.GetContextSite(System.Web.HttpContext.Current)
   9:Dim allSites As SPWebCollection = site.AllWebs
  10:Dim subSite As SPWeb = allSites(0)
  11:Dim list as SPList = subSite.Lists("Anuncios")
  12:Dim field As SPField
  13:output.WriteLine("<table width='100%'><tr><td>Name</td><td>Description</td><td>InternalName</td><td>Type</td></tr>")
  14:For Each field in list.Fields
  15:output.WriteLine("<tr><td>"+SPEncode.HtmlEncode(field.Title)+"</td><td>"+SPEncode.HtmlEncode(field.Description)+"</td><td>"+SPEncode.HtmlEncode(field.InternalName)+"</td><td>"+SPEncode.HtmlEncode(field.TypeAsString)+"</td></tr>")
  16:Next field
  17:output.WriteLine("</table>")
  18:End Sub
  19:End Module
End Script Code

Also, some users ask to me about remove the copyright in the bottom of webpart, I think that csegScript is a tool for developpers and is not thought, for end users.And in a future I will open the code.

Note: If you want to share your small tricks, suggest improvements with csegScript, csegRollUp or others webparts please uses the forum or comments. I always respond.

(the cut and paste code is in the forum :-) )
 

Monday, August 08, 2005 8:31:53 PM (Hora de verano romance, UTC+02:00)   #    Comments [0]   csegScript  | 

There are things that I do not understand (too many) of SharePoint, today I have paid attention in the actions menu in image libraries, there is an action called “View all Folders” that not exist in document libraries, trying to solve this problem, I have had the idea to how to do a pretty webpart to Copy and Paste documents in documents libraries (this is in mind).

        

But, first les us solve the problem of view all folders in document libraries. I have spent an interesting short time  while seeing as the pages generated by sharepoint work, and there is an stupid trick to solve the problem.  It is enough with adding a link with javascript.

You can use FrontPage to add the simple link

Javascript:window.navigate(ctx.HttpRoot + "/_layouts/3082/folders.aspx?List=" + ctx.listName)

If you prefer you can put a content editor webpart and paste this code to add a custom menu action with the link.

<script language="javascript">
function Custom_AddDocLibMenuItems(m, ctx)
{
    var strDisplayText = "View all Folders";
    var strUrl = ctx.HttpRoot + "/_layouts/3082/folders.aspx?List=" + ctx.listName;
    var strAction = 'window.navigate(strUrl)';
    CAMOpt(m, strDisplayText, strAction, "");
    return false;
}
</script>

Remember change the 3082 (spanish) for your lenguaje code.

 

Saturday, August 06, 2005 7:28:11 PM (Hora de verano romance, UTC+02:00)   #    Comments [2]   SharePoint  | 

imagine test your webparts without compile, imagine an VBA for sharepoint, that was what I imagined yesterday and this is here... I have desire to say Yeahhhhh

Screenshoots (better an image than thousand words)

csegScript showing code

 

csegScriptWebPart custom Properties

Show Code – Show the code with line numbers to identificate errors
Run Code – The code is executed when you applies changes
Script References – Write here the references of the project (.dll files)

If the file is in windows\system or in the assembly the path is not necesary so if you need a .dll (as Microsoft.SharePoint.dll) you need include the full path in the server, separe each reference with semicolon

Script Code – Visual Basic .NET based code, (Visual studio for applications code)

Separate lines with “\\” double backslash, internally they are replaced by carriage returns.

csegScript properties



Sample script code

This sample code shows all lists in the current site and in subsites with a link to the default list view. (the source is included in the zip file)

   1:  imports Microsoft.SharePoint
   2:  imports Microsoft.SharePoint.Utilities
   3:  imports Microsoft.SharePoint.WebPartPages
   4:  imports Microsoft.SharePoint.WebControls
   5:  imports System.Web.UI
   6:  Module Script
   7:  Public Sub Main()
   8:     Dim site As SPSite = SPControl.GetContextSite(System.Web.HttpContext.Current)   
   9:     Dim allSites As SPWebCollection = site.AllWebs
  10:     Dim subSite As SPWeb
  11:     For Each subSite In allSites
  12:        Dim allSiteLists As SPListCollection = subSite.Lists
  13:        Dim subSiteList As SPList
  14:        For Each subSiteList In  allSiteLists
  15:           output.WriteLine("<IMG SRC='"+subSiteList.ImageUrl+"'></IMG>" & " " & _
                                 SPEncode.HtmlEncode(subSite.Name) & " :: " & _
                                 "<A HREF='" + subSiteList.DefaultViewUrl & "'>" & _
                                 SPEncode.HtmlEncode(subSiteList.Title) & _
                                 "</A><BR>")
  16:        Next subSiteList
  17:     Next subSite
  18:  End Sub
  19:  End Module
 
 

Special

There is two special keys (output and _this)

output (internally is an HtmlTextWriter object) that you can use in the script code.

Sample: output.WriteLine(“Hello Sharepoint Developpers”)

_this is a reference to the webpart (internally is a WebPart object)

Sample: output.WriteLine(_this.Title) 
 

Usage in six steps….

1.- Unmark “Run Script”  and mark “Show Script Source”
2.- Put your code in the properties window, after each line put \\ instead of newline.
3.- Add your system references in the Script References, separated by semicolon (remenber the full path if they are not in assembly)
4.- Apply changes
5.- If there are errors you can view the error description, line number and line text, solve the problems and apply changes.



6.- When all is correct mark “Run Script” and VOILA….

 

Download csegScriptWebPart.zip (7,91 KB)
Thursday, August 04, 2005 11:10:41 PM (Hora de verano romance, UTC+02:00)   #    Comments [1]   csegScript  | 

I am thinking thinking and thinking about a great idea....
I dont now if it will work...
I feel not to be able to advance nothing...
If this works ouchhhhh....
I am nervous single with thinking in it...

I am going to work in it .... to see that it happens

Wednesday, August 03, 2005 8:06:44 PM (Hora de verano romance, UTC+02:00)   #    Comments [0]   SharePoint  | 

Some users have reported some small errors with csegSearch, and some doubts,

- the colorize results only runs in the first set of results (fixed
- some extended results are in incorrect site (fixed)

Try this new version (with care this is not the 1.2 final), first uninstall previous version

csegSearchWebPart12.zip (11,45 KB)

stsadm –o deletewppack –name csegSearchWebPart.cab
iisreset

Stsadm –a addwppack –filename csegSearchWebPart.cab [-globalinstall –force]
iisreset

Plase use the forums to comment bugs and the doubts in foros.ideseg.com

TIPO: To add a custom property (metadata) in the csegSearchResults

1.- In “Site Configuration” go to "Manage Properties of Crawled Content", locate the value-type properties in the urn:schemas-microsoft-com:office:office namespace, select the desired custom metadata (ows_METADATA) and check the option, "Included in the Advanced Search options", which exposes the meta property to the Sharepoint Search Service.

2.- Edit the Search.aspx with Search.aspx?Mode=Edit&PageView=Shared

3.- Export the csegSearch webpart

4.- Edit the .dwp file (add your custom metadata to the <QueryTemplateSelectPart>) This is the select part in the query

“urn:schemas-microsoft-com:office:office:ows_METADATA”

5.- Import the .dwp and put in the Search.aspx page

6.- Then in extended results put

MyMetadata; urn:schemas-microsoft-com:office:office:ows_METADATA

Wednesday, August 03, 2005 7:54:46 AM (Hora de verano romance, UTC+02:00)   #    Comments [3]   csegSearch  | 


Copyright © 2008 Carlos Segura. All rights reserved.