[from now] 2012/05/31 20:17:16

diff --git a/src/main/java/org/ryu22e/nico2cal/model/MyCalendarLog.java b/src/main/java/org/ryu22e/nico2cal/model/MyCalendarLog.java
index 1b56f28..e2b2883 100644
--- a/src/main/java/org/ryu22e/nico2cal/model/MyCalendarLog.java
+++ b/src/main/java/org/ryu22e/nico2cal/model/MyCalendarLog.java
@@ -41,6 +41,11 @@ public final class MyCalendarLog implements Serializable {
     /**
      *
      */
+    private String calendarId;
+
+    /**
+     *
+     */
     private ModelRef<Nicolive> nicolive =
             new ModelRef<Nicolive>(Nicolive.class);

@@ -96,6 +101,20 @@ public final class MyCalendarLog implements Serializable {
         this.user = user;
     }

+    /**
+     * @return the calendarId
+     */
+    public String getCalendarId() {
+        return calendarId;
+    }
+
+    /**
+     * @param calendarId the calendarId to set
+     */
+    public void setCalendarId(String calendarId) {
+        this.calendarId = calendarId;
+    }
+
     public ModelRef<Nicolive> getNicolive() {
         return nicolive;
     }
diff --git a/src/main/java/org/ryu22e/nico2cal/service/CalendarService.java b/src/main/java/org/ryu22e/nico2cal/service/CalendarService.java
index d29a6ed..de68520 100644
--- a/src/main/java/org/ryu22e/nico2cal/service/CalendarService.java
+++ b/src/main/java/org/ryu22e/nico2cal/service/CalendarService.java
@@ -418,6 +418,7 @@ public class CalendarService {
                             .query(ml)
                             .filter(
                                 ml.user.equal(myCalendar.getUser()),
+                                ml.calendarId.equal(myCalendar.getCalendarId()),
                                 ml.nicolive.equal(nicolive.getKey()))
                             .count();
                 if (count <= 0) {
@@ -464,6 +465,7 @@ public class CalendarService {
                     // インポートしたNicoliveをmyCalendarLogに登録して、二度とインポートしないようにする。
                     MyCalendarLog myCalendarLog = new MyCalendarLog();
                     myCalendarLog.setUser(myCalendar.getUser());
+                    myCalendarLog.setCalendarId(myCalendar.getCalendarId());
                     myCalendarLog.getNicolive().setModel(nicolive);
                     Datastore.putAsync(myCalendarLog);
                 }
diff --git a/src/test/java/org/ryu22e/nico2cal/service/CalendarServiceTest.java b/src/test/java/org/ryu22e/nico2cal/service/CalendarServiceTest.java
index cd99f94..c2c2a05 100644
--- a/src/test/java/org/ryu22e/nico2cal/service/CalendarServiceTest.java
+++ b/src/test/java/org/ryu22e/nico2cal/service/CalendarServiceTest.java
@@ -646,7 +646,12 @@ public final class CalendarServiceTest extends AppEngineTestCase {

         MyCalendarLogMeta ml = MyCalendarLogMeta.get();
         List<MyCalendarLog> myCalendarLogs =
-                Datastore.query(ml).filter(ml.user.equal(user)).asList();
+                Datastore
+                    .query(ml)
+                    .filter(
+                        ml.user.equal(user),
+                        ml.calendarId.equal("calendar1"))
+                    .asList();
         assertThat(myCalendarLogs, is(notNullValue()));
         assertThat(myCalendarLogs.size(), is(10));
         List<Key> storedKeys = new ArrayList<Key>();
diff --git a/war/WEB-INF/appengine-generated/datastore-indexes-auto.xml b/war/WEB-INF/appengine-generated/datastore-indexes-auto.xml
index 26b278f..8696f83 100644
--- a/war/WEB-INF/appengine-generated/datastore-indexes-auto.xml
+++ b/war/WEB-INF/appengine-generated/datastore-indexes-auto.xml
@@ -1,4 +1,4 @@
-<!-- Indices written at Tue, 29 May 2012 23:23:52 JST -->
+<!-- Indices written at Thu, 31 May 2012 18:53:25 JST -->

 <datastore-indexes/>

diff --git a/war/css/global.css b/war/css/global.css
index 1774c5f..ad79f64 100644
--- a/war/css/global.css
+++ b/war/css/global.css
@@ -8,4 +8,9 @@ body {
 .twitter-share-button {
   margin-top: 10px;
   margin-left: 10px;
+}
+
+input.caldav-url {
+  cursor: auto;
+  background-color: #ffffff;
 }
\ No newline at end of file
diff --git a/war/js/nico2ical.js b/war/js/nico2ical.js
index da785c5..8adc85c 100644
--- a/war/js/nico2ical.js
+++ b/war/js/nico2ical.js
@@ -39,6 +39,15 @@ $(function () {

     var CalendarSummaries = function(params) {
         this.selectedValue = ko.observable(params.selectedValue);
+        this.caldavUrlThunderbirdLightning = ko.computed(
+                function() {
+                    if (0 < this.selectedValue().length) {
+                        return 'https://www.google.com/calendar/dav/' + this.selectedValue() + '/events';
+                    } else {
+                        return '';
+                    }
+                },
+                this);
         this.keywords = ko.observable(params.keywords);
         this.isSaveSuccess = ko.observable(false);
         this.isSavaError = ko.observable(false);
@@ -46,6 +55,12 @@ $(function () {
         this.isEnableButton = function() {
             return 0 < this.selectedValue().length;
         }.bind(this);
+        this.caldavUrlicalSelected = function() {
+            $('#caldav-url-ical').select();
+        }.bind(this);
+        this.caldavUrlThunderbirdLightningSelected = function() {
+            $('#caldav-url-thunderbird-lightning').select();
+        }.bind(this);
         this.updateCalendar = function() {
             var s = this;
             s.isSaveSuccess(false);
diff --git a/war/myCalendar/index.jsp b/war/myCalendar/index.jsp
index 96844ee..6461496 100644
--- a/war/myCalendar/index.jsp
+++ b/war/myCalendar/index.jsp
@@ -1,3 +1,5 @@
+<%@page import="com.google.appengine.api.users.UserServiceFactory"%>
+<%@page import="com.google.appengine.api.users.User"%>
 <%@page import="org.slim3.util.ServletContextLocator"%>
 <%@page pageEncoding="UTF-8" isELIgnored="false"%>
 <c:import url="/layout.jsp">
@@ -46,6 +48,36 @@
                     </c:if>
                   </div><!-- /.controls -->
                 </div><!-- /.control-group -->
+                <div class="control-group" data-bind="if: selectedValue">
+                    <label class="control-label">
+                      CalDAVサポート用のURLは以下の通り（CalDAVサポートについては<a target="_blank" href="http://support.google.com/calendar/bin/answer.py?hl=ja&answer=99357">こちら</a>を参照）。
+                    </label>
+                    <div class="controls">
+                      <label class="control-label" for="caldav-url-ical">iCal用</label>
+                      <div class="input-append">
+                        <%
+                          String email = UserServiceFactory.getUserService().getCurrentUser().getEmail();
+                          request.setAttribute("email", email);
+                        %>
+                        <input id="caldav-url-ical"
+                               class="caldav-url input-xlarge"
+                               type="text"
+                               data-bind="hasfocus: caldavUrlicalSelected, click: caldavUrlicalSelected"
+                               readonly="readonly"
+                               value="https://www.google.com/calendar/dav/${f:h(email)}/user" />
+                        <input type="button" value="Copy" />
+                      </div>
+                    </div><!-- /.controls -->
+                    <div class="controls">
+                      <label class="control-label" for="">Thunderbird/Lightning用</label>
+                      <input id="caldav-url-thunderbird-lightning"
+                             class="caldav-url input-xlarge"
+                             type="text"
+                             data-bind="value: caldavUrlThunderbirdLightning, hasfocus: caldavUrlThunderbirdLightningSelected, click: caldavUrlThunderbirdLightningSelected"
+                             readonly="readonly" />
+                      <input type="button" value="Copy" />
+                    </div><!-- /.controls -->
+                </div><!-- /.control-group -->
               </fieldset>
               <fieldset>
                 <legend>インポート条件</legend>
[from now] 2012/05/31 20:24:34

diff --git a/war/js/nico2ical.js b/war/js/nico2ical.js
index 8adc85c..0334e31 100644
--- a/war/js/nico2ical.js
+++ b/war/js/nico2ical.js
@@ -38,6 +38,7 @@ $(function () {
     });

     var CalendarSummaries = function(params) {
+        var self = this;
         this.selectedValue = ko.observable(params.selectedValue);
         this.caldavUrlThunderbirdLightning = ko.computed(
                 function() {
@@ -62,9 +63,8 @@ $(function () {
             $('#caldav-url-thunderbird-lightning').select();
         }.bind(this);
         this.updateCalendar = function() {
-            var s = this;
-            s.isSaveSuccess(false);
-            s.isSavaError(false);
+            self.isSaveSuccess(false);
+            self.isSavaError(false);
             $('#save-calendar').button('loading');
             $('#mycalendar-tab a').attr('data-disabled', 'true');
             var disabledInputs = $('#form-settings input:not(disabled)');
@@ -76,16 +76,16 @@ $(function () {
                         dataType: 'json',
                         data: {
                             'csrftoken': $.cookie('csrftoken'),
-                            'keywords': s.keywords().split(' '),
+                            'keywords': self.keywords().split(' '),
                             'calendarId': this.selectedValue()
                             }
                     }
             ).success(function(data) {
                 $('#save-calendar').button('complete');
-                s.isSaveSuccess(true);
+                self.isSaveSuccess(true);
             }).error(function(xhr, textStatus, errorThrown) {
                 $('#save-calendar').button('error');
-                s.isSavaError(true);
+                self.isSavaError(true);
             }).complete(function() {
                 $('#mycalendar-tab a').removeAttr('data-disabled');
                 disabledInputs.removeAttr('disabled');
@@ -94,7 +94,7 @@ $(function () {
         this.disConnectCalendar = function() {
             var s = this;
             if (confirm('実行すると連携が解除されます。よろしいですか？')) {
-                s.isDisconnectError(false);
+                self.isDisconnectError(false);
                 $('#disconnect-calendar').button('loading');
                 $('#mycalendar-tab a').attr('data-disabled', 'true');
                 $.ajax(
@@ -112,7 +112,7 @@ $(function () {
                     $('#nav-mycalendar-settings').hide();
                 }).error(function(xhr, textStatus, errorThrown) {
                     $('#disconnect-calendar').addClass('btn-danger').button('error');
-                    s.isDisconnectError(true);
+                    self.isDisconnectError(true);
                 }).complete(function() {
                     $('#mycalendar-tab a').removeAttr('data-disabled');
                 });
[from now] 2012/05/31 20:26:50

diff --git a/war/js/nico2ical.js b/war/js/nico2ical.js
index 0334e31..163e609 100644
--- a/war/js/nico2ical.js
+++ b/war/js/nico2ical.js
@@ -92,7 +92,6 @@ $(function () {
             });
         }.bind(this);
         this.disConnectCalendar = function() {
-            var s = this;
             if (confirm('実行すると連携が解除されます。よろしいですか？')) {
                 self.isDisconnectError(false);
                 $('#disconnect-calendar').button('loading');
[from now] 2012/05/31 20:28:37

diff --git a/war/js/nico2ical.js b/war/js/nico2ical.js
index 163e609..c444869 100644
--- a/war/js/nico2ical.js
+++ b/war/js/nico2ical.js
@@ -40,15 +40,6 @@ $(function () {
     var CalendarSummaries = function(params) {
         var self = this;
         this.selectedValue = ko.observable(params.selectedValue);
-        this.caldavUrlThunderbirdLightning = ko.computed(
-                function() {
-                    if (0 < this.selectedValue().length) {
-                        return 'https://www.google.com/calendar/dav/' + this.selectedValue() + '/events';
-                    } else {
-                        return '';
-                    }
-                },
-                this);
         this.keywords = ko.observable(params.keywords);
         this.isSaveSuccess = ko.observable(false);
         this.isSavaError = ko.observable(false);
@@ -56,12 +47,6 @@ $(function () {
         this.isEnableButton = function() {
             return 0 < this.selectedValue().length;
         }.bind(this);
-        this.caldavUrlicalSelected = function() {
-            $('#caldav-url-ical').select();
-        }.bind(this);
-        this.caldavUrlThunderbirdLightningSelected = function() {
-            $('#caldav-url-thunderbird-lightning').select();
-        }.bind(this);
         this.updateCalendar = function() {
             self.isSaveSuccess(false);
             self.isSavaError(false);
diff --git a/war/myCalendar/index.jsp b/war/myCalendar/index.jsp
index 6461496..d6c6180 100644
--- a/war/myCalendar/index.jsp
+++ b/war/myCalendar/index.jsp
@@ -48,36 +48,6 @@
                     </c:if>
                   </div><!-- /.controls -->
                 </div><!-- /.control-group -->
-                <div class="control-group" data-bind="if: selectedValue">
-                    <label class="control-label">
-                      CalDAVサポート用のURLは以下の通り（CalDAVサポートについては<a target="_blank" href="http://support.google.com/calendar/bin/answer.py?hl=ja&answer=99357">こちら</a>を参照）。
-                    </label>
-                    <div class="controls">
-                      <label class="control-label" for="caldav-url-ical">iCal用</label>
-                      <div class="input-append">
-                        <%
-                          String email = UserServiceFactory.getUserService().getCurrentUser().getEmail();
-                          request.setAttribute("email", email);
-                        %>
-                        <input id="caldav-url-ical"
-                               class="caldav-url input-xlarge"
-                               type="text"
-                               data-bind="hasfocus: caldavUrlicalSelected, click: caldavUrlicalSelected"
-                               readonly="readonly"
-                               value="https://www.google.com/calendar/dav/${f:h(email)}/user" />
-                        <input type="button" value="Copy" />
-                      </div>
-                    </div><!-- /.controls -->
-                    <div class="controls">
-                      <label class="control-label" for="">Thunderbird/Lightning用</label>
-                      <input id="caldav-url-thunderbird-lightning"
-                             class="caldav-url input-xlarge"
-                             type="text"
-                             data-bind="value: caldavUrlThunderbirdLightning, hasfocus: caldavUrlThunderbirdLightningSelected, click: caldavUrlThunderbirdLightningSelected"
-                             readonly="readonly" />
-                      <input type="button" value="Copy" />
-                    </div><!-- /.controls -->
-                </div><!-- /.control-group -->
               </fieldset>
               <fieldset>
                 <legend>インポート条件</legend>
[from now] 2012/05/31 20:29:56

diff --git a/war/js/nico2ical.js b/war/js/nico2ical.js
index c444869..34f2ff4 100644
--- a/war/js/nico2ical.js
+++ b/war/js/nico2ical.js
@@ -45,7 +45,7 @@ $(function () {
         this.isSavaError = ko.observable(false);
         this.isDisconnectError = ko.observable(false);
         this.isEnableButton = function() {
-            return 0 < this.selectedValue().length;
+            return 0 < self.selectedValue().length;
         }.bind(this);
         this.updateCalendar = function() {
             self.isSaveSuccess(false);
@@ -62,7 +62,7 @@ $(function () {
                         data: {
                             'csrftoken': $.cookie('csrftoken'),
                             'keywords': self.keywords().split(' '),
-                            'calendarId': this.selectedValue()
+                            'calendarId': self.selectedValue()
                             }
                     }
             ).success(function(data) {