Quote of the Day Web Part, Reprised – Part 1

, , ,

[Via EndUserSharePoint.com] In March, Mark Miller of EndUserSharePoint.com (EUSP) has created a Quote of the Day web part. And while it has been downloaded and installed on many sites, it has one shortcoming: you had to edit the web part’s code to manage the quotes. Recently Mark asked me whether it would be possible to do something about it, to make the web part more end-user friendly.

I came up with an idea to base the Quote of the Day Web Part on the standard List View Web Part. Sounds interesting enough? Check out my article Quote of the Day Web Part, Reprised – Part 1 on EndUserSharePoint.com. For all of you who are subscribed to the EUSP Weekly Newsletter Mark Miller has a surprise.

Possibly related posts

9 Responses to “Quote of the Day Web Part, Reprised – Part 1”

  1. Francis Ong Says:

    Sry for the trouble. But i am having a little bit of problem. I can't use your quote of the day web part as i can't import web part.

    Is there an other way to have quote of the day without the web part, etc like using CEWP (jquery)?

    Please assist.

    I have already downloaded your web part.

  2. Waldek Mastykarz Says:

    @Francis: could you provide some more information about the issue you're experiencing while importing the Web Part?
    As for an alternative: the above Web Part is a CEWP with jQuery

  3. Francis Ong Says:

    Could you share the jQuery for this CEWP?

    I can't use import Web Part function in Sharepoint as the permission for that is not given.

    Thanks in advance.

  4. Waldek Mastykarz Says:

    @Francis: the jQuery is inside the Web Part file. You can open it in Notepad and extract the jQuery from there.

  5. Francis Ong Says:

    Sorry but it still doesn't work.

    This was what i did step by step:

    1) Create List called "Quotes"
    2) Have 2 columns, first "Quote", second "Author"
    3) Add Web Part List: Quotes
    4) Add Web Part CEWP and put in your source in source editor as below-mentioned:

    var Imtech = Imtech || {};
    Imtech.QuoteOfTheDay = function(listName) {
    var selector = "table[class=ms-listviewtable][summary='" + listName + "'] > tbody > tr";
    var quote = { text: null, author: null, obj: null };

    var renderQuote = function() {
    quote.obj.parents("table:first").parents("td:first").html('

    ' + quote.text + " + quote.author + '

    ')
    }

    this.init = function() {
    var quotes = $(selector).not(":first");
    quote.obj = $(quotes[0]);
    quote.text = $("td:first", quote.obj).text();
    quote.author = $("td:last", quote.obj).text();
    renderQuote();
    }
    }

    var quoteOfTheDay;

    $(function() {
    quoteOfTheDay = new Imtech.QuoteOfTheDay("Quotes");
    quoteOfTheDay.init();
    });

    I cannot even see it replacing the Web Part List (Quotes) with first quote & its author.

    I even tried to change the view to "Summary View" but with no effect.

    Would appreciate for more assistance.

  6. Francis Ong Says:

    I realised it is having the problem when i have your other image-slideshow jquery running in the same page.

    http://blog.mastykarz.nl/images-slideshow-sharepoint-2007-jquery/

    How can i get the the image-slideshow & quote of the day working together?

  7. Waldek Mastykarz Says:

    @Francis: I'd suggest you try to debug the JavaScript to find out what's causing the problem. You can use Firebug for Firefox for that or Visual Studio for Internet Explorer. That should give you more idea of what the problem is and how to solve it.

  8. Francis Ong Says:

    Sorry i am not sure about debugging the JavaScript. But it happens when both slideshow & quote of the day is running from the same page. Only the slideshow is working but not the quote of the day. Could it be something in the coding. I use exactly your source.

  9. Bridgette Richards Says:

    Waldek,
    Greetings! I am experiencing a similar problem as Francis. I have imported the Webpart, and also have attempted to create it from scratch by copying the code with no success. I have followed the instructions in the article word for word.

    It seems that it may not "see" the Quotes List. To keep it simple, I used the same naming conventions. I figured once I got it to work, I'll figure out how to change the names.

    Here is the code in Source Editor within teh Quotes Script webpart:

    jQuery.fn.extend({
    random: function() {
    return $(this[Math.floor(Math.random() * this.length)]);
    }
    });

    var Imtech = Imtech || {};
    Imtech.QuoteOfTheDay = function(listName) {
    var selector = "table[class=ms-listviewtable][summary='" + listName + "'] > tbody > tr";
    var quote = { text: null, author: null, obj: null };

    var renderQuote = function() {
    quote.obj.parents("table:first").parents("td:first").html('

    ' + quote.quote + " + quote.author + '

    ')
    }

    this.init = function() {
    var quotes = $(selector).not(":first");
    quote.obj = $(quotes[0]);
    quote.text = $("td:first", quote.obj).text();
    quote.author = $("td:last", quote.obj).text();
    renderQuote();
    }
    }

    var quoteOfTheDay;

    $(function() {
    quoteOfTheDay = new Imtech.QuoteOfTheDay("Quotes");
    quoteOfTheDay.init();
    });

    Your help is most appreciated. Thank you!

Leave a Reply

Security Code:

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS
Copyright © 2007 - 2010 Waldek Mastykarz

Creative Commons License