Author: vvalchev
Date: Fri Apr  6 09:05:42 2012
New Revision: 1310250

URL: http://svn.apache.org/viewvc?rev=1310250&view=rev
Log:
Fixed  FELIX-3449 Event plugin cannto send events without properties
https://issues.apache.org/jira/browse/FELIX-3449

Modified:
    
felix/trunk/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/bundle.properties
    
felix/trunk/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/bundle_bg.properties
    felix/trunk/webconsole-plugins/event/src/main/resources/res/events.html
    felix/trunk/webconsole-plugins/event/src/main/resources/res/ui/events.css
    felix/trunk/webconsole-plugins/event/src/main/resources/res/ui/events.js
    felix/trunk/webconsole-plugins/event/src/main/resources/res/ui/propeditor.js

Modified: 
felix/trunk/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/bundle.properties
URL: 
http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/bundle.properties?rev=1310250&r1=1310249&r2=1310250&view=diff
==============================================================================
--- 
felix/trunk/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/bundle.properties
 (original)
+++ 
felix/trunk/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/bundle.properties
 Fri Apr  6 09:05:42 2012
@@ -44,3 +44,4 @@ sendEvent=Send/Post Event
 post=Post Event
 send=Send Event
 close=Close
+reset=Reset

Modified: 
felix/trunk/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/bundle_bg.properties
URL: 
http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/bundle_bg.properties?rev=1310250&r1=1310249&r2=1310250&view=diff
==============================================================================
--- 
felix/trunk/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/bundle_bg.properties
 (original)
+++ 
felix/trunk/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/bundle_bg.properties
 Fri Apr  6 09:05:42 2012
@@ -44,4 +44,5 @@ sendEvent=ИзпращаÐ
 post=Прати
 send=Прати веднага
 close=Затваряне
+reset=Ресет
 

Modified: 
felix/trunk/webconsole-plugins/event/src/main/resources/res/events.html
URL: 
http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/event/src/main/resources/res/events.html?rev=1310250&r1=1310249&r2=1310250&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/event/src/main/resources/res/events.html 
(original)
+++ felix/trunk/webconsole-plugins/event/src/main/resources/res/events.html Fri 
Apr  6 09:05:42 2012
@@ -6,6 +6,7 @@ var i18n = {
        displayTimeline: '${displayTimeline}',
        displayList    : '${displayList}',
        close          : '${close}',
+    reset          : '${reset}',
        send           : '${send}',
        post           : '${post}'
 }
@@ -58,9 +59,7 @@ var i18n = {
                </tr>
                <tr>
                        <th>${properties}:</th>
-                       <td>
-                               <div id="sendProperties">&nbsp;</div>
-                       </td>
+                       <td id="sendProperties"></td>
                </tr>
        </tbody>
        </table>

Modified: 
felix/trunk/webconsole-plugins/event/src/main/resources/res/ui/events.css
URL: 
http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/event/src/main/resources/res/ui/events.css?rev=1310250&r1=1310249&r2=1310250&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/event/src/main/resources/res/ui/events.css 
(original)
+++ felix/trunk/webconsole-plugins/event/src/main/resources/res/ui/events.css 
Fri Apr  6 09:05:42 2012
@@ -31,6 +31,6 @@ td.time { white-space: nowrap }
 .addremove button { width: 16px; height: 16px; line-height: 10px; font-size: 
10px; margin: 2px 2px }
 .addremove_inner { display: inline }
 .propeditor_entry select {     margin-left: 4px }
-#sendTopic { width: 100% }
+#sendTopic { width: 100%; margin-bottom: 1em }
 #sendDialog table { margin-left: auto; margin-right: auto }
 #sendDialog table th { text-align: right; font-weight: bold; padding-right: 
.5em }

Modified: 
felix/trunk/webconsole-plugins/event/src/main/resources/res/ui/events.js
URL: 
http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/event/src/main/resources/res/ui/events.js?rev=1310250&r1=1310249&r2=1310250&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/event/src/main/resources/res/ui/events.js 
(original)
+++ felix/trunk/webconsole-plugins/event/src/main/resources/res/ui/events.js 
Fri Apr  6 09:05:42 2012
@@ -104,10 +104,10 @@ $(document).ready(function(){
                if (topicOk) {
                        sendTopic.removeClass('ui-state-error');
                } else {
-                       addTopic.removeClass('ui-state-error');
+                       sendTopic.addClass('ui-state-error');
                }
                var data = sendProperties.propeditor('serialize');
-               if (topicOk && data != false) {
+               if (topicOk && typeof data != 'boolean') {
                        $.post(pluginRoot,
                                data.concat([
                                        {name : 'action', value : action},
@@ -125,6 +125,9 @@ $(document).ready(function(){
        sendButtons[i18n.close] = function() {
                $(this).dialog("close");
        }
+       sendButtons[i18n.reset] = function() {
+               sendProperties.propeditor('reset');
+       }
        sendButtons[i18n.send] = function() {
                sendData('send');
        }
@@ -137,8 +140,8 @@ $(document).ready(function(){
                width   : '40%',
                buttons : sendButtons,
                open    : function() {
-                       sendTopic.val('');
-                       sendProperties.propeditor('reset');
+                       //sendTopic.val('');
+                       //sendProperties.propeditor('reset');
                }
        });
        var sendTopic = $('#sendTopic');

Modified: 
felix/trunk/webconsole-plugins/event/src/main/resources/res/ui/propeditor.js
URL: 
http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/event/src/main/resources/res/ui/propeditor.js?rev=1310250&r1=1310249&r2=1310250&view=diff
==============================================================================
--- 
felix/trunk/webconsole-plugins/event/src/main/resources/res/ui/propeditor.js 
(original)
+++ 
felix/trunk/webconsole-plugins/event/src/main/resources/res/ui/propeditor.js 
Fri Apr  6 09:05:42 2012
@@ -21,22 +21,22 @@
        
        Options:
        validator : function(keyInputField, valInputField, type)
+       types     : ['byte', 'int', 'long', 'float', 'double', 'string', 
'char', 'hex', 'base64', 'sha1']
 */
 (function( $ ){
-       var TYPES = ['byte', 'int', 'long', 'float', 'double', 'string', 
'char', 'hex', 'base64', 'sha1'];
-
        var methods = {
                init : function(options) {
                        return this.each( function() {
                                // If options exist, lets merge them with our 
default settings
                                var settings = {
                                        validator  : false,
+                                       types      : ['byte', 'int', 'long', 
'float', 'double', 'string', 'char', 'hex', 'base64', 'sha1']
                                };
                                if (options) settings = $.extend(settings, 
options);
 
                                var _this = $(this);
                                _this.data('propeditor_settings', settings);
-                               _this.append(_entry());
+                               _this.append(_entry(settings.types));
                                _this.addremove(settings);
                        })
                },
@@ -56,15 +56,13 @@
                        if (entries.size() == 1) {
                                var k = 
entries.find('.key').removeClass('ui-state-error').val();
                                var v = 
entries.find('.val').removeClass('ui-state-error').val();
-                               if (k != '' || v != '') {
+                               if (k || v) {
                                        var data = _check_entry( entries, 
validator );
-                                       //if ( data == false ) ok = false; else 
result.push(data);
                                        if ( data == false ) ok = false; else 
result = data;
                                }
                        } else {
                                entries.each(function() {
                                        var data = _check_entry( $(this), 
validator );
-                                       //if ( data == false ) ok = false; else 
result.push(data);
                                        if ( data == false ) ok = false; else 
result = result.concat(data);
                                });
                        }
@@ -102,7 +100,7 @@
                return ret;
        }
 
-       var _entry = function() {
+       var _entry = function(TYPES) {
                var sel = _el('select', 'typ');
                for(var i in TYPES) {
                        sel.append( _el('option').text( TYPES[i] ) );


Reply via email to