renamed validatebutton into topmenuvalidation
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Mon, 16 Dec 2013 11:11:43 +0000 (12:11 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Mon, 16 Dec 2013 11:11:43 +0000 (12:11 +0100)
manifold/static/js/plugin.js
plugins/topmenuvalidation/__init__.py [moved from plugins/validatebutton/__init__.py with 85% similarity]
plugins/topmenuvalidation/static/js/topmenuvalidation.opj [moved from plugins/validatebutton/static/js/validatebutton.js with 92% similarity]
portal/sliceview.py
sample/topmenuvalidationview.py [moved from sample/validatebuttonview.py with 74% similarity]
sample/urls.py
ui/topmenu.py

index a751e17..4530b51 100644 (file)
@@ -266,7 +266,7 @@ var Plugin = Class.extend({
     /* SPIN */
     // use spin() to get our default spin settings (called presets)
     // use spin(true) to get spin's builtin defaults
     /* SPIN */
     // use spin() to get our default spin settings (called presets)
     // use spin(true) to get spin's builtin defaults
-    // you can also call spin_presets() yourself and tweak what you need to, like validatebutton does
+    // you can also call spin_presets() yourself and tweak what you need to, like topmenuvalidation does
     spin: function (presets) {
        var presets = ( presets === undefined ) ? spin_presets() : presets;
        try { this.$element.spin(presets); }
     spin: function (presets) {
        var presets = ( presets === undefined ) ? spin_presets() : presets;
        try { this.$element.spin(presets); }
similarity index 85%
rename from plugins/validatebutton/__init__.py
rename to plugins/topmenuvalidation/__init__.py
index 69dddf3..ef7a733 100644 (file)
@@ -1,11 +1,11 @@
 from unfold.plugin import Plugin
 
 from unfold.plugin import Plugin
 
-class ValidateButton (Plugin):
+class TopmenuValidation (Plugin):
 
     """This plugin is designed to work together with topmenu.
     
 It will check to see if user has PI rights at least on one authority, 
 
     """This plugin is designed to work together with topmenu.
     
 It will check to see if user has PI rights at least on one authority, 
-and if so will enable corresponding button in topmenu.
+and if so will enable corresponding validation button in topmenu.
 
 A realistic example would have incoming query as
 
 
 A realistic example would have incoming query as
 
@@ -27,7 +27,7 @@ Query.get('ple:user').filter_by('user_hrn', '==', '$user_hrn').select('pi_author
         return ""
     
     def requirements (self):
         return ""
     
     def requirements (self):
-        return { 'js_files': [ 'js/validatebutton.js', 'js/manifold-query.js', 
+        return { 'js_files': [ 'js/topmenuvalidation.js', 'js/manifold-query.js', 
                                "js/spin-presets.js", "js/spin.min.js", "js/jquery.spin.js", 
                                ], }
 
                                "js/spin-presets.js", "js/spin.min.js", "js/jquery.spin.js", 
                                ], }
 
@@ -7,7 +7,7 @@
     var debug=false;
 //    debug=true
 
     var debug=false;
 //    debug=true
 
-    var ValidateButton = Plugin.extend({
+    var TopmenuValidation = Plugin.extend({
 
         init: function(options, element) {
             this._super(options, element);
 
         init: function(options, element) {
             this._super(options, element);
@@ -39,6 +39,6 @@
        },
     });
 
        },
     });
 
-    $.plugin('ValidateButton', ValidateButton);
+    $.plugin('TopmenuValidation', TopmenuValidation);
 
 })(jQuery);
 
 })(jQuery);
index ff4cc5e..91d60ef 100644 (file)
@@ -10,7 +10,7 @@ from manifold.manifoldapi            import execute_query
 
 from ui.topmenu                      import topmenu_items, the_user
 
 
 from ui.topmenu                      import topmenu_items, the_user
 
-from plugins.validatebutton          import ValidateButton
+from plugins.topmenuvalidation          import TopmenuValidation
 from plugins.raw                     import Raw
 from plugins.stack                   import Stack
 from plugins.tabs                    import Tabs
 from plugins.raw                     import Raw
 from plugins.stack                   import Stack
 from plugins.tabs                    import Tabs
@@ -428,14 +428,15 @@ class SliceView (LoginRequiredAutoLogoutView):
         # even though this plugin does not have any html materialization, the corresponding domid
         # must exist because it is searched at init-time to create the JS plugin
         # so we simply piggy-back the target button here
         # even though this plugin does not have any html materialization, the corresponding domid
         # must exist because it is searched at init-time to create the JS plugin
         # so we simply piggy-back the target button here
-        validatebutton = ValidateButton (page=page, 
-                                         # see above
-                                         domid='topmenu-validation',
-                                         query=query_pi_auths,
-                                         # this one is the target for a $.show() when the query comes back
-                                         button_domid="topmenu-validation")
+        topmenuvalidation = TopmenuValidation (
+            page=page, 
+            # see above
+            domid='topmenu-validation',
+            query=query_pi_auths,
+            # this one is the target for a $.show() when the query comes back
+            button_domid="topmenu-validation")
         # although the result does not matter, rendering is required for the JS init code to make it in the page
         # although the result does not matter, rendering is required for the JS init code to make it in the page
-        validatebutton.render(request)
+        topmenuvalidation.render(request)
 # end topmenu addition
 
         # variables that will get passed to the view-unfold1.html template
 # end topmenu addition
 
         # variables that will get passed to the view-unfold1.html template
similarity index 74%
rename from sample/validatebuttonview.py
rename to sample/topmenuvalidationview.py
index 5c861f7..4f33dda 100644 (file)
@@ -9,11 +9,11 @@ from unfold.page import Page
 
 from ui.topmenu import topmenu_items, the_user
 
 
 from ui.topmenu import topmenu_items, the_user
 
-from plugins.validatebutton import ValidateButton
+from plugins.topmenuvalidation import TopmenuValidation
 
 
-class ValidateButtonView (TemplateView):
+class TopmenuValidationView (TemplateView):
 
 
-    # mention a user name in the URL as .../trash/simplevalidatebutton/ple.inria.thierry_parmentelat
+    # mention a user name in the URL as .../trash/simpletopmenuvalidation/ple.inria.thierry_parmentelat
     def get (self, request, username='ple.inria.thierry_parmentelat'):
 
         if username=='logged': username='$user_hrn'
     def get (self, request, username='ple.inria.thierry_parmentelat'):
 
         if username=='logged': username='$user_hrn'
@@ -26,15 +26,16 @@ class ValidateButtonView (TemplateView):
         # even though this plugin does not have any html materialization, the corresponding domid
         # must exist because it is searched at init-time to create the JS plugin
         # so we simply piggy-back the target button here
         # even though this plugin does not have any html materialization, the corresponding domid
         # must exist because it is searched at init-time to create the JS plugin
         # so we simply piggy-back the target button here
-        validatebutton = ValidateButton (page=page, 
-                                         # see above
-                                         domid='topmenu-validation',
-                                         query=query_pi_auths,
-                                         # this one is the target for enabling when the query comes back
-                                         button_domid="topmenu-validation")
+        topmenuvalidation = TopmenuValidation (
+            page=page, 
+            # see above
+            domid='topmenu-validation',
+            query=query_pi_auths,
+            # this one is the target for enabling when the query comes back
+            button_domid="topmenu-validation")
         # there is a need to call render() for exposing the query and creating the js plugin
         # even though this returns an empty string
         # there is a need to call render() for exposing the query and creating the js plugin
         # even though this returns an empty string
-        validatebutton.render(request)
+        topmenuvalidation.render(request)
 
 
         # variables that will get passed to the view-unfold1.html template
 
 
         # variables that will get passed to the view-unfold1.html template
@@ -44,7 +45,7 @@ class ValidateButtonView (TemplateView):
         template_env ['unfold_main'] = '<h1>Some title </h1>'
         
         # more general variables expected in the template
         template_env ['unfold_main'] = '<h1>Some title </h1>'
         
         # more general variables expected in the template
-        template_env [ 'title' ] = 'simple validatebutton %(username)s'%locals()
+        template_env [ 'title' ] = 'simple topmenuvalidation %(username)s'%locals()
         # the menu items on the top
         template_env [ 'topmenu_items' ] = topmenu_items('Slice', request) 
         # so we can see who is logged
         # the menu items on the top
         template_env [ 'topmenu_items' ] = topmenu_items('Slice', request) 
         # so we can see who is logged
index 0d06e3e..2edfcd0 100644 (file)
@@ -25,7 +25,7 @@ from sample.views     import WebSocketsView, WebSockets2View
 
 import sample.querytableview
 import sample.querygridview
 
 import sample.querytableview
 import sample.querygridview
-import sample.validatebuttonview
+import sample.topmenuvalidationview
 
 urlpatterns = patterns(
     '',
 
 urlpatterns = patterns(
     '',
@@ -37,5 +37,5 @@ urlpatterns = patterns(
     url(r'^dashboard/?$',                                       'sample.dashboardview.dashboard_view'),
     url(r'^querytable/(?P<slicename>[\w\.]+)/?$',               sample.querytableview.QueryTableView.as_view()),
     url(r'^querygrid/(?P<slicename>[\w\.]+)/?$',                sample.querygridview.QueryGridView.as_view()),
     url(r'^dashboard/?$',                                       'sample.dashboardview.dashboard_view'),
     url(r'^querytable/(?P<slicename>[\w\.]+)/?$',               sample.querytableview.QueryTableView.as_view()),
     url(r'^querygrid/(?P<slicename>[\w\.]+)/?$',                sample.querygridview.QueryGridView.as_view()),
-    url(r'^validatebutton/(?P<username>[\w\._]+)/?$',           sample.validatebuttonview.ValidateButtonView.as_view()),
+    url(r'^topmenuvalidation/(?P<username>[\w\._]+)/?$',        sample.topmenuvalidationview.TopmenuValidationView.as_view()),
 )
 )
index d023878..c23adf7 100644 (file)
@@ -13,7 +13,7 @@ from manifold.core.query        import Query
 # , ..]
 
 # see also templates/widget-topmenu.html for how these items are put together
 # , ..]
 
 # see also templates/widget-topmenu.html for how these items are put together
-# and plugins/validatebutton for how this hident button is turned on when necessary
+# and plugins/topmenuvalidation for how this hident button is turned on when necessary
 
 # current: the beginning of the label in the menu that you want to outline
 def topmenu_items (current,request=None):
 
 # current: the beginning of the label in the menu that you want to outline
 def topmenu_items (current,request=None):
@@ -59,7 +59,7 @@ def topmenu_items (current,request=None):
 ####            result.append({'label':'Validation', 'href': '/portal/validate/'})
 ###        result.append({'label':'Validation', 'href': '/portal/validate/'})
         # always create a disabled button for validation, and let the 
 ####            result.append({'label':'Validation', 'href': '/portal/validate/'})
 ###        result.append({'label':'Validation', 'href': '/portal/validate/'})
         # always create a disabled button for validation, and let the 
-        # validatebutton plugin handle that asynchroneously, based on this domid
+        # topmenuvalidation plugin handle that asynchroneously, based on this domid
         result.append({'label':'Validation', 'href': '/portal/validate/', 'domid':'topmenu-validation', 'disabled':True})
         dropdown = []
         dropdown.append({'label':'Platforms', 'href': '/portal/platforms/'})
         result.append({'label':'Validation', 'href': '/portal/validate/', 'domid':'topmenu-validation', 'disabled':True})
         dropdown = []
         dropdown.append({'label':'Platforms', 'href': '/portal/platforms/'})