2013-11-20 07:29:58 +00:00
|
|
|
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
2013-08-05 09:29:54 +00:00
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
|
2012-07-19 08:10:31 +00:00
|
|
|
from __future__ import unicode_literals
|
2014-02-14 10:17:51 +00:00
|
|
|
import frappe
|
2014-04-04 10:56:45 +00:00
|
|
|
from frappe.utils import cint
|
2012-02-29 09:41:06 +00:00
|
|
|
|
2014-02-14 10:17:51 +00:00
|
|
|
@frappe.whitelist()
|
2012-02-29 09:41:06 +00:00
|
|
|
def get_feed(arg=None):
|
2014-04-04 10:56:45 +00:00
|
|
|
"""get feed"""
|
2014-03-03 10:21:13 +00:00
|
|
|
roles = frappe.get_roles()
|
2014-02-26 07:05:33 +00:00
|
|
|
return frappe.db.sql("""select
|
2012-02-29 09:41:06 +00:00
|
|
|
distinct t1.name, t1.feed_type, t1.doc_type, t1.doc_name, t1.subject, t1.owner,
|
|
|
|
t1.modified
|
|
|
|
from tabFeed t1, tabDocPerm t2
|
|
|
|
where t1.doc_type = t2.parent
|
2014-03-03 10:21:13 +00:00
|
|
|
and t2.role in (%s)
|
2013-01-02 11:16:35 +00:00
|
|
|
and t2.permlevel = 0
|
2012-02-29 09:41:06 +00:00
|
|
|
and ifnull(t2.`read`,0) = 1
|
|
|
|
order by t1.modified desc
|
2014-04-04 10:56:45 +00:00
|
|
|
limit %s, %s""" % (','.join(['%s']*len(roles)), '%s', '%s'),
|
|
|
|
tuple(roles + [cint(frappe.form_dict['limit_start']), cint(frappe.form_dict['limit_page_length'])]),
|
|
|
|
as_dict=1)
|