%h3{:style => 'text-align:center;'} %a{:href => '/'} GroupDocs Ruby SDK Samples \- Sample41 .samplecontent{:style => 'padding:10px;'} %span.description This sample will show how to set callback for Annotation and manage user rights using Ruby SDK. %br/ %br/ / %span.documentation %a{:href => '/docs/sample41.html'} Builtin documentation for this sample %br/ %br/ %p You entered: %p ClientID = #{(defined? userId) ? userId : ''} %p PrivateKey = #{(defined? privateKey) ? privateKey : ''} %p FileID = #{(defined? fileId) ? fileId : ''} %p %font{:color => 'red'} #{(defined? err) ? err : ''} %br/ #requestForm{:style => 'padding:20px; border:1px solid black;'} %p Enter data for request and press "Make request" button %form{:action => "/sample41", :enctype => 'multipart/form-data', :method => 'post', :id=>'form'} %label{:for => 'clientId'} GroupDocs ClientID %br/ %input{:type=>'text', :name=>'clientId', :id=>'client_id', :value=>"#{(defined? userId) ? userId : ''}"} %br/ %label{:for => 'privateKey'} GroupDocs PrivateKey %br/ %input{:type=>'text', :name=>'privateKey', :id=>'private_key', :value=>"#{(defined? privateKey) ? privateKey : ''}"} %br/ %div.guid_radio{:style=>"#{(defined? userId) ? 'display:none' : 'display:block'}"} %input{:type=>'radio', :name=>'source', :value=>'guid'} File ID (GUID) %br/ %input{:type=>'radio', :name=>'source', :value=>'local', :checked=>'checked'}Upload local file %br/ %input{:type=>'radio', :name=>'source', :value=>'url'} Upload file from URL %br/ %div.fields{:style=>"#{(defined? userId) ? 'display:none' : 'display:block'}"} %div.guid_field{:style=>'display:none;'} %label{:for=>'fileId', :id=>'guid'} File ID (GUID) %br/ %input{:type=>'text', :name=>'fileId', :id=>'guid', :value=>"#{(defined? fileId) ? fileId : ''}"} %div.guid_field %label{:for=>'file'} Upload local file %br/ %input{:type=>'file', :name=>'file', :id=>'file'} %div.guid_field{:style=>'display:none;'} %label{:for=>'url', :id=>'url'} Upload file from URL %br/ %input{:type=>'text', :name=>'url', :id=>'url'} %label First collaborator email %br/ %input{:type=>'text', :name=>'email[]', :value=>""} %br/ %label Second collaborator email %br/ %input{:type=>'text', :name=>'email[]', :value=>""} %br/ %label callbackUrl %span{:class => 'optional'} (Optional)
(For test Callback you can use this URL: http://groupdocs-ruby-samples.herokuapp.com/sample41/callback) %br/ %input{:type=>'text', :name=>'callbackUrl', :id => 'callbackUrl', :value=>"#{(defined? callbackUrl) ? callbackUrl : ''}"} %br/ %label{:for => 'basePath'} Base Path %font{:color=>'grey'} (Optional) %br/ %input{:type=>'text', :name=>'basePath', :id=>'base_path', :value=>"#{(defined? base_path) ? base_path : ''}"} %br/ %br/ %input{:type => 'submit', :id => 'button', :value => 'Make request'} %br/ %span{:id=>'resultsStatus', :style=>'color:red;display:none;'} (Please wait for ajax response) %br/ %div{:style => 'padding:20px; border:1px solid black;'} %p Results: #rights %p #result %p #{(defined? iframe) ? iframe : ''} = partial :_others_samples %script{:src=>'//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'} :javascript $(function($){ $('.guid_radio input').change(function(){ var elementIndex = $(this).parent().children('input').index($(this)); $('.guid_field').hide(); $('.guid_field').eq(elementIndex).show(); }); }); $(document).ready(setTimeout(check, 5000)); function check() { if (($("input[name=callbackUrl]").val() != "") && (document.getElementById("result") != null)) { $('#resultsStatus').fadeIn("slow"); $.ajax({ type: 'POST', url: '/sample41/check_guid', success: function (data) { $('#resultsStatus').fadeOut("slow"); var result = null; result = data; if (result) { var message = result; $("#rights").append('' + message + '') var url = $('#iframe').attr('src'); $('#iframe').attr('src', url); } }, dataType: "text" }); } }