Skip to content

Commit

Permalink
Merge branch 'master' of github.com:codesharp/cooper
Browse files Browse the repository at this point in the history
  • Loading branch information
sunleepy committed Aug 9, 2012
2 parents 80a29cd + 44659da commit d5174e6
Show file tree
Hide file tree
Showing 15 changed files with 321 additions and 116 deletions.
Binary file removed cooper.zip
Binary file not shown.
21 changes: 17 additions & 4 deletions src/ConfigFiles/CooperWeb/properties.config
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,20 @@
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F456565c04215b679919c4672e6b5805b' type='text/javascript'%3E%3C/script%3E"));
</script>
</div>
<script type="text/javascript">
var _gauges = _gauges || [];
(function() {
var t = document.createElement('script');
t.type = 'text/javascript';
t.async = true;
t.id = 'gauges-tracker';
t.setAttribute('data-site-id', '502109e8613f5d523600000f');
t.src = '//secure.gaug.es/track.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(t, s);
})();
</script>
</div>
]]>
</zhcn_web_analysis>
<zhcn_do_not_login_or_timeout>还未登录或登录超时</zhcn_do_not_login_or_timeout>
Expand Down Expand Up @@ -95,8 +108,8 @@
<zhcn_priority_upcoming>稍后完成</zhcn_priority_upcoming>
<zhcn_priority_later>迟些再说</zhcn_priority_later>
<zhcn_priority_title>指定任务希望在何时处理</zhcn_priority_title>
<zhcn_duetime>截止日期</zhcn_duetime>
<zhcn_sort_by_duetime>按截止日期排序</zhcn_sort_by_duetime>
<zhcn_dueTime>截止日期</zhcn_dueTime>
<zhcn_sort_by_dueTime>按截止日期排序</zhcn_sort_by_dueTime>
<zhcn_share_to>分享到</zhcn_share_to>
<zhcn_sync>同步</zhcn_sync>
<zhcn_sync_to>同步至日历</zhcn_sync_to>
Expand All @@ -122,7 +135,7 @@
<zhcn_task_deleted>个任务已删除,</zhcn_task_deleted>
<zhcn_revoke>撤销</zhcn_revoke>
<zhcn_by_priority_title>以优先级排序方式查看任务</zhcn_by_priority_title>
<zhcn_by_duetime_title>以截止时间排序查看任务</zhcn_by_duetime_title>
<zhcn_by_dueTime_title>以截止时间排序查看任务</zhcn_by_dueTime_title>
<zhcn_lose_conn>与Cooper失去连接</zhcn_lose_conn>
<zhcn_retry_lose_conn>请您稍后再试...</zhcn_retry_lose_conn>
<zhcn_can_not_edit_others_task>抱歉,不能编辑其他人的任务</zhcn_can_not_edit_others_task>
Expand Down
2 changes: 1 addition & 1 deletion src/Cooper.Model.Test/TaskTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void LastUpdateTime()
Assert.AreEqual(task.LastUpdateTime, old);
task.SetBody(string.Empty);
Assert.Greater(task.LastUpdateTime, old);
//duetime
//dueTime
old = task.LastUpdateTime;
this.Idle();
task.SetDueTime(null);
Expand Down
6 changes: 3 additions & 3 deletions src/Cooper.Web/Controllers/PersonalController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public ActionResult MobileDetail(string id)
public ActionResult MobileDetail(string id
, string subject
, string body
, string duetime
, string dueTime
, string priority
, string isCompleted)
{
Expand All @@ -103,7 +103,7 @@ public ActionResult MobileDetail(string id
task.SetSubject(subject);
task.SetBody(body);
DateTime time;
task.SetDueTime(DateTime.TryParse(duetime, out time) ? time : new DateTime?());
task.SetDueTime(DateTime.TryParse(dueTime, out time) ? time : new DateTime?());
int p;
task.SetPriority((Priority)(int.TryParse(priority, out p) ? p : 0));
bool c;
Expand Down Expand Up @@ -396,7 +396,7 @@ private Sort[] ParseSortsByDueTime(Account account, Sort[] sorts, params TaskInf
{
Sort due, today, upcoming, later;
due = sorts.FirstOrDefault(o => o.Key == "dueTime") ?? new Sort() { By = "", Key = "dueTime" };
due.Name = this.Lang().sort_by_duetime;
due.Name = this.Lang().sort_by_dueTime;
today = sorts.FirstOrDefault(o => o.Key == "0") ?? new Sort() { By = "priority", Key = "0" };
today.Name = this.Lang().priority_today;
upcoming = sorts.FirstOrDefault(o => o.Key == "1") ?? new Sort() { By = "priority", Key = "1" };
Expand Down
13 changes: 8 additions & 5 deletions src/Cooper.Web/Scripts/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Task.prototype = {
renderRow: function () {
this.setCompleted(this.isCompleted());
this.setPriority(this.priority());
this.setDueTime(this.dueTime());
this.setDueTime(this.due());
},
renderDetail: function () {
if (!this.$el_detail)
Expand All @@ -64,7 +64,7 @@ Task.prototype = {
this.setDetail_Completed(this.isCompleted());
this.setDetail_Subject(this.subject());
this.setDetail_Priority(this.priority());
this.setDetail_DueTime(this.dueTime());
this.setDetail_DueTime(this.due());
this.setDetail_Body(this.get('body'));
//设置url快捷链接区域 临时方案
var $urls = this.$el_detail.find('#urls');
Expand Down Expand Up @@ -129,8 +129,9 @@ Task.prototype = {
id: function () { return this.get('id'); },
isCompleted: function () { return this.get('isCompleted') },
priority: function () { return this.get('priority') },
dueTime: function () { return this.get('dueTime'); },
due: function () { return this.get('dueTime'); },
subject: function () { return this.get('subject'); },
body: function () { return this.get('body'); },
///////////////////////////////////////////////////////////////////////////////
//属性以及ui设置
setId: function (i) {
Expand Down Expand Up @@ -169,8 +170,10 @@ Task.prototype = {
this.setDetail_Priority(p);
},
setDueTime: function (t) {
var k = 'duetime';
var $e = this._getRowEl(k);
var k = 'dueTime';
//为避免与detail区域的input#deuTime重复id,而导致jqdatepicker异常
//https://github.com/codesharp/cooper/issues/41
var $e = this._getRowEl(k + 'Label');
if (t == undefined || t == null) {
this.update(k, null);
$e.html('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
Expand Down
19 changes: 15 additions & 4 deletions src/Cooper.Web/Scripts/task_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ UI_List_Common.prototype = {
deletes: null, //上一次任务删除记录
deletes_timer: null, //删除恢复期间的定时器
deletes_timer2: null, //删除恢复期间的定时器
detail_timer: null, //详情区域渲染延时timer
detail_timer_enable: true, //为unittest而设计的属性
//常用任务属性
today: '0',
upcoming: '1',
Expand Down Expand Up @@ -64,10 +66,19 @@ UI_List_Common.prototype = {
},
//详情区域渲染
_renderDetail: function ($r) {
var t = this.getTask($r);
this.$wrapper_detail.empty().append(t.renderDetail());
//额外修正一些由于未append导致的显示问题
t.fixDetail();
if (this.detail_timer)
clearTimeout(this.detail_timer);
var base = this;
var fn = function () {
var t = base.getTask($r);
base.$wrapper_detail.empty().append(t.renderDetail());
//额外修正一些由于未append导致的显示问题
t.fixDetail();
}
if (this.detail_timer_enable)
this.detail_timer = setTimeout(fn, 100); //增加timer延迟优化性能
else
fn();
},
_renderBatchDetail: function ($rows) {
if (!this.$batchDetail)
Expand Down
18 changes: 9 additions & 9 deletions src/Cooper.Web/Scripts/task_due.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
///<reference path="task.js" />
///<reference path="task_common.js" />

//根据duetime排序任务列表UI模式
//根据dueTime排序任务列表UI模式
var UI_List_Due = function () { }
UI_List_Due.prototype = new UI_List_Common();
UI_List_Due.prototype.mode = 'ByDueTime';
Expand All @@ -27,8 +27,8 @@ UI_List_Due.prototype.renderByDueTime = function (b) {
var idx = this.byDueTime.indexs();
for (var i = 0; i < idx.length; i++) {
for (var j = idx.length - 1; j > 0; j--) {
var r = this.getTaskById(idx[j]).dueTime().getTime();
var l = this.getTaskById(idx[j - 1]).dueTime().getTime();
var r = this.getTaskById(idx[j]).due().getTime();
var l = this.getTaskById(idx[j - 1]).due().getTime();
if (r < l) {
var temp = idx[j - 1];
idx[j - 1] = idx[j];
Expand Down Expand Up @@ -60,15 +60,15 @@ UI_List_Due.prototype.onPrepareBinds = function () {
var $actives = base.getActives();

if (ctrl) {
//针对duetime排序区域将上下移动行为调整为dueTime变更
//针对dueTime排序区域将上下移动行为调整为dueTime变更
//仅支持单个
if ((!up && !down)
|| $actives.length != 1
|| $focus == null
|| !base._isDueTimeRow($focus)) return;

var task = base.getTask($focus);
var dueTime = task.dueTime();
var dueTime = task.due();
var day = 86400000;
if (up)
dueTime = addDay(dueTime, -1);
Expand All @@ -77,8 +77,8 @@ UI_List_Due.prototype.onPrepareBinds = function () {
task.setDueTime(dueTime);
//优化 避免重新排序
var arr = base._findNextAndPrev($focus);
var prev = arr[0] == null ? null : base.getTask(arr[0]).dueTime();
var next = arr[1] == null ? null : base.getTask(arr[1]).dueTime();
var prev = arr[0] == null ? null : base.getTask(arr[0]).due();
var next = arr[1] == null ? null : base.getTask(arr[1]).due();
if ((prev == null || prev.getTime() <= dueTime) && (next == null || next.getTime() >= dueTime))
return false;
//重排序
Expand All @@ -89,7 +89,7 @@ UI_List_Due.prototype.onPrepareBinds = function () {
}
});
}
//批量变更duetime时
//批量变更dueTime时
UI_List_Due.prototype.onDueTimeBatchChange = function (tasks, t) {
for (var i = 0; i < tasks.length; i++)
if (this._isDueTimeRow(tasks[i].el())) {
Expand Down Expand Up @@ -137,7 +137,7 @@ UI_List_Due.prototype.appendTask = function (p) {
var active = this.getTask($row);
this._appendTaskToRow($row, t, active);

var dueTime = active.dueTime();
var dueTime = active.due();
if (dueTime != null) {
t.setDueTime(dueTime);
this.byDueTime.flush();
Expand Down
1 change: 1 addition & 0 deletions src/Cooper.Web/Scripts/task_row.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ UI_List_Common.prototype._fireRowClick = function ($r, c, s) {
this.setActive($r);
this.focusRow($r);
this.$focusRow = $r;

//详情呈现
var $actives = this.getActives();
if ($actives.length == 1)
Expand Down
10 changes: 7 additions & 3 deletions src/Cooper.Web/Scripts/taskpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,18 +289,22 @@
//global event bind
$('.flag_continueDelete').click(continueDelete);
$('.flag_cancelDelete').click(cancelDelete);

$('.flag_byPriority').click(byPriority);
$('.flag_byDueTime').click(byDueTime);

$('.flag_openTasklists').click(openTasklists);
$('.flag_addTasklist').click(function () { doAddTasklist(this); });
$('.flag_removeTasklist').click(doRemoveTasklist);

$('.flag_archiveTasks').click(archiveTasks);
$('.flag_hideArchive').click(hideArchive);
$('.flag_showArchive').click(showArchive);

$('.flag_toggleTasks').click(toggleTasks);
$('.flag_appendTask').click(appendTask);
$('.flag_deleteTask').click(deleteTask);
$('.flag_addTasklist').click(function () { doAddTasklist(this); });
$('.flag_removeTasklist').click(doRemoveTasklist);


$.ajaxSetup({
cache: false,
error: function (x, e) {
Expand Down
Loading

0 comments on commit d5174e6

Please sign in to comment.