<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <div class="moz-cite-prefix">On 05/21/2014 06:04 PM, wenwang wrote:<br>
    </div>
    <blockquote cite="mid:537C7A1E.1050703@linux.vnet.ibm.com"
      type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      Nice job!<br>
      <br>
      But there still exists 2 minor issues that you might want to fix:<br>
      <br>
      1) The 'Generate Time' Changes to the current time after renaming,
      which I think better be the time that user generated the file.<br>
    </blockquote>
    ACK. Will send a patch. File creation time API is platform
    dependent, maybe we need use the modification time instead of change
    time in current implement.<br>
    <blockquote cite="mid:537C7A1E.1050703@linux.vnet.ibm.com"
      type="cite"> 2) List is not ordered after renaming. I think it's
      better be sorted by generate time. <br>
    </blockquote>
    ACK.<br>
    <blockquote cite="mid:537C7A1E.1050703@linux.vnet.ibm.com"
      type="cite"> <img alt=""
        src="cid:part1.04080107.00030707@linux.vnet.ibm.com"
        height="434" width="899"><br>
      <br>
      Best Regards<br>
      <br>
      Wang Wen<br>
      <br>
      <br>
      <br>
      <br>
      <div class="moz-cite-prefix">On 05/21/2014 05:09 PM, Hongliang
        Wang wrote:<br>
      </div>
      <blockquote
        cite="mid:1400663358-5607-6-git-send-email-hlwang@linux.vnet.ibm.com"
        type="cite">
        <pre wrap="">Added rename page including HTML, CSS, and JS.

Signed-off-by: Hongliang Wang <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:hlwang@linux.vnet.ibm.com">&lt;hlwang@linux.vnet.ibm.com&gt;</a>
---
 ui/css/theme-default/report-rename.css | 22 ++++++++++++++
 ui/js/src/kimchi.report_rename_main.js | 39 +++++++++++++++++++++++++
 ui/pages/report-rename.html.tmpl       | 53 ++++++++++++++++++++++++++++++++++
 3 files changed, 114 insertions(+)
 create mode 100644 ui/css/theme-default/report-rename.css
 create mode 100644 ui/js/src/kimchi.report_rename_main.js
 create mode 100644 ui/pages/report-rename.html.tmpl

diff --git a/ui/css/theme-default/report-rename.css b/ui/css/theme-default/report-rename.css
new file mode 100644
index 0000000..959d577
--- /dev/null
+++ b/ui/css/theme-default/report-rename.css
@@ -0,0 +1,22 @@
+#report-rename-window {
+    height: 300px;
+    width: 400px;
+}
+
+#report-rename-window .field {
+    font-size: 12px;
+}
+
+#report-name-textbox {
+    -moz-box-sizing: border-box;
+    box-sizing: border-box;
+    margin: .5em 0;
+    width: 100%;
+}
+
+#button-report-rename[disabled] {
+    background: #c0c0c0 url(../../images/theme-default/loading.gif) 7px
+                center no-repeat;
+    color: #DDD;
+    prenameing-left: 26px;
+}
diff --git a/ui/js/src/kimchi.report_rename_main.js b/ui/js/src/kimchi.report_rename_main.js
new file mode 100644
index 0000000..3bb5020
--- /dev/null
+++ b/ui/js/src/kimchi.report_rename_main.js
@@ -0,0 +1,39 @@
+kimchi.report_rename_main = function() {
+    var renameReportForm = $('#form-report-rename');
+    var submitButton = $('#button-report-rename');
+    var nameTextbox = $('input[name="name"]', renameReportForm);
+    var submitForm = function(event) {
+        if(submitButton.prop('disabled')) {
+            return false;
+        }
+        var reportName = nameTextbox.val();
+        var validator = RegExp("^[A-Za-z0-9-]*$");
+        if (!validator.test(reportName)) {
+            kimchi.message.error.code('KCHDR6011M');
+            return false;
+        }
+        var formData = renameReportForm.serializeObject();
+        submitButton.prop('disabled', true);
+        nameTextbox.prop('disabled', true);
+        kimchi.renameReport(kimchi.selectedReport, formData, function(result) {
+            kimchi.window.close();
+            kimchi.topic('kimchi/debugReportRenamed').publish({
+                result: result
+            });
+        }, function(result) {
+            var errText = result &amp;&amp;
+                result['responseJSON'] &amp;&amp;
+                result['responseJSON']['reason'];
+            kimchi.message.error(errText);
+            submitButton.prop('disabled', false);
+            nameTextbox.prop('disabled', false).focus();
+        });
+
+        event.preventDefault();
+    };
+
+    renameReportForm.on('submit', submitForm);
+    submitButton.on('click', submitForm);
+
+    nameTextbox.val(kimchi.selectedReport).select();
+};
diff --git a/ui/pages/report-rename.html.tmpl b/ui/pages/report-rename.html.tmpl
new file mode 100644
index 0000000..7fab0b6
--- /dev/null
+++ b/ui/pages/report-rename.html.tmpl
@@ -0,0 +1,53 @@
+#*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2013
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *#
+#unicode UTF-8
+#import gettext
+#from kimchi.cachebust import href
+#silent t = gettext.translation($lang.domain, $lang.localedir, languages=$lang.lang)
+#silent _ = t.gettext
+#silent _t = t.gettext
+&lt;!DOCTYPE html&gt;
+&lt;div id="report-rename-window" class="window"&gt;
+    &lt;header&gt;
+        &lt;h1 class="title"&gt;$_("Rename a Debug Report")&lt;/h1&gt;
+        &lt;div class="close"&gt;X&lt;/div&gt;
+    &lt;/header&gt;
+    &lt;div class="content"&gt;
+        &lt;form id="form-report-rename"&gt;
+            &lt;section class="form-section"&gt;
+                &lt;h2&gt;
+                    &lt;label for="report-name-textbox"&gt;$_("Report Name")&lt;/label&gt;
+                &lt;/h2&gt;
+                &lt;div class="field"&gt;
+                    &lt;span&gt;
+                        $_("The name used to identify the report. Name can contain: letters, digits and hyphen (\"-\").")
+                    &lt;/span&gt;
+                    &lt;input type="text" class="text" id="report-name-textbox" name="name" /&gt;
+                &lt;/div&gt;
+            &lt;/section&gt;
+        &lt;/form&gt;
+    &lt;/div&gt;
+    &lt;footer&gt;
+        &lt;div class="btn-group"&gt;
+            &lt;button id="button-report-rename" class="btn-normal"&gt;&lt;span class="text"&gt;$_("Submit")&lt;/span&gt;&lt;/button&gt;
+        &lt;/div&gt;
+    &lt;/footer&gt;
+&lt;/div&gt;
+&lt;script&gt;
+    kimchi.report_rename_main();
+&lt;/script&gt;
</pre>
      </blockquote>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Kimchi-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Kimchi-devel@ovirt.org">Kimchi-devel@ovirt.org</a>
<a class="moz-txt-link-freetext" href="http://lists.ovirt.org/mailman/listinfo/kimchi-devel">http://lists.ovirt.org/mailman/listinfo/kimchi-devel</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>