2011-04-16 14:40:15 +00:00
/ * *
* global variable
* /
2011-03-17 03:39:05 +00:00
var XcatmonTableId = "XcatMonsettingTable" ;
2011-04-16 14:40:15 +00:00
/ * *
* load xCAT monitor
* /
2010-08-04 08:49:20 +00:00
function loadXcatMon ( ) {
//find the xcat mon tab
var xcatMonTab = $ ( '#xcatmon' ) ;
2011-03-17 03:39:05 +00:00
xcatMonTab . append ( "<div id= xcatmonTable></div>" ) ;
2011-09-12 16:10:53 +00:00
2011-04-16 14:40:15 +00:00
//show the content of the table monsetting
2011-03-17 03:39:05 +00:00
$ . ajax ( {
url : 'lib/cmd.php' ,
dataType : 'json' ,
data : {
cmd : 'tabdump' ,
tgt : '' ,
args : 'monsetting' ,
msg : ''
} ,
success : loadXcatMonSetting
2010-08-04 08:49:20 +00:00
} ) ;
2011-03-17 03:39:05 +00:00
}
2011-04-16 14:40:15 +00:00
function loadXcatMonSetting ( data ) {
var apps ; //contain the xcatmon apps config
2011-09-12 16:10:53 +00:00
var rsp = data . rsp ;
var apps _flag = 0 ; //is the apps is stored?
2011-04-16 14:40:15 +00:00
var ping ; //contain the xcatmon ping-interval setting
2011-09-12 16:10:53 +00:00
var ping _flag = 0 ;
2011-03-17 03:39:05 +00:00
//create a infoBar
2011-09-12 16:10:53 +00:00
var infoBar = createInfoBar ( 'Click on a cell to edit. Click outside the table to write to the cell. Once you are finished configuring the xCAT monitor, click on Apply.' ) ;
2011-03-17 03:39:05 +00:00
$ ( '#xcatmonTable' ) . append ( infoBar ) ;
2010-08-04 08:49:20 +00:00
2011-03-17 03:39:05 +00:00
//create xcatmonTable
var XcatmonTable = new DataTable ( XcatmonTableId ) ;
2010-08-04 08:49:20 +00:00
2011-03-17 03:39:05 +00:00
//create Datatable
var dTable ;
2011-04-16 14:40:15 +00:00
//create the xcatmonTable header
2011-03-17 03:39:05 +00:00
var header = rsp [ 0 ] . split ( "," ) ;
header . splice ( 3 , 2 ) ;
header . splice ( 0 , 1 ) ;
header [ 0 ] = "apps name" ;
header [ 1 ] = "configure" ;
header . push ( '<input type="checkbox" onclick="selectAllCheckbox(event,$(this))">' ) ;
2010-08-04 08:49:20 +00:00
2011-03-17 03:39:05 +00:00
header . unshift ( '' ) ;
2011-04-16 14:40:15 +00:00
XcatmonTable . init ( header ) ; //create the table header
2011-03-17 03:39:05 +00:00
2011-04-16 14:40:15 +00:00
//create container of original table contents
2011-03-17 03:39:05 +00:00
var origCont = new Array ( ) ;
2011-04-16 14:40:15 +00:00
origCont [ 0 ] = header ; //table header
2011-03-17 03:39:05 +00:00
//create contariner for new contents use for update the monsetting table
var newCont = new Object ( ) ;
2011-09-12 16:10:53 +00:00
newCont [ 0 ] = rsp [ 0 ] . split ( "," ) ; //table header
2011-07-20 21:13:09 +00:00
//create container for other monsetting lines not xcatmon
2011-03-17 03:39:05 +00:00
var otherCont = new Array ( ) ;
2011-04-16 14:40:15 +00:00
$ ( '#xcatmonTable' ) . append ( XcatmonTable . object ( ) ) ; //add table object
2011-09-12 16:10:53 +00:00
var m = 1 ; //the count for origCont
var n = 0 ;
for ( var i = 1 ; i < rsp . length ; i ++ ) { //get the apps and the ping-interval configure
var pos = rsp [ i ] . indexOf ( "xcatmon" ) ; //only check the xcatmon setting
if ( pos == 1 ) {
2011-04-16 14:40:15 +00:00
//get the useful info and add it to the page.
2011-09-12 16:10:53 +00:00
if ( ( rsp [ i ] . indexOf ( "apps" ) == - 1 ) && ( rsp [ i ] . indexOf ( "ping" ) == - 1 ) ) {
2011-03-17 03:39:05 +00:00
var cols = rsp [ i ] . split ( ',' ) ;
2011-04-16 14:40:15 +00:00
//pair the semicolon of the content
2011-09-12 16:10:53 +00:00
for ( var j = 0 ; j < cols . length ; j ++ ) {
if ( cols [ j ] . count ( '"' ) % 2 == 1 ) {
while ( cols [ j ] . count ( '"' ) % 2 == 1 ) {
cols [ j ] = cols [ j ] + "," + cols [ j + 1 ] ;
cols . splice ( j + 1 , 1 ) ;
2011-03-17 03:39:05 +00:00
}
}
2011-09-12 16:10:53 +00:00
cols [ j ] = cols [ j ] . replace ( new RegExp ( '"' , 'g' ) , '' ) ;
2011-03-17 03:39:05 +00:00
}
2011-09-12 16:10:53 +00:00
2011-04-16 14:40:15 +00:00
//remove the commend disable
2011-03-17 03:39:05 +00:00
cols . splice ( 3 , 2 ) ;
2011-04-16 14:40:15 +00:00
//remove the xcatmon
2011-03-17 03:39:05 +00:00
cols . splice ( 0 , 1 ) ;
2011-09-12 16:10:53 +00:00
cols . push ( '<input type="checkbox" name="' + cols [ 0 ] + '" title="Checking this checkbox will add/remove the app from the configure apps value" />' ) ;
2011-03-17 03:39:05 +00:00
cols . unshift ( '<span class="ui-icon ui-icon-close" onclick="deleteRow1(this)"></span>' ) ;
2011-07-20 21:13:09 +00:00
//add the column tho the table
2011-03-17 03:39:05 +00:00
XcatmonTable . add ( cols ) ;
2011-09-12 16:10:53 +00:00
origCont [ m ++ ] = cols ;
} else {
if ( ! apps _flag ) { //check the apps setting
if ( rsp [ i ] . indexOf ( "apps" ) > - 1 ) { //check for is apps or not
2011-04-16 14:40:15 +00:00
apps = rsp [ i ] . split ( ',' ) ;
2011-03-17 03:39:05 +00:00
2011-09-12 16:10:53 +00:00
for ( var j = 0 ; j < apps . length ; j ++ ) { //pair the semicolon
if ( apps [ j ] . count ( '"' ) % 2 == 1 ) {
while ( apps [ j ] . count ( '"' ) % 2 == 1 ) {
apps [ j ] = apps [ j ] + "," + apps [ j + 1 ] ;
2011-04-16 14:40:15 +00:00
apps . splice ( j + 1 , 1 ) ;
2011-03-17 03:39:05 +00:00
}
}
2011-09-12 16:10:53 +00:00
apps [ j ] = apps [ j ] . replace ( new RegExp ( '"' , 'g' ) , '' ) ;
2011-03-17 03:39:05 +00:00
}
2011-04-16 14:40:15 +00:00
apps _flag = 1 ; //set the flag to 1 to avoid this subroute
2011-03-17 03:39:05 +00:00
}
}
2011-07-20 21:13:09 +00:00
2011-04-16 14:40:15 +00:00
//get into the ping setting subroute
2011-09-12 16:10:53 +00:00
if ( ! ping _flag ) {
2011-03-17 03:39:05 +00:00
//check the ping-interval config
2011-09-12 16:10:53 +00:00
if ( rsp [ i ] . indexOf ( "ping-interval" ) > - 1 ) {
2011-03-17 03:39:05 +00:00
ping = rsp [ i ] . split ( ',' ) ;
2011-04-16 14:40:15 +00:00
//pair the semicolon
2011-09-12 16:10:53 +00:00
for ( var j = 0 ; j < ping . length ; j ++ ) {
if ( ping [ j ] . count ( '"' ) % 2 == 1 ) {
while ( ping [ j ] . count ( '"' ) % 2 == 1 ) {
ping [ j ] = ping [ j ] + "," + ping [ j + 1 ] ;
2011-03-17 03:39:05 +00:00
ping . splice ( j + 1 , 1 ) ;
}
}
2011-09-12 16:10:53 +00:00
ping [ j ] = ping [ j ] . replace ( ( new RegExp ( '"' , 'g' ) ) , '' ) ;
2011-03-17 03:39:05 +00:00
}
2011-09-12 16:10:53 +00:00
ping _flag = 1 ;
2011-03-17 03:39:05 +00:00
}
}
}
2011-09-12 16:10:53 +00:00
} else if ( pos != 1 ) {
2011-04-16 14:40:15 +00:00
//the other monitor in the monsetting table
2011-09-12 16:10:53 +00:00
var otherCols = rsp [ i ] . split ( ',' ) ;
for ( var k = 0 ; k < otherCols . length ; k ++ ) {
if ( otherCols [ k ] . count ( '"' ) % 2 == 1 ) {
while ( otherCols [ k ] . count ( '"' ) % 2 == 1 ) {
otherCols [ k ] = otherCols [ k ] + "," + otherCols [ k + 1 ] ;
2011-03-17 03:39:05 +00:00
otherCols . splice ( k + 1 , 1 ) ;
}
}
2011-09-12 16:10:53 +00:00
otherCols [ k ] = otherCols [ k ] . replace ( new RegExp ( '"' , 'g' ) , '' ) ;
2011-03-17 03:39:05 +00:00
}
//add the rows to the otherCont.
2011-09-12 16:10:53 +00:00
otherCont [ n ++ ] = otherCols ;
2011-03-17 03:39:05 +00:00
}
}
2011-04-16 14:40:15 +00:00
//if the apps is not in the monsetting table.Then create the default apps row.
//when saving the changes,add the row to the table.
2011-09-12 16:10:53 +00:00
if ( ! apps _flag ) {
apps = rsp [ 0 ] . split ( ',' ) ;
apps [ 0 ] = "xcatmon" ;
apps [ 1 ] = "apps" ;
apps [ 2 ] = "" ;
apps [ 3 ] = "" ;
apps [ 4 ] = "" ;
2011-04-16 14:40:15 +00:00
}
2011-03-17 03:39:05 +00:00
2011-04-16 14:40:15 +00:00
//if the ping-interval is not in the monsetting table.Then create the default ping-interval row.
//when saving the changes,add the row to the table.
2011-09-12 16:10:53 +00:00
if ( ! ping _flag ) {
ping = rsp [ 0 ] . split ( ',' ) ;
ping [ 0 ] = "xcatmon" ;
ping [ 1 ] = "ping-interval" ;
2011-04-16 14:40:15 +00:00
//the default ping-interval setting is 5
2011-09-12 16:10:53 +00:00
ping [ 2 ] = "5" ;
ping [ 3 ] = "" ;
ping [ 4 ] = "" ;
2010-08-04 08:49:20 +00:00
}
2011-03-17 03:39:05 +00:00
2011-04-16 14:40:15 +00:00
//set the checkbox to be true according to the apps
2011-09-12 16:10:53 +00:00
var checked = apps [ 2 ] . split ( ',' ) ;
for ( var i = 0 ; i < checked . length ; i ++ ) {
2011-04-16 14:40:15 +00:00
//set the selcet checkbox to true
2011-03-17 03:39:05 +00:00
$ ( "input:checkbox[name=" + checked [ i ] + "]" ) . attr ( 'checked' , true ) ;
2011-09-12 16:10:53 +00:00
for ( var j = 0 ; j < origCont . length ; j ++ ) {
2011-04-16 14:40:15 +00:00
//set the origCont's checkbox to true
2011-09-12 16:10:53 +00:00
if ( origCont [ j ] [ 1 ] == checked [ i ] ) {
2011-03-17 03:39:05 +00:00
origCont [ j ] . splice ( 3 , 1 ) ;
origCont [ j ] . push ( '<input type="checkbox" name="' + origCont [ j ] [ 1 ] + '" title="Click this checkbox will add/remove the app from the configure apps value." checked=true/>' ) ;
}
}
2010-08-04 08:49:20 +00:00
2011-03-17 03:39:05 +00:00
}
$ ( ":checkbox" ) . tooltip ( ) ;
2011-09-12 16:10:53 +00:00
2011-03-17 03:39:05 +00:00
//make the table editable
2011-09-12 16:10:53 +00:00
$ ( '#' + XcatmonTableId + ' td:not(td:nth-child(1),td:last-child)' ) . editable (
function ( value , settings ) {
var colPos = this . cellIndex ;
var rowPos = dTable . fnGetPosition ( this . parentNode ) ;
2011-04-16 14:40:15 +00:00
dTable . fnUpdate ( value , rowPos , colPos ) ;
return ( value ) ;
2011-03-17 03:39:05 +00:00
} , {
2011-04-16 14:40:15 +00:00
onblur : 'submit' ,
type : 'textarea' ,
placeholder : ' ' ,
height : '30px'
2011-03-17 03:39:05 +00:00
}
) ;
2011-04-16 14:40:15 +00:00
2011-03-17 03:39:05 +00:00
//save the datatable
2011-09-12 16:10:53 +00:00
dTable = $ ( '#' + XcatmonTableId ) . dataTable ( {
'iDisplayLength' : 50 ,
'bLengthChange' : false ,
"sScrollX" : "100%" ,
"bAutoWidth" : true
} ) ;
2010-08-04 08:49:20 +00:00
2011-09-12 16:10:53 +00:00
//create action bar
var actionBar = $ ( '<div class="actionBar"></div>' ) ;
var addRowLnk = $ ( '<a>Add row</a>' ) ;
addRowLnk . bind ( 'click' , function ( event ) {
2011-04-16 14:40:15 +00:00
//create the container of the new row
2011-03-17 03:39:05 +00:00
var row = new Array ( ) ;
2011-04-16 14:40:15 +00:00
//add the delete button to the row
2011-03-17 03:39:05 +00:00
row . push ( '<span class="ui-icon ui-icon-close" onclick="deleteRow1(this)"></span>' ) ;
2011-04-16 14:40:15 +00:00
//add the xcatmon
//add the contain of the setting
2011-09-12 16:10:53 +00:00
for ( var i = 0 ; i < header . length - 2 ; i ++ ) {
2011-03-17 03:39:05 +00:00
row . push ( '' ) ;
}
2011-04-16 14:40:15 +00:00
//add the checkbox
2011-09-12 16:10:53 +00:00
row . push ( '<input type="checkbox" name="' + row [ 2 ] + '" title="Checking this checkbox will add/remove the app from the configure apps value"/>' ) ;
2011-04-16 14:40:15 +00:00
//get the datatable of the table
2011-09-12 16:10:53 +00:00
var dTable = $ ( '#' + XcatmonTableId ) . dataTable ( ) ;
2011-04-16 14:40:15 +00:00
//add the new row to the datatable
2011-03-17 03:39:05 +00:00
dTable . fnAddData ( row ) ;
2011-04-16 14:40:15 +00:00
//make the datatable editable
2011-03-17 03:39:05 +00:00
$ ( ":checkbox[title]" ) . tooltip ( ) ;
2011-09-12 16:10:53 +00:00
$ ( '#' + XcatmonTableId + ' td:not(td:nth-child(1),td:last-child)' ) . editable (
function ( value , settings ) {
var colPos = this . cellIndex ;
var rowPos = dTable . fnGetPosition ( this . parentNode ) ;
2011-04-16 14:40:15 +00:00
dTable . fnUpdate ( value , rowPos , colPos ) ;
return ( value ) ;
2011-03-17 03:39:05 +00:00
} , {
2011-04-16 14:40:15 +00:00
onblur : 'submit' ,
type : 'textarea' ,
placeholder : ' ' ,
height : '30px'
2010-08-04 08:49:20 +00:00
}
2011-03-17 03:39:05 +00:00
) ;
2010-08-04 08:49:20 +00:00
} ) ;
2011-09-12 16:10:53 +00:00
2011-04-16 14:40:15 +00:00
/ * *
* apply button
*
* the Apply button is used to store the contain of the table in the page to
* the monsetting table on the MN .
* /
2011-09-12 16:10:53 +00:00
var applyLnk = $ ( '<a>Apply</a>' ) ;
applyLnk . bind ( 'click' , function ( event ) {
2011-04-16 14:40:15 +00:00
//get the datatable of the page
2011-09-12 16:10:53 +00:00
var dTable = $ ( '#' + XcatmonTableId ) . dataTable ( ) ;
2011-04-16 14:40:15 +00:00
//get the rows of the datatable
2011-09-12 16:10:53 +00:00
var dRows = dTable . fnGetNodes ( ) ;
var count = 0 ;
2011-04-16 14:40:15 +00:00
//create the new container of the apps' value.
2011-09-12 16:10:53 +00:00
var appValue = '' ;
var tableName = 'monsetting' ;
2011-03-17 03:39:05 +00:00
var tmp ;
var tmp1 ;
2011-09-12 16:10:53 +00:00
var closeBtn = createButton ( 'close' ) ;
2011-04-16 14:40:15 +00:00
//get the contain of the rows
2011-09-12 16:10:53 +00:00
for ( var i = 0 ; i < dRows . length ; i ++ ) {
if ( dRows [ i ] ) {
2011-04-16 14:40:15 +00:00
//get the columns fo the row
2011-09-12 16:10:53 +00:00
var cols = dRows [ i ] . childNodes ;
2011-04-16 14:40:15 +00:00
//create the container of the new column
2011-03-17 03:39:05 +00:00
var vals = new Array ( ) ;
2011-09-12 16:10:53 +00:00
for ( var j = 1 ; j < cols . length - 1 ; j ++ ) {
2011-04-16 14:40:15 +00:00
//get the value of every column(except the first and the last.why ? .ni dong de)
2011-03-17 03:39:05 +00:00
var val = cols . item ( j ) . firstChild . nodeValue ;
2011-09-12 16:10:53 +00:00
if ( val == ' ' ) {
vals [ j - 1 ] = '' ;
} else {
vals [ j - 1 ] = val ;
2011-03-17 03:39:05 +00:00
}
}
2011-04-16 14:40:15 +00:00
//prepare another space for the array/
2011-09-12 16:10:53 +00:00
var vals _orig = new Array ( ) ;
2011-04-16 14:40:15 +00:00
//copy the data from vals to vals_orig
2011-09-12 16:10:53 +00:00
for ( var p = 0 ; p < 2 ; p ++ ) {
var val = vals [ p ] ;
vals _orig [ p ] = val ;
2011-04-16 14:40:15 +00:00
}
2011-03-17 03:39:05 +00:00
2011-09-12 16:10:53 +00:00
vals . push ( '' ) ;
vals . push ( '' ) ;
vals . unshift ( 'xcatmon' ) ;
2011-04-16 14:40:15 +00:00
//stored the new column to the newCont
2011-09-12 16:10:53 +00:00
newCont [ i + 1 ] = vals ;
2011-03-17 03:39:05 +00:00
2011-04-16 14:40:15 +00:00
//check the checkbox of the row and add different checkbox to the orignCont
//for the cancle button
2011-09-12 16:10:53 +00:00
if ( cols . item ( cols . length - 1 ) . firstChild . checked ) {
vals _orig . push ( '<input type="checkbox" name="' + vals _orig [ 0 ] + '" title="Click this checkbox will add/remove the app from the configure apps value." checked=true/>' ) ;
} else {
vals _orig . push ( '<input type="checkbox" name="' + vals _orig [ 0 ] + '" title="Click this checkbox will add/remove the app from the configure apps value."/>' ) ;
2011-04-16 14:40:15 +00:00
}
//push the delete button to the row
2011-03-17 03:39:05 +00:00
vals _orig . unshift ( '<span class="ui-icon ui-icon-close" onclick="deleteRow1(this)"></span>' ) ;
2011-04-16 14:40:15 +00:00
//add the row to the orignCont
2011-09-12 16:10:53 +00:00
origCont [ i + 1 ] = vals _orig ;
count = i + 1 ;
2011-03-17 03:39:05 +00:00
2011-04-16 14:40:15 +00:00
//check the checkbox fo everyrow for merging the appName to the apps values
2011-09-12 16:10:53 +00:00
if ( cols . item ( cols . length - 1 ) . firstChild . checked ) {
2011-04-16 14:40:15 +00:00
//the new value for the apps.get the name fo every app.
2011-09-12 16:10:53 +00:00
appValue = appValue . concat ( cols . item ( 2 ) . firstChild . nodeValue + "," ) ;
2011-03-17 03:39:05 +00:00
}
}
}
2011-04-16 14:40:15 +00:00
2011-03-17 03:39:05 +00:00
count ++ ;
2011-04-16 14:40:15 +00:00
//delete the last "," of the apps value
2011-09-12 16:10:53 +00:00
appValue = appValue . substring ( 0 , ( appValue . length - 1 ) ) ;
apps [ 2 ] = appValue ;
2011-03-17 03:39:05 +00:00
2011-04-16 14:40:15 +00:00
//newCont add the apps row
2011-09-12 16:10:53 +00:00
newCont [ count ++ ] = apps ;
2011-04-16 14:40:15 +00:00
//newCont add the ping-interval row
2011-09-12 16:10:53 +00:00
newCont [ count ++ ] = ping ;
2011-04-16 14:40:15 +00:00
//add the other monitor setting of the mosetting
2011-09-12 16:10:53 +00:00
for ( var j = 0 ; j < otherCont . length ; j ++ ) {
newCont [ count ++ ] = otherCont [ j ] ;
2011-03-17 03:39:05 +00:00
}
2011-04-16 14:40:15 +00:00
//create the save dialog
2011-09-12 16:10:53 +00:00
var dialogSave = $ ( '<div id="saveDialog" align="center">saving the configuration </div>' ) ;
2011-03-22 11:49:27 +00:00
dialogSave . append ( createLoader ( ) ) ;
2011-09-12 16:10:53 +00:00
$ ( '#xcatmon' ) . append ( dialogSave ) ;
2011-04-16 14:40:15 +00:00
//open the dialog..modal is true
2011-03-22 11:49:27 +00:00
$ ( "#saveDialog" ) . dialog ( { modal : true } ) ;
2011-04-16 14:40:15 +00:00
//hide the cross...
2011-03-22 11:49:27 +00:00
$ ( '.ui-dialog-titlebar-close' ) . hide ( ) ;
2011-04-16 14:40:15 +00:00
//put the table name and the contain to the tabRestore.php
2010-08-04 08:49:20 +00:00
$ . ajax ( {
2011-03-17 03:39:05 +00:00
type : 'POST' ,
url : 'lib/tabRestore.php' ,
2010-08-04 08:49:20 +00:00
dataType : 'json' ,
data : {
2011-03-17 03:39:05 +00:00
table : tableName ,
cont : newCont
2010-08-04 08:49:20 +00:00
} ,
2011-04-16 14:40:15 +00:00
success : function ( data ) {
//empty the dialog.add the close button
2011-03-22 11:49:27 +00:00
$ ( "#saveDialog" ) . empty ( ) . append ( '<p>The Configure has saved!</p>' ) ;
$ ( "#saveDialog" ) . append ( closeBtn ) ;
2010-08-04 08:49:20 +00:00
}
2011-03-17 03:39:05 +00:00
2010-08-04 08:49:20 +00:00
} ) ;
2011-04-16 14:40:15 +00:00
//close button function
closeBtn . bind ( 'click' , function ( event ) {
$ ( "#saveDialog" ) . dialog ( "distroy" ) ;
$ ( "#saveDialog" ) . remove ( ) ;
} ) ;
2010-08-04 08:49:20 +00:00
2011-04-16 14:40:15 +00:00
//clear the newCont
2011-09-12 16:10:53 +00:00
newCont = null ;
newCont = new Object ( ) ;
2011-04-16 14:40:15 +00:00
//just for tmp=newCont;
2011-09-12 16:10:53 +00:00
newCont [ 0 ] = rsp [ 0 ] . split ( "," ) ;
2011-04-16 14:40:15 +00:00
} ) ;
2011-09-12 16:10:53 +00:00
var cancelLnk = $ ( '<a>Cancel</a>' ) ;
cancelLnk . bind ( 'click' , function ( event ) {
2011-04-16 14:40:15 +00:00
//get the datatable of the page
2011-09-12 16:10:53 +00:00
var dTable = $ ( '#' + XcatmonTableId ) . dataTable ( ) ;
2011-03-17 03:39:05 +00:00
2011-04-16 14:40:15 +00:00
//clear the datatable
2011-03-17 03:39:05 +00:00
dTable . fnClearTable ( ) ;
2011-04-16 14:40:15 +00:00
//add the contain of the origCont to the datatable
2011-09-12 16:10:53 +00:00
for ( var i = 1 ; i < origCont . length ; i ++ ) {
2011-03-17 03:39:05 +00:00
dTable . fnAddData ( origCont [ i ] , true ) ;
}
$ ( ":checkbox[title]" ) . tooltip ( ) ;
2011-04-16 14:40:15 +00:00
$ ( '#' + XcatmonTableId + ' td:not(td:nth-child(1),td:last-child)' ) . editable (
function ( value , settings ) {
2011-09-12 16:10:53 +00:00
var colPos = this . cellIndex ;
var rowPos = dTable . fnGetPosition ( this . parentNode ) ;
2011-04-16 14:40:15 +00:00
dTable . fnUpdate ( value , rowPos , colPos ) ;
return ( value ) ;
2011-03-17 03:39:05 +00:00
} , {
2011-04-16 14:40:15 +00:00
onblur : 'submit' ,
type : 'textarea' ,
placeholder : ' ' ,
height : '30px'
} ) ;
} ) ;
2011-09-12 16:10:53 +00:00
//actions
var actionsLnk = '<a>Actions</a>' ;
var actsMenu = createMenu ( [ addRowLnk , applyLnk , cancelLnk ] ) ;
//create an action menu
var actionsMenu = createMenu ( [ [ actionsLnk , actsMenu ] ] ) ;
actionsMenu . superfish ( ) ;
actionsMenu . css ( 'display' , 'inline-block' ) ;
actionBar . append ( actionsMenu ) ;
//create a division to hold actions menu
var menuDiv = $ ( '<div id="' + XcatmonTableId + '_menuDiv" class="menuDiv"></div>' ) ;
$ ( '#' + XcatmonTableId + '_wrapper' ) . prepend ( menuDiv ) ;
menuDiv . append ( actionBar ) ;
$ ( '#' + XcatmonTableId + '_filter' ) . appendTo ( menuDiv ) ;
2010-08-04 08:49:20 +00:00
}
2011-04-16 14:40:15 +00:00
/ * *
* delete a row from the table
* /
2011-03-17 03:39:05 +00:00
function deleteRow1 ( obj ) {
2011-09-12 16:10:53 +00:00
var dTable = $ ( '#' + XcatmonTableId ) . dataTable ( ) ;
var rows = dTable . fnGetNodes ( ) ;
var tgtRow = $ ( obj ) . parent ( ) . parent ( ) . get ( 0 ) ;
for ( var i in rows ) {
if ( rows [ i ] == tgtRow ) {
2011-03-17 03:39:05 +00:00
dTable . fnDeleteRow ( i , null , true ) ;
break ;
}
2010-08-04 08:49:20 +00:00
}
}