Commits

huhuchen  committed e510b4c Merge

fix

  • Participants
  • Parent commits 8b6d0a4, b739d42
  • Branches realfex_20120227_hero_new

Comments (0)

Files changed (7)

File config/vps.py

 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
-BASE_PATH = "/mnt/nova/xen"
+BASE_PATH = "/mnt/data/xen"
 NBD_DEVICE = "/dev/nbd6"
 

File ctrl/j/__init__.py

 from model.zsite import user_can_reply
 from ctrl.zsite.wall import post_reply
 from model.buzz import mq_buzz_follow_new
+from model.cid import CID_TAG
+from model.zsite_fav import zsite_fav_new, zsite_fav_rm
 
 @urlmap('/j/login')
 class Login(Base):
         zsite = Zsite.mc_get(id)
 
         if zsite:
-            follow_new(current_user_id, id)
-            mq_buzz_follow_new(current_user_id, id)
+            cid = zsite.cid
+            if cid == CID_TAG:
+                zsite_fav_new(zsite, current_user_id)                
+            else:
+                follow_new(current_user_id, id)
+                mq_buzz_follow_new(current_user_id, id)
+
+@urlmap('/j/follow/rm/(\d+)')
+class FollowRm(JLoginBase):
+    def get(self, id):
+        current_user_id = self.current_user_id
+
+        zsite = Zsite.mc_get(id)
+        if zsite:
+            cid = zsite.cid
+            if cid == CID_TAG:
+                zsite_fav_rm(zsite, current_user_id)
+            else:
+                follow_rm(current_user_id, id)
+
+        self.finish('{}')
+
+
 
 @urlmap('/j/follow/reply/(\d+)')
 class FollowRm(JLoginBase):
             self.finish('{}')
 
 
-@urlmap('/j/follow/rm/(\d+)')
-class FollowRm(JLoginBase):
-    def get(self, id):
-        current_user_id = self.current_user_id
-
-        zsite = Zsite.mc_get(id)
-        if zsite:
-            follow_rm(current_user_id, id)
-
-        self.finish('{}')

File htm/ctrl/zsite/index/tag.htm

 
         <div id="tagbar">\
 <span class="xatxt">\
+<a class="xa fav_txt" id="follow_a${zsite_id}" href="javascript:follow_a(${zsite_id});void(0)">\
             %if is_faved:
-<a class="xa fav_txt" href="javascript:void(0)" >遗忘</a>\
+淡忘\
             %else:
-<a class="xa fav_txt" href="javascript:void(0)" >关注</a>\
+关注\
             %endif
+</a>\
 <a class="xa" href="javascript:void(0)">投递</a>\
 <a class="xa" href="javascript:void(0)">提问</a>\
 </span>\

File misc/vps/create_vm.py

     _create_raw_image (swap_path, "mkswap", swap_size)
 
     vm_config_content = """
+kernel = "%s/kernel/kernel-3.2.1-r2-domu"
 name = "%s"
 maxmem = %d
 memory = %d
 vcpus = 1
-kernel = "/mnt/nova/xen/kernel/kernel-3.2.1-r2-domu"
 root = "/dev/xvda1 ro"
 extra="xencons=xvc0 console=tty" 
 on_poweroff = "destroy"
 vnclisten = "0.0.0.0"
 disk = [ "tap:qcow:%s,xvda1,w", "tap:aio:%s,xvdb1,w", "tap:aio:%s,xvdc1,w"]
 vif = ["bridge=br0"]
-""" % (vm_name, mem_size, mem_size, disk1_path, disk2_path, swap_path)
+""" % (base_path, vm_name, mem_size, mem_size, disk1_path, disk2_path, swap_path)
     f = open (config_path, "w+")
     try:
         f.write (vm_config_content)

File model/feed_import.py

 if __name__ == '__main__':
     pass
     for i in FeedImport.where(zsite_id=ZSITE_UCD_CHINA_ID):
-        print i.title
+        print i.rid
         #i.delete()
     #for i in FeedImport.where("state>%s"%FEED_IMPORT_STATE_INIT):
     #    i.state=FEED_IMPORT_STATE_WITHOUT_TAG

File model/zsite_fav.py

 
 def zsite_fav_rm(zsite, owner_id):
     fav = zsite_fav_get(zsite, owner_id)
-    if fav.state <= STATE_ACTIVE:
+    if fav and fav.state <= STATE_ACTIVE:
         zsite_list_rm(
             zsite.id,
             owner_id,

File static/js/ctrl.js

 
 CANNOT_REPLY = '<div class="fancyban"><p>抱歉 ...</p><p>为了维护讨论的气氛</p><p>未认证用户不能发言</p><p><a href="/i/verify">点此补充您的资料吧</a></p></div>'
 
+
 function follow_a(id) {
 	var a = $("#follow_a" + id),
 	text = a.html(),
 	follow_rm = "淡忘";
 	if (text == follow) {
 		text = follow_rm;
-		fancybox = $.fancybox;
-		fancybox({
-			content: '<form id="follow_reply" class="fancyreply"><h3>你好 ...</h3><textarea name="txt"></textarea><div class="btns"><span class="btnw"><button class="btn" type="submit">此致 , 敬礼 !</button></span><span id="follow_secret_span"><input type="checkbox" name="secret" id="follow_reply_secret"><label for="follow_reply_secret">私语</label></span></div></form>',
-			onComplete: function() {
-				var reply = $("#follow_reply"),
-				textarea = reply.find('textarea');
-				reply.submit(function() {
-					var txt = $.trim(textarea.val());
-					if (txt && txt.length) {
-						fancybox.showActivity()
-						$.postJSON("/j/follow/reply/" + id, {
-							'txt': txt
-						},
-						function(r) {
-							if (r.can_not_reply) {
-								fancybox({
-									content: CANNOT_REPLY
-								})
-							} else {
-								fancybox.close()
-							}
-						})
-					} else {
-						fancybox.close()
-					}
-					return false
-				})
-				textarea.focus()
-			}
-		})
 	} else {
-        if(confirm("取消关注 , 确定 ?")){
-    		text = follow;
-	    	url += "/rm"
-        }
+        text = follow;
+        url += "/rm"
 	}
 	$.postJSON(url + "/" + id)
 	a.html(text)