Confirm announcement
512387
def mail_confirm?
      if mailto
        return true if force?
        to  = [mailto].flatten.join(", ")
        ans = ask("Announce to #{to} [(v)iew (y)es (N)o]? ")
        case ans.downcase
        when 'y', 'yes'
          true
        when 'v', 'view'
          puts "From: #{from}"
          puts "To: #{to}"
          puts "Subject: #{subject}"
          puts
          puts message
          mail_confirm?
        else
          false
        end
      end
    end
640708
public static function announce()
    {
        //  Fetch the blogs, each blog should have its own admin nav grouping
        $oCi =& get_instance();
        $oCi->load->model('blog/blog_model');
        $oCi->load->model('blog/blog_post_model');
        $aBlogs = $oCi->blog_model->getAll();

        $aOut = array();

        if (!empty($aBlogs)) {

            foreach ($aBlogs as $oBlog) {

                if (!userHasPermission('admin:blog:post:' . $oBlog->id . ':manage')) {

                    continue;
                }

                //  Clear group naming
                $sGroupLabel = count($aBlogs) > 1 ? 'Blog: ' . $oBlog->label : $oBlog->label;

                //  Any draft posts?
                $iNumDrafts = $oCi->blog_post_model->countDrafts($oBlog->id);
                $oAlert = Factory::factory('NavAlert', 'nails/module-admin');
                $oAlert->setValue($iNumDrafts);
                $oAlert->setLabel('Drafts');

                //  Post name
                $postNamePlural = appSetting('postNamePlural', 'blog-' . $oBlog->id);
                if (empty($postNamePlural)) {
                    $postNamePlural = 'posts';
                }

                //  Create the navGrouping
                $oNavGroup = Factory::factory('Nav', 'nails/module-admin');
                $oNavGroup->setLabel($sGroupLabel);
                $oNavGroup->setIcon('fa-pencil-square-o');
                $oNavGroup->addAction(
                    'Manage ' . ucFirst($postNamePlural),
                    'index/' . $oBlog->id,
                    array($oAlert),
                    0
                );

                $aOut[] = $oNavGroup;
            }
        }

        return $aOut;
    }
531911
def insertAnnouncement(self, announcement):
        
        url = announcement.get('url', None)
        try:
            peers.Peer(url)
        except:
            raise exceptions.BadUrlException(url)
        try:
            # TODO get more details about the user agent
            models.Announcement.create(
                url=announcement.get('url'),
                attributes=json.dumps(announcement.get('attributes', {})),
                remote_addr=announcement.get('remote_addr', None),
                user_agent=announcement.get('user_agent', None))
        except Exception as e:
            raise exceptions.RepoManagerException(e)
1373243
def edit_announcement_view(request, announcement_pk):
    '''  '''
    announce = get_object_or_404(Announcement, pk=announcement_pk)
    profile = UserProfile.objects.get(user=request.user)
    if not (announce.incumbent == profile or request.user.is_superuser):
        return HttpResponseRedirect(
            reverse('managers:view_announcement', kwargs={"announcement_pk": announcement_pk}),
            )
    page_name = "Edit Announcement"

    announcement_form = AnnouncementForm(
        request.POST or None,
        instance=announce,
        profile=profile,
        editing=True,
        )
    if announcement_form.is_valid():
        announcement_form.save(request)
        return HttpResponseRedirect(
            reverse('managers:view_announcement', kwargs={"announcement_pk": announcement_pk}),
            )

    return render_to_response('edit_announcement.html', {
        'page_name': page_name,
        'announcement_form': announcement_form,
        }, context_instance=RequestContext(request))
585336
function(title, message) {
            if (!message) {
                message = title;
                title = null;
            }

            return Dialogs.open(null, {
                "title": title,
                "message": message,
                "dialog": "confirm"
            });
        }
226954
public function confirmed()
    {
        $this->confirmed = true;
        $this->confirmed_at = Carbon::now();
        $this->save();
    }
186778
def confirm_operation(prompt, prefix=None, assume_yes=False, err=False):
    """"""
    if assume_yes:
        return True

    prefix = prefix or click.style(
        "Are you %s certain you want to" % (click.style("absolutely", bold=True))
    )

    prompt = "%(prefix)s %(prompt)s?" % {"prefix": prefix, "prompt": prompt}

    if click.confirm(prompt, err=err):
        return True

    click.echo(err=err)
    click.secho("OK, phew! Close call. :-)", fg="green", err=err)
    return False
347622
public void confirmationPresent(double seconds) {
        try {
            double timeTook = popup(seconds);
            checkConfirmationPresent(seconds, timeTook);
        } catch (TimeoutException e) {
            checkConfirmationPresent(seconds, seconds);
        }
    }
790519
function cmd_confirm(args, done) {
    var seneca = this
    var why
    var userent = seneca.make(user_canon)

    userent.load$({ confirmcode: args.code }, function(err, user) {
      if (err) return done(err)

      if (user) {
        if (user.active) {
          user.confirmed = true
          user.save$(function(err, user) {
            if (err) return done(err)
            done(null, { ok: true, user: user })
          })
        } else {
          seneca.log.debug(
            'confirm/fail',
            (why = 'not-active'),
            args.code,
            user
          )
          return done(null, { ok: false, why: why, user: user })
        }
      } else {
        seneca.log.debug(
          'confirm/fail',
          (why = 'invalid-code'),
          args.code,
          user
        )
        return done(null, { ok: false, why: why })
      }
    })
  }
386026
def add_announcement_view(request):
    """"""
    if request.method == "POST":
        form = AnnouncementForm(request.POST)
        logger.debug(form)
        if form.is_valid():
            obj = form.save()
            obj.user = request.user
            # SAFE HTML
            obj.content = safe_html(obj.content)
            obj.save()
            announcement_posted_hook(request, obj)
            messages.success(request, "Successfully added announcement.")
            return redirect("index")
        else:
            messages.error(request, "Error adding announcement")
    else:
        form = AnnouncementForm()
    return render(request, "announcements/add_modify.html", {"form": form, "action": "add"})
655310
def event_confirmation(self, date, time, pid, commerce_id, transaction_id, request_ip, order_id):
        '''
        '''
        raise NotImplementedError("Logging Handler must implement event_confirmation")
143772
public void confirm(final int title, final int message,
                        final DialogInterface.OnClickListener onClickListener) {
        final AlertDialog.Builder builder = new AlertDialog.Builder(
                getContext());
        builder.setTitle(title).setIcon(android.R.drawable.ic_dialog_info).setMessage(message);
        builder.setPositiveButton(android.R.string.ok,
                new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(final DialogInterface dialog,
                                        final int which) {
                        if (onClickListener != null) {
                            onClickListener.onClick(dialog, which);
                        }

                    }
                });
        builder.setNegativeButton(android.R.string.cancel,
                new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(final DialogInterface dialog,
                                        final int which) {
                        if (onClickListener != null) {
                            onClickListener.onClick(dialog, which);
                        }
                    }
                });
        builder.show();
    }
568510
def approve_announcement_view(request, req_id):
    
    req = get_object_or_404(AnnouncementRequest, id=req_id)

    requested_teachers = req.teachers_requested.all()
    logger.debug(requested_teachers)
    if request.user not in requested_teachers:
        messages.error(request, "You do not have permission to approve this announcement.")
        return redirect("index")

    if request.method == "POST":
        form = AnnouncementRequestForm(request.POST, instance=req)
        if form.is_valid():
            obj = form.save(commit=True)
            # SAFE HTML
            obj.content = safe_html(obj.content)
            obj.save()
            if "approve" in request.POST:
                obj.teachers_approved.add(request.user)
                obj.save()
                if not obj.admin_email_sent:
                    if settings.SEND_ANNOUNCEMENT_APPROVAL:
                        admin_request_announcement_email(request, form, obj)
                    obj.admin_email_sent = True
                    obj.save()

                return redirect("approve_announcement_success")
            else:
                obj.save()
                return redirect("approve_announcement_reject")

    form = AnnouncementRequestForm(instance=req)
    context = {"form": form, "req": req, "admin_approve": False}
    return render(request, "announcements/approve.html", context)
168935
public void acceptConfirmation() {
        String action = "Clicking 'OK' on a confirmation";
        String expected = "Confirmation is present to be clicked";
        if (isNotConfirmation(action, expected)) {
            return;
        }
        accept(action, expected, "confirmation");
    }
1086438
public static function announce()
    {
        $oNavGroup = Factory::factory('Nav', 'nails/module-admin');
        $oNavGroup->setLabel('Settings');
        $oNavGroup->setIcon('fa-wrench');

        if (userHasPermission('admin:cdn:settings:*')) {
            $oNavGroup->addAction('CDN');
        }

        return $oNavGroup;
    }
1240158
def ask_confirmation(prompt = 'Continue?', default = false)
      a = ''
      s = default ? '[Y/n]' : '[y/N]'
      d = default ? 'y' : 'n'
      until %w[y n].include? a
        a = ask("#{prompt} #{s} ") { |q| q.limit = 1; q.case = :downcase }
        a = d if a.length.zero?
      end
      a == 'y'
    end
1001737
def admin_request_announcement_email(request, form, obj):
    

    subject = "News Post Approval Needed ({})".format(obj.title)
    emails = [settings.APPROVAL_EMAIL]
    base_url = request.build_absolute_uri(reverse('index'))
    data = {
        "req": obj,
        "formdata": form.data,
        "info_link": request.build_absolute_uri(reverse("admin_approve_announcement", args=[obj.id])),
        "base_url": base_url
    }
    email_send("announcements/emails/admin_approve.txt", "announcements/emails/admin_approve.html", data, subject, emails)