@ -136,8 +136,17 @@ OC.Share={
return data ;
} ,
share : function ( itemType , itemSource , shareType , shareWith , permissions , callback ) {
$ . post ( OC . filePath ( 'core' , 'ajax' , 'share.php' ) , { action : 'share' , itemType : itemType , itemSource : itemSource , shareType : shareType , shareWith : shareWith , permissions : permissions } , function ( result ) {
share : function ( itemType , itemSource , shareType , shareWith , permissions , itemSourceName , callback ) {
$ . post ( OC . filePath ( 'core' , 'ajax' , 'share.php' ) ,
{
action : 'share' ,
itemType : itemType ,
itemSource : itemSource ,
shareType : shareType ,
shareWith : shareWith ,
permissions : permissions ,
itemSourceName : itemSourceName
} , function ( result ) {
if ( result && result . status === 'success' ) {
if ( callback ) {
callback ( result . data ) ;
@ -170,9 +179,9 @@ OC.Share={
}
} ) ;
} ,
showDropDown : function ( itemType , itemSource , appendTo , link , possiblePermissions ) {
showDropDown : function ( itemType , itemSource , appendTo , link , possiblePermissions , filename ) {
var data = OC . Share . loadItem ( itemType , itemSource ) ;
var html = '<div id="dropdown" class="drop" data-item-type="' + itemType + '" data-item-source="' + itemSource + '"> ' ;
var html = '<div id="dropdown" class="drop" data-item-type="' + itemType + '" data-item-source="' + itemSource + '"" data-item-source-name="' + filename + '"> ' ;
if ( data !== false && data . reshare !== false && data . reshare . uid _owner !== undefined ) {
if ( data . reshare . share _type == OC . Share . SHARE _TYPE _GROUP ) {
html += '<span class="reshare">' + t ( 'core' , 'Shared with you and the group {group} by {owner}' , { group : escapeHTML ( data . reshare . share _with ) , owner : escapeHTML ( data . reshare . displayname _owner ) } ) + '</span>' ;
@ -276,12 +285,13 @@ OC.Share={
event . stopPropagation ( ) ;
var itemType = $ ( '#dropdown' ) . data ( 'item-type' ) ;
var itemSource = $ ( '#dropdown' ) . data ( 'item-source' ) ;
var itemSourceName = $ ( '#dropdown' ) . data ( 'item-source-name' ) ;
var shareType = selected . item . value . shareType ;
var shareWith = selected . item . value . shareWith ;
$ ( this ) . val ( shareWith ) ;
// Default permissions are Edit (CRUD) and Share
var permissions = OC . PERMISSION _ALL ;
OC . Share . share ( itemType , itemSource , shareType , shareWith , permissions , function ( ) {
OC . Share . share ( itemType , itemSource , shareType , shareWith , permissions , itemSourceName , function ( ) {
OC . Share . addShareWith ( shareType , shareWith , selected . item . label , permissions , possiblePermissions ) ;
$ ( '#shareWith' ) . val ( '' ) ;
OC . Share . updateIcon ( itemType , itemSource ) ;
@ -588,6 +598,7 @@ $(document).ready(function() {
$ ( document ) . on ( 'change' , '#dropdown #linkCheckbox' , function ( ) {
var itemType = $ ( '#dropdown' ) . data ( 'item-type' ) ;
var itemSource = $ ( '#dropdown' ) . data ( 'item-source' ) ;
var itemSourceName = $ ( '#dropdown' ) . data ( 'item-source-name' ) ;
if ( this . checked ) {
// Create a link
OC . Share . share ( itemType , itemSource , OC . Share . SHARE _TYPE _LINK , '' , OC . PERMISSION _READ , function ( data ) {
@ -619,6 +630,7 @@ $(document).ready(function() {
var allowPublicUpload = $ ( this ) . is ( ':checked' ) ;
var itemType = $ ( '#dropdown' ) . data ( 'item-type' ) ;
var itemSource = $ ( '#dropdown' ) . data ( 'item-source' ) ;
var itemSourceName = $ ( '#dropdown' ) . data ( 'item-source-name' ) ;
var permissions = 0 ;
// Calculate permissions
@ -638,6 +650,7 @@ $(document).ready(function() {
if ( ! $ ( '#showPassword' ) . is ( ':checked' ) ) {
var itemType = $ ( '#dropdown' ) . data ( 'item-type' ) ;
var itemSource = $ ( '#dropdown' ) . data ( 'item-source' ) ;
var itemSourceName = $ ( '#dropdown' ) . data ( 'item-source-name' ) ;
var allowPublicUpload = $ ( '#sharingDialogAllowPublicUpload' ) . is ( ':checked' ) ;
var permissions = 0 ;
@ -663,6 +676,7 @@ $(document).ready(function() {
var dropDown = $ ( '#dropdown' ) ;
var itemType = dropDown . data ( 'item-type' ) ;
var itemSource = dropDown . data ( 'item-source' ) ;
var itemSourceName = $ ( '#dropdown' ) . data ( 'item-source-name' ) ;
var permissions = 0 ;
// Calculate permissions