|
m |
| (17 intermediate revisions not shown.) |
| Line 1: |
Line 1: |
| | + | <OneClick /> |
| | <html> | | <html> |
| - | <script type="text/javascript">
| |
| - | String.prototype.capitalize = function(){
| |
| - | return this.replace(/\w+/g, function(a){
| |
| - | return a.charAt(0).toUpperCase() + a.substr(1).toLowerCase();
| |
| - | });
| |
| - | };
| |
| - | function getArgs() {
| |
| - | var args = new Object();
| |
| - | var query = location.search.substring(1); // Get query string.
| |
| - | var pairs = query.split(","); // Break at comma.
| |
| - | for(var i = 0; i < pairs.length; i++) {
| |
| - | var pos = pairs[i].indexOf('='); // Look for "name=value".
| |
| - | if (pos == -1) continue; // If not found, skip.
| |
| - | var argname = pairs[i].substring(0,pos); // Extract the name.
| |
| - | var value = pairs[i].substring(pos+1); // Extract the value.
| |
| - | args[argname] = unescape(value); // Store as a property.
| |
| - | }
| |
| - | return args; // Return the object.
| |
| - | }
| |
| - | function isLoggedIn(){
| |
| - | if (wgUserName == null){
| |
| - | return false;
| |
| - | }
| |
| - | return true;
| |
| - | }
| |
| - | function changeDisplayById(id,val){
| |
| - | if (document.getElementById){
| |
| - | var nodeObj = document.getElementById(id);
| |
| - | var display='none';
| |
| - | if (val == 'on'){
| |
| - | display = 'table-row';
| |
| - | }
| |
| - | nodeObj.style.display = display;
| |
| - | }
| |
| - | }
| |
| - | function EntryCheck(){
| |
| - | if (!document.forms.OneClick.Project.value){
| |
| - | alert('Project must be specified');
| |
| - | return false;
| |
| - | }
| |
| - | var opt = document.forms.OneClick.Type.selectedIndex;
| |
| - | var type = document.forms.OneClick.Type.options[opt];
| |
| - | switch (type.value){
| |
| - | case 'IGEM':
| |
| - | if (!document.forms.OneClick.Institution.value){
| |
| - | alert('Institution must be specified');
| |
| - | return false;
| |
| - | }
| |
| - | break;
| |
| - | case 'USER':
| |
| - | break;
| |
| - | default:
| |
| - | case 'LAB':
| |
| - | if (!document.forms.OneClick.Lab.value){
| |
| - | alert('Lab name must be specified');
| |
| - | return false;
| |
| - | }
| |
| - | break;
| |
| - | }
| |
| - | return true;
| |
| - | }
| |
| - | function MakePageName(){
| |
| - | var igem = 'IGEM';
| |
| - | var user = 'User';
| |
| - | var notebook = 'Notebook';
| |
| - | var igemYear = '2008';
| |
| - | var project = document.forms.OneClick.Project.value;
| |
| - | var inst = document.forms.OneClick.Institution.value;
| |
| - | var lab = document.forms.OneClick.Lab.value;
| |
| - | if (project){
| |
| - | project = project.capitalize();
| |
| - | }
| |
| - | document.forms.OneClick.Username.value = wgUserName;
| |
| - | var opt = document.forms.OneClick.Type.selectedIndex;
| |
| - | var type = document.forms.OneClick.Type.options[opt];
| |
| - | var url = '';
| |
| - | switch (type.value){
| |
| - | case 'IGEM':
| |
| - | changeDisplayById('LabRow','off');
| |
| - | changeDisplayById('ProjectRow','on');
| |
| - | changeDisplayById('InstitutionRow','on');
| |
| - | if (inst.length == 0 || project.length == 0)
| |
| - | url= '';
| |
| - | else
| |
| - | url = igem+':'+inst+'/'+igemYear+'/'+notebook+'/'+project;
| |
| - | break;
| |
| - | case 'USER':
| |
| - | changeDisplayById('LabRow','off');
| |
| - | changeDisplayById('ProjectRow','on');
| |
| - | changeDisplayById('InstitutionRow','off');
| |
| - | if (project.length == 0)
| |
| - | url= '';
| |
| - | else
| |
| - | url = user+':'+wgUserName+'/'+ notebook+'/'+project;
| |
| - | break;
| |
| - | case 'LAB':
| |
| - | changeDisplayById('LabRow','on');
| |
| - | changeDisplayById('ProjectRow','on');
| |
| - | changeDisplayById('InstitutionRow','off');
| |
| - | if (lab.length == 0 || project.length == 0)
| |
| - | url= '';
| |
| - | else
| |
| - | url = lab +':'+notebook+'/'+project;
| |
| - | break;
| |
| - | }
| |
| - | return url;
| |
| - | }
| |
| - | function ShowURL(){
| |
| - | if (!isLoggedIn()){
| |
| - | alert ('You must be logged in to create a new Notebook.');
| |
| - | window.location = "/wiki/Special:Userlogin&returnto=Help:Notebook/One_Click_Setup";
| |
| - | }
| |
| - | var currentURL = MakePageName();
| |
| - | document.getElementById('DisplayURL').innerHTML=currentURL;
| |
| - | return true;
| |
| - | }
| |
| - | function loadMessage(){
| |
| - | var args = getArgs();
| |
| - | if (args.Message){
| |
| - | changeDisplayById('form_body','off');
| |
| - | var nodeObj = document.getElementById('message_body');
| |
| - | nodeObj.style.verticalAlign='middle';
| |
| - | nodeObj.style.width='600px';
| |
| - | nodeObj.style.height='120px';
| |
| - | if (args.Error == null){
| |
| - | nodeObj.style.backgroundColor='#e5edc8';
| |
| - | nodeObj.innerHTML=
| |
| - | "<img src='/images/f/f8/Owwnotebook_icon.png' style='float: left;' " +
| |
| - | " alt='Owwnotebook_icon.png' /><br />"+
| |
| - | "<span style=\"font-size: 20px; font-weight: bold;\">Success!</span><br />"+args.Message;
| |
| - | }else{
| |
| - | nodeObj.style.backgroundColor='#e0bcc1';
| |
| - | nodeObj.innerHTML=
| |
| - | "<img src='/images/f/f8/Owwnotebook_icon.png' style='float: left;' " +
| |
| - | " alt='Owwnotebook_icon.png' /><br />"+
| |
| - | "<span style=\"font-size: 20px; font-weight: bold;\">Error</span><br />"+args.Message;
| |
| - | }
| |
| - | return true;
| |
| - | }
| |
| - | return false;
| |
| - | }
| |
| - | </script>
| |
| | <div id="form_body" class="forms_body"> | | <div id="form_body" class="forms_body"> |
| | <form action="/um/um_process_oneclick.php" name="OneClick" | | <form action="/um/um_process_oneclick.php" name="OneClick" |
| | id="OneClick" onsubmit="return EntryCheck();" method="POST"> | | id="OneClick" onsubmit="return EntryCheck();" method="POST"> |
| | <input type="hidden" name="Username" value="" /> | | <input type="hidden" name="Username" value="" /> |
| | + | <input type="hidden" name="CurrentURL" value="" /> |
| | <table class="forms_table" width="100%" border="0" cellpadding="5" cellspacing="0"> | | <table class="forms_table" width="100%" border="0" cellpadding="5" cellspacing="0"> |
| | <tr> | | <tr> |
| Line 159: |
Line 19: |
| | <option value="LAB">Lab</option> | | <option value="LAB">Lab</option> |
| | </select> | | </select> |
| | + | |
| | <div class="forms_style1"> | | <div class="forms_style1"> |
| | Select the type of notebook to be created.<br /> | | Select the type of notebook to be created.<br /> |
| Line 166: |
Line 27: |
| | </div> | | </div> |
| | </td> | | </td> |
| | + | <td valign="top" align="right" width="250px"> |
| | + | <a href="http://openwetware.org/wiki/Help:Notebook">What's an OpenWetWare Lab Notebook?</a> |
| | + | </td> |
| | </tr> | | </tr> |
| | <tr id='ProjectRow'> | | <tr id='ProjectRow'> |
| Line 214: |
Line 78: |
| | </td> | | </td> |
| | <td valign="top" align="left"> | | <td valign="top" align="left"> |
| - | <span class="forms_style1"><span id="DisplayURL"></span><br /> | + | <span class="forms_style1"><span id="DisplayURL" style="color:#336699; background-color:#D3DCE5; text-decoration:underline; padding:4px;"></span><br /> |
| - | This is the full OWW page of the notebook to be created.</span><span onclick="ShowURL()"> Update</span> | + | This is the full OWW page of the notebook to be created. </span><span onclick="ShowURL()" style="border:#CCCCCC 1px solid; padding:2px; background-color:#EEEEEE;">Update</span> |
| | </td> | | </td> |
| | </tr> | | </tr> |
| Line 238: |
Line 102: |
| | } | | } |
| | </script> | | </script> |
| | + | </html> |
| | + | [[category:OWWLabNotebookV1]] |