質問する質問する
 

回答済みFied Control WCM

  • 2008年10月29日 13:58MOSSBUDDY ユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     
     I have a requirement for a MOSS WCM  implementation wherein I need to display PAGING for some of the content in a Field control.
    Basically the TEXT is rich text and authored content, and about few 100 lines, so basically they need to display 100 lines in the first page with Paging buttons/links (<< 1, 2, 3 >>).
    Following is the entire article page (publishing page)

    Free Image Hosting I was thinking this can be done using a custom Field Control, but dont know how to implement paging in that field control while it is in DISPLAY mode and hide the Paging in AUTHORING mode.

    I wanted to know if somebody has alreayd implemented something similar.

    Appreciate your help.

    thanks
    MB

回答

  • 2008年10月31日 16:12Waldek MastykarzMVPユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     回答済み
    hamidovt:

    To be honest: I would stick to the JavaScript approach. Eventually: all you want to do is to alter the presentation. While you definitely could achieve similar functionality using the control approach you would add some extra complexity to indexing the page. Personally I think JavaScript is more suitable for this challenge.

    By retrieving the form state I meant server side of course. The control would determine whether the content has been requested in the display or authoring mode and would provide the paging controls if applicable. You could of course do exactly the same check using server-side technology.

すべての返信

  • 2008年10月29日 16:19Waldek MastykarzMVPユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     
    If you are able to use JavaScript I would definitely choose to do so. Using the SPContext.Current.FormContext.FormMode Property you would determine whether you're in display or authoring mode. In display mode you would output some extra JavaScript which would split the content into chunks and display the paging controls. Whenever the visitors would have JavaScript disabled they would see the full content so both solution and content remain accessible.
    Tip: Using jQuery might simplify the whole process of using JavaScript for content paging. Although I haven't found a plugin which might help you right away, the library provides many functions for content manipulation.

    -- http://blog.mastykarz.nl
  • 2008年10月30日 13:03MOSSBUDDY ユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     
    Hey Waldek, Can you please explain your approach in more details please, I quite didnt get it.
    As there are few fields on the page like: Image, Date, Author, Title, Commentary and Summary. Now it is only the part of the fields are basically paged that is the Commentary field for e.g. and there is another field called Summary which might appear on the other pages.
    So quite not sure how this will work, appreciate your help.

    Thanks
    MB
  • 2008年10月31日 13:44Waldek MastykarzMVPユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     
    It all comes down to creating a client-side solution. Using the various controls one the Page Layout you display some content on the page. To wrap it in pages you could use JavaScript to get the contents of a particular div, split it into chunks and provide a JavaScript control which would allow you to scroll between various chunks. Because you would be operating on the HTML output you could create such wrapper for every piece of the page.

    -- http://blog.mastykarz.nl
  • 2008年10月31日 14:09MOSSBUDDY ユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     

    Thank you Waldek,
    So as I understand the DIV that will be hosting all the PAGE LAYOUT CONTROLs (all of them in this single container) will be used for chunking. Do you have any sample that I can use to do this chunking and paging using the Javascript as I am really not a Java person and dont really know how to do this chunking and achieve paging. Appreciate your help.

     

     

  • 2008年10月31日 14:11Waldek MastykarzMVPユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     
    It's your own choice whether you put all controls in one div all in separates divs. It all depends on what kind of chunks you want to provide: over whole content or the text only. Unfortunately I don't have any example for you but there should be something what might help you somewhere on the Internet. Just give it a shot and search a bit. You can of course share the findings.

    -- http://blog.mastykarz.nl
  • 2008年10月31日 14:18Madhur AhujaMSFTユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     
    There is one sample given here:
    http://archive.xmlpronews.com/xmlpronews-41-20040803PagingmechanismusingXMLXSLT.html

    --
    Madhur

    http://blogs.msdn.com/mahuja | Please mark the replies as answers if they help
  • 2008年10月31日 14:48MOSSBUDDY ユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     
    Thank you Madhur but my content is not XML content (it is a pure text content, could be some rich content also).
    Also I am planning to use out of the box Field controls and so dont have the content in XML format. This content will be stored in the Pages directory (associated with a page-layout).
    So I dont think I can use the approach mentioned in the article you send.
  • 2008年10月31日 15:02hamidovt ユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     

    To Waldek:

    I was wondering would not it be more elegant solution to write a custom field control.

    I mean just inherit the out of the box version and then overwrite render or one of the create… methods to spit out the output your want.

     

    This might be not exactly Sharepoint, but rather a .NET developer way of solving this problem. But I think that is much more elegant solution. What do you thing?


    Also it is not clear to me how do you retrieve the value of the SPContext.Current.FormContext.FormMode on client side? This is something server side, is not it?
     

    Greetings,

     

    Tofig Hamidov

  • 2008年10月31日 15:38MOSSBUDDY ユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     

    Thanks Tofig,

    Basically we can't do it thru a Field control the reason being the paging is not part of one single Control it is basically a PAGE level paging in the sense if the first 2 controls have lot of contents then the Paging has to show remaining controls and any content of first 2 controls on the next page, so basically we dont know during the design time (i.e. while designing the PAge layout) that which control is going to have excess contents. So we really can't do this in a field control, this paging has to be in some kind of a container which holds all the Page controls and then manages the paging such that if the content height reach X number the paging is enabled and the page controls are displayed.

  • 2008年10月31日 16:12Waldek MastykarzMVPユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     回答済み
    hamidovt:

    To be honest: I would stick to the JavaScript approach. Eventually: all you want to do is to alter the presentation. While you definitely could achieve similar functionality using the control approach you would add some extra complexity to indexing the page. Personally I think JavaScript is more suitable for this challenge.

    By retrieving the form state I meant server side of course. The control would determine whether the content has been requested in the display or authoring mode and would provide the paging controls if applicable. You could of course do exactly the same check using server-side technology.