View to see legacy events.
776547
def legacy_events_view(request):
    
    events = TeacherEvent.objects.all()
    event_count = events.count()
    paginator = Paginator(events, 100)

    page = request.GET.get('page')
    try:
        events = paginator.page(page)
    except PageNotAnInteger:
        events = paginator.page(1)
    except EmptyPage:
        events = paginator.page(paginator.num_pages)
    return render_to_response(
        'teacher_events.html',
        {'page_name': "Legacy Events",
         'events': events,
         'event_count': event_count,},
        context_instance=RequestContext(request)
    )
293732
public function from_legacy_event_to_data(\calendar_event $legacyevent) {
        $legacyevent->count_repeats();
        $data = $legacyevent->properties();
        $data->timedurationuntil = $legacyevent->timestart + $legacyevent->timeduration;
        $data->duration = (empty($legacyevent->timeduration)) ? 0 : 1;

        if ($legacyevent->eventtype == 'group') {
            // Set up the correct value for the to display on the form.
            $data->groupid = $legacyevent->groupid;
            $data->groupcourseid = $legacyevent->courseid;
        }
        if ($legacyevent->eventtype == 'course') {
            // Set up the correct value for the to display on the form.
            $data->courseid = $legacyevent->courseid;
        }
        $data->description = [
            'text' => $data->description,
            'format' => $data->format
        ];

        // We don't want to return the context because it's not a
        // form value and breaks the validation.
        if (isset($data->context)) {
            unset($data->context);
        }

        return $data;
    }
737976
function (fn) {
    var self = this;

    var evtCount = 0;
    var eventQueue = [];
    var eventQueueHandling = false;

    var errs = [];
    var doneCalled = false;
    var doneClb = null;

    var revisionMap = {};
    var collections = {};

    var lastEvent;

    var seenEvents = {};

    var replay = function (evt) {
      var evtId = dotty.get(evt, self.definition.id);
      lastEvent = evt;
      var concatenatedId;
      if (!!self.definition.revision && dotty.exists(evt, self.definition.revision) &&
        !!self.definition.aggregateId && dotty.exists(evt, self.definition.aggregateId)) {
        concatenatedId = self.getConcatenatedId(evt);
        revisionMap[concatenatedId] = dotty.get(evt, self.definition.revision);
      }

      var concatenatedWithEventId = evtId;
      if (concatenatedId) concatenatedWithEventId = concatenatedId + ':' + evtId;
      if (seenEvents[concatenatedWithEventId]) return;
      seenEvents[concatenatedWithEventId] = true;

      var target = self.dispatcher.getTargetInformation(evt);

      var viewBuilders = [], foundPrioSet = false;

      _.each(self.dispatcher.tree.getViewBuilders(target), function (vb) {
        if (!vb.collection.noReplay) {
          viewBuilders.push(vb);

          if (!foundPrioSet && vb.priority < Infinity) {
            foundPrioSet = true;
          }

          if (!collections[vb.collection.workerId]) {
            vb.collection.isReplaying = true;
            collections[vb.collection.workerId] = vb.collection;
          }
        }
      });

      if (foundPrioSet) {
        _.each(viewBuilders, function (vb) {
          eventQueue.push({event: evt, viewBuilders: [vb]});
          evtCount++;
        });
      } else {
        eventQueue.push({event: evt, viewBuilders: viewBuilders});
        evtCount += viewBuilders.length;
      }

      function handleNext () {
        if (evtCount <= 0 && doneCalled) {
          doneLater();
          return;
        }

        if (eventQueue.length > 0) {
          var task = eventQueue.shift();
          var e = task.event, vbs = task.viewBuilders;

          async.series([
            function (clb) {
              var preEventExtender = self.dispatcher.tree.getPreEventExtender(self.dispatcher.getTargetInformation(e));
              if (!preEventExtender) return clb(null);
              preEventExtender.extend(e, function (err, extEvt) {
                if (err) return clb(err);
                e = extEvt || e;
                clb(null);
              });
            },
            function (clb) {
              async.each(vbs, function (vb, callback) {
                vb.denormalize(e, function (err) {
                  --evtCount;
                  if (err) {
                    debug(err);
                    errs.push(err);
                  }

                  callback();
                });
              }, clb);
            }
          ], function () {
            handleNext();
          });
        } else if (eventQueueHandling) {
          eventQueueHandling = false;
        }
      }

      if (!eventQueueHandling) {
        eventQueueHandling = true;
        process.nextTick(handleNext);
      }
    };

    function doneLater() {
      if (doneCalled) {
        done(doneClb);
      }
    }

    var done = function (callback) {
      if (evtCount > 0) {
        doneCalled = true;
        doneClb = callback;
        return;
      }

      async.parallel([
        function (callback) {
          async.each(_.values(collections), function (col, callback) {
            col.saveReplayingVms(callback);
          }, callback);
        },
        function (callback) {
          self.updateRevision(revisionMap, callback);
        },
        function (callback) {
          self.store.saveLastEvent(lastEvent, callback);
        }
      ], function (err) {
        seenEvents = {};

        if (err) {
          debug(err);
          errs.push(err);
        }

        if (errs.length === 0) {
          if (callback) {
            callback(null);
          }
          return;
        }

        if (callback) {
          callback(errs);
        }
      });
    };

    fn(replay, done);
  }
718898
protected void onDataSetStaleEvent(@Observes DataSetStaleEvent event) {
        DataSetDef def = event.getDataSetDef();
        if (DataSetProviderType.BEAN.equals(def.getProvider())) {
            staticDataSetProvider.removeDataSet(def.getUUID());
        }
    }
871109
def event_table(events):
    """"""
    table = formatting.Table([
        "Id",
        "Start Date",
        "End Date",
        "Subject",
        "Status",
        "Acknowledged",
        "Updates",
        "Impacted Resources"
    ], title="Upcoming Events")
    table.align['Subject'] = 'l'
    table.align['Impacted Resources'] = 'l'
    for event in events:
        table.add_row([
            event.get('id'),
            utils.clean_time(event.get('startDate')),
            utils.clean_time(event.get('endDate')),
            # Some subjects can have \r\n for some reason.
            utils.clean_splitlines(event.get('subject')),
            utils.lookup(event, 'statusCode', 'name'),
            event.get('acknowledgedFlag'),
            event.get('updateCount'),
            event.get('impactedResourceCount')
        ])
    return table
876805
def _dispatch_legacy_subscriber(self, obj, *args, **kwargs):
    """"""
    if obj in self._legacy_subscribers:
      self._legacy_subscribers[obj](obj)
1024260
def user_view_events(self) -> List[str]:
        """"""
        return [event_type for event_type, event in self.items if event.get_event_action()
                == event_actions.VIEWED]
62779
def use_plenary_family_view(self):
        """"""
        self._family_view = PLENARY
        # self._get_provider_session('family_lookup_session') # To make sure the session is tracked
        for session in self._get_provider_sessions():
            try:
                session.use_plenary_family_view()
            except AttributeError:
                pass
862906
public static final function restore_legacy($legacy) {
        $classname = get_called_class();
        /** @var base $event */
        $event = new $classname();
        $event->restored = true;
        $event->triggered = true;
        $event->dispatched = true;

        $context = false;
        $component = 'legacy';
        if ($legacy->cmid) {
            $context = \context_module::instance($legacy->cmid, IGNORE_MISSING);
            $component = 'mod_'.$legacy->module;
        } else if ($legacy->course) {
            $context = \context_course::instance($legacy->course, IGNORE_MISSING);
        }
        if (!$context) {
            $context = \context_system::instance();
        }

        $event->data = array();

        $event->data['eventname'] = $legacy->module.'_'.$legacy->action;
        $event->data['component'] = $component;
        $event->data['action'] = $legacy->action;
        $event->data['target'] = null;
        $event->data['objecttable'] = null;
        $event->data['objectid'] = null;
        if (strpos($legacy->action, 'view') !== false) {
            $event->data['crud'] = 'r';
        } else if (strpos($legacy->action, 'print') !== false) {
            $event->data['crud'] = 'r';
        } else if (strpos($legacy->action, 'update') !== false) {
            $event->data['crud'] = 'u';
        } else if (strpos($legacy->action, 'hide') !== false) {
            $event->data['crud'] = 'u';
        } else if (strpos($legacy->action, 'move') !== false) {
            $event->data['crud'] = 'u';
        } else if (strpos($legacy->action, 'write') !== false) {
            $event->data['crud'] = 'u';
        } else if (strpos($legacy->action, 'tag') !== false) {
            $event->data['crud'] = 'u';
        } else if (strpos($legacy->action, 'remove') !== false) {
            $event->data['crud'] = 'u';
        } else if (strpos($legacy->action, 'delete') !== false) {
            $event->data['crud'] = 'p';
        } else if (strpos($legacy->action, 'create') !== false) {
            $event->data['crud'] = 'c';
        } else if (strpos($legacy->action, 'post') !== false) {
            $event->data['crud'] = 'c';
        } else if (strpos($legacy->action, 'add') !== false) {
            $event->data['crud'] = 'c';
        } else {
            // End of guessing...
            $event->data['crud'] = 'r';
        }
        $event->data['edulevel'] = $event::LEVEL_OTHER;
        $event->data['contextid'] = $context->id;
        $event->data['contextlevel'] = $context->contextlevel;
        $event->data['contextinstanceid'] = $context->instanceid;
        $event->data['userid'] = ($legacy->userid ? $legacy->userid : null);
        $event->data['courseid'] = ($legacy->course ? $legacy->course : null);
        $event->data['relateduserid'] = ($legacy->userid ? $legacy->userid : null);
        $event->data['timecreated'] = $legacy->time;

        $event->logextra = array();
        if ($legacy->ip) {
            $event->logextra['origin'] = 'web';
            $event->logextra['ip'] = $legacy->ip;
        } else {
            $event->logextra['origin'] = 'cli';
            $event->logextra['ip'] = null;
        }
        $event->logextra['realuserid'] = null;

        $event->data['other'] = (array)$legacy;

        return $event;
    }
1011202
def show(self):
        """"""
        for entry in self._entries:
            print "{'%s': %s, 'records': %s}" % (
                entry._record_type, entry.host, entry.records)
        print
547127
def events_mark_seen(self, event):
        
        last_seen = event if isinstance(event, int) else event.id
        self.client.post('{}/seen'.format(Event.api_endpoint), model=Event(self.client, last_seen))
330595
def showEvent(self, event):
        
        super(XWalkthroughWidget, self).showEvent(event)
        
        self.autoLayout()
        self.restart()
        self.setFocus()
        self.raise_()
17980
def recentEvents(self):
        '''
        
        '''
        return Event.objects.filter(
            Q(pk__in=self.individualEvents.values_list('pk',flat=True)) |
            Q(session__in=self.eventSessions.all()) |
            Q(publicevent__category__in=self.eventCategories.all()) |
            Q(series__category__in=self.seriesCategories.all())
        ).filter(
            Q(startTime__lte=timezone.now() + timedelta(days=60)) &
            Q(endTime__gte=timezone.now() - timedelta(days=60))
        )
1356804
protected void onDataSetStaleEvent(@Observes DataSetStaleEvent event) {
        DataSetDef def = event.getDataSetDef();
        if (DataSetProviderType.SQL.equals(def.getProvider())) {
            String uuid = def.getUUID();
            staticDataSetProvider.removeDataSet(uuid);
        }
    }
891872
def events(self):
        
        if not self.event_reflector:
            return []

        events = []
        for event in self.event_reflector.events:
            if event.involved_object.name != self.pod_name:
                # only consider events for my pod name
                continue

            if self._last_event and event.metadata.uid == self._last_event:
                # saw last_event marker, ignore any previous events
                # and only consider future events
                # only include events *after* our _last_event marker
                events = []
            else:
                events.append(event)
        return events
794367
def on_show_mainframe(self, event):
        
        self.parent.Enable()
        self.parent.Show()
        self.parent.Raise()
1226437
private void dispatchLegacyEventIfNeeded(ManagerEvent event)
    {
        if (event instanceof DialBeginEvent)
        {
            DialEvent legacyEvent = new DialEvent((DialBeginEvent) event);
            dispatchEvent(legacyEvent);
        }
    }