File size: 5,741 Bytes
0004cda
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
var messageFilterTimer;

var lastFilterText;

var lastFormatBtn = null;

var lastFormat = null;



function downloadTemplate(id)

{

    window.location = "/download.template?Id=" + id;

}





function downloadMessage(eid)

{

    window.location = "/download.message?eid=" + eid;

}





function setListFormat(format)

{

    var x = document.getElementsByName("format");

    if (x.length == 0)

    {

        return;

    }



    var elem;

    if (format != null && lastFormat != null && format != lastFormat)

    {

        elem = document.getElementById("tabIcon" + lastFormat);

        changeTabCellClass(elem, "tabIconOn", "tabIconOff");

        elem = document.getElementById("tabCaption" + lastFormat);

        changeTabCellClass(elem, "tabCaptionOn", "tabCaptionOff");

    }

    if (format != null && format != lastFormat)

    {

        elem = document.getElementById("tabIcon" + format);

        changeTabCellClass(elem, "tabIconOff", "tabIconOn");

        elem = document.getElementById("tabCaption" + format);

        changeTabCellClass(elem, "tabCaptionOff", "tabCaptionOn");

        lastFormat = format;

    }



    x[0].value = format;

    loadMessageListRecords();

}



function changeTabCellClass(element, oldClass, newClass)

{

    if (hasStyleClass(element, oldClass))

    {

        delStyleClass(element, oldClass);

    }

    if (! hasStyleClass(element, newClass))

    {

        addStyleClass(element, newClass);

    }

}





function loadMainContainer(uri)

{

    var container = getContainer("mainContainer");

    loadContainer(uri, container, onLoadContainer);

}



function onKeyupMessageFilter(textField)

{

    if (textField.value == lastFilterText)

    {

        return;

    }



    lastFilterText = textField.value;



    if (messageFilterTimer != null)

    {

        clearTimeout(messageFilterTimer);

    }



    messageFilterTimer = setTimeout("gotoPage(1)", 500);

}





function clearMessageFilter(textField)

{

    if (textField.value == "")

    {

        return;

    }



    textField.value = lastFilterText = "";



    if (messageFilterTimer != null)

    {

        clearTimeout(messageFilterTimer);

    }



    textField.focus();

    gotoPage(1);

}





function onSortMessages(columnIndex)

{

    var field = document.getElementsByName("sortColumn")[0];

    var oldIndex = field.value;

    field.value = columnIndex;



    field = document.getElementsByName("sortDirection")[0];

    if (oldIndex != columnIndex)

    {

        field.value = 1;

    }

    else

    {

        field.value = (field.value < 0) ? 1 : -1;

    }



    gotoPage(1);

}





function gotoPage(pageNumber)

{

    var field = document.getElementsByName("page")[0];

    field.value = pageNumber;



    loadMessageListRecords(true);

}





function selectTranslation(tableRow, id, languageId)

{

    var format = document.getElementsByName("format")[0].value;

    selectRecord(tableRow, id);

    loadArtifacts(id, languageId, format);

}



function clickLanguageButton(languageCode)

{

    window.location = languageCode + getShowEnglishQuery(true);

}



function loadMessageList(languageId)

{

    var container = document.getElementById("mainContainer");

    loadContainer("/translated_messages.do?languageId=" + languageId + getShowEnglishQuery(false), container, onLoadContainer, false);

}



function loadMessageListContent(languageId)

{

    var container = document.getElementById("leftContent");

    loadContainer("/message_list.do?languageId=" + languageId + getShowEnglishQuery(false), container, onLoadContainer, true);

}



function loadMessageListRecords()

{

    var form = document.getElementById("messageListForm");

    var container = document.getElementById("messageListRecords");

    var field = document.getElementsByName("show_en")[0];

    field.value = getShowEnglishValue();



    submitForm(form, container, onLoadContainer, true)

}



function loadArtifacts(tmId, languageId, format)

{

    var container = document.getElementById("messageRecordDetails");

    loadContainer("message_artifacts.do?tmId=" + tmId + "&languageId=" + languageId + "&format=" + format + getShowEnglishQuery(false), container, null, true);

}



// function playWmbMp3(eid)

// {

//     var url = "/play_message.do?eid=" + eid;

//     openPopup(url, "playMessage", 500, 250)

// }



// function loadMessagePlayer(file, id, autostart)

// {

//     var so1 = new SWFObject("/include/mediaplayer.swf", "flvplayer", "450", "100", "9", "#ffffff");

//     so1.addParam('allowscriptaccess', 'always');

//     so1.addParam("wmode", "opaque");

//     so1.addVariable("height", "100");

//     so1.addVariable("width", "450");

//     so1.addVariable("volume", "100");

//     so1.addVariable("backcolor", "0x000000");

//     so1.addVariable("frontcolor", "0xCCCCCC");

//     so1.addVariable("lightcolor", "0x990000");

//     so1.addVariable("screencolor", "000000");

//     so1.addVariable("bufferlength", "5");

//     so1.addVariable("autostart", autostart == null ? "false" : autostart);

//     so1.addVariable("file", file);

//     so1.addVariable("id", id);

//     so1.write("messagePlayer");

// }





function getShowEnglishQuery(isFirstParam)

{

    var value = getShowEnglishValue();

    if (value == "")

    {

        return "";

    }

    return (isFirstParam ? "?" : "&") + "show_en=" + value;

}





function getShowEnglishValue()

{

    var qs = new Querystring();

    return qs.get("show_en", "");

}