Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
103 - 1
function scriptDoLoadDialog(scriptUrl, scriptPos, scriptArgs, widthVal, heightVal) {
2
	var screenWidth, screenHeight;
3
    screenWidth = $(window).width();
4
    screenHeight = 	$(window).height();
5
 
6
    if ( screenWidth <= 769 ) {
7
    	widthVal = screenWidth * .80;
8
    	heightVal = screenHeight * .80;
9
    } else {
10
    	widthVal = widthVal ? widthVal : 900;
11
    	heightVal = heightVal ? heightVal : 600;
12
    }
13
 
14
	$('#dialogContent').dialog({
15
	    autoOpen : false,
16
	    width : widthVal,
17
	    height : heightVal,
18
	    title : 'Seo Panel',
19
	    modal : true,
20
	    close : function() {
21
	    	$("#dialogContent").html('');
22
	    	needPopup = false;
23
	    	changeDateInputField('parent_from_time', 'from_time');
24
	    	changeDateInputField('parent_to_time', 'to_time');
25
	    	$(this).dialog("destroy");
26
	    },
27
	    open : function() {
28
	    	var dataVals = {
29
	                "method" : "get",
30
	                "dataType" : "html",
31
	                "url" : scriptUrl,
32
	                "data" : scriptArgs + "&fromPopUp=1",
33
	                beforeSend: function(){
34
	                	$("#dialogContent").html('<div id="loading_content"></div>');
35
	                },
36
	                success : function(response) {
37
	        	    	needPopup = true;
38
	        	    	changeDateInputField('from_time', 'parent_from_time');
39
	        	    	changeDateInputField('to_time', 'parent_to_time');
40
	                	$("#dialogContent").html(response);
41
	                	$("#dialogContent").show();
42
	                },
43
	                error : function(xhr, status, error) {
44
	                },
45
	                complete : function() {
46
	                   $("#dialogContent").append('<div id="popup_tmp"></div>');
47
	                }
48
	            }
49
	            $.ajax(dataVals);
50
	    }
51
	});
52
	$('#dialogContent').dialog("open");
53
}
54
 
55
function popupScriptDoLoadPostDialog(scriptUrl, scriptForm, scriptPos, scriptArgs, widthVal, heightVal) {
56
	var screenWidth, screenHeight;
57
    screenWidth = $(window).width();
58
    screenHeight = 	$(window).height();
59
 
60
    if ( screenWidth <= 769 ) {
61
    	widthVal = screenWidth * .80;
62
    	heightVal = screenHeight * .80;
63
    } else {
64
    	widthVal = widthVal ? widthVal : 900;
65
    	heightVal = heightVal ? heightVal : 600;
66
    }
67
 
68
    formData = $('#'+scriptForm).serialize() + scriptArgs + "&fromPopUp=1";
69
 
70
	$('#dialogContent').dialog({
71
	    autoOpen : false,
72
	    width : widthVal,
73
	    height : heightVal,
74
	    title : 'Seo Panel',
75
	    modal : true,
76
	    close : function() {
77
	    	$("#dialogContent").html('');
78
	    	needPopup = false;
79
	    	changeDateInputField('parent_from_time', 'from_time');
80
	    	changeDateInputField('parent_to_time', 'to_time');
81
	    	$(this).dialog("destroy");
82
	    },
83
	    open : function() {
84
	    	var dataVals = {
85
	                "method" : "post",
86
	                "dataType" : "html",
87
	                "url" : scriptUrl,
88
	                "data" : formData,
89
	                beforeSend: function(){
90
	                	$("#dialogContent").html('<div id="loading_content"></div>');
91
	                },
92
	                success : function(response) {
93
	        	    	needPopup = true;
94
	        	    	changeDateInputField('from_time', 'parent_from_time');
95
	        	    	changeDateInputField('to_time', 'parent_to_time');
96
	                	$("#dialogContent").html(response);
97
	                	$("#dialogContent").show();
98
	                },
99
	                error : function(xhr, status, error) {
100
	                },
101
	                complete : function() {
102
	                   $("#dialogContent").append('<div id="popup_tmp"></div>');
103
	                }
104
	            }
105
	            $.ajax(dataVals);
106
	    }
107
	});
108
	$('#dialogContent').dialog("open");
109
}
110
 
111
function changeDateInputField(inputName, changeInputName) {
112
	if ($('input[name="'+inputName+'"]').length) {
113
		$('input[name="'+inputName+'"]').attr("name", changeInputName);
114
	}
115
}
116
 
117
function scriptDoLoadPostDialog(scriptUrl, scriptForm, scriptPos, scriptArgs, noLoading) {
118
	if(!scriptArgs) { var scriptArgs = ''; }
119
	var loadingContent = showLoadingIcon(scriptPos, noLoading);
120
	var scriptPos = (scriptPos == "content") ? "#dialogContent" : "#dialogContent #" + scriptPos;
121
	var dataVals = {
122
            "method" : "post",
123
            "dataType" : "html",
124
            "url" : scriptUrl,
125
            "data" : $('#dialogContent #'+scriptForm).serialize() + scriptArgs + "&fromPopUp=1",
126
            beforeSend: function(){
127
            	$(scriptPos).html(loadingContent);
128
            },
129
            success : function(response) {
130
    	    	needPopup = true;
131
            	$(scriptPos).html(response);
132
            	$(scriptPos).show();
133
            },
134
            error : function(xhr, status, error) {
135
            },
136
            complete : function() {
137
            }
138
        }
139
	$.ajax(dataVals);
140
}
141
 
142
function scriptDoLoadGetDialog(scriptUrl, scriptPos, scriptArgs, noLoading) {
143
	if(!scriptArgs){ var scriptArgs = ''; }
144
	var loadingContent = showLoadingIcon(scriptPos, noLoading);
145
	var scriptPos = (scriptPos == "content") ? "#dialogContent" : "#dialogContent #" + scriptPos;
146
	var dataVals = {
147
            "method" : "get",
148
            "dataType" : "html",
149
            "url" : scriptUrl,
150
            "data" : scriptArgs + "&fromPopUp=1",
151
            beforeSend: function(){
152
            	$(scriptPos).html(loadingContent);
153
            },
154
            success : function(response) {
155
    	    	needPopup = true;
156
            	$(scriptPos).html(response);
157
            	$(scriptPos).show();
158
            },
159
            error : function(xhr, status, error) {
160
            },
161
            complete : function() {
162
            }
163
        }
164
	$.ajax(dataVals);
165
}