pari: branch asterisknow r1914 - /branches/asterisknow/config/digital.html

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Wed Dec 5 18:21:15 CST 2007


Author: pari
Date: Wed Dec  5 18:21:14 2007
New Revision: 1914

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=1914
Log:
Get rid of the unnecessary dropdown menu, there is only one option under it (Edit)

Modified:
    branches/asterisknow/config/digital.html

Modified: branches/asterisknow/config/digital.html
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/digital.html?view=diff&rev=1914&r1=1913&r2=1914
==============================================================================
--- branches/asterisknow/config/digital.html (original)
+++ branches/asterisknow/config/digital.html Wed Dec  5 18:21:14 2007
@@ -90,19 +90,31 @@
 		text-align: center;
 		font-weight: bold;
 	}
+	
+	span.downbutton {
+		font-size:12px;
+		background:#FFFFFF; 
+		border:1px solid #8A8A8A; 
+		padding:2px 7px 2px 7px;
+		text-decoration:none;
+	}
+	span.downbutton:hover {
+		background:#F3640D;
+		color:#FFFFFF;
+		text-decoration:none;
+	}
+
 </style>
 <script>
 var SPANS = {};
 var oldSpanCount = 0; // we get this from previuos applyzap.conf
 var oldLoadZone;
-var menu ; // document.getElementById('mymenu');
 var GROUPS = [];
 var NEWGROUPNUMBER;
-
-function hide_mymenu(){ menu.style.display="none"; }
+var CURRENT_SPAN; // span being edited
 
 function verify_priChLimit(){
-	var l = String( menu.span_value );
+	var l = String(CURRENT_SPAN);
 	if(_$('editspan_signalling').value.beginsWith('fx')){ return true;}
 	var y = Number(_$('edit_DefinedChans').value);
 	if( Number(SPANS[l]['totchans'] ) <= 24 && y ==24){return false;}//alert("You should leave atleast 1 channel for PRI signalling");
@@ -136,96 +148,65 @@
 function canelSpanInfo(){
 	_$('edit_span').style.display = "none";
 	_$('bg_transparent').style.display = "none";
+	CURRENT_SPAN = null;
 }
 
-function preparemenus(){
-	menu.style.width="80";
-	menu.style.borderColor = "#eee #bbb #bbb #ddd";
-	ASTGUI.events.add( document.body , "click", function(){ menu.style.display="none"; } );
-	var edit_DefinedChans_changed = function(){
-		var b = String( menu.span_value );
-		var y = Number(_$('edit_DefinedChans').value);
-		if( !verify_priChLimit() ){
-			alert("You should leave atleast one channel for signalling");
-			return true;
+var editSPAN = function(l){ // show values for SPAN l in the edit_span dialog box
+	CURRENT_SPAN = l;
+	_$('editspan_SPAN').innerHTML = SPANS[l]['description'];
+	_$('editspan_ALARMS').innerHTML = SPANS[l]['alarms'];
+
+	// console.log( SPANS[l]['min_ch'] );
+	// console.log( SPANS[l]['max_ch'] );
+	// console.log( SPANS[l]['definedchans']  );
+
+	ASTGUI.selectbox.clear( _$('editspan_fac') );
+	var w = _$('edit_DefinedChans') ;
+
+	var ijkl = function(){
+		ASTGUI.selectbox.clear(w);
+		var f = Number( SPANS[l]['totchans'] ), g=0;
+		for(g=1; g <=f; g++){ ASTGUI.selectbox.append(w,g,g); }
+		ASTGUI.selectbox.selectOption(w,SPANS[l]['definedchans']);
+		_$('edit_labelReserved').innerHTML = SPANS[l]['reserved_ch'];
+		_$('edit_labelZapchan').innerHTML = calc_bchan_fxx(l);
+	}();
+
+	if ( Number(SPANS[l]['totchans']) <= 24 ){
+		ASTGUI.selectbox.append(_$('editspan_fac'),'ESF/B8ZS', 'ESF/B8ZS');
+		ASTGUI.selectbox.append(_$('editspan_fac'),'D4/AMI', 'D4/AMI');
+	}else{
+		ASTGUI.selectbox.append(_$('editspan_fac'),'CCS/HDB3', 'CCS/HDB3');
+		ASTGUI.selectbox.append(_$('editspan_fac'),'CCS/CRC4/HDB3', 'CCS/CRC4/HDB3');
+	}
+
+	if(SPANS[l]['framing'] && SPANS[l]['coding']) {
+		if( SPANS[l]['framing'] == 'CCS/CRC4' ){
+			ASTGUI.selectbox.selectOption( _$('editspan_fac') , 'CCS/CRC4/HDB3' );
+		}else{
+			ASTGUI.selectbox.selectOption( _$('editspan_fac') , SPANS[l]['framing'] + '/' + SPANS[l]['coding'] );
 		}
-
-		SPANS[b]['definedchans'] = y;
-		//_$('edit_labelReserved').innerHTML = SPANS[b]['reserved_ch'];
-		_$('edit_labelZapchan').innerHTML = calc_bchan_fxx(b);
-	};
-
-	ASTGUI.events.add( _$('edit_DefinedChans'), "change", edit_DefinedChans_changed );
-
-	var editSPAN = function(l){ // show values for SPAN l in the edit_span dialog box
-		_$('editspan_SPAN').innerHTML = SPANS[l]['description'];
-		_$('editspan_ALARMS').innerHTML = SPANS[l]['alarms'];
-
-		// console.log( SPANS[l]['min_ch'] );
-		// console.log( SPANS[l]['max_ch'] );
-		// console.log( SPANS[l]['definedchans']  );
-
-		ASTGUI.selectbox.clear( _$('editspan_fac') );
-		var w = _$('edit_DefinedChans') ;
-
-		var ijkl = function(){
-			ASTGUI.selectbox.clear(w);
-			var f = Number( SPANS[l]['totchans'] ), g=0;
-			for(g=1; g <=f; g++){ ASTGUI.selectbox.append(w,g,g); }
-			ASTGUI.selectbox.selectOption(w,SPANS[l]['definedchans']);
-			_$('edit_labelReserved').innerHTML = SPANS[l]['reserved_ch'];
-			_$('edit_labelZapchan').innerHTML = calc_bchan_fxx(l);
-		}();
-
-		if ( Number(SPANS[l]['totchans']) <= 24 ){
-			ASTGUI.selectbox.append(_$('editspan_fac'),'ESF/B8ZS', 'ESF/B8ZS');
-			ASTGUI.selectbox.append(_$('editspan_fac'),'D4/AMI', 'D4/AMI');
-		}else{
-			ASTGUI.selectbox.append(_$('editspan_fac'),'CCS/HDB3', 'CCS/HDB3');
-			ASTGUI.selectbox.append(_$('editspan_fac'),'CCS/CRC4/HDB3', 'CCS/CRC4/HDB3');
-		}
-
-
-
-		if(SPANS[l]['framing'] && SPANS[l]['coding']) {
-			if( SPANS[l]['framing'] == 'CCS/CRC4' ){
-				ASTGUI.selectbox.selectOption( _$('editspan_fac') , 'CCS/CRC4/HDB3' );
-			}else{
-				ASTGUI.selectbox.selectOption( _$('editspan_fac') , SPANS[l]['framing'] + '/' + SPANS[l]['coding'] );
-			}
-		}
-
-		_$('editspan_channels').innerHTML = String(SPANS[l]['usedchans']) + "/" + String(SPANS[l]['totchans']) + " ("+SPANS[l]['spantype']+")";
-	
-		if( SPANS[l]['signalling'] ){
-			ASTGUI.selectbox.selectOption( _$('editspan_signalling') , SPANS[l]['signalling'] );
-		}else{
-			_$('editspan_signalling').selectedIndex = -1 ; 
-		}
-		disablEnable_sc();
-		if(SPANS[l]['switchtype']){
-			ASTGUI.selectbox.selectOption( _$('editspan_switchtype') , SPANS[l]['switchtype'] );
-		}else{
-			_$('editspan_switchtype').selectedIndex = -1 ;
-		}
-		ASTGUI.selectbox.selectOption( _$('editspan_syncsrc') , SPANS[l]['syncsrc'] );
-		ASTGUI.selectbox.selectOption( _$('editspan_lbo') , SPANS[l]['lbo'] );
-		_$('edit_span').style.display = "";
-		_$('bg_transparent').style.display = "";
-	};
-
-	var menuitem1 = document.createElement('div');
-	menuitem1.innerHTML = "Edit" ;
-	menuitem1.onclick =  function(){ hide_mymenu();  editSPAN( this.parentNode.span_value); };
-	menu.appendChild(menuitem1);
-}
-
-function show_downmenu(s){
-	var a = _$("span_"+s);
-	menu.span_value = s ;
-	ASTGUI.alignBbelowA(a,menu);
-	setTimeout( function(){ menu.style.display=""; } , 100 );
-}
+	}
+
+	_$('editspan_channels').innerHTML = String(SPANS[l]['usedchans']) + "/" + String(SPANS[l]['totchans']) + " ("+SPANS[l]['spantype']+")";
+
+	if( SPANS[l]['signalling'] ){
+		ASTGUI.selectbox.selectOption( _$('editspan_signalling') , SPANS[l]['signalling'] );
+	}else{
+		_$('editspan_signalling').selectedIndex = -1 ; 
+	}
+	disablEnable_sc();
+	if(SPANS[l]['switchtype']){
+		ASTGUI.selectbox.selectOption( _$('editspan_switchtype') , SPANS[l]['switchtype'] );
+	}else{
+		_$('editspan_switchtype').selectedIndex = -1 ;
+	}
+	ASTGUI.selectbox.selectOption( _$('editspan_syncsrc') , SPANS[l]['syncsrc'] );
+	ASTGUI.selectbox.selectOption( _$('editspan_lbo') , SPANS[l]['lbo'] );
+	_$('edit_span').style.display = "";
+	_$('bg_transparent').style.display = "";
+};
+
 
 function showtable(){ // navigates through the SPANS object and presents as a table to the user
 	var tbl = _$('digitalcardstable') ;
@@ -286,7 +267,13 @@
 
 
 		var newCell5 = newRow.insertCell(5);
-		newCell5.innerHTML = "<span class=\"downmenubutton\" id='" + "span_" + span + "'  onclick=\"show_downmenu( '"+ span + "');\">Options&nbsp;&nbsp;<img src=images/1.gif></span>" ;
+
+
+		newCell5.innerHTML = "<span class=\"downbutton\" id='" + "span_" + span + "'  onclick=\"editSPAN( '"+ span + "');\">Edit</span>" ;
+
+		//newCell5.innerHTML = "<span class=\"downmenubutton\" id='" + "span_" + span + "'  onclick=\"show_downmenu( '"+ span + "');\">Options&nbsp;&nbsp;<img src=images/1.gif></span>" ;
+
+
 		newCell5.style.width = 90;
 		newCell5.align = "center";
 	};
@@ -310,7 +297,6 @@
 }
 
 function localajaxinit(){
-	menu = document.getElementById('mymenu');
 	setWindowTitle("Digital Cards(T1/E1) Configuration");
 	top._$('mainscreen').width= 798;
 	_$('save_b').disabled = true;
@@ -322,9 +308,25 @@
 	_$('message_text').innerHTML = "Detecting Digital Cards ...";
 	_$('status_message').style.display="block";
 	setTimeout("_$('status_message').style.display='none';", 1000);
-	preparemenus();
 	_$('ListFXSPorts').innerHTML = parent.FXS_PORTS_DETECTED.join(',');
 	_$('ListFXOPorts').innerHTML = parent.FXO_PORTS_DETECTED.join(',');
+
+
+	var edit_DefinedChans_changed = function(){
+		var b = CURRENT_SPAN ;
+		var y = Number(_$('edit_DefinedChans').value);
+		if( !verify_priChLimit() ){
+			alert("You should leave atleast one channel for signalling");
+			return true;
+		}
+
+		SPANS[b]['definedchans'] = y;
+		//_$('edit_labelReserved').innerHTML = SPANS[b]['reserved_ch'];
+		_$('edit_labelZapchan').innerHTML = calc_bchan_fxx(b);
+	};
+
+	ASTGUI.events.add( _$('edit_DefinedChans'), "change", edit_DefinedChans_changed );
+
 	parent.loadscreen(this);
 	//loadConfigFiles.readApplyzap();
 	loadConfigFiles.runZtscan();
@@ -498,7 +500,7 @@
 		return true;
 	}
 
-	var b = String( menu.span_value );
+	var b = String(CURRENT_SPAN);
 
 	if( _$('editspan_fac').value == 'CCS/CRC4/HDB3' ){
 		SPANS[b]['framing'] = 'CCS/CRC4';
@@ -712,7 +714,6 @@
 	</div>
 </div>
 <div id="errmsg" style="display:none"></div>
-<div id="mymenu" class="mymenu" style="display:none"></div>
 <div id="bg_transparent" STYLE="display:none; position: absolute; left: 0; top: 0; width:100%; height:100%;  background-color:#FFFFFF; filter:alpha(opacity=50); -moz-opacity:.50;opacity:.50; border-width: 0px; z-index:4">
 </div>
 




More information about the asterisk-gui-commits mailing list