ultimix
double_panel.js
Go to the documentation of this file.
1 
6 if( !ultimix )
7 {
8  ultimix = {};
9 }
10 
16 if( !ultimix.double_panel )
17 {
18  ultimix.double_panel = {};
19 }
20 
24 function FirstToSecond( FirstPanel , SecondPanel , EntityName )
25 {
26  if( EntityName != '' )
27  {
28  document.getElementById( FirstPanel ).removeChild( document.getElementById( EntityName + '_hidden_id' ) );
29  document.getElementById( FirstPanel ).removeChild( document.getElementById( EntityName + '_div_id_first' ) );
30  document.getElementById( SecondPanel ).innerHTML += "<div onclick=\"javascript:SecondToFirst( '" + FirstPanel +
31  "' , '" + SecondPanel + "' , '" + EntityName + "' );\" class='double_panel_row no_selection_text' id='" +
32  EntityName + "_div_id_second'>" + EntityName + "</div>";
33 
34  jQuery( '.no_selection_text' ).disableTextSelect();
35  }
36 }
37 
41 function SecondToFirst( FirstPanel , SecondPanel , EntityName )
42 {
43  if( EntityName != '' )
44  {
45  document.getElementById( FirstPanel ).innerHTML += "<input type='hidden' name='entities[]' id='" +
46  EntityName + "_hidden_id' value='" + EntityName + "'>";
47  document.getElementById( SecondPanel ).removeChild( document.getElementById( EntityName + '_div_id_second' ) );
48  document.getElementById( FirstPanel ).innerHTML += "<div onclick=\"javascript:FirstToSecond( '" + FirstPanel +
49  "' , '" + SecondPanel + "' , '" + EntityName + "' );\" class='double_panel_row no_selection_text' id='" +
50  EntityName + "_div_id_first'>" + EntityName + "</div>";
51 
52  jQuery( '.no_selection_text' ).disableTextSelect();
53  }
54 }
55 
59 ultimix.double_panel.init_first_panel = function( FirstPanel , SecondPanel , FirstPanelEntities )
60 {
61  if( FirstPanelEntities != '' )
62  {
63  FirstPanelEntities = FirstPanelEntities.split( ',' );
64 
65  for( i = 0 ; i < FirstPanelEntities.length ; i++ )
66  {
67  document.getElementById( FirstPanel ).innerHTML += "<div onclick=\"javascript:FirstToSecond( '" +
68  FirstPanel + "' , '" + SecondPanel + "' , '" + FirstPanelEntities[ i ] +
69  "' );\" class='double_panel_row no_selection_text' id='" + FirstPanelEntities[ i ] +
70  "_div_id_first'>" + FirstPanelEntities[ i ] + "</div>";
71  document.getElementById( FirstPanel ).innerHTML += "<input type='hidden' name='entities[]' id='" +
72  FirstPanelEntities[ i ] + "_hidden_id' value='" + FirstPanelEntities[ i ] + "'>";
73  }
74  }
75  else
76  {
77  FirstPanelEntities = new Array;
78  }
79 
80  return( FirstPanelEntities );
81 }
82 
86 ultimix.double_panel.init_second_panel = function( FirstPanel , SecondPanel , FirstPanelEntities , SecondPanelEntities )
87 {
88  if( SecondPanelEntities != '' )
89  {
90  SecondPanelEntities = SecondPanelEntities.split( ',' );
91 
92  for( i = 0 ; i < SecondPanelEntities.length ; i++ )
93  {
94  if( in_array( SecondPanelEntities[ i ] , FirstPanelEntities ) == false )
95  {
96  document.getElementById( SecondPanel ).innerHTML += "<div onclick=\"javascript:SecondToFirst( '" +
97  FirstPanel + "' , '" + SecondPanel + "' , '" + SecondPanelEntities[ i ] +
98  "' );\" class='double_panel_row no_selection_text' id='" + SecondPanelEntities[ i ] +
99  "_div_id_second'>" + SecondPanelEntities[ i ] + "</div>";
100  }
101  }
102  }
103 }
104 
108 function InitPanels( FirstPanel , SecondPanel , FirstPanelEntities , SecondPanelEntities )
109 {
110  FirstPanelEntities = ultimix.double_panel.init_first_panel( FirstPanel , SecondPanel , FirstPanelEntities );
111 
112  ultimix.double_panel.init_second_panel( FirstPanel , SecondPanel , FirstPanelEntities , SecondPanelEntities );
113 
114  jQuery( function()
115  {
116  jQuery( '.no_selection_text' ).disableTextSelect();
117  }
118  );
119 }