Commit 7cb866e7 authored by techird's avatar techird

share recover

parent ba29cdf5
......@@ -7,26 +7,26 @@
<meta name="description" content="百度脑图,便捷的脑图编辑工具。让您在线上直接创建、保存并分享你的思路。">
<script src="lib/jquery-2.1.0.min.js?_=1399824598062" charset="utf-8"></script>
<script src="lib/ZeroClipboard.min.js?_=1399824598062" charset="utf-8"></script>
<script src="lib/jquery-2.1.0.min.js?_=1399893922286" charset="utf-8"></script>
<script src="lib/ZeroClipboard.min.js?_=1399893922286" charset="utf-8"></script>
<script type="text/javascript">
ZeroClipboard.setDefaults( { moviePath: 'lib/ZeroClipboard.swf' } );
</script>
<script src="lib/kitygraph.all.min.js?_=1399824598062" charset="utf-8"></script>
<script src="kityminder.all.min.js?_=1399824598062" charset="utf-8"></script>
<script src="kityminder.config.js?_=1399824598062" charset="utf-8"></script>
<script src="lang/zh-cn/zh-cn.js?_=1399824598062" charset="utf-8"></script>
<script src="lib/kitygraph.all.min.js?_=1399893922286" charset="utf-8"></script>
<script src="kityminder.all.min.js?_=1399893922286" charset="utf-8"></script>
<script src="kityminder.config.js?_=1399893922286" charset="utf-8"></script>
<script src="lang/zh-cn/zh-cn.js?_=1399893922286" charset="utf-8"></script>
<script src="lib/zip.js?_=1399824598062" charset="utf-8"></script>
<script src="lib/zip.js?_=1399893922286" charset="utf-8"></script>
<script>
zip.inflateJSPath = 'lib/inflate.js';
</script>
<script src="lib/jquery.xml2json.js?_=1399824598062" charset="utf-8"></script>
<script src="lib/baidu-frontia-js-full-1.0.0.js?_=1399824598062" charset="utf-8"></script>
<script src="social/draftmanager.js?_=1399824598062" charset="utf-8"></script>
<script src="social/social.js?_=1399824598062" charset="utf-8"></script>
<script src="lib/jquery.xml2json.js?_=1399893922286" charset="utf-8"></script>
<script src="lib/baidu-frontia-js-full-1.0.0.js?_=1399893922286" charset="utf-8"></script>
<script src="social/draftmanager.js?_=1399893922286" charset="utf-8"></script>
<script src="social/social.js?_=1399893922286" charset="utf-8"></script>
<link href="social/social.css" rel="stylesheet">
<link href="themes/default/css/import.css" type="text/css" rel="stylesheet" />
......
......@@ -197,38 +197,39 @@ $( function () {
if ( !match ) return;
var shareId = match[ 1 ];
var query = new baidu.frontia.storage.Query();
query.on( 'shareMinder.id' ).equal( shareId );
$share_btn.loading( '正在加载分享内容...' );
baidu.frontia.storage.findData( query, {
success: function ( ret ) {
if ( ret.count === 0 ) {
$share_btn.loading( false );
return notice( '加载分享内容失败!请确认分享链接正确。' );
$.ajax( {
url: 'http://naotu.baidu.com/mongo.php',
data: {
action: 'find',
id: shareId
},
dataType: 'json',
success: function ( data ) {
if ( data.error ) {
return notice( data.error );
}
if ( draftManager ) {
var draft = draftManager.openByPath( 'share/' + shareId );
if ( draft ) {
draftManager.load();
} else {
draftManager.create( 'share/' + shareId );
minder.importData( ret.result[ 0 ].obj.shareMinder.data, 'json' );
minder.importData( data.shareMinder.data, 'json' );
}
} else {
minder.importData( ret.result[ 0 ].obj.shareMinder.data, 'json' );
minder.importData( data.shareMinder.data, 'json' );
}
setRemotePath( null, false );
$share_btn.loading( false );
},
error: function ( e ) {
console.log( e );
error: function () {
notice( '请求分享文件失败,请重试!' );
}
} );
$share_btn.loading( '正在加载分享内容...' );
isShareLink = true;
}
......@@ -676,12 +677,31 @@ $( function () {
$share_btn.loading( '正在分享...' );
baidu.frontia.storage.insertData( shareData, {
success: function () {
$share_dialog.show();
$share_url.val( shareUrl )[ 0 ].select();
$.ajax({
url: 'http://naotu.baidu.com/mongo.php',
type: 'POST',
data: {
action: 'insert',
record: JSON.stringify( {
shareMinder: {
id: shareId,
data: minder.exportData( 'json' )
}
} )
},
success: function ( result ) {
if ( result.error ) {
notice( result.error );
} else {
$share_dialog.show();
$share_url.val( shareUrl )[ 0 ].select();
}
},
error: function() {
notice('分享失败,可能是当前的环境不支持该操作。');
}
} );
shareConfig.bdTitle = shareConfig.bdText = minder.getMinderTitle();
shareConfig.bdDesc = shareConfig.bdText = '“' + minder.getMinderTitle() + '” - 我用百度脑图制作的思维导图,快看看吧!(地址:' + shareUrl + ')';
shareConfig.bdUrl = shareUrl;
......
......@@ -197,38 +197,39 @@ $( function () {
if ( !match ) return;
var shareId = match[ 1 ];
var query = new baidu.frontia.storage.Query();
query.on( 'shareMinder.id' ).equal( shareId );
$share_btn.loading( '正在加载分享内容...' );
baidu.frontia.storage.findData( query, {
success: function ( ret ) {
if ( ret.count === 0 ) {
$share_btn.loading( false );
return notice( '加载分享内容失败!请确认分享链接正确。' );
$.ajax( {
url: 'http://naotu.baidu.com/mongo.php',
data: {
action: 'find',
id: shareId
},
dataType: 'json',
success: function ( data ) {
if ( data.error ) {
return notice( data.error );
}
if ( draftManager ) {
var draft = draftManager.openByPath( 'share/' + shareId );
if ( draft ) {
draftManager.load();
} else {
draftManager.create( 'share/' + shareId );
minder.importData( ret.result[ 0 ].obj.shareMinder.data, 'json' );
minder.importData( data.shareMinder.data, 'json' );
}
} else {
minder.importData( ret.result[ 0 ].obj.shareMinder.data, 'json' );
minder.importData( data.shareMinder.data, 'json' );
}
setRemotePath( null, false );
$share_btn.loading( false );
},
error: function ( e ) {
console.log( e );
error: function () {
notice( '请求分享文件失败,请重试!' );
}
} );
$share_btn.loading( '正在加载分享内容...' );
isShareLink = true;
}
......@@ -676,12 +677,31 @@ $( function () {
$share_btn.loading( '正在分享...' );
baidu.frontia.storage.insertData( shareData, {
success: function () {
$share_dialog.show();
$share_url.val( shareUrl )[ 0 ].select();
$.ajax({
url: 'http://naotu.baidu.com/mongo.php',
type: 'POST',
data: {
action: 'insert',
record: JSON.stringify( {
shareMinder: {
id: shareId,
data: minder.exportData( 'json' )
}
} )
},
success: function ( result ) {
if ( result.error ) {
notice( result.error );
} else {
$share_dialog.show();
$share_url.val( shareUrl )[ 0 ].select();
}
},
error: function() {
notice('分享失败,可能是当前的环境不支持该操作。');
}
} );
shareConfig.bdTitle = shareConfig.bdText = minder.getMinderTitle();
shareConfig.bdDesc = shareConfig.bdText = '“' + minder.getMinderTitle() + '” - 我用百度脑图制作的思维导图,快看看吧!(地址:' + shareUrl + ')';
shareConfig.bdUrl = shareUrl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment