-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.js
executable file
·72 lines (63 loc) · 3.12 KB
/
init.js
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
/*
* Copyright (c) Codiad & daeks & Coulee Techlink, distributed
* as-is and without warranty under the MIT License. See
* [root]/license.txt for more. This information must remain intact.
*/
(function(global, $){
var codiad = global.codiad,
scripts = document.getElementsByTagName('script'),
path = scripts[scripts.length-1].src.split('?')[0],
curpath = path.split('/').slice(0, -1).join('/')+'/';
$(function() {
codiad.svn.init();
});
codiad.svn = {
controller: curpath + 'controller.php',
dialog: curpath + 'dialog.php',
init: function() {
$('.project-list-title').append('<a id="project-svn" class="icon-publish icon" ></a>');
$('#project-svn').click(codiad.svn.create_project);
},
create_project: function(){
codiad.svn.pull('yes');
},
pull: function(newproject) {
var _this = this;
codiad.modal.load(550, _this.dialog + '?action=pull&newproject=' + newproject );
$('#modal-content form')
.live('submit', function(e) {
e.preventDefault();
if( $('#modal-content form input[name="svn_newproject"]').is(':checked')){
svn_newproject = true;
var path = $('#modal-content form input[name="path"]').val();
} else {
svn_newproject = false;
var path = root + '/' + $('#modal-content form input[name="path"]').val();
}
var root = codiad.project.getCurrent(),
svnRepo = $('#modal-content form input[name="svn_repo"]')
.val(),
svnBranch = $('#modal-content form input[name="svn_branch"]')
.val();
svnBranch = $('#modal-content form input[name="svn_username"]')
.val();
svnPassword = $('#modal-content form input[name="svn_password"]')
.val();
svn_projectname = $('#modal-content form input[name="svn_projectname"]').val();
$('#modal-content').html('<div id="modal-loading"></div><div align="center">Contacting SVN Server...</div><br>');
$.get(_this.controller + '?' + $.param({ 'svn_projectname': svn_projectname , 'svn_newproject': svn_newproject ,action: 'pull', path: path, 'svn_repo':svnRepo, svn_branch:svnBranch, svn_username: svnBranch,svn_password:svnPassword }) , function(data) {
createResponse = codiad.jsend.parse(data);
if (createResponse != 'error') {
codiad.message.success(createResponse.message);
codiad.filemanager.rescan(root);
} else {
codiad.message.error(createResponse.message);
}
codiad.modal.unload();
});
});
},
open: function(path) {
}
};
})(this, jQuery);