class TimelineBox(object): ''' This plugin is similar to the TimelineMessage object with the only difference that it generates a box wrapping the text. ''' def __init__(self, box_type, box_class, format_string, *item_names): self.message = TimelineMessage(format_string, *item_names) self.boxtype = box_type self.box_class = box_class def render(self, item): box_fmt = BoxType._box_formats[self.boxtype] if self.box_class != None and self.boxtype in [BoxType.TYPE_DIV]: rendered = box_fmt.render(self.box_class, self.message.construct_message(item)) else: rendered = box_fmt.format(self.message.construct_message(item)) return rendered
class TimelineBox(object): ''' This plugin is similar to the TimelineMessage object with the only difference that it generates a box wrapping the text. ''' def __init__(self, box_type, box_class, format_string, *item_names): self.message = TimelineMessage( format_string, *item_names ) self.boxtype = box_type self.box_class = box_class def render(self, item): box_fmt = BoxType._box_formats[self.boxtype] if self.box_class != None and self.boxtype in [ BoxType.TYPE_DIV ]: rendered = box_fmt.render(self.box_class, self.message.construct_message(item)) else: rendered = box_fmt.format(self.message.construct_message(item)) return rendered
You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' from TimelineDefn import TimelineDefn, TimelineTitle, DataQueryCatalog from TimelineDefn import TimelineMessage from TimelinePlugins.TimelineBox import TimelineBox, BoxType from Catalog import Catalog timeline = [ TimelineDefn( TimelineTitle("Call", "fa-phone"), DataQueryCatalog(Catalog.CATALOG_COMMS, "telephony.calls", "date", "type", "name", "number", "duration"), "date", [ TimelineMessage(u"{} call from {} ({})", "type", "name", "number"), TimelineMessage(u"Duration: {}", "duration") ]), TimelineDefn( TimelineTitle("SMS", "fa-comment"), DataQueryCatalog(Catalog.CATALOG_COMMS, "telephony.sms_messages", "date", "date_send", "status", "type", "address", "seen", "body"), "date", [ TimelineMessage(u"{} SMS Message from/to {}", "type", "address"), TimelineMessage(u"Message Status: {}", "status"), TimelineMessage(u"Content:") ], [TimelineBox(BoxType.TYPE_TEXTBOX, None, u"{}", "body")]), TimelineDefn( TimelineTitle("Website Visit", "fa-globe"), DataQueryCatalog(Catalog.CATALOG_NETWORKING,
def __init__(self, box_type, box_class, format_string, *item_names): self.message = TimelineMessage( format_string, *item_names ) self.boxtype = box_type self.box_class = box_class
def __init__(self, box_type, box_class, format_string, *item_names): self.message = TimelineMessage(format_string, *item_names) self.boxtype = box_type self.box_class = box_class