site.event_handlers.js
5.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
site.event_handlers=new function(){
this.setInfoPaneToolbar=function(toolbarId){
$('#info_pane_toolbar').slideUp(100,function(){
$('#info_pane_toolbar').html($('#'+toolbarId).html()).slideDown(100);
$('.fg-button',$('#info_pane_toolbar')).each(function(){
$(this).mouseover(function(){
$(this).addClass('ui-state-hover');
});
$(this).mouseout(function(){
$(this).removeClass('ui-state-hover');
});
});
});
}
this.folder_panel_info_show=function(id){
if(id!=undefined)if(isNaN(id))id=undefined;
id=lib.def(id,site.currentFolder);
if(id!=undefined){
site.currentFolder=id;
var url=site.cfg('baseurl')+site.cfg('service.folderInfo')+id;
if(lib.resources.resourceLoaded(url)){
var data=lib.resources.getResourceFromUrl(url);
events.trigger('panel.clear');
site.event_handlers.setInfoPaneToolbar('info_panel_toolbar_viewFolder');
ktApp.folder.parseXML($(data.data).find('entry')[0]);
ktApp.folder.renderContainer();
$('#panel_folder_info').fadeIn(100);
}else{
lib.resources.getUrl(url,site.event_handlers.folder_panel_info_show);
}
}
}
this.folder_panel_edit_show=function(id){
if(id!=undefined)if(isNaN(id))id=undefined;
id=lib.def(id,site.currentFolder);
if(id!=undefined){
site.currentFolder=id;
var url=site.cfg('baseurl')+site.cfg('service.folderInfo')+id;
if(lib.resources.resourceLoaded(url)){
var data=lib.resources.getResourceFromUrl(url);
events.trigger('panel.clear');
site.event_handlers.setInfoPaneToolbar('info_panel_toolbar_editFolder');
ktApp.folder.parseXML($(data.data).find('entry')[0]);
ktApp.folder.renderContainer();
$('#panel_folder_edit').fadeIn(100);
}else{
lib.resources.getUrl(url,site.event_handlers.folder_panel_info_show);
}
}
}
this.document_panel_info_show=function(id){
if(id!=undefined)if(isNaN(id))id=undefined;
id=lib.def(id,site.currentDocument);
if(id!=undefined){
site.currentDocument=id;
var url=site.cfg('baseurl')+site.cfg('service.docInfo')+id;
if(lib.resources.resourceLoaded(url)){
var data=lib.resources.getResourceFromUrl(url);
events.trigger('panel.clear');
site.event_handlers.setInfoPaneToolbar('info_panel_toolbar_viewDocument');
ktApp.document.parseXML($(data.data).find('entry')[0]);
ktApp.document.renderContainer();
$('#panel_document_info').fadeIn(100);
}else{
lib.resources.getUrl(url,site.event_handlers.document_panel_info_show);
}
}
}
this.document_panel_edit_show=function(id){
if(id!=undefined)if(isNaN(id))id=undefined;
id=lib.def(id,site.currentDocument);
if(id!=undefined){
site.currentDocument=id;
var url=site.cfg('baseurl')+site.cfg('service.docInfo')+id;
if(lib.resources.resourceLoaded(url)){
var data=lib.resources.getResourceFromUrl(url);
events.trigger('panel.clear');
site.event_handlers.setInfoPaneToolbar('info_panel_toolbar_editDocument');
ktApp.document.parseXML($(data.data).find('entry')[0]);
ktApp.document.renderContainer();
$('#panel_document_info_edit').fadeIn(100);
}else{
lib.resources.getUrl(url,site.event_handlers.document_panel_edit_show);
}
}
}
this.folder_action_save=function(){
site.showDialog('Feature Not Yet Supported','In the future, folder meta info can be <b>saved</b> back to the system by clicking here.' +
'<p />The site will then generate an atompub formatted PUT request, and clear it\'s own cache before reloading the folder' +
' information and switching to the folder info view panel.');
}
this.folder_action_move=function(){
site.showDialog('Feature Not Yet Supported','In the future, a folder can be <b>moved</b> by clicking here.');
}
this.document_action_save=function(){
site.showDialog('Feature Not Yet Supported','In the future, document meta info can be <b>saved</b> back to the system by clicking here.' +
'<p />The site will then generate an atompub formatted PUT request, and clear it\'s own cache before reloading the document' +
' information and switching to the document info view panel.');
}
this.document_action_checkout=function(){
site.showDialog('Feature Not Yet Supported','In the future the document can be <b>checked out</b> here.');
}
this.document_action_download=function(){
//site.showDialog('Feature Not Yet Supported','In the future the document can be <b>downloaded</b> here.');
if(site.currentDocument!=undefined){
var url=unescape(ktApp.document.data.document_download_url);
window.document.location.replace(url);
}
}
this.document_action_delete=function(){
site.showDialog('Feature Not Yet Supported','In the future, a document can be <b>deleted</b> clicking here.' +
'<p />The site will then generate an atompub formatted DELETE request, and clear it\'s own cache and the document tree cache before ' +
'switching to an empty panel.');
}
this.discovery=function(url){
var sdoc=url+'servicedocument';
if(typeof(url)!='string')sdoc=site.cfg('service');
site.cfg('service',sdoc);
if(lib.resources.resourceLoaded(sdoc)){
var data=lib.resources.getResourceFromUrl(sdoc);
ktApp.serviceDoc.parseXML($(data.data).find('service')[0],'DMS');
}else{
lib.resources.getUrl(sdoc,site.event_handlers.discovery);
}
}
}