Stump the Panel Topic: Green Tip Web Part http://www.endusersharepoint.com/STP/ Paul Grenier, Lead Moderator en Wed, 11 Feb 2009 13:57:52 +0000 Christophe on "Green Tip Web Part" http://www.endusersharepoint.com/STP/topic/green-tip-web-part#post-4099 Tue, 10 Feb 2009 21:16:52 +0000 Christophe 4099@http://www.endusersharepoint.com/STP/ <p>@Mark: as baldcat mentions, credit for this script goes to "Path to SharePoint":<br /> <a href="http://pathtosharepoint.wordpress.com/2008/12/18/random-quote/" rel="nofollow">http://pathtosharepoint.wordpress.com/2008/12/18/random-quote/</a></p> <p>@ Laura: please don't call this programming ;-) </p> EndUserSharePoint on "Green Tip Web Part" http://www.endusersharepoint.com/STP/topic/green-tip-web-part#post-4094 Tue, 10 Feb 2009 20:28:44 +0000 EndUserSharePoint 4094@http://www.endusersharepoint.com/STP/ <p>Dan - Very nice. I'd like to document this in a screencast and give you credit. Any problem with that? -- Mark </p> baldcat on "Green Tip Web Part" http://www.endusersharepoint.com/STP/topic/green-tip-web-part#post-4092 Tue, 10 Feb 2009 20:10:14 +0000 baldcat 4092@http://www.endusersharepoint.com/STP/ <p>ha ha .. so do i.. </p> laura67 on "Green Tip Web Part" http://www.endusersharepoint.com/STP/topic/green-tip-web-part#post-4077 Tue, 10 Feb 2009 11:07:19 +0000 laura67 4077@http://www.endusersharepoint.com/STP/ <p>OMG, you ROCK! I tried it, and it worked. So cool! I wish I were a programmer.</p> <p>Laura Rogers<br /> <a href="http://spinsiders.com/laurar" rel="nofollow">http://spinsiders.com/laurar</a> </p> baldcat on "Green Tip Web Part" http://www.endusersharepoint.com/STP/topic/green-tip-web-part#post-4062 Mon, 09 Feb 2009 22:48:53 +0000 baldcat 4062@http://www.endusersharepoint.com/STP/ <p>oh and to find your LISTID</p> <p>Navigate to the SharePoint list using the browser.<br /> Select the Settings + List Settings menu command.<br /> Copy the Url from the browser address bar into Notepad. It will look something like:<br /> <a href="http://server/site/_layouts/listedit.aspx?List=%7B26534EF9%2DAB3A%2D46E0%2DAE56%2DEFF168BE562F%7D" rel="nofollow">http://server/site/_layouts/listedit.aspx?List=%7B26534EF9%2DAB3A%2D46E0%2DAE56%2DEFF168BE562F%7D</a></p> <p>Delete everying before and including “List=”.<br /> Change “%7B” to “{”<br /> Change all “%2D” to “-“<br /> Chnage “%7D” to “}”<br /> You are now left with the Id:</p> <p>{26534EF9-AB3A-46E0-AE56-EFF168BE562F} </p> baldcat on "Green Tip Web Part" http://www.endusersharepoint.com/STP/topic/green-tip-web-part#post-4061 Mon, 09 Feb 2009 22:46:48 +0000 baldcat 4061@http://www.endusersharepoint.com/STP/ <p>ok so try this out.. </p> <p>-Create a new Custom list called "Green Tips".. and add a second column called content. (make this a multi-text rich text)<br /> -go to the page where you want your green tips to show..<br /> -Add a "Content Editor WebPart"<br /> -edit source and paste this in</p> <pre><code>&lt;DIV ID=&quot;GreenPlaceholder&quot;&gt;&lt;/DIV&gt; &lt;script type=&quot;text/javascript&quot;&gt; var ListID = &quot;{22B56A50-AE74-4FFC-B0DC-1AD162078A98}&quot;; var ServerURL = &quot;http://server&quot;; var SiteURL = &quot;http://server/site&quot;; var URLprotocolURL = SiteURL + &quot;/_vti_bin/owssvr.dll?Cmd=Display&#38;XMLDATA=TRUE&#38;List=&quot; + ListID ; var xmlhttp=null; try { xmlhttp = new XMLHttpRequest(); } catch(e) { try { xmlhttp = new ActiveXObject(&quot;Msxml2.XMLHTTP&quot;); } catch(e) { try { xmlhttp = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;); } catch(e) { alert(&quot;Your browser does not support XMLHTTP.&quot;); } } } xmlhttp.onreadystatechange=StateChange; xmlhttp.open(&quot;GET&quot;,URLprotocolURL,true); xmlhttp.send(null); function StateChange() { if (xmlhttp.readyState==4) { if (xmlhttp.status==200) { DisplayTip(); } else { alert(&quot;Problem retrieving XML data&quot;); } } } function DisplayTip() { var xmlDoc = xmlhttp.responseXML; var ListItems = xmlDoc.getElementsByTagName(&quot;z:row&quot;) || xmlDoc.getElementsByTagNameNS(&quot;*&quot;,&quot;row&quot;) ; var SelectedItem = Math.floor(Math.random()* ListItems.length); var SelectedTipTitle = ListItems[SelectedItem].getAttribute(&quot;ows_LinkTitle&quot;); var SelectedTipContent = ListItems[SelectedItem].getAttribute(&quot;ows_Content&quot;); document.getElementById(&quot;GreenPlaceholder&quot;).innerHTML = &#39;&lt;center&gt;&lt;b&gt;&#39; + SelectedTipTitle + &#39;&lt;/b&gt;&lt;/center&gt;&lt;/p&gt;&#39; + SelectedTipContent; } &lt;/script&gt;</code></pre> <p>You'll see the bottom part of the script,, is were the displaying is done..</p> <pre><code>var SelectedTipTitle = ListItems[SelectedItem].getAttribute(&quot;ows_LinkTitle&quot;); var SelectedTipContent = ListItems[SelectedItem].getAttribute(&quot;ows_Content&quot;); document.getElementById(&quot;GreenPlaceholder&quot;).innerHTML = &#39;&lt;center&gt;&lt;b&gt;&#39; + SelectedTipTitle + &#39;&lt;/b&gt;&lt;/center&gt;&lt;/p&gt;&#39; + SelectedTipContent;</code></pre> <p>See pics for how my quickie turned out.. I'm going to look at maybe wrapping some graphics around it.. Now any coders may say you should do this in AJAX, and I say go right ahead :) I'm a cut and paste coder.. KUDOS goes out to Mike at my work and<br /> <a href="http://pathtosharepoint.wordpress.com/2008/12/18/random-quote" rel="nofollow">http://pathtosharepoint.wordpress.com/2008/12/18/random-quote</a> for the original idea.</p> <p><a href="http://www.aussieslivingsimply.com.au/images/Untitled%20picture22.png" rel="nofollow">http://www.aussieslivingsimply.com.au/images/Untitled%20picture22.png</a><br /> <a href="http://www.aussieslivingsimply.com.au/images/Untitled%20picture23.png" rel="nofollow">http://www.aussieslivingsimply.com.au/images/Untitled%20picture23.png</a><br /> <a href="http://www.aussieslivingsimply.com.au/images/Untitled%20picture24.png" rel="nofollow">http://www.aussieslivingsimply.com.au/images/Untitled%20picture24.png</a> </p> baldcat on "Green Tip Web Part" http://www.endusersharepoint.com/STP/topic/green-tip-web-part#post-4056 Mon, 09 Feb 2009 19:17:17 +0000 baldcat 4056@http://www.endusersharepoint.com/STP/ <p>ah I've got you.. so instead of Quote of the day your just after a webpart that will randomlyy display a list item.. In the list you would have Green tips... Nice idea, I think that is something we could use as well...</p> <p>Let me have a play and see what I can come up with.. Maybe we could share Tips as well.. </p> jlschu1 on "Green Tip Web Part" http://www.endusersharepoint.com/STP/topic/green-tip-web-part#post-4050 Mon, 09 Feb 2009 18:37:03 +0000 jlschu1 4050@http://www.endusersharepoint.com/STP/ <p>I am wanting to offer a "Go Green" web part, a tip of the day on how to live eco-friendly. Something similar to your quote of the moment. </p> EndUserSharePoint on "Green Tip Web Part" http://www.endusersharepoint.com/STP/topic/green-tip-web-part#post-4035 Sat, 07 Feb 2009 22:02:20 +0000 EndUserSharePoint 4035@http://www.endusersharepoint.com/STP/ <p>Jen - More specific please. What should a "Green Tip" do? -- Mark </p> jlschu1 on "Green Tip Web Part" http://www.endusersharepoint.com/STP/topic/green-tip-web-part#post-4022 Fri, 06 Feb 2009 18:16:22 +0000 jlschu1 4022@http://www.endusersharepoint.com/STP/ <p>Hello! I was wondering if anyone has ran across a "Green Tip" web part? Similar to a quote of the day. </p>