function renderPlugin_smart(data) { if ((data.Plugins.Plugin_SMART !== undefined) && (data.Plugins.Plugin_SMART.columns !== undefined) && (items(data.Plugins.Plugin_SMART.columns.column).length > 0) && (data.Plugins.Plugin_SMART.disks !== undefined) && (items(data.Plugins.Plugin_SMART.disks.disk).length > 0)) { var smartitems = items(data.Plugins.Plugin_SMART.columns.column); var html = ''; var i,j; var smartid; var attribute_name; html+=""; html+=""; html+=""+genlang(2, 'smart')+""; // Name for (i = 0; i < smartitems.length ; i++) { attribute_name = smartitems[i]["@attributes"].attribute_name; if (typeof attribute_name === 'string') attribute_name = attribute_name.replace(/_/g, " ").replace(/;/g, "
"); else attribute_name = "Attribute " + smartitems[i]["@attributes"].id; html+=""+ attribute_name + ""; } html+=""; html+=""; var diskitems = items(data.Plugins.Plugin_SMART.disks.disk); html += ''; for (i = 0; i < diskitems.length; i++) { html += ''; if (diskitems[i]["@attributes"].event !== undefined) html += '
'+ diskitems[i]["@attributes"].name + ' !
'; else html += ''+ diskitems[i]["@attributes"].name + ''; var attribitems = items(diskitems[i].attribute); var valarray = []; for (j = 0;j < attribitems.length; j++) { valarray[attribitems[j]["@attributes"].id] = attribitems[j]["@attributes"]; } for (j = 0; j < smartitems.length; j++) { smartid = smartitems[j]["@attributes"].id; if ((smartid !== undefined) && (valarray[smartid] !== undefined)) { var itemvalue = valarray[smartid][smartitems[j]["@attributes"].name]; if ((itemvalue !== undefined) && (itemvalue !== '' )) { if (smartid === "194") { html += '' + formatTemp(itemvalue, data.Options["@attributes"].tempFormat) + ''; } else { html += '' + itemvalue + ''; } } else { html += ''; } } else { html += ''; } } html += ''; } html += ''; $('#smart').empty().append(html); $('#smart').addClass("sortable"); sorttable.makeSortable($('#smart')[0]); sorttable.innerSortFunction.apply($('#smart_name')[0], []); $('#block_smart').show(); } else { $('#block_smart').hide(); } }