Projekt

Allgemein

Profil

GX-Bug #52480 » GMGPrintSurfacesManager.js

Till Tepelmann, 30.07.2017 22:02

 
1
/* GMGPrintSurfacesManager.js <?php
2
#   --------------------------------------------------------------
3
#   GMGPrintSurfacesManager.js 2017-07-25 gambio
4
#   Gambio GmbH
5
#   http://www.gambio.de
6
#   Copyright (c) 2017 Gambio GmbH
7
#   Released under the GNU General Public License (Version 2)
8
#   [http://www.gnu.org/licenses/gpl-2.0.html]
9
#   --------------------------------------------------------------
10
?>*/
11
/*<?php
12
if($GLOBALS['coo_debugger']->is_enabled('uncompressed_js') == false)
13
{
14
?>*/
15
function GMGPrintSurfacesManager(e,t){this.v_surfaces=new Object,this.v_name="",this.v_current_surfaces_id=0,this.v_surfaces_groups_id=e,this.v_coo_gprint_configuration=t,this.page_token=$('input[name="page_token"]').val();var _='<?php if(defined("GM_GPRINT_ADMIN")){ ?>';this.create_surface=function(e,t,_){var s="";for(t_languages_id in e)""!=s&&(s+="&"),s+="names["+encodeURIComponent(t_languages_id)+"]="+encodeURIComponent(e[t_languages_id]);var i=gm_gprint_clear_number(this.get_surfaces_groups_id()),r=gm_gprint_clear_number(t),a=gm_gprint_clear_number(_),n=jQuery.ajax({data:"action=create_surface&surfaces_groups_id="+i+"&"+s+"&width="+r+"&height="+a+"&mode="+c_mode+"&page_token="+this.page_token+"&XTCsid="+gm_session_id,url:"request_port.php?module=GPrint",type:"POST",async:!1}).responseText;this.load_surface(e,t,_,n)},_="<?php } ?>",this.load_surface=function(e,t,_,s){var i=new GMGPrintSurfaces(s,this);this.v_surfaces[s]=i,this.v_surfaces[s].set_width(t),this.v_surfaces[s].set_height(_),this.v_surfaces[s].set_names(e),this.set_current_surfaces_id(s)},this.load_surfaces_group=function(e,t){var _,s,i,r;r="undefined"!=typeof t?encodeURIComponent(t):"";var a=gm_gprint_clear_number(e);if(jQuery.ajax({data:"action=load_surfaces_group&surfaces_groups_id="+a+"&mode="+c_mode+"&page_token="+this.page_token+"&product="+r+"&XTCsid="+gm_session_id,url:"request_port.php?module=GPrint",dataType:"json",type:"POST",async:!1,success:function(e){_=e}}),"0"!=_.v_current_surfaces_id){this.reset_display();for(var n in _.v_surfaces)null==i&&(i=n),this.load_surface(_.v_surfaces[n].v_names,_.v_surfaces[n].v_width,_.v_surfaces[n].v_height,n),this.display_surface(n,this.get_coo_gprint_configuration()),s=_.v_surfaces[n].v_elements,this.v_surfaces[n].load_elements(s);this.set_name(_.v_name),this.display_name(this.get_name()),this.set_current_surfaces_id(i),this.update_current_surfaces_id(i),this.display_surface(i,this.get_coo_gprint_configuration()),this.activate_tabs()}else this.set_name(_.v_name),this.display_name(this.get_name());$(".gm_gprint_field").keyup(function(){var e=$(this).val(),t='<?php echo gm_get_conf("GM_GPRINT_EXCLUDE_SPACES"); ?>',s=gm_gprint_clear_number($(this).attr("id"));"1"==t&&(e=e.replace(/\s+/g,"")),e=e.replace(/\n+/g,""),e=e.replace(/\t+/g,""),e=e.replace(/\r+/g,""),e=e.replace(/\v+/g,"");var i=e.length,r=0,a=0;for(r in _.v_surfaces)if("object"==typeof _.v_surfaces[r].v_elements[s]&&(a=Number(_.v_surfaces[r].v_elements[s].v_max_characters),a>0&&i>a)){var n=i-a,c=$(this).val(),o=c.substr(0,c.length-n);"1"==t&&(o=o.replace(/^\s+/,"").replace(/\s+$/,"")),$(this).val(o),alert("<?php echo GM_GPRINT_MAX_CHARACTERS_PREFIX; ?>"+a+"<?php echo GM_GPRINT_MAX_CHARACTERS_SUFFIX; ?>")}}),this.show()},this.activate_tabs=function(){var e=this,t=this.get_coo_gprint_configuration();$(".gm_gprint_tab, .gm_gprint_tab_active").click(function(){var _=$(this).attr("id");_=_.replace(/gm_gprint_tab_/g,""),c_clicked_surfaces_id=gm_gprint_clear_number(_),e.set_current_surfaces_id(c_clicked_surfaces_id),e.update_current_surfaces_id(c_clicked_surfaces_id),e.display_surface(e.get_current_surfaces_id(),t)}),_='<?php if(defined("GM_GPRINT_ADMIN")){ ?>',$(".gm_gprint_surface").dblclick(function(){0==t_hover_element&&($(".gm_gprint_flyover").show(),$("#create_surface_div").hide(),$("#create_element_div").hide(),$("#edit_surface_div").show(),$("#edit_element_div").hide())}),_="<?php } ?>"},this.display_surface=function(e){"show_create_element_flyover"==$("#show_create_element_flyover").attr("id")&&($("#show_create_element_flyover").show(),$("#show_edit_surface_flyover").show()),$("#gm_gprint_content .gm_gprint_surface").each(function(){$(this).hide()}),$(".gm_gprint_tab_active").each(function(){$(this).removeClass("gm_gprint_tab_active"),$(this).addClass("gm_gprint_tab")}),$("#tab_"+e).attr("id")!="tab_"+e?($("#gm_gprint_tabs").append('<li class="gm_gprint_tab_active" id="tab_'+this.v_surfaces[e].get_surfaces_id()+'"><span>'+this.v_surfaces[e].get_name(this.v_coo_gprint_configuration.get_languages_id())+"</span></li>"),_='<?php if(defined("GM_GPRINT_ADMIN") || gm_get_conf("GM_GPRINT_AUTO_WIDTH") == 0){ ?>',$("#gm_gprint_content").append('<div class="gm_gprint_surface" id="surface_'+this.v_surfaces[e].get_surfaces_id()+'" style="overflow: hidden; position: relative; width: '+this.v_surfaces[e].get_width()+"px; height: "+this.v_surfaces[e].get_height()+'px;"></div>'),_="<?php }else{ ?>",$("#gm_gprint_content").append('<div class="gm_gprint_surface" id="surface_'+this.v_surfaces[e].get_surfaces_id()+'" style="overflow: hidden; position: relative; height: '+this.v_surfaces[e].get_height()+'px;"></div>'),_="<?php } ?>"):($("#tab_"+e).removeClass("gm_gprint_tab"),$("#tab_"+e).addClass("gm_gprint_tab_active"),$("#tab_"+e+" span").html(this.v_surfaces[e].get_name(this.v_coo_gprint_configuration.get_languages_id())),$("#surface_"+e).show()),this.v_surfaces[e].update_form(),$("#gm_gprint_tabs .gm_gprint_tab").mouseover(function(){$(this).css({"text-decoration":"underline"})}),$("#gm_gprint_tabs .gm_gprint_tab_active").mouseover(function(){$(this).css({"text-decoration":"none"})}),$("#gm_gprint_tabs .gm_gprint_tab").mouseout(function(){$(this).css({"text-decoration":"none"})})},this.reset_display=function(){$("#gm_gprint_tabs").html(""),$("#gm_gprint_content").html("")},this.show=function(){_='<?php if(defined("GM_GPRINT_ADMIN") || gm_get_conf("GM_GPRINT_SHOW_TABS") == "1"){ ?>',$("#gm_gprint_tabs").show(),_="<?php } ?>",$("#gm_gprint_content").show(),window.jse&&window.location.pathname.indexOf("gm_gprint.php")<=5&&$(window).trigger(jse.libs.template.events.STICKYBOX_CONTENT_CHANGE())},_='<?php if(defined("GM_GPRINT_ADMIN")){ ?>',this.delete_surface=function(e){var t=gm_gprint_clear_number(e),_=jQuery.ajax({data:"action=delete_surface&surfaces_id="+t+"&mode="+c_mode+"&page_token="+this.page_token+"&XTCsid="+gm_session_id,url:"request_port.php?module=GPrint",type:"POST",async:!1}).responseText;if("true"==_){delete this.v_surfaces[e],$("#tab_"+e).remove(),$("#surface_"+e).remove();var s=0;for(s in this.v_surfaces)this.set_current_surfaces_id(s);s>0?this.display_surface(s):"show_edit_surface_flyover"==$("#show_edit_surface_flyover").attr("id")&&($("#show_edit_surface_flyover").hide(),$("#show_create_element_flyover").hide())}},_="<?php } ?>",this.update_current_surfaces_id=function(e){_='<?php if(defined("GM_GPRINT_ADMIN")){ ?>';var t=gm_gprint_clear_number(e);jQuery.ajax({data:"action=set_current_surfaces_id&surfaces_id="+t+"&mode="+c_mode+"&page_token="+this.page_token+"&XTCsid="+gm_session_id,url:"request_port.php?module=GPrint",type:"POST",async:!1}).json;_="<?php } ?>"},_='<?php if(defined("GM_GPRINT_ADMIN")){ ?>',this.update_name=function(e){var t=encodeURIComponent(e),_=!1,s=gm_gprint_clear_number(this.get_surfaces_groups_id());jQuery.ajax({data:"action=update_surfaces_group&surfaces_groups_id="+s+"&name="+t+"&mode="+c_mode+"&page_token="+this.page_token+"&XTCsid="+gm_session_id,url:"request_port.php?module=GPrint",dataType:"json",type:"POST",async:!1,success:function(e){_=e}}),1==_&&this.set_name(e)},_="<?php }	?>",this.display_name=function(){$("#surfaces_group_name").val(this.get_name()),$("#surfaces_group_name_title").html(this.get_name())},this.set_name=function(e){this.v_name=gm_unescape(e)},this.get_name=function(){return this.v_name},this.set_current_surfaces_id=function(e){this.v_current_surfaces_id=e},this.get_current_surfaces_id=function(){return this.v_current_surfaces_id},this.set_surfaces_groups_id=function(e){this.v_surfaces_groups_id=v_surfaces_groups_id},this.get_surfaces_groups_id=function(){return this.v_surfaces_groups_id},this.get_coo_gprint_configuration=function(){return this.v_coo_gprint_configuration}}
16
/*<?php
17
}
18
else
19
{
20
?>*/
21
function GMGPrintSurfacesManager(p_surfaces_groups_id, p_coo_gprint_configuration)
22
{
23
    this.v_surfaces = new Object();
24
    this.v_name = '';
25
    this.v_current_surfaces_id = 0;
26
    this.v_surfaces_groups_id = p_surfaces_groups_id;
27
    this.v_coo_gprint_configuration = p_coo_gprint_configuration;
28
    this.page_token = $('input[name="page_token"]').val();
29

    
30
    var t_php_helper = '<?php if(defined("GM_GPRINT_ADMIN")){ ?>';
31

    
32
    this.create_surface = function(p_names, p_width, p_height)
33
	{
34
        var t_surfaces_names = '';
35

    
36
		for(t_languages_id in p_names)
37
		{
38
			if(t_surfaces_names != '')
39
			{
40
                t_surfaces_names += '&';
41
            }
42
            t_surfaces_names += 'names[' + encodeURIComponent(t_languages_id) + ']=' + encodeURIComponent(p_names[t_languages_id]);
43
		}
44

    
45
		var c_surfaces_groups_id = gm_gprint_clear_number(this.get_surfaces_groups_id());
46
		var c_width = gm_gprint_clear_number(p_width);
47
		var c_height = gm_gprint_clear_number(p_height);
48

    
49
        var t_surfaces_id = jQuery.ajax({
50
            data: 'action=create_surface&surfaces_groups_id=' + c_surfaces_groups_id + '&' + t_surfaces_names + '&width=' + c_width + '&height=' + c_height + '&mode=' + c_mode + '&page_token=' + this.page_token + '&XTCsid=' + gm_session_id,
51
            url: 'request_port.php?module=GPrint',
52
            type: "POST",
53
            async: false
54
        }).responseText;
55

    
56
        this.load_surface(p_names, p_width, p_height, t_surfaces_id)
57
    }
58

    
59
	t_php_helper = '<?php } ?>';
60

    
61
	this.load_surface = function(p_names, p_width, p_height, p_surfaces_id)
62
	{
63
		var coo_surface = new GMGPrintSurfaces(p_surfaces_id, this);
64

    
65
        this.v_surfaces[p_surfaces_id] = coo_surface;
66
        this.v_surfaces[p_surfaces_id].set_width(p_width);
67
        this.v_surfaces[p_surfaces_id].set_height(p_height);
68
        this.v_surfaces[p_surfaces_id].set_names(p_names);
69

    
70
        this.set_current_surfaces_id(p_surfaces_id);
71
	}
72

    
73
    this.load_surfaces_group = function(p_surfaces_groups_id, p_product)
74
	{
75
        var coo_surfaces_group;
76
		var coo_elements;
77
		var t_first_surfaces_id;
78
		var c_product;
79

    
80
		if(typeof(p_product) != 'undefined')
81
		{
82
			c_product = encodeURIComponent(p_product);
83
		}
84
		else
85
		{
86
			c_product = '';
87
		}
88

    
89
		var c_surfaces_groups_id = gm_gprint_clear_number(p_surfaces_groups_id);
90

    
91
		jQuery.ajax({
92
            data: 'action=load_surfaces_group&surfaces_groups_id=' + c_surfaces_groups_id + '&mode=' + c_mode + '&page_token=' + this.page_token + '&product=' + c_product + '&XTCsid=' + gm_session_id,
93
            url: 'request_port.php?module=GPrint',
94
            dataType: 'json',
95
            type: "POST",
96
            async: false,
97
            success: function(p_surfaces_group)
98
			{
99
				coo_surfaces_group = p_surfaces_group;
100
			}
101
        });
102

    
103
		if(coo_surfaces_group.v_current_surfaces_id != '0')
104
		{
105
			this.reset_display();
106

    
107
			for(var t_surfaces_id in coo_surfaces_group.v_surfaces)
108
			{
109
				if(t_first_surfaces_id == null)
110
				{
111
					t_first_surfaces_id = t_surfaces_id;
112
				}
113

    
114
				this.load_surface(coo_surfaces_group.v_surfaces[t_surfaces_id].v_names, coo_surfaces_group.v_surfaces[t_surfaces_id].v_width, coo_surfaces_group.v_surfaces[t_surfaces_id].v_height, t_surfaces_id);
115
				this.display_surface(t_surfaces_id, this.get_coo_gprint_configuration());
116

    
117
				coo_elements = coo_surfaces_group.v_surfaces[t_surfaces_id].v_elements;
118
				this.v_surfaces[t_surfaces_id].load_elements(coo_elements);
119
			}
120

    
121
			this.set_name(coo_surfaces_group.v_name);
122
			this.display_name(this.get_name());
123
			this.set_current_surfaces_id(t_first_surfaces_id);
124
			this.update_current_surfaces_id(t_first_surfaces_id);
125
			this.display_surface(t_first_surfaces_id, this.get_coo_gprint_configuration());
126

    
127
			this.activate_tabs();
128
		}
129
		else
130
		{
131
			this.set_name(coo_surfaces_group.v_name);
132
			this.display_name(this.get_name());
133
		}
134

    
135
		$('.gm_gprint_field').keyup(function()
136
		{
137
			var t_input_text = $(this).val();
138
			var t_exclude_spaces = '<?php echo gm_get_conf("GM_GPRINT_EXCLUDE_SPACES"); ?>';
139
			var t_elements_id = gm_gprint_clear_number($(this).attr('id'));
140

    
141
			if(t_exclude_spaces == '1')
142
			{
143
				t_input_text = t_input_text.replace(/\s+/g, '');
144
			}
145

    
146
			t_input_text = t_input_text.replace(/\n+/g, '');
147
			t_input_text = t_input_text.replace(/\t+/g, '');
148
			t_input_text = t_input_text.replace(/\r+/g, '');
149
			t_input_text = t_input_text.replace(/\v+/g, '');
150

    
151
			var t_input_length = t_input_text.length;
152
			var t_surfaces_id = 0;
153
			var t_max_characters = 0;
154

    
155
			for(t_surfaces_id in coo_surfaces_group.v_surfaces)
156
			{
157
				if(typeof(coo_surfaces_group.v_surfaces[t_surfaces_id].v_elements[t_elements_id]) == 'object')
158
				{
159
					t_max_characters = Number(coo_surfaces_group.v_surfaces[t_surfaces_id].v_elements[t_elements_id].v_max_characters);
160

    
161
					if(t_max_characters > 0 && t_input_length > t_max_characters)
162
					{
163
						var t_character_count = t_input_length - t_max_characters;
164
						var t_original_input_text = $(this).val();
165
						var t_new_input_text = t_original_input_text.substr(0, t_original_input_text.length - t_character_count);
166
						if(t_exclude_spaces == '1')
167
						{
168
							t_new_input_text = t_new_input_text.replace(/^\s+/, '').replace(/\s+$/, '');
169
						}
170

    
171
						$(this).val(t_new_input_text);
172

    
173
						alert('<?php echo GM_GPRINT_MAX_CHARACTERS_PREFIX; ?>' + t_max_characters + '<?php echo GM_GPRINT_MAX_CHARACTERS_SUFFIX; ?>');
174
					}
175
				}
176
			}
177
		});
178

    
179
		this.show();
180
    }
181

    
182
	this.activate_tabs = function()
183
	{
184

    
185
		var coo_surfaces_manager_copy = this;
186
		var coo_configuration_copy = this.get_coo_gprint_configuration();
187

    
188
		$('.gm_gprint_tab, .gm_gprint_tab_active').click(function()
189
		{
190
            var f_clicked_surfaces_id = $(this).attr('id');
191
            f_clicked_surfaces_id = f_clicked_surfaces_id.replace(/gm_gprint_tab_/g, '');
192

    
193
            c_clicked_surfaces_id = gm_gprint_clear_number(f_clicked_surfaces_id);
194

    
195
            coo_surfaces_manager_copy.set_current_surfaces_id(c_clicked_surfaces_id);
196
            coo_surfaces_manager_copy.update_current_surfaces_id(c_clicked_surfaces_id);
197
            coo_surfaces_manager_copy.display_surface(coo_surfaces_manager_copy.get_current_surfaces_id(), coo_configuration_copy);
198
        });
199

    
200
		t_php_helper = '<?php if(defined("GM_GPRINT_ADMIN")){ ?>';
201

    
202
		$('.gm_gprint_surface').dblclick(function()
203
		{
204
			if(t_hover_element == false)
205
			{
206
				$('.gm_gprint_flyover').show();
207
				$('#create_surface_div').hide();
208
				$('#create_element_div').hide();
209
				$('#edit_surface_div').show();
210
				$('#edit_element_div').hide();
211
			}
212
		});
213
		t_php_helper = '<?php } ?>';
214
    }
215

    
216
    this.display_surface = function(p_surfaces_id)
217
	{
218
    	if($('#show_create_element_flyover').attr('id') == 'show_create_element_flyover')
219
    	{
220
    		$('#show_create_element_flyover').show();
221
    		$('#show_edit_surface_flyover').show();
222
    	}
223

    
224
    	$('#gm_gprint_content .gm_gprint_surface').each(function()
225
		{
226
            $(this).hide();
227
        });
228

    
229
        $('.gm_gprint_tab_active').each(function()
230
        		{
231
                    $(this).removeClass('gm_gprint_tab_active');
232
                    $(this).addClass('gm_gprint_tab');
233
                });
234

    
235

    
236

    
237
        if($('#tab_' + p_surfaces_id).attr('id') != 'tab_' + p_surfaces_id)
238
		{
239
            $('#gm_gprint_tabs').append('<li class="gm_gprint_tab_active" id="tab_' + this.v_surfaces[p_surfaces_id].get_surfaces_id() + '"><span>' + this.v_surfaces[p_surfaces_id].get_name(this.v_coo_gprint_configuration.get_languages_id()) + '</span></li>');
240
            t_php_helper = '<?php if(defined("GM_GPRINT_ADMIN") || gm_get_conf("GM_GPRINT_AUTO_WIDTH") == 0){ ?>';
241
            $('#gm_gprint_content').append('<div class="gm_gprint_surface" id="surface_' + this.v_surfaces[p_surfaces_id].get_surfaces_id() + '" style="overflow: hidden; position: relative; width: ' + this.v_surfaces[p_surfaces_id].get_width() + 'px; height: ' + this.v_surfaces[p_surfaces_id].get_height() + 'px;"></div>');
242
            t_php_helper = '<?php }else{ ?>';
243
            $('#gm_gprint_content').append('<div class="gm_gprint_surface" id="surface_' + this.v_surfaces[p_surfaces_id].get_surfaces_id() + '" style="overflow: hidden; position: relative; height: ' + this.v_surfaces[p_surfaces_id].get_height() + 'px;"></div>');
244
            t_php_helper = '<?php } ?>';
245
        }
246
        else
247
		{
248
            $('#tab_' + p_surfaces_id).removeClass('gm_gprint_tab');
249
			$('#tab_' + p_surfaces_id).addClass('gm_gprint_tab_active');
250
			$('#tab_' + p_surfaces_id + ' span').html(this.v_surfaces[p_surfaces_id].get_name(this.v_coo_gprint_configuration.get_languages_id()));
251
			$('#surface_' + p_surfaces_id).show();
252
        }
253

    
254
        this.v_surfaces[p_surfaces_id].update_form();
255

    
256
		$('#gm_gprint_tabs .gm_gprint_tab').mouseover(function()
257
		{
258
			$(this).css({
259
				'text-decoration': 'underline'
260
			});
261
		});
262

    
263
		$('#gm_gprint_tabs .gm_gprint_tab_active').mouseover(function()
264
		{
265
			$(this).css({
266
				'text-decoration': 'none'
267
			});
268
		});
269

    
270
		$('#gm_gprint_tabs .gm_gprint_tab').mouseout(function()
271
		{
272
			$(this).css({
273
				'text-decoration': 'none'
274
			});
275
		});
276
    }
277

    
278
	this.reset_display = function()
279
	{
280
		$('#gm_gprint_tabs').html('');
281
		$('#gm_gprint_content').html('');
282
	}
283

    
284
	this.show = function()
285
	{
286
		t_php_helper = '<?php if(defined("GM_GPRINT_ADMIN") || gm_get_conf("GM_GPRINT_SHOW_TABS") == "1"){ ?>';
287
		$('#gm_gprint_tabs').show();
288
		t_php_helper = '<?php } ?>';
289
		$('#gm_gprint_content').show();
290
		
291
		// Trigger sticky box content change only in frontend
292
		if (window.jse && window.location.pathname.indexOf('gm_gprint.php') <= 5) {
293
			$(window).trigger(jse.libs.template.events.STICKYBOX_CONTENT_CHANGE());
294
		}
295
	}
296

    
297
	t_php_helper = '<?php if(defined("GM_GPRINT_ADMIN")){ ?>';
298
    this.delete_surface = function(p_surfaces_id)
299
	{
300
    	var c_surfaces_id = gm_gprint_clear_number(p_surfaces_id);
301

    
302
    	var t_success = jQuery.ajax({
303
            data: 'action=delete_surface&surfaces_id=' + c_surfaces_id + '&mode=' + c_mode + '&page_token=' + this.page_token + '&XTCsid=' + gm_session_id,
304
            url: 'request_port.php?module=GPrint',
305
            type: "POST",
306
            async: false
307
        }).responseText;
308

    
309
        if(t_success == 'true')
310
		{
311
            delete(this.v_surfaces[p_surfaces_id]);
312
            $("#tab_" + p_surfaces_id).remove();
313
            $("#surface_" + p_surfaces_id).remove();
314

    
315
            var t_surfaces_id = 0;
316

    
317
            for(t_surfaces_id in this.v_surfaces)
318
            {
319
            	this.set_current_surfaces_id(t_surfaces_id);
320
            }
321

    
322
            if(t_surfaces_id > 0)
323
            {
324
            	this.display_surface(t_surfaces_id);
325
            }
326
            else if($('#show_edit_surface_flyover').attr('id') == 'show_edit_surface_flyover')
327
           	{
328
           		$('#show_edit_surface_flyover').hide();
329
           		$('#show_create_element_flyover').hide();
330
            }
331
        }
332
    }
333
    t_php_helper = '<?php } ?>';
334

    
335
	this.update_current_surfaces_id = function(p_surfaces_id)
336
	{
337
		t_php_helper = '<?php if(defined("GM_GPRINT_ADMIN")){ ?>';
338

    
339
		var c_surfaces_id = gm_gprint_clear_number(p_surfaces_id);
340

    
341
		var t_success = jQuery.ajax({
342
            data: 'action=set_current_surfaces_id&surfaces_id=' + c_surfaces_id + '&mode=' + c_mode + '&page_token=' + this.page_token + '&XTCsid=' + gm_session_id,
343
            url: 'request_port.php?module=GPrint',
344
            type: "POST",
345
            async: false
346
        }).json;
347
		t_php_helper = '<?php } ?>';
348
    }
349

    
350
	t_php_helper = '<?php if(defined("GM_GPRINT_ADMIN")){ ?>';
351
	this.update_name = function(p_name)
352
	{
353
		var c_name = encodeURIComponent(p_name);
354
		var t_success = false;
355
		var c_surfaces_groups_id = gm_gprint_clear_number(this.get_surfaces_groups_id());
356

    
357
		jQuery.ajax({
358
            data: 'action=update_surfaces_group&surfaces_groups_id=' + c_surfaces_groups_id + '&name=' + c_name + '&mode=' + c_mode + '&page_token=' + this.page_token + '&XTCsid=' + gm_session_id,
359
            url: 'request_port.php?module=GPrint',
360
            dataType: 'json',
361
            type: "POST",
362
            async: false,
363
            success: function(p_success)
364
			{
365
				t_success = p_success;
366
			}
367
        });
368

    
369
		if(t_success == true)
370
		{
371
			this.set_name(p_name);
372
		}
373
	}
374
	t_php_helper = '<?php }	?>';
375

    
376
	this.display_name = function()
377
	{
378
		$('#surfaces_group_name').val(this.get_name());
379
		$('#surfaces_group_name_title').html(this.get_name());
380
	}
381

    
382
	this.set_name = function(p_name)
383
	{
384
		this.v_name = gm_unescape(p_name);
385
	}
386

    
387
	this.get_name = function()
388
	{
389
		return this.v_name;
390
	}
391

    
392
    this.set_current_surfaces_id = function(p_surfaces_id)
393
	{
394
        this.v_current_surfaces_id = p_surfaces_id;
395
    }
396

    
397
    this.get_current_surfaces_id = function()
398
	{
399
        return this.v_current_surfaces_id;
400
    }
401

    
402
    this.set_surfaces_groups_id = function(p_surfaces_groups_id)
403
	{
404
        this.v_surfaces_groups_id = v_surfaces_groups_id;
405
    }
406

    
407
    this.get_surfaces_groups_id = function()
408
	{
409
        return this.v_surfaces_groups_id;
410
    }
411

    
412
    this.get_coo_gprint_configuration = function()
413
    {
414
    	return this.v_coo_gprint_configuration;
415
    }
416
}
417
/*<?php
418
}
419
?>*/
420

    
    (1-1/1)