function utipsClient() { //if not a DOM browser, hopeless this.onloadOK = false; this.ua = navigator.userAgent; this.name = navigator.appName; this.ver = navigator.appVersion; //Get data about the browser this.mac = (this.ver.indexOf('Mac') != -1); this.win = (this.ver.indexOf('Windows') != -1); //Look for Gecko this.gecko = (this.ua.indexOf('Gecko') > 1); if (this.gecko) { this.geckoVer = parseInt(this.ua.substring(this.ua.indexOf('Gecko')+6, this.ua.length)); this.onloadOK = true; } //Look for Firebird this.firebird = (this.ua.indexOf('Firebird') > 1); //Look for Safari this.safari = (this.ua.indexOf('Safari') > 1); if (this.safari) { this.onloadOK = true; this.gecko = false; } //Look for IE this.ie = (this.ua.indexOf('MSIE') > 0); if (this.ie) { this.ieVer = parseFloat(this.ua.substring(this.ua.indexOf('MSIE')+5, this.ua.length)); this.onloadOK = false; } //Look for Opera this.opera = (this.ua.indexOf('Opera') > 0); if (this.opera) { this.operaVer = parseFloat(this.ua.substring(this.ua.indexOf('Opera')+6, this.ua.length)); this.onloadOK = true; } //Special case for the horrible ie5mac this.ie5mac = (this.ie&&this.mac&&(this.ieVer<6)); } function js_display_folder() { var d; this.body_str = ""; this.load_str = ""; /*--- This hack is needed for folder display --- when the folder display frame has --- another domain displayed in it. --- It appears that only IE has this problem. --- */ try { d = parent.frames[this.ui_frame_name].document; } catch(e) { var f = parent.frames[this.ui_frame_name]; f.location.href = "cf_folder_display.cfm"; return; } var time1 = new Date(); var i; var type_id = this.type_id[this.folder_id]; var base = parent.frames[this.code_frame_name].location.toString(); base = base.substring(0, base.lastIndexOf("/")+1); this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += '' + this.folder_title + ''; this.body_str += this.style.style; this.body_str += ''; this.body_str += ""; this.body_str += ""; this.body_str += ""; this.body_str += "
"; this.js_display_folder_header(base); this.body_str += ""; for(i = 0; i < this.item_id.length; i++) { var prev_id; var next_id; if(i == 0) { prev_id = -1; } else { if(i == 1) { prev_id = -2; } else { prev_id = this.item_id[i-2]; } } if(i == (this.item_id.length - 1)) { next_id = -1; } else { next_id = this.item_id[i+1]; } this.js_display_item(this.item_id[i], i%2, base, prev_id, next_id); } this.body_str += "
"; this.body_str += "
"; if(this.debug > 0) { /* Debugging output */ var time2 = new Date(); this.body_str += "
" + (time2.getTime() - time1.getTime()) + " ms to load
"; } this.body_str += ""; this.body_str += ''; this.js_set_document(); parent.frames[this.code_frame_name].controller.test_view = "detailed"; if(this.mode != 2 && this.folder_InsertBit != 0) { var x = d.getElementById('sort_mode'); if(x) { x.value = this.folder_SortMode; } } var y = d.getElementById('view_mode'); if(y) { y.value = this.folder_ViewMode; } } function js_round_off(value, precision) { value = "" + value; //convert value to string precision = parseInt(precision); var whole = "" + Math.round(value * Math.pow(10, precision)); var decPoint = whole.length - precision; if(decPoint != 0) { result = whole.substring(0, decPoint); var frac = parseInt(whole.substring(decPoint, whole.length)); if(frac != 0) { result += "."; result += whole.substring(decPoint, whole.length); } else { result += "  "; } } else { result = whole; } return result; } function js_bytes_to_string(bytes) { var sizes = [1024*1024*1024, 1024*1024, 1024, 1]; var names = [ "gb", "mb", "kb", "  "]; var f = ""; var mnemonic = "  "; var i; for(i = 0; i < sizes.length; i++) { if(bytes >= sizes[i]) { f = bytes/sizes[i]; mnemonic = names[i]; break; } } if(i < sizes.length) { f = js_round_off(f, 1); } return f + " " + mnemonic; } function js_display_folder_header(base) { var title = this.folder_title; var owner = this.folder_owner; var desc = this.folder_Description; var w = this.style.title_width; var i; var size = 0; var size_str; var perm_str = ""; var on_upload_click_str = "parent.frames['"+this.code_frame_name+"'].menu_event('anonymous_upload');"; var anonymous_upload_str = ""; var on_view_change_str = "parent.frames['"+this.code_frame_name+"'].controller."+ 'set_view_folder(this.value);'; //code added by team vinove var on_view_change_test_str = "parent.frames['"+this.code_frame_name+"'].controller."+ 'folder_click('+this.tree_id+','+this.folder_id+');'; //end code var on_sort_change_str = "parent.frames['"+this.code_frame_name+"'].controller."+ 'set_sort_folder(this.value);'; var isRoot = parent.frames[this.code_frame_name].controller.trees[this.tree_id-1].node_is_root(this.folder_id); var sort_select = ' Sort By:'+ ' '; if((this.folder_AnonymousUpload != 0) && (this.mode == 1)) { anonymous_upload_str = ''+ '
'+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ '
  Upload File(s)
'+ '
'+ ''; } if(this.folder_ReadBit != 0) { perm_str = "View" } if(this.folder_InsertBit != 0) { perm_str = perm_str + "/Add" } if(this.folder_DeleteBit != 0) { perm_str = perm_str + "/Delete" } if(this.mode == 2 || this.folder_InsertBit == 0) { sort_select = ''; } for(i = 0; i < this.item_id.length; i++) { size += parseInt(this.FileSize[this.item_id[i]]); } size_str = js_bytes_to_string(size); this.body_str += ''+ ' '+ ' '+ ' '+ ' '+ ''+ ''+ ''+ ''+ ''+ ''+ '
'+ ''+ ' '+ ' '+ ' '+ '
'+ '   '+ ''; this.body_str += ''+title+''; if(desc) { this.body_str += '
'+desc+''; } this.body_str += '
'+ '
'+ ''+ ' '+ ' '+ ' '+ ' '+ ' '+ '
'+ ' Date' ; if((this.mode == 0) && (this.folder_IsImported != 0)) { this.body_str += '
(Owner: '+owner+'
'+perm_str+')
' ; } this.body_str += '
'+ ' '+size_str+'
'+ '
'+ ''+ ' '+ ' '; if(this.mode != 1) { if(this.folder_type_id == 5) { this.body_str += ''; } else if(!isRoot) { this.body_str += ' '; } } else { this.body_str += ' '; } this.body_str +=' '+ ' '+ '
'+ anonymous_upload_str + ' '+ ' View:'+ ' '+ ' '+ ' View:'+ ' '+ ' '+ ' '+ sort_select + '
' ; } function js_display_item(item_id, odd, base, prev_id, next_id) { var bgcolor; var w = this.style.width; var image = base + this.style.image[this.sub_type_id[item_id]]; var t_is_published = ((this.Published[item_id] == 1) && (this.mode != 1) && (this.mode != 2)); var onselect_str; var onclick_str; var checked = ""; var href; var type_id = this.type_id[item_id]; var sub_type_id = this.sub_type_id[item_id]; var action = this.style.action[sub_type_id]; var link_type = this.style.link_type[type_id]; var target = ""; var style_class = "class='normal_item'"; var title_class = "class='normal_item'"; var sort_arrows = ""; var function_str_up = "parent.frames["+'"'+this.code_frame_name+'"'+"]."+ "controller.reorder_item("+item_id+", "+prev_id+");"; var function_str_down = "parent.frames["+'"'+this.code_frame_name+'"'+"]."+ "controller.reorder_item("+item_id+", "+next_id+");"; if(t_is_published) { title_class = "class='published_item'"; } onselect_str = "parent.frames['"+this.code_frame_name+"'].controller."+ 'item_select('+this.folder_id+','+item_id+', this.checked);'; if(this.NewWindow[item_id] == 1) { target = "target='_blank'"; } else { target = "target='_self'"; } onclick_str = 'parent.frames["'+this.code_frame_name+'"].controller.'+ 'item_click('+this.tree_id+','+this.folder_id+','+item_id+');'; //onclick_str = 'alert("clicking: '+escape(onclick_str)+'");' + onclick_str + 'alert("clicked")'; if(this.selected[item_id] == 1) { checked = "checked"; } if(this.folder_SortMode == 'manual' && this.mode != 2 && this.folder_InsertBit != 0) { sort_arrows = ""; if(prev_id != -1) { sort_arrows += ""; sort_arrows += ""; sort_arrows += ""; sort_arrows += "   "; } if(next_id != -1) { sort_arrows += ""; sort_arrows += ""; sort_arrows += ""; } sort_arrows += ""; } if(odd) { bgcolor = this.style.bgcolor.odd_item; } else { bgcolor = this.style.bgcolor.even_item; } this.body_str += ""; this.body_str += ''; if(this.mode == 0) { this.body_str += ''; } this.body_str += ''; this.body_str += ""+ ""+item_id+""+""; if(t_is_published) { this.body_str += ""; } else { this.body_str += ""; } this.body_str += ""; this.body_str += ""+ this.title[item_id]+""; this.body_str += ""+this.ModDate[item_id]+""; this.body_str += ""+""+""; this.body_str += sort_arrows; this.body_str += ""+js_bytes_to_string(this.FileSize[item_id])+""; this.body_str += ""; if((this.do_edit) == 1 && (this.selected[item_id] == 1)) { this.body_str += ""; this.body_str += ""; this.body_str += js_edit_item_ui(this, item_id); this.body_str += ""; this.body_str += ""; } this.body_str += "\n"; } function js_add_item(item) { var a; this.item_id.push(item.item_id); for(a in this.attributes) { if(typeof(item[this.attributes[a]]) != "undefined") { this[this.attributes[a]][item.item_id] = item[this.attributes[a]]; } } } function js_update_item(item) { var a; for(a in this.attributes) { if(typeof(item[this.attributes[a]]) != "undefined") { this[this.attributes[a]][item.item_id] = item[this.attributes[a]]; } } } function js_delete_item(item_id) { var a; var i; var atmp = new Array(); for(a in this.attributes) { delete this[this.attributes[a]][item_id]; } delete this.selected[item_id]; for(i = 0; i < this.item_id.length; i++) { if(this.item_id[i] != item_id) { atmp.push(this.item_id[i]); } } this.item_id = atmp; } function js_publish_item(item_id, publish_value) { this.Published[item_id] = publish_value; } function js_item_select(item_id, state) { if(state) { this.selected[item_id] = 1; } else { this.selected[item_id] = 0; } } function js_folder_click(folder_id, auto_display, folder_read_password) { /* This is commented out to check the server * every time a click occurs. Allows for * folder content changes that occur externally * to be picked up. */ //if(folder_id != this.folder_id) { var vars = new Object(); vars['action'] = "load_folder"; vars['user_id'] = this.user_id; vars['folder_id'] = folder_id; vars['auto_display'] = auto_display; vars['folder_read_password'] = folder_read_password; vars['Submit'] = 'Submit'; parent.frames[this.code_frame_name].controller.send_action("cf_item_management.cfm", vars); } } /* * requires type_id[item_id], sub_type_id[item_id], action[item_id], resource[item_id], * user_id, and style elements to be set. */ function js_item_click(item_id, folder_read_password) { var type_id = this.type_id[item_id]; var link_type = this.style.link_type[type_id]; var sub_type_id = this.sub_type_id[item_id]; var action = this.style.action[sub_type_id]; var base = parent.frames[this.code_frame_name].location.toString(); base = base.substring(0, base.lastIndexOf("/")+1); var href = ""; if(link_type) { href = this.resource[item_id]; } else { if(action) { href = (base + action + "?user_id=" + this.user_id + "&item_id=" + item_id + "&folder_read_password=" + folder_read_password + "&mypage=" + this.mode ); } else if(this.mode == 2) { href = this.path+'/'+this.resource[item_id]; } else { href = (base + "download/" + escape(this.resource[item_id]) + "?user_id=" + this.user_id + "&item_id=" + item_id + "&folder_read_password=" + folder_read_password ); } } if(this.NewWindow[item_id] == 0) { parent.frames[this.ui_frame_name].document.location.href = href; } else { window.open(href,'mywindow','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes,fullscreen=yes'); } } function js_set_mode(new_mode) { this.mode = new_mode; } function js_set_edit(new_edit) { this.do_edit = new_edit; } function js_set_user_name(new_user_name) { this.user_name = new_user_name; } function js_get_read_password(folder_id, item_id, action) { var d; /*--- This hack is needed for folder display --- when the folder display frame has --- another domain displayed in it. --- It appears that only IE has this problem. --- */ try { d = parent.frames[this.ui_frame_name].document; } catch(e) { var f = parent.frames[this.ui_frame_name]; f.location.href = "cf_folder_display.cfm"; return; } if(d.getElementById('folder_read_password')) { if(d.getElementById('folder_read_password').value != "") { alert("The password is not correct. Please try again."); } var p_elem = d.getElementById('folder_read_password'); p_elem.value = ""; p_elem.focus(); var t_elem = d.getElementById('folder_title'); t_elem.innerHTML = this.folder_title; var id_elem = d.getElementById('folder_id'); id_elem.value = folder_id; var i_elem = d.getElementById('item_id'); i_elem.value = item_id; var a_elem = d.getElementById('action'); a_elem.value = action; } else { var base = parent.frames[this.code_frame_name].location.toString(); base = base.substring(0, base.lastIndexOf("/")+1); var action_str = "parent.frames[\""+this.code_frame_name+"\"].controller.folder_read_password_form_handler();"; var pngfix_str = ""; var C = new utipsClient(); if(C.ie && C.ieVer < 7.) { pngfix_str = ""; } this.body_str = ''; this.load_str = ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += 'Folder Read Password'; this.body_str += this.style.style; this.body_str += pngfix_str; this.body_str += ''; this.body_str += ""; this.body_str += "
"; this.body_str += ""; this.body_str += ""; this.body_str += ""; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += '
  Password Required


A password is required to view ' + this.folder_title + '.

'; this.body_str += 'Password:   '; this.body_str += ''; this.body_str += '






'; this.body_str += '
'; this.js_set_document(); if(d.getElementById('folder_read_password')) { var p_elem = d.getElementById('folder_read_password'); p_elem.focus(); } } } function js_get_write_password(folder_id, action) { var d; /*--- This hack is needed for folder display --- when the folder display frame has --- another domain displayed in it. --- It appears that only IE has this problem. --- */ try { d = parent.frames[this.ui_frame_name].document; } catch(e) { var f = parent.frames[this.ui_frame_name]; f.location.href = "cf_folder_display.cfm"; return; } if(d.getElementById('folder_write_password')) { if(d.getElementById('folder_write_password').value != "") { alert("The password is not correct. Please try again."); } var p_elem = d.getElementById('folder_write_password'); p_elem.value = ""; p_elem.focus(); var t_elem = d.getElementById('folder_title'); t_elem.innerHTML = this.folder_title; var id_elem = d.getElementById('folder_id'); id_elem.value = folder_id; var a_elem = d.getElementById('action'); a_elem.value = action; } else { var base = parent.frames[this.code_frame_name].location.toString(); base = base.substring(0, base.lastIndexOf("/")+1); var action_str = "parent.frames[\""+this.code_frame_name+"\"].controller.folder_write_password_form_handler();"; var pngfix_str = ""; var C = new utipsClient(); if(C.ie && C.ieVer < 7.) { pngfix_str = ""; } this.body_str = ''; this.load_str = ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += 'Folder Write Password'; this.body_str += this.style.style; this.body_str += pngfix_str; this.body_str += ''; this.body_str += ""; this.body_str += "
"; this.body_str += ""; this.body_str += ""; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += ''; this.body_str += '
  Password Required


A password is required to upload to ' + this.folder_title + '.

'; this.body_str += 'Password:   '; this.body_str += ''; this.body_str += '






'; this.body_str += '
'; this.js_set_document(); if(d.getElementById('folder_write_password')) { var p_elem = d.getElementById('folder_write_password'); p_elem.focus(); } } } function js_set_document() { var d; /*--- This hack is needed for folder display --- when the folder display frame has --- another domain displayed in it. --- It appears that only IE has this problem. --- */ try { d = parent.frames[this.ui_frame_name].document; } catch(e) { var f = parent.frames[this.ui_frame_name]; f.location.href = "cf_folder_display.cfm"; return; } d.open(); d.write(this.body_str); d.close(); try { if(this.load_str) { // this works on MSIE6 while onload="" works in firefox setTimeout(this.load_str, 1); //eval(this.load_str); } } catch(e) { // do nothing if it fails } } function js_begin_display_anonymous_upload(tree_id, folder_id) { var base = parent.frames[this.code_frame_name].location.toString(); base = base.substring(0, base.lastIndexOf("/")+1); var onload_str = "parent.frames['"+this.code_frame_name+"'].controller.display_upload_onload("+tree_id+", "+folder_id+",1);"; var pngfix_str = ""; var C = new utipsClient(); if (C.onloadOK) { this.load_str = ''; onload_str = 'onload="'+onload_str+'"'; } else { this.load_str = onload_str; } if(C.ie && C.ieVer < 7.) { pngfix_str = ""; } this.body_str = ""+ "" + pngfix_str + "" + "" + "" + "" + "" + "" + "" + "
" + "
" + "
" + "" + " File Upload " + "
" + "
" + "
" + "
" + "" + "" + "
" + "
" + "
" + "
" + "" + "
" + "
" + ""; this.js_set_document(); } function js_finish_display_anonymous_upload(password) { var input_vars = Array(); input_vars['user_id'] = this.user_id; input_vars['folder_id'] = this.folder_id; input_vars['folder_write_password'] = password; input_vars['action'] = 'anonymous_upload'; var d = parent.frames[this.ui_frame_name].document; var par = d.getElementById("upload_file_parent"); if(par.childNodes.length <= 0) { var file_upload = new FileUpload(d, "anon", "/cf_item_management.cfm", 10, input_vars); par.appendChild(file_upload.main); } } function js_display_upload_result(folder_title, item_title, success, errMsg1) { var msg; var on_continue_click_str = "parent.frames['" + this.code_frame_name + "'].controller.display_folder_or_submit_action();"; if(success) { msg = ''+ '
'+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ '
'+ ''+ '
  Uploaded Files(s) to ' + folder_title + ' results:'+errMsg1+'
'+ '
'; } else { msg = '' + '
'+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ '
'+ ''+ '
  Uploaded Files(s) to ' + folder_title + ' results:
'+ '
'; } this.load_str = ''; this.body_str = ""+ "" + "" + "" + "" + "" + "
" + msg + "
" + ""; this.js_set_document(); } function js_begin_display_new_file_upload(tree_id, folder_id, user_space_used, user_space_available ) { var base = parent.frames[this.code_frame_name].location.toString(); base = base.substring(0, base.lastIndexOf("/")+1); var onload_str = "parent.frames['"+this.code_frame_name+"'].controller.display_upload_onload("+tree_id+", "+folder_id+",0);"; var pngfix_str = ""; var C = new utipsClient(); if (C.onloadOK) { //this.load_str = ''; this.load_str = onload_str; onload_str = 'onload="'+onload_str+'"' } else { this.load_str = onload_str; } if(C.ie && C.ieVer < 7.) { pngfix_str = ""; } var BORDER_COLOR = parent.frames[this.code_frame_name].controller.folder_style.bgcolor.header; var BGCOLOR = parent.frames[this.code_frame_name].controller.folder_style.bgcolor.even_item; this.body_str = ""+ "" + pngfix_str + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "
" + "
" + "
" + "" + " New File Upload " + "
" + "
" + "
 " + "" + "
" + "" + "" + "" + "
" + "Space Used " + user_space_used + " mb
" + "Space Available " + user_space_available + " mb
" + "
" + "
" + "" + "" + "
" + "
" + "
 " + "
" + ""; this.js_set_document(); } function js_finish_display_new_file_upload() { var input_vars = Array(); input_vars['user_id'] = this.user_id; input_vars['folder_id'] = this.folder_id; input_vars['hidAddMediaTo'] = parent.frames[this.code_frame_name].controller.addingmediato; input_vars['hidIsForMediaSection'] = parent.frames[this.code_frame_name].controller.isForMediaSection; input_vars['action'] = 'new_file'; var d = parent.frames[this.ui_frame_name].document; var par = d.getElementById("upload_file_parent"); if(par != null) { if(par.childNodes.length <= 0) { var file_upload = new FileUpload(d, "new_file", "/cf_item_management.cfm", 10, input_vars); par.appendChild(file_upload.main); } } } function js_folder(user_id, folder_id, code_frame_name, ui_frame_name, load_frame_name, style, tree_id) { this.user_id = user_id; this.folder_id = folder_id; this.code_frame_name = code_frame_name; this.ui_frame_name = ui_frame_name; this.load_frame_name = load_frame_name; this.style = style; this.tree_id = tree_id; this.debug = 0; this.path = ".."; this.mode = 0; /* 0 -- normal logged in user display * 1 -- anonymous - My Page display * 2 -- zip tool - static display */ this.do_edit = 0; this.user_name = ""; this.body_str = ""; this.load_str = ""; this.folder_title = "my title"; this.folder_type_id = -1; this.folder_owner = "my owner"; this.folder_Description = "my description"; this.folder_ReadPassword = ""; this.folder_WritePassword = ""; this.folder_AnonymousUpload = 0; this.folder_SortMode = 'manual'; this.folder_ViewMode = "list"; this.folder_IsImported = 0; this.folder_ReadBit = 0; this.folder_InsertBit = 0; this.folder_DeleteBit = 0; this.attributes = ["resource", "title", "type_id", "sub_type_id", "Published", "Description", "NewWindow", "ModDate", "FileSize", "EmailHash"]; this.item_id = new Array(); this.EmailHash = new Object(); this.resource = new Object(); this.title = new Object(); this.type_id = new Object(); this.sub_type_id = new Object(); this.Published = new Object(); this.Description = new Object(); this.NewWindow = new Object(); this.ModDate = new Object(); this.FileSize = new Object(); this.selected = new Object(); /* methods */ this.js_display_folder = js_display_folder; this.js_display_folder_header = js_display_folder_header; this.js_display_item = js_display_item; this.js_add_item = js_add_item; this.js_update_item = js_update_item; this.js_delete_item = js_delete_item; this.js_publish_item = js_publish_item; this.js_item_select = js_item_select; this.js_folder_click = js_folder_click; this.js_item_click = js_item_click; this.js_set_mode = js_set_mode; this.js_set_edit = js_set_edit; this.js_set_user_name = js_set_user_name; this.js_get_read_password = js_get_read_password; this.js_get_write_password = js_get_write_password; this.js_set_document = js_set_document; this.js_begin_display_anonymous_upload = js_begin_display_anonymous_upload; this.js_finish_display_anonymous_upload = js_finish_display_anonymous_upload; this.js_begin_display_new_file_upload = js_begin_display_new_file_upload; // my_code : new_file this.js_finish_display_new_file_upload = js_finish_display_new_file_upload; // my_code : new_file this.js_display_upload_result = js_display_upload_result; }