fixed GUI
[myslice.git] / portal / templates / reputation.html
index c690f77..d30d2f9 100644 (file)
@@ -8,8 +8,6 @@
 \r
 <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}/css/onelab.css" />\r
 \r
-\r
-\r
 <!-- Reputation Specific -->\r
 <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}reputation_static/css/main.css" />\r
 \r
          </div>\r
          <div id="tabs-2">\r
                <h1>Experiment Evaluation</h1>\r
-               <p><b>List of your unrated experiments</b></p><div id="slicelist">\r
+               <p><b>List of your unrated experiments</b></p>\r
+               <div style=" width: 70% !important" id="slicelist">\r
                        \r
                        {% for aslice in slicelist %}\r
-                       <h3>Slice <b>{{ aslice.slice_hrn }}</b></h3>\r
+                               <h3>Slice <b>{{ aslice.slice_hrn }}</b></h3>\r
                        <div style="padding-bottom:0;padding-top:0;">\r
                            <ul><li>\r
                                    experiment from <b>{{ aslice.start_t }}</b> to <b>{{ aslice.end_t }}</b> | <a href="#" class="rate_button" data-resid={{ aslice.id }}>Rate it</a>\r
 <div id="scoreform" style="display:none">\r
     <ol>\r
         <li>\r
-            How was your overall experience with NETMODE Testbed? \r
+            <span>How was your overall experience with this Testbed?</span> \r
             <div id="q1">\r
             </div>\r
         </li>\r
             </div>\r
         </li>\r
         <li>\r
-            Would you use NETMODE testbed again?\r
+            Would you use this testbed again?\r
             <div id="q4">\r
                 <input type="radio" name="q4" value="1" />Yes\r
                 <input type="radio" name="q4" value="0" />No\r
 \r
 <script type="text/javascript">\r
 \r
+serv_per_tb = jQuery.parseJSON('{{ serv_per_tb|safe }}');\r
 \r
 $(function() {\r
        $( "#tabs" ).tabs();\r
@@ -238,8 +238,6 @@ $(function() {
 \r
 var data = jQuery.parseJSON('{{ json_data|safe }}');\r
 \r
-\r
-\r
 var resid = -1;\r
 var q1 = -1;\r
 var q2 = -1;\r
@@ -267,7 +265,7 @@ function initDialog() {
 \r
         $("a[data-resid='"+resid+"']").css("text-decoration", "line-through").unbind("click").removeAttr("href");\r
 \r
-        //TODO: check input if valid before submitting\r
+        //TODO: validate input before submitting\r
 \r
         sum = q1 + q2 + q3 + q4 + q5 + q6 + q7 +q8;\r
 \r
@@ -282,10 +280,11 @@ function initDialog() {
                                        slicedata = (data[event]);\r
                                }       \r
                        }\r
+                       \r
                        slicedata["user_eval"] = {'overall':q1, 'problems':q2, 'support':q3, 'reuse':q4, 'pay':q5, 'availability':q6, 'link_quality':q7, 'quality':q8};\r
                        testbeds_str = JSON.stringify(slicedata['testbeds'])\r
                        delete slicedata['testbeds'];\r
-            console.log(JSON.stringify(slicedata))\r
+            //console.log(JSON.stringify(slicedata))\r
                         \r
             $.ajax({\r
                    type: "GET",\r
@@ -360,7 +359,7 @@ $(function() {
     });\r
 \r
     initDialog();\r
-       \r
+               \r
     clone = $("#scoreform").clone(true);\r
 \r
     $(".rate_button").click(function() {\r
@@ -370,9 +369,43 @@ $(function() {
         q4 = -1;\r
         q5 = -1;\r
         q6 = -1;\r
-       q7 = -1;\r
-       q8 = -1;\r
-        resid = $(this).attr("data-resid");        \r
+               q7 = -1;\r
+               q8 = -1;\r
+        resid = $(this).attr("data-resid"); \r
+        \r
+        slicedata = {};\r
+       for(var event in data){\r
+                       if ((data[event]).id == resid) {\r
+                               slicedata = (data[event]);\r
+                       }       \r
+               }       \r
+\r
+               srv_arr = []            \r
+        for (var tb in slicedata["testbeds"]){ \r
+               for (var srv in serv_per_tb[tb]){ \r
+                       if (srv != 'equals') {\r
+                               //console.log(serv_per_tb[tb][srv]); \r
+                               srv_arr.push(serv_per_tb[tb][srv]) \r
+                       } \r
+               } \r
+        }     \r
+        \r
+        cq1 = "overall";\r
+        cq6 = "availability";\r
+        cq7 = "link_quality";\r
+        \r
+        q_to_remove = []\r
+        \r
+        if ($.inArray(cq1, srv_arr) == -1 ){\r
+               $("#scoreform > ol").children(':eq('+0+')').remove();\r
+        } \r
+        if ($.inArray(cq6, srv_arr) == -1 ){\r
+               $("#scoreform > ol").children(':eq('+5+')').remove();\r
+        } \r
+               if ($.inArray(cq7, srv_arr) == -1 ){\r
+               $("#scoreform > ol").children(':eq('+6+')').remove();\r
+        } \r
+        \r
         $("#scoreform").dialog({\r
             title: "Rate experiment",\r
             width: 500,\r