rbrindley: branch rbrindley/features_revamp r4730 - in /team/rbrindley/featur...
SVN commits to the Asterisk-GUI project
asterisk-gui-commits at lists.digium.com
Thu Apr 9 11:41:23 CDT 2009
Author: rbrindley
Date: Thu Apr 9 11:41:20 2009
New Revision: 4730
URL: http://svn.digium.com/svn-view/asterisk-gui?view=rev&rev=4730
Log:
- added javascript handlers for feature map
Modified:
team/rbrindley/features_revamp/config/features2.html
team/rbrindley/features_revamp/config/js/features2.js
Modified: team/rbrindley/features_revamp/config/features2.html
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/features_revamp/config/features2.html?view=diff&rev=4730&r1=4729&r2=4730
==============================================================================
--- team/rbrindley/features_revamp/config/features2.html (original)
+++ team/rbrindley/features_revamp/config/features2.html Thu Apr 9 11:41:20 2009
@@ -104,20 +104,28 @@
<div id="feature_map" class="section">
<span class="title"><img class="title_img" src="images/asterisk_red.gif"/>Feature Map</span>
<div class="feature disabled">
- <input type="checkbox" id="fmap_blindxfer" />
- Blind Transfer: <input size="2" id="fmap_blindxfer_val" /> (default is #)
+ <input type="hidden" id="fmap_blindxfer" />
+ <label for="fmap_blindxfer">Blind Transfer:</label>
+ <input type="text" id="fmap_blindxfer_val" size="2" /> (default is #)
+ <span class="update"></span>
</div>
<div class="feature disabled">
- <input type="checkbox" id="fmap_disconnect" />
- Disconnect: <input size="2" id="fmap_disconnect_val" /> (default is *)
+ <input type="hidden" id="fmap_disconnect" />
+ <label for="fmap_disconnect">Disconnect:</label>
+ <input type="text" id="fmap_disconnect_val" size="2" /> (default is *)
+ <span class="update"></span>
</div>
<div class="feature disabled">
- <input type="checkbox" id="fmap_atxfer" />
- Attended Transfer: <input size="2" id="fmap_blindxfer_val" />
+ <input type="hidden" id="fmap_atxfer" />
+ <label for="fmap_atxfer">Attended Transfer:</label>
+ <input type="text" id="fmap_atxfer_val" size="2" />
+ <span class="update"></span>
</div>
<div class="feature disabled">
- <input type="checkbox" id="fmap_parkcall" />
- Call Parking: <input size="2" id="fmap_blindxfer_val" />
+ <input type="hidden" id="fmap_parkcall" />
+ <label for="fmap_parkcall">Call Parking:</label>
+ <input type="text" id="fmap_parkcall_val" size="2" />
+ <span class="update"></span>
</div>
</div>
</div>
@@ -132,17 +140,52 @@
</body>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/astman.js"></script>
-<script type="text/javascript" src="js/features.js"></script>
+<script type="text/javascript" src="js/features2.js"></script>
<script type="text/javascript" src="js/jquery.tooltip.js"></script>
<script type="text/javascript" src="js/jquery.autocomplete.js"></script>
+<script type="text/javascript" src="js/jquery.delegate-1.1.js"></script>
+<script type="text/javascript" src="js/jquery.ui.core.js"></script>
<script type="text/javascript">
$(document).ready( function() {
top.document.title = "Call Feature Preferences";
$('.refresh_icon').click( function() {
window.location.reload();
});
- $('.feature .checkbox :checkbox').click( function() {
- $(this).parents(".feature").toggleClass('disabled');
+ $('#feature_map')
+ .delegate('click', ':hidden', function() {
+ $(this).parents(".feature").toggleClass('disabled');
+ if (!$(this).parents('.feature').hasClass('disabled')) {
+ $('#'+$(this).attr('id')+'_val').focus();
+ } else {
+ /* send action to remove feature */
+ fmap.remove($(this));
+ }
+ }).delegate('click', ':text', function() {
+ $(this).parents('.feature').removeClass('disabled');
+ $(this).siblings(':hidden').attr('checked', 'checked');
+ }).delegate('change', ':text', function() {
+ if ($(this).val() === '') {
+ $(this).parents('.feature').addClass('disabled');
+ $(this).siblings(':hidden').removeAttr('checked');
+ /* send action to remove feature */
+ fmap.remove($(this));
+ } else {
+ $(this).parents('.feature').removeClass('disabled');
+ $(this).siblings(':hidden').attr('checked', 'checked');
+ /* send action to update */
+ fmap.edit($(this));
+ }
+ });
+ $('#feature_map :text').blur(function() {
+ if ($(this).val() === '') {
+ $(this).parents('.feature').addClass('disabled');
+ $(this).siblings(':hidden').removeAttr('checked');
+ /* send action to remove feature */
+ fmap.remove($(this));
+ } else {
+ /* send action to update */
+ fmap.edit($(this));
+ }
});
});
</script>
Modified: team/rbrindley/features_revamp/config/js/features2.js
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/features_revamp/config/js/features2.js?view=diff&rev=4730&r1=4729&r2=4730
==============================================================================
--- team/rbrindley/features_revamp/config/js/features2.js (original)
+++ team/rbrindley/features_revamp/config/js/features2.js Thu Apr 9 11:41:20 2009
@@ -16,3 +16,47 @@
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
+
+/**
+ * object for feature maps
+ */
+var fmap = {};
+
+/**
+ * function to edit feature maps
+ * @param obj the DOM object
+ */
+fmap.edit = function(obj) {
+ updateMsg(obj, 'enabled!', 'edit');
+};
+
+/**
+ * function to remove feature maps
+ * @param obj the DOM object
+ */
+fmap.remove = function(obj) {
+ updateMsg(obj, 'disabled!', 'remove');
+};
+
+/**
+ * function to show update mesgs
+ * @param obj the DOM object
+ * @param msg the msg to display
+ */
+var updateMsg = function(obj, msg, type) {
+ var type = type || '';
+ switch(type) {
+ case 'edit':
+ var color = 'green';
+ break;
+ case 'error':
+ var color = 'orange';
+ break;
+ default:
+ var color = 'red';
+ }
+ var span = obj.siblings('.update');
+ span.html(msg).css('color', color);
+ span.show();
+ span.fadeOut(1000);
+};
More information about the asterisk-gui-commits
mailing list