https://wiki.creativecommons.org/api.php?action=feedcontributions&user=Devin+Chalmers&feedformat=atomCreative Commons - User contributions [en]2024-03-29T09:34:03ZUser contributionsMediaWiki 1.30.0https://wiki.creativecommons.org/index.php?title=Case_Studies&diff=28132Case Studies2009-12-06T19:37:34Z<p>Devin Chalmers: </p>
<hr />
<div><div style="margin-top:-100px; margin-left: -16px;"><br />
[[Image:Casestudies-splash.jpg|link=Case Studies]]<br />
</div><br />
<br />
Whether you're looking for inspiration, business models, or precedents, the CC Case Studies are a perfect place to start. <br><br />
Help us expand this resource by sharing your work and telling your story. Exceptional and well-written case studies will be included in upcoming publications and research.<br />
<div style="float: left; width: 47%; margin-right: 3%;"><br />
== Explore ==<br />
<br />
{{Explorebox|<br />
[[Image:NIN The Slip.jpg|120px|left|link=Nine_Inch_Nails_The_Slip]] <br />
'''[[Case_Studies/Nine_Inch_Nails_The_Slip | The Slip]]''' is a ten-track DRM-free album released by Nine Inch Nail's front man and best-selling artist Trent Razor.<br />
}}<br />
{{Explorebox|<br />
[[Image:Remixhome.png|120px|left|link=Remixing Çatalhöyük]]<br />
'''[[Case_Studies/Remixing_Çatalhöyük | Remixing Çatalhöyük]]''' interprets archaeological excavations from the 9,000-year-old settlement mound of Çatalhöyük in central Turkey.<br />
}}<br />
{{Explorebox|<br />
[[Image:Urbanministries.png|120px|left|link=UrbanMinistry.org]]<br />
'''[[Case_Studies/UrbanMinistry.org | UrbanMinistry.org]]''' delivers online faith-based materials and social services to under-resourced communities. <br />
}}<br />
{{Explorebox|<br />
[[Image:LinuxOutlaws-Coverart3.jpg|120px|left|link=Linux_Outlaws]] <br />
'''[[Case_Studies/Linux_Outlaws | Linux Outlaws]]''' is a tech podcast with a strong focus on free and open technologies told with lighthearted humor and from the perspective of the general Linux user.<br />
<br />
[http://wiki.creativecommons.org/Category:Casestudy? More Case Studies...]<br />
}}<br />
<br />
<br />
<br />
</div><br />
<div style="float: left; width: 46%; margin-right: 2%"><br />
== Add a case study ==<br />
{{#forminput:Case_Study|30|Case study name|Add or edit|super_page=Case_Studies}}<br />
[[Case_Studies/HOWTO|How to add a Case Study]]<br><br />
[[Media:Case_Studies_Questionnaire.pdf|Download the Case Studies Questionnaire (PDF)]] <br />
<br />
==View by==<br />
[[Case_Studies_List|Name]] | [http://wiki.creativecommons.org/index.php?title=Special:Ask&offset=0&limit=20&q=%5B%5BCategory%3ACasestudy%5D%5D&p=format%3Dbroadtable&po=%3FCountry%0A%3FAuthor%0A%3FFormat%0A&sort=Country&order=ASC Country]<br />
<br />
[[Photographer|Photography]] | [[Musician|Music]] | [[Filmmaker|Film]] | [[Writer|Literature]]<br />
<br />
'''Or...'''<br />
<br />
[http://wiki.creativecommons.org/index.php?title=Special:Ask&offset=0&limit=20&q=%5B%5BCategory%3ACasestudy%5D%5D&p=format%3Dbroadtable&po=%3FAuthor%0A%3FFormat%0A%3FCountry%0A&order=ASC&eq=yes Custom Case Study Search]<br />
<br />
</div><br />
<br />
<br clear="both"/><br />
== Get the Book! ==<br />
[[Image:Building_an_australassian_commons_thumbnail.jpg|left]]<br />
<div style="margin-left:200px;"><br />
[http://creativecommons.org.au/materials/Building_an_Australasian_Commons_book.pdf Building an Australasian Commons (full book PDF)] has been produced by [http://creativecommons.org.au Creative Commons Australia] to highlight case studies from the Australasian region.<br />
<br />
'''Download field-specific PDF booklets:'''<br />
* [http://creativecommons.org.au/materials/BAAC_music_cluster.pdf CC & Sound]<br />
* [http://creativecommons.org.au/materials/BAAC_democracy_cluster.pdf CC & Democratic Change]<br />
* [http://creativecommons.org.au/materials/BAAC_film_cluster.pdf CC & Moving Images]<br />
* [http://creativecommons.org.au/materials/BAAC_visual_arts_cluster.pdf CC & Visual Arts]<br />
* [http://creativecommons.org.au/materials/BAAC_visual_arts_cluster.pdf CC,] [http://zendreview.wordpress.com/ Zend] [http://creativecommons.org.au/materials/BAAC_visual_arts_cluster.pdf & Visual Arts]<br />
* [http://creativecommons.org.au/materials/BAAC_government_cluster.pdf CC, Cultural & Government Institutions]<br />
* [http://creativecommons.org.au/materials/BAAC_text_cluster.pdf CC & Written Word]<br />
* [http://creativecommons.org.au/materials/BAAC_education_cluster.pdf CC, Education & Research]<br />
</div><br />
<br />
'''Visit http://creativecommons.org.au/casestudiesvol1 for more information, including remixable source files.'''<br />
<br />
== Help the Project! ==<br />
<br />
Have an idea for a case study but can't execute? Add your request to [[Talk:Case_Studies]]. You can also pitch in by fleshing out [[Case_Studies/Incomplete | incomplete Case Studies]].<br />
<br />
Check out our '''[[Case_Studies/Roadmap|roadmap]]''' or contact [[User talk:Michelle Thorne]] to pick up a shovel and help us make this better.<br />
<br />
<br />
{| border="0" style="background:transparent; margin: auto"<br />
|-<br />
|<br />
[http://creativecommons.org http://wiki.creativecommons.org/images/5/52/Cc_logo_small.jpg]<br />
||<br />
[http://creativecommons.org.au http://wiki.creativecommons.org/images/6/6b/Cc_au_logo_small.jpg]<br />
||<br />
[http://www.cci.edu.au http://wiki.creativecommons.org/images/c/c6/Cci_small.jpg]<br />
|}<br />
<br />
<br />
__NOTOC__<br />
__NOEDITSECTION__<br />
[[Category:Metrics]] [[Category:Project]] <br />
{{Translations}}</div>Devin Chalmershttps://wiki.creativecommons.org/index.php?title=CCNewsletter&diff=28131CCNewsletter2009-12-06T19:14:53Z<p>Devin Chalmers: </p>
<hr />
<div>[http://creativecommons.org/about/newsletter#subscribe Subscribe] to the ccNewsletter, a monthly email newsletter bringing the latest CC news directly to you! Check out these beautifully-designed PDF versions of the newsletter, designed for your reading pleasure by the CC Philippines team.<br />
<br />
== '''Current ccNewsletter''' ==<br />
<br><br />
'''ccNewsletter #15'''<br />
<br />
<imagemap><br />
Image:Ccnewsletter15.jpg|left<br />
desc none<br />
default [http://mirrors.creativecommons.org/newsletter/ccnewsletter15.pdf Download PDF]<br />
</imagemap><br />
[http://mirrors.creativecommons.org/newsletter/ccnewsletter15.pdf Download PDF]<br />
<br />
Creative Commons, turning 7 in mid-December, enters its 5th annual fundraising campaign, in an effort to raise public awareness and support of our mission to promote free and legal sharing of creative works. This newsletter, from September-December 2009, is a testament to how important our work is, and includes stories of new jurisdiction launches, a Nobel Prize for work concerning "the Commons," CC-licensed feature-length films, and much more. <br />
<br />
<br />
<br />
<br clear="left"/><br />
<br />
== '''Past ccNewsletters''' ==<br />
<br><br />
<br />
<br />
'''ccNewsletter #14'''<br />
<br />
<imagemap><br />
Image:Ccnewsletter14.jpg|left<br />
desc none<br />
default [http://mirrors.creativecommons.org/newsletter/ccnewsletter14.pdf Download PDF]<br />
</imagemap><br />
[http://mirrors.creativecommons.org/newsletter/ccnewsletter14.pdf Download PDF]<br />
<br />
September's newsletter opens with a special update from CEO Joi Ito, filling you in on the latest news from within CC. Read about the most exciting recent developments for CC in arts & culture, science, education, and internationally. From groundbreaking CC integrations with Google and Wikipedia, to the launch of new open educational resources, to a CC-licensed web series by director Ridley Scott, you can see for yourself how far CC has come just this year.<br />
<br />
<br clear="left"/><br />
<br />
'''ccNewsletter #13'''<br />
<br />
<imagemap><br />
Image:Ccnewsletter13.jpg|left<br />
desc none<br />
default [http://mirrors.creativecommons.org/newsletter/ccnewsletter13.pdf Download PDF]<br />
</imagemap><br />
[http://mirrors.creativecommons.org/newsletter/ccnewsletter13.pdf Download PDF]<br />
<br />
Read about the latest CC news, from the launch of the collaborative CC Case Studies effort, to the Wikimedia Foundation approval to use CC licenses for Wikipedia articles, plus updates from our jurisdictions around the world and news of CC in the world of science, education, and arts & culture. This will be the last newsletter produced on the bi-monthly schedule; from now on, we will send brief monthly e-news updates, and produce PDF newsletters, with a CEO update, on a quarterly basis.<br />
<br />
<br clear="left"/><br />
<br />
'''ccNewsletter #12'''<br />
<br />
<imagemap><br />
Image:Ccnewsletter12.jpg|left<br />
desc none<br />
default [http://mirrors.creativecommons.org/newsletter/ccnewsletter12.pdf Download PDF]<br />
</imagemap><br />
[http://mirrors.creativecommons.org/newsletter/ccnewsletter12.pdf Download PDF]<br />
<br />
Spring is a time for new beginnings, and April's newsletter will catch you up on all of CC's many exciting new projects in addition to several milestones marking our continued growth and development as a leader of openness in the realms of science, education and culture, as well as internationally. This newsletter is chock full of interesting items, including the launch of CC Zero; updates from several international jurisdictions; GreenXchange, a project of CC, Nike and Best Buy; a new site for OpenEd that will provide valuable resources for the open education movement; and even a CC-licensed animated feature film.<br />
<br />
<br clear="left"/><br />
<br />
'''ccNewsletter #11'''<br />
<br />
<imagemap><br />
Image:Ccnewsletter11.png|left<br />
desc none<br />
default [http://mirrors.creativecommons.org/newsletter/ccnewsletter11.pdf Download PDF]<br />
</imagemap><br />
[http://mirrors.creativecommons.org/newsletter/ccnewsletter11.pdf Download PDF]<br />
<br />
At the start of 2009, we found ourselves at a very exciting juncture in the life of CC. We had a great year in 2008, and as you’ll read in this newsletter, CC is poised for even more growth and success in 2009 — in the realms of education, science, culture, internationally, and more.<br />
<br />
February also marks the one-year anniversary since the CC Philippines team first began designing the stunning PDF versions of the newsletter. As always, many thanks to CC Philippines for the lovely work!<br />
<br />
<br clear="left"/><br />
<br />
'''ccNewsletter #10'''<br />
<br />
<imagemap><br />
Image:Ccnewsletter10.png|left<br />
desc none<br />
default [http://mirrors.creativecommons.org/newsletter/ccnewsletter10.pdf Download PDF]<br />
</imagemap><br />
[http://mirrors.creativecommons.org/newsletter/ccnewsletter10.pdf Download PDF]<br />
<br />
December's newsletter features ccLearn, the education branch of Creative Commons which has grown substantially this year and has a lot of exciting plans lined up for its bright future as a leader in the open education movement. The newsletter also brings to you news highlights from each of CC's other program areas. As always, many thanks to the CC Philippines team for designing the PDF version. <br />
<br />
<br clear="left"/><br />
<br />
<br />
'''ccNewsletter #9'''<br />
<br />
<imagemap><br />
Image:Ccnewsletter9.png|left<br />
desc none<br />
default [http://mirrors.creativecommons.org/newsletter/ccnewsletter9.pdf Download PDF]<br />
</imagemap><br />
[http://mirrors.creativecommons.org/newsletter/ccnewsletter9.pdf Download PDF]<br />
<br />
October’s newsletter focuses on CC’s newly launched annual fundraising initiative — the Build the Commons campaign. If CC is important to you, then I strongly encourage you to check out this edition of the ccNewsletter and to participate in the campaign. Thanks again to the CC Philippines team for designing the awesome PDF version. <br />
<br clear="left"/> <br />
<br />
'''ccNewsletter #8'''<br />
<br />
<imagemap><br />
Image:Ccnewsletter8.png|left<br />
desc none<br />
default [http://mirrors.creativecommons.org/newsletter/ccnewsletter8.pdf Download PDF]<br />
</imagemap><br />
[http://mirrors.creativecommons.org/newsletter/ccnewsletter8.pdf Download PDF]<br />
<br />
Featured in August is an update on Culture Commons, the branch of Creative Commons dedicated to expanding the already profound impact that CC has had in the realms of music, media, art, and society. The update spotlights recent success stories from CC users Nine Inch Nails, the One Laptop Per Child Project, and the Media that Matters Film Festival. Also included are brief points of interest from CCi, Science Commons, ccLearn, and CC in general.<br />
<br clear="left"/> <br />
<br />
'''ccNewsletter #7'''<br />
<br />
<imagemap><br />
Image:Newsletter7.png|left<br />
desc none<br />
default [http://mirrors.creativecommons.org/newsletter/ccnewsletter7.pdf Download PDF]<br />
</imagemap><br />
[http://mirrors.creativecommons.org/newsletter/ccnewsletter7.pdf Download PDF]<br />
<br />
June's newsletter spotlights Science Commons, a project of Creative Commons dedicated to bringing the sharing and reuse principles CC brought to the world of culture, to scientific research. Their work focuses on identifying unnecessary barriers to research, and developing strategies and tools for faster, more efficient scientific research. The goal - to speed the translation of data into discovery.<br />
<br clear="left"/><br />
<br />
'''ccNewsletter #6'''<br />
<br />
<imagemap><br />
Image:Newsletter6.png|left<br />
desc none<br />
default [http://mirrors.creativecommons.org/newsletter/ccnewsletter6.pdf Download PDF]<br />
</imagemap><br />
[http://mirrors.creativecommons.org/newsletter/ccnewsletter6.pdf Download PDF]<br />
<br />
The April 2008 newsletter features CC international, covering pertinent topics such as recent and upcoming jurisdiction and project launches from Serbia to India to New Zealand, and much more. The articles show the incredible and exciting leaps and bounds that CCi has taken and continues to take as the dedicated folks behind it work to build an international commons. The newsletter also contains articles about news and points of interest for CC, including the recent changes in leadership. <br />
<br clear="left"><br />
<br />
'''ccNewsletter #5'''<br />
<br />
<imagemap><br />
Image:Newsletter5.png|left<br />
desc none<br />
default [http://mirrors.creativecommons.org/newsletter/ccnewsletter5.pdf Download PDF]<br />
</imagemap><br />
[http://mirrors.creativecommons.org/newsletter/ccnewsletter5.pdf Download PDF]<br />
<br />
The February 2008 newsletter contains a plethora of articles from across the CC [[http://zendreview.wordpress.com/ zend]] spectrum, including ccLearn, Science Commons, CCTech, CC Legal, and CCi. All the items discussed in this newsletter point to the exciting prospects for CC as it enters a new year (2008) and embarks upon projects that will continue to further its reach nationally and internationally.<br />
<br clear="left"><br />
<br />
'''ccNewsletter #4'''<br />
<br />
<imagemap><br />
Image:Ccnewsletter4.jpg|left<br />
desc none<br />
default [http://mirrors.creativecommons.org/newsletter/ccnewsletter4.pdf Download PDF]<br />
</imagemap><br />
[http://mirrors.creativecommons.org/newsletter/ccnewsletter4.pdf Download PDF]<br />
<br />
As CC’s 5th anniversary draws near, the December 2007 newsletter features articles on news and points of interest that best exemplify the progress made by CC in the realms of business and science, as well as internationally. The newsletter also features 2007 Campaign updates and discusses how important and crucial it is to help build the commons.<br />
<br clear="left"><br />
<br />
'''ccNewsletter #3'''<br />
<br />
<imagemap><br />
Image:Ccnewsletter3.jpg|left<br />
desc none<br />
default [http://mirrors.creativecommons.org/newsletter/ccnewsletter3.pdf Download PDF]<br />
</imagemap><br />
[http://mirrors.creativecommons.org/newsletter/ccnewsletter3.pdf Download PDF] <br />
<br />
The September 2007 newsletter features updates and exciting developments from CC as well as Science Commons news, CC in Business, and other points of interest as CC prepares to embark upon its 3rd annual online fundraising campaign.<br />
<br clear="left"><br />
<br />
'''ccNewsletter #2'''<br />
<br />
<imagemap><br />
Image:Ccnewsletter2.jpg|left<br />
desc none<br />
default [http://mirrors.creativecommons.org/newsletter/ccnewsletter2.pdf Download PDF]<br />
</imagemap><br />
[http://mirrors.creativecommons.org/newsletter/ccnewsletter2.pdf Download PDF]<br />
<br />
The August 2007 newsletter features articles about projects and happenings within CC itself, as well as CC’s growing presence in the business and science realms. The newsletter also highlights use cases and features CC points of interest that speak to the vitality of the free culture movement and the timely role that CC has come to play in that movement.<br />
<br clear="left"><br />
<br />
'''ccNewsletter #1'''<br />
<br />
<imagemap><br />
Image:Ccnewsletter1.jpg|left<br />
desc none<br />
default [http://mirrors.creativecommons.org/newsletter/ccnewsletter1.pdf Download PDF]<br />
</imagemap><br />
[http://mirrors.creativecommons.org/newsletter/ccnewsletter1.pdf Download PDF]<br />
<br />
The inaugural newsletter from June 2007 features CC articles of interest, including Science Commons news, CC in Business, and CC Use Cases and Shoutouts. The articles lay the foundation for newsletters to come and demonstrate how increasingly significant the work of CC has become in the move towards a global digital commons.<br />
<br clear="left"></div>Devin Chalmershttps://wiki.creativecommons.org/index.php?title=Cchost/developer/tutorial/Remix_Me&diff=28130Cchost/developer/tutorial/Remix Me2009-12-06T19:09:57Z<p>Devin Chalmers: </p>
<hr />
<div>[[Category:ccHost]]<br />
[[Category:ccMixter]]<br />
[[Category:Developer]]<br />
[[Category:Software]]<br />
[[Category:Technology]]<br />
{{cchost_head}}<br />
{{lowercase}}<br />
<br />
=Overview=<br />
This tutorial will walk through the creation of a feature for [http://ccmixter.org ccMixter.org] that was added by taking full advantage of [[Cchost/concepts/Templates|template engine]] and [[Cchost/concepts/Query_Engine|Query API]]. If you just want to download and install the finished project or want to follow along in your own version of the code you can jump down to the [[#Download the Source|download]] section.<br />
<br />
The idea was to create a quick-and-dirty version of a feature of other remix sites that allow artists to embed "remix me" widgets onto their site. (Typical example is from the [http://www.trifonic.com/2008/11/13/new-remix-page/ Trifonic site].) Those sites use fancy Flash (tm) widgets, but here we aren't aiming so high. We just want a simplified version of that, something that leads remixers to the [http://en.wikipedia.org/wiki/Stem_(music) stems] and starts them down the road to uploading.<br />
<br />
Even though this feature was made with ccMixter in mind, we've written the code to be portable to all ccHost installations. The ccMixter specific parts (logo and headline) are parametrized using the template tag ('Edit Footers and Banners') admin screens so you can customize it without changes to the code.<br />
<br />
===Tech Notes===<br />
This feature involves four [[Cchost/Custom_Query_Templates|custom templates]] and one [[Cchost/developer/concepts/Working_With_Data#Custom_Dataviews|custom dataview]] ([[Cchost/developer/concepts/Working_With_Data#Using_Dataviews_in_Templates|embedded]] into one of the templates). <br />
<br />
This tutorial demonstrates the flexibility of templates. By the end we will:<br />
*Create a template the fits into the '''publicize''' feature.<br />
*Create a template that targets a popup window.<br />
*Nest a ccHost system template in a wrapper template of our own.<br />
*Create a 'feature page' template that ties it all together.<br />
<br />
The entire project, from concept to check-in took less than four hours to put together and install on the site. <br />
<br />
=Feature Requirements=<br />
For this feature we want to generate an HTML snippet that will:<br />
*List the remixes of a given artist with the ability to stream, download and find out more about the remix.<br />
*Show a link for downloading stems <br />
*Show a link for uploading a remix.<br />
<br />
This last step is a little tricky. What other sites do is direct users to a screen that allows them to register an account with the site in the same transaction as upload their remix. We won't be quite so fancy and just create a screen that directs users to either create an account or, if they already have an account, submit the remix.<br />
<br />
=Implementation Spec=<br />
To create this feature we will create several templates and use the [[Cchost/concepts/Query_Engine|Query API]] to call them. Here are the templates we want to make:<br />
*A ''Remix Me'' template - this will be embedded into the user's blog or web site. It will have to be 'straight' HTML and assume nothing about styles or layout.<br />
*A ''Get My Stems'' template - when the user clicks on 'get my stems' this will popup a window with a list of download-able samples from the artist.<br />
*An ''Upload My Remix'' template - this will live on the ccHost installation site and direct the remixer to either the login/register screens or the 'Submit Remix' screen depending on whether they are logged in already.<br />
*In addition to those we'll create a page on our installation with instructions for our users about how to install the embedding's snippets into their blogs.<br />
<br />
We will craft this feature so it will appear in the list of optional embedding in the '''publicize''' feature, so technically the last page mentioned is not needed -- but the feature is just cool enough that we'll create it's own instruction page, hopefully inspiring ccMixter users to give it go.<br />
=Making the Templates=<br />
==The 'Remix Me' Embedding Template==<br />
The template we embed onto the user's blogs is the most complicated, important piece so we'll start there.<br />
<br />
The way we embed snippets into external sites is to generate a <nowiki><script></nowiki> tag. The ''SRC'' attribute of that tag points back to ccMixter and requests a Query API call whose format parameter is set to ''docwrite''. This parameter is the same as the ''html'' format, except the returning HTML in wrapped in javascript docwrite() calls, injecting the results directly into the web page. All the user has to do is copy the one line of HTML with the <nowiki><script></nowiki> tag and we do the rest.<br />
<br />
For the ''SRC'' attribute we're aiming for a query that will look something like:<br />
<br />
'''api/query?f=docwrite&t=remix_me&user=<user_name>'''<br />
<br />
===Making it 'publicize' Compatible===<br />
ccHost already has a feature for generating these types of embedding. It's called the '''publicize''' [[Cchost/concepts/Commands|command]]. (You can see it action at [http://ccmixter.org/publicize/teru ccMixter].) If we do our 'Remix Me' feature right, it will just slip into the 'format' drop down.<br />
<br />
In order to this we need to have certain things in place:<br />
*The template must reside in '''<local_files>/skins/formats'''<br />
*The ''meta'' section of the template must specify ''type = format''<br />
*The same ''meta'' section must have a 'desc' field with a one-line description<br />
<br />
The template should also be amenable to either remixes ''by'' our user or ''of'' our user, unfortunately this is a drag because, really, we only care about the remixes ''of'' our user. Ah well, the template will act a little funny in '''publicize''' but we'll make up for below.<br />
<br />
Since this feature is about remixes ''of'' a given artist and it really doesn't make sense to do it for remixes ''by'' the user. There we'll also specify that ''remixesof'' parameter as a requirement of the query in the ''meta'' section.<br />
<br />
We put the following shell of the template into '''<local_files>/skins/formats/remix_me.tpl''':<br />
<br />
%%<br />
[meta]<br />
type = format<br />
desc = _('Remix ME (use with Other Peoples Remixes...)')<br />
required_args = remixesof<br />
[/meta]<br />
%%<br />
<br />
===Making it Portable to non-ccMixter Sites===<br />
Keeping in mind that this code might be used on sites other than ccMixter, the key phrases and logo are pulled in from the environment so admins can [[#Customise|customize]] the feature.<br />
<br />
We look for two variables in the template ''remix-me-title'' and ''remix-me-logo'' but don't assume either is there. We'll use the %if_not_null% [[Cchost/concepts/Templates#Macro_table|template macro]] to check:<br />
<br />
%if_not_null(remix-me-logo)% <br />
<nowiki><img style="float:left" src="%(remix-me-logo)%" /></nowiki><br />
%end_if%<br />
<br />
===Adding a 'Download My Stems' Popup Window===<br />
We want to have a link at the top that says 'Download My Stems'. This should lead to a popup window with a list of the artist's upload tagged ''sample''.<br />
<br />
ccHost arlready has a '''download''' template that lists out the download links for a query ([http://ccmixter.org/api/query?t=download&f=html&user=teru&tags=archive example here]).<br />
<br />
We use the ''html'' format parameter so we don't get the whole skin into the popup window.<br />
<br />
Ideally the URL for that popup window would be something:<br />
<br />
'''<your_installation_root>api/query?t=download&user=<user_name>&f=html'''<br />
<br />
Unfortunately, we don't have the user_name (!) as part of the query results in the this template (remember, the query results are the remixes ''of'' this artist). However, we do have the user name in the query that generated this template -- it's in the ''remixesof'' parameter. So the best we can do is squeeze off the ''remixesof'' PHP's $_GET variable.<br />
<br />
In order to make the code portable, we use the ''query-url'' variable for our ccHost installation:<br />
<br />
<nowiki><a onclick=</nowiki><br />
"window.open( '%(query-url)%t=download&user=%(#_GET/remixesof)%&f=html', <br />
'cchwin',<br />
'height=600,width=450'); <br />
return 0;">download my stems<nowiki></a></nowiki><br />
<br />
(For brevity we've left off all the javascript goop for the window specs. You can see all that in the [[#Download the Source|code download]].) <br />
<br />
===Adding a 'upload your remix' Link===<br />
We'll add another link in the header of the template that points to a template directing the user to the sumbit remix screen (or register if they don't have an account). We'll fill out the ''remix_me_upload'' template later, for now we'll use the $_GET trick again to get the user's name:<br />
<br />
<nowiki><a href="%(query-url)%t=remix_me_upload&user=%(#_GET/remixesof)%">upload your remix</a></nowiki><br />
<br />
===Displaying the remixes===<br />
We'll want to [[Cchost/Custom_Query_Templates#Add_File_Looping|loop over the records]] and display the remixes of our artist by upload name and remixer. Because we are embedding into random blogs we want to keep everything self contained -- no links to CSS files, no outside scripts and the safest layout mechanism possible. That means (forgive me) <nowiki><table></nowiki>. We'll also want to control the overflow so we'll make extensive use of the %chop% [[Cchost/concepts/Templates#Macro_table|template macro]] when displaying names:<br />
<br />
<nowiki><table cellpadding="0" cellpadding="0"></nowiki><br />
%loop(records,R)%<br />
<nowiki><tr></nowiki><br />
<nowiki><td>%chop(#R/upload_name,23)%</td></nowiki><br />
<nowiki><td>%text(str_by)%&nbsp;</td></nowiki><br />
<nowiki><td>%chop(#R/user_real_name,12)%&nbsp;</td></nowiki><br />
</tr><br />
%end_loop%<br />
<nowiki></table></nowiki><br />
<br />
You're now ready to take a peak. Pick a user that has been remixed in your installation and try:<br />
<br />
'''api/query?t=formats/remix_me.tpl&remixes=<user_name>'''<br />
<br />
(See [[Cchost/concepts/Templates#Embedded_Macros_vs._Paths|why you need the .tpl extension]] in this case.)<br />
<br />
===Customizing the Dataview===<br />
Until now we're using the default dataview. If you [[Cchost/guide/Troubleshooting#Variable_Dumps|dump that using '''dpreview=1''']] to peek inside, you'll see there is no file download URL field. Since we want a download link for each remix we'll need a different set of columns. (While we're at, we will optimize to only the columns we need to avoid default dataview's intense performance overhead.) We'll setup a [[Cchost/developer/concepts/Working_With_Data#Custom_Dataviews|custom dataview]]... <br />
<br />
[meta]<br />
type = format<br />
desc = _('Remix ME (use with Other Peoples Remixes...)')<br />
required_args = remixesof<br />
'''dataview = remix_me'''<br />
'''embedded = 1'''<br />
[/meta]<br />
<br />
and embed it directly into the template:<br />
<br />
[dataview]<br />
function remix_me_dataview()<br />
{<br />
$sql =<<<EOF<br />
SELECT upload_id, upload_contest, upload_name, user_name, user_real_name<br />
%columns%<br />
FROM cc_tbl_uploads<br />
JOIN cc_tbl_user ON upload_user=user_id<br />
%joins%<br />
%where%<br />
%order%<br />
%limit%<br />
EOF;<br />
<br />
$sql_count =<<<EOF<br />
SELECT COUNT(*)<br />
FROM cc_tbl_uploads<br />
JOIN cc_tbl_user ON upload_user=user_id<br />
%joins%<br />
%where%<br />
%order%<br />
EOF;<br />
<br />
return array( 'sql' => $sql, <br />
'sql_count' => $sql_count, <br />
'e' => array( '''CC_EVENT_FILTER_DOWNLOAD_URL''' ) );<br />
}<br />
[/dataview]''<br />
<br />
The return array has the event that will trigger the [[Cchost/developer/concepts/Working_With_Data#Dataview_Filtering|dataview filter]] to generate the 'download_url' field in the returning records. That particular filter requires some columns to work (upload_id, upload_contest, upload_name) so we made those part of the ''SELECT'' statement.<br />
<br />
Now that we have the 'download_url' we can use it in the display table:<br />
<br />
<nowiki><td><a href="%(#R/download_url)%">download</a></td></nowiki><br />
<br />
===Adding the Stream URL===<br />
Audio streaming in ccHost is done by an M3U [[Cchost/concepts/Query_Engine|"plain text" query formatter]]. The trick for the Query API URLs is that many music players require an .m3u extension on the end of the URL. <br />
<br />
As demonstrated in the [http://code.creativecommons.org/svnroot/cchost/trunk/mixter-files/skins/formats/remix_me.tpl live version of the template], in order to handle this we gerry-rig the api url to append a file called 'stream.m3u' and make a new field in every record called ''stream_url'':<br />
<br />
'''$stream_base =''' <br />
'''url_args( ccl('api','query','stream.m3u'), 'f=m3u&ids=' ) . '/';'''<br />
<br />
$sql =<<<EOF<br />
SELECT upload_id, upload_contest, upload_name, user_name, user_real_name,<br />
'''CONCAT( '{$stream_base}', upload_id ) as stream_url'''<br />
%columns%<br />
FROM cc_tbl_uploads<br />
JOIN cc_tbl_user ON upload_user=user_id<br />
%joins%<br />
<br />
<br />
The only parameter left is the upload_id for the '''ids''' parameters. We can safely embed the query URL directly into the HREF attribute of an anchor because most browsers will not navigate to page, just call up the system's music player. (No, it's not ideal but we're just trying to get through this - exercise for the reader: cram a Flash(tm) player into this scheme somewhere.)<br />
<br />
The stream link looks like:<br />
<br />
<nowiki><td><a href="%(#R/stream_url)%">stream</a></td></nowiki><br />
<br />
===Adding an 'info' button===<br />
To add an 'info' button we'll use ccHost's 'i' icon at '''ccskins/shared/images/i-fg.png'''. Again, because we are being embedded into a random blog's page and we don't want any borders on the image. To generate a fully qualified URL we'll use the %url% [[Cchost/concepts/Templates#Macro_table|template macro]]:<br />
<br />
<nowiki><img style="border:0px" src="%url('images/i-fg.png')%" /></nowiki><br />
<br />
The link we wrap around this will need a URL to the page of the remix. We can generate this into a field (i.e. SQL column) called 'file_page_url' using the ''ccl'' URL builder helper and then SQL's ''CONCAT'' function:<br />
<br />
[dataview]<br />
function remix_me_dataview()<br />
{<br />
'''$furl = ccl('files') . '/';'''<br />
<br />
$sql =<<<EOF<br />
SELECT upload_id, upload_contest, upload_name, user_name, user_real_name,<br />
CONCAT( '{$stream_base}', upload_id ) as stream_url<br />
'''CONCAT( '{$furl}', user_name, '/', upload_id ) as file_page_url'''<br />
%columns%<br />
FROM cc_tbl_uploads<br />
JOIN cc_tbl_user ON upload_user=user_id<br />
%joins%<br />
%where%<br />
%order%<br />
%limit%<br />
EOF;<br />
<br />
Now that the remix's page URL is available we can use it in the wrapper link:<br />
<br />
<nowiki><td><a href="%(#R/file_page_url)%"><img style="border:0px" src="%url('images/i-fg.png')%" /></a></td></nowiki><br />
<br />
===Adding a License Button===<br />
If the [http://code.creativecommons.org/svnroot/cchost/trunk/mixter-files/skins/formats/remix_me.tpl live version of the code] we added a link to the license for each license.<br />
<br />
To do that we have to add some columns and join the license table into the dataview:<br />
<br />
SELECT upload_id, upload_contest, upload_name, user_name, user_real_name,<br />
CONCAT( '{$furl}', user_name, '/', upload_id ) as file_page_url,<br />
'''license_url, license_name'''<br />
%columns%<br />
FROM cc_tbl_uploads<br />
JOIN cc_tbl_user ON upload_user=user_id<br />
'''JOIN cc_tbl_licenses ON upload_license=license_id'''<br />
%joins%<br />
%where%<br />
<br />
and use those new fields in the template:<br />
<br />
<nowiki><td><a href="%(#R/license_url)%" title="%(#R/license_name)%">...</a></nowiki><br />
<br />
==The 'Download My Stems' Template==<br />
Unfortunately the system's '''download''' template is [http://ccmixter.org/api/query?t=download&f=html&user=teru&tags=archive really boring]. We want to style it similar to our embedding look/feel and we want a pretty header with the user's name and other information in it.<br />
<br />
We will make our version in '''<local_files>/skins/remix_me_download.tpl'''. <br />
<br />
Quick back step: since we're changing templates we have to update our [[#Adding_a_.27Download_My_Stems.27_Popup_Window|popup window URL]] in the embedding template:<br />
<br />
window.open( '%(query-url)%t='''remix_me_download'''&user...<br />
<br />
<br />
===Nesting Templates===<br />
We take advantage of the nesting quality of templates and queries to embed the system '''download''' template in one of our own. <br />
<br />
Each template in ccHost is a self-contained entity. They each have their own query that triggers them, their own dataview that defines the data sources and their own rendering that defines what the results are formatted like.<br />
<br />
Just because we embed the system's '''download''' template does 'not' mean we have to have the same query, dataview or render format.<br />
<br />
In this case the query for our 'outer' may ''look'' the same as the one we pass to the '''download''' when we embed it, but it will behave in a very, very different. (For a technical explanation see the section on [[Cchost/developer/concepts/Working_With_Data#Alternate_tables:_datasource|datasources]].)<br />
<br />
===Digging Out the User===<br />
In ccHost the user has two 'names' - the login name and a 'pretty' name called ''user_real_name'' internally. In order to get that piece of information in our 'outer' template we'll use the system's ''user_basic'' dataview which returns basic information from the user's record.<br />
<br />
We'll also require callers to this template to use a ''user'' parameter:<br />
<br />
%%<br />
[meta]<br />
type = template_component<br />
dataview = user_basic<br />
require_args = user<br />
[/meta]<br />
%%<br />
<br />
Since we only care about one user at a time, we use the %map% [[Cchost/concepts/Templates#Macro_table|template macro]] to get the first (and only) user in the array into a local variable:<br />
<br />
%map(#R, records/0 )%<br />
<br />
The combination of these steps will allow us to display good looking information about the user like:<br />
<br />
<nowiki><h2>Remix %(#R/user_real_name)%!</h2></nowiki><br />
<br />
Here are %(#R/user_real_name)%'s stems for download...<br />
<br />
===Embed the System's 'Download' Template===<br />
Ideally we'd just use the %query% [[Cchost/concepts/Templates#Macro_table|template macro]] with something:<br />
<br />
%query('t=download&tags=sample&user=%(#R/user_name)%')%<br />
<br />
Unfortunately macros can not nest so we have to drop to PHP. You can see we use the ''embed'' format which will run the query and output the HTML directly to the screen in situ. The [[Cchost/concepts/Templates#Macro_table|PHP equivalent]] of the %query% macro, now with our parameter is:<br />
<br />
<?= cc_query_fmt(<br />
'f=embed&noexit=1&nomime=1&t=download&tags=sample&user=' .<br />
$R['user_name']);<br />
?><br />
<br />
==The 'Upload Your Remix' Template==<br />
This where the user lands when they click on the 'Upload Your Remix' link. It's a very basic screen that simply checks to see if the user is logged in and puts out different messages based on that [http://zendreview.wordpress.com zend review].<br />
<br />
We'll use the same ''user_basic'' dataview we used in our download template and put it in '''<local_files>/skins/remix_me_upload.tpl'''.<br />
<br />
Here's the environment variable ''logged_in_as'' to perform the logged in check:<br />
<br />
%if_not_null(logged_in_as)%<br />
<nowiki><p>Since you're already logged in...</nowiki><br />
<br />
and the ''ccl'' helper to build up [[Cchost/concepts/Commands|command URLs]]:<br />
<br />
<nowiki>go to <a href="<?= ccl('submit','remix') ?>">Submit A Remix</a> form</nowiki><br />
<br />
==The 'Remix Me' Feature Page==<br />
This page is just a nice place to come to see the feature and instruct users on how to use it. We created the file '''<local_files>/skins/remix_me_embed.tpl'''<br />
<br />
We use the ''user_basic'' dataview one more time to make thing pretty. <br />
<br />
The one thing to note is that query url in the ''SRC'' attribute of the <nowiki><script></nowiki> tag needs to URL encoded.<br />
<br />
You call it with the user's login name in a query:<br />
<br />
api/query?t=remix_me_embed&user=<user_name><br />
<br />
===Adding it to the Menu===<br />
To highlight the new feature we put a link to this template into the 'Artists' menu. To customize per use we use the (previously undocumented) feature of ccHost menus of substituting the currently logged in user's name for ''%login_name%''.<br />
<br />
So for the 'Action' field of the our new menu item, we put exactly this:<br />
<br />
api/query?t=remix_me_embed&user=%login_name%<br />
<br />
{{Infobox|NOTE: There is a bug in the menu editor that expands ampersands ('&') to URL-safe versions (&'<nowiki>amp</nowiki>';). Before you save your menu make sure ''all'' your URLs are correct. This bug is fixed [http://code.creativecommons.org/svnroot/cchost/trunk/cchost_lib/cc-menu-admin.inc in SVN].}}<br />
<br />
=Download the Source=<br />
The source for the latest version of feature is available from the mixter section of the [http://code.creativecommons.org/svnroot/cchost/trunk/mixter-files/skins/ ccHost SVN repository]. The version that this tutorial uses is available from [http://ccmixter.org/remix_me_feature_src.zip here (ZIP)]. <br />
<br />
==Installing==<br />
*Unzip the [http://ccmixter.org/remix_me_feature_src.zip the source ZIP] file on your local directory and copy the files to '''<local_files>/skins''' maintaining the directory structure.<br />
*You have to edit the file called ''remix_me_embed.tpl'' to replace all occurrences of the string ''mixter-files'' with the your '''<local_files>''' directory.<br />
<br />
==Customizing==<br />
*Log in as admin to your ccHost installation (if not already)<br />
*Click on ''Manage Site'', then ''Banner and Footers'', then ''Banner Text, Footers, etc.''<br />
*In the header of the form click on ''clicking here''.<br />
*Type in the text: 'remix-me-title' (without the quotes)<br />
*Click on 'Submit' (this should bring you back to the 'Edit Banners...' form).<br />
*Again, in the header of the ''clicking here''<br />
*Type in the text: 'remix-me-logo' (without the quotes)<br />
*Click on 'Sumbit'<br />
*Now at the bottom of this form you should see the new fields you just enetered.<br />
**For the title enter something like 'Remix Me' - this will be the text that is displayed in the embedding on the users' sites.<br />
**For the logo enter the fully qualified URL to any logo you want to appear in the embedding. This is optional and you can fill it in later.<br />
<br />
Now your "remix me" feature is ready to go. You should see it as an option when you browse to '''publicize/<user_name>''' and also when you browse to '''api/query?t=remix_me_embed&user=<user_name>''' which you [[#Adding_it_to_the_Menu|put into your menu]] for registered users.</div>Devin Chalmers