Project

General

Profile

« Previous | Next » 

Revision 4032

Added by berkley over 16 years ago

added functionality to make the document public after upload

View differences:

lib/style/skins/sms/index.jsp
99 99
                if(status != null && status.equals("success"))
100 100
                {
101 101
                  out.print("Your file was successfully uploaded with id <a href=\"http://linus.nceas.ucsb.edu/sms/metacat?docid=" + docid 
102
                  + "&action=read&qformat=sms\">" + docid + "</a>.");
102
                  + "&action=read&qformat=sms\">" + docid + "</a>.  " +  
103
                  "<a href=\"javascript:makepublic('" + docid + "')\">Click here</a> to make this document publicly readable.");
103 104
                }
104 105
                else
105 106
                {
lib/style/skins/sms/util.js
114 114
  var searchval = document.getElementById("searchtextbox").value
115 115
  var url = '/sms/metacat?action=query&anyfield=' + searchval + '&returnfield=dataset/title&qformat=sms&pagesize=10&pagestart=0';
116 116
  setCookie("sms-searchval", searchval);
117
  setCookie("sms-pagestart", 0);
117 118
  reloadSearchContent(url);
118 119
}
119 120

  
120 121
function showDatasets()
121 122
{
122 123
  var searchval = getCookie('sms-searchval');
123
  alert('searchval: ' + searchval);
124
  if(searchval == '')
124
  if(searchval == null || searchval == '')
125 125
  {
126 126
    searchval = '%25';
127 127
  }
......
153 153
  $("form").submit();
154 154
}
155 155

  
156
function makepublic(docid)
157
{
158
  $.get("/sms/metacat?action=setaccess&docid=" + docid + 
159
        "&principal=public&permission=read&permType=allow&permOrder=allowFirst",
160
        function(data) {
161
          if(data.indexOf("<success>") != -1)
162
          {
163
            slideUp("#uploadstatus");
164
            $("#uploadstatus").html('<p>The document with id ' + 
165
              '<a href="/sms/metacat?action=read&docid=' + docid + '&qformat=sms">' + docid + 
166
              '</a> is now publicly readable.</p>');
167
            slideDown("#uploadstatus");
168
            //alert('success: ' + "#makepublic");
169
            //slideUp("#makepublic");
170
          }
171
          else
172
          {
173
            alert('The access control changes for ' + docid + ' failed.  It is not publicly readable.');
174
          }
175
        }, "XML");
176
}
177

  
156 178
function slideUp(id)
157 179
{
158 180
  $(id).slideUp("slow");

Also available in: Unified diff