The purpose of this tutorial isn't immediately clear. What it does is that it allows you to add news articles to one list and mark them as separate content, so that you can have articles displayed on the home page, and you can have links to 'lone' articles that will only be displayed when you want them to.
If you are like me, you hate adding links to 'static' content on your Share Point 2003 site. We are going to create an announcement or news list that will display properly on your homepage, but it will also contain 'hidden' articles that are not displayed unless you provide their ID through the Querystring, and all list items are hidden except the one with that ID.
Here is a solution to THAT problem:
1. Create a news article list. Add a new column to the list, a checkbox (Y/N) and call it 'Hide'
2. Create a view that aproximates what you want.
3. Open that view in FrontPage.
4. Convert to XSLT.
5. IMPORTANT: Go into any of the cells that are in your list, and make a new table. Place ALL content into that table. Delete all webpart content that is not in that table.
6. Make it look pretty by arranging the content on the page the way you want it to look, changing fonts and all that too.
7. Go into Code view in Front Page.8. Search for "Title"
9. Look around the code for your table. The whole table will be enclosed in a
tag. 10. Just before your table tag, add a div with class="ophogusshack{@Hide}" and id="article{@ID}" 11. Just after your closing table tag, add the closing div tag. 12. Step 10 and 11 enclosed each list item into a div, with a class of hidden (or not), and an id, so we can call them later. 13. Add the following css style: .ophogusshack1 { display: none; }
14. This class will hide all content that you don't want to display yet. 15. Do this: http://ophogus.blogspot.com/2006/06/filter-list-view-with-url-parameter.html 16. Add the following JavaScript to the bottom of the page in code view, but before the closing body tag: <script><!-- if (browseris.mac && !browseris.ie5up) { var ms_maccssfpfixup = "/_layouts/1033/styles/owsmac.css"; document.write("<link rel='stylesheet' Type='text/css' href='" + ms_maccssfpfixup + "'>"); }
function getQueryVariable(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i<vars.length;i++) { var pair = vars[i].split("="); if (pair[0] == variable) { return pair[1]; } } //alert('Query Variable ' + variable + ' not found'); } var IntRecordID = getQueryVariable("ID") if (typeof(IntRecordID)!="undefined" && IntRecordID != "") { //alert('Displaying only article: ' + IntRecordID + ' and hiding all hidden and unhidden articles except ' + IntRecordID + '.'); promoBox(); document.getElementById('article' + IntRecordID).style.display = 'Block'; } else { //alert ('Display Homepage articles, hiding all hidden articles (hide=1).'); //there is no js here, this should be expected default bahavior. }
function getElementsByClass(searchClass,node,tag) { var classElements = new Array(); if ( node == null ) node = document; if ( tag == null ) tag = '*';
var els = node.getElementsByTagName(tag); var elsLen = els.length; var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
for (i = 0, j = 0; i < elsLen; i++) { if ( pattern.test(els[i].className) ) { classElements[j] = els[i]; j++; } } return classElements; }
function promoBox(){ // this searches for all elements with the class name required // and creates an array
var el = getElementsByClass('barrysjshack0');
// this loops thru the array and sets the style you want for (var i=0; i < el.length; i++){ el[i].style.display = "none"; } }
//--></script> That's all there is to it.
My friend Yatin Purohit said:
An easy way is to link a SharePoint Services List (say, contacts) to Access 2003 then use Access as a data source in Word 2003 for mail merge.
In Access 2003, create a new blank database (.mdb). Then in menu File -> Get External Data -> Link Tables. In the dialog box, select "Type of Files" as Windows SharePoint Services(). In the wizard that follows, Type site name and then the List name, plus other option for whole list or a view. You will see the linked table in Access where you can also make chages, queries, etc.
In Word 2003 create the base document, then select menu Tools -> Letters and Mailing -> MailMerge. Use the task pane for mail merge. Open the Mail Merge tool bar and in Data Sources dialog box, select File Type as Access and the new .mdb file. Now you are set to add fields from the list to the mailmerge document.
From: http://developer.ebusiness-apps.com/ebakb/ebakb.asp?artid=174&catid=28
So how does SharePoint store the data for the lists? It turns out that for each site there is a seperate SQL database, containing a number of tables. The two important tables for us are the Lists and the UserData tables. The Lists table contains an entry for each list within the site (and its subwebs) and there is a column called tp_Fields that contains an XML fragment describing the schema for the list. In this schema, each field in the list is associated with a column in the UserData table. The UserData table contains a column for every possible field that can exist in a list. For example, there are 32 floating point columns, 16 datetime columns, etc. The schema in tp_Fields then associates each field in the list with a column in the UserData table. All of the data from every single list in the entire site is then kept in this UserData table. So it is not a trivial task to write a SQL query that will retrieve all of the data for a specific SharePoint list. First we have to determine which columns in the UserData table correspond to which fields in the list. This requires getting the schema for the list from the Lists table and working out the mappings. Then we can retrieve the proper data from the UserData table, and perform our reporting on that data. To ease this process, I've created an application that goes through the Lists table and creates a seperate SQL View for each SharePoint list. Then we can perform our queries on the View for the list, and it will be as if we are accessing the list itself.
|