Show detail of one record.  Format of html & js should be supported.

 === Permission
 ModelPermission::READ on this controller is required.
547438
def show
      @record = user_scoped.find(params[:id])
     #add_topic_path
      respond_to do |format|
        format.html {
          prepare_list
          @search = page_info.record
          render :action=>'index'
        }
        format.js
      end
    end
1159371
def show
      respond_to do |format|
        format.html { render @page.template if @page.template.present? }
        format.json { render json: @page }
      end
    end
480647
def get_permission(context, method, *args, **kwargs):
    
    request = context.get('request', None)
    perm_handler = request.forum_permission_handler if request else PermissionHandler()

    allowed_methods = inspect.getmembers(perm_handler, predicate=inspect.ismethod)
    allowed_method_names = [a[0] for a in allowed_methods if not a[0].startswith('_')]

    if method not in allowed_method_names:
        raise template.TemplateSyntaxError(
            'Only the following methods are allowed through '
            'this templatetag: {}'.format(allowed_method_names))

    perm_method = getattr(perm_handler, method)
    return perm_method(*args, **kwargs)
980510
def perform_permissions_check(self, user, obj, perms):
        
        return self.request.forum_permission_handler.can_edit_post(obj, user)
353364
def entry_detail(request, slug, template='djournal/entry_detail.html'):
    ''''''

    entry = get_object_or_404(Entry.public, slug=slug)

    context = {
        'entry': entry,
    }

    return render_to_response(
        template,
        context,
        context_instance=RequestContext(request),
    )
66950
def generate_detail_view(self):
        """"""

        name = model_class_form(self.model + 'DetailView')
        detail_args = dict(
            detailview_excludes=self.detailview_excludes,
            model=self.get_model_class,
            template_name=self.get_template('detail'),
            login_required=self.check_login_required,
            permissions=self.view_permission('detail'),
            inlineformset=self.inlineformset,
            permission_required=self.check_permission_required,
            custom_postfix_url=self.custom_postfix_url
        )

        detail_class = type(name, (BaseDetailViewMixin, DetailView), detail_args)
        self.classes[name] = detail_class
        return detail_class
1370783
def _populate_permissions(resources, content_type_id):
    
    from django.contrib.auth.models import Permission
    # read the whole auth_permission table into memory
    db_perms = [perm.codename for perm in Permission.objects.all()]

    for resource in resources:
        # get all resource's permissions that are not already in db
        perms = [perm for perm in resource.access_controller.get_perm_names(resource) if perm not in db_perms]
        for perm in perms:
            _save_new_permission(perm, content_type_id)
305814
function beforeRead (controller, args, forms, queryArgs) {
    // load records
    return loadRecord(controller, args, queryArgs).then(res => {
        // if no forms then return response
        if (!defined(forms)) {
            return res
        }
        // build forms for record
        return buildForms(args, controller, forms, res[controller.model.name])
        // merge forms to res which will go to args
        .then(forms => {
            res.forms = forms
            // return response with instance and forms
            return res
        })
    })
}
1224906
function(res, method, model, options) {
		// parse non-document responses
		if (res._id == null && res._rev == null) {
			// write result
			if (method !== "read") return { _id: res.id, _rev: res.rev };

			// view result
			if (res.rows != null) {
				if (isCollection(model)) return res.rows.map(function(row) {
					return row[options.rowKey];
				});

				// grab just the first row for models
				return res.rows.length ? res.rows[0][options.rowKey] : null;
			}

			// changes feed result
			if (res[options.rowKey] != null) return res[options.rowKey];
		}

		return res;
	}
874846
def handleHTML(self, record):
        
        # Create a unique file name to identify where this HTML source is coming from
        fileName = datetime.today().strftime("Neolib %Y-%m-%d %H-%M-%S ") + record.module + ".html"
        
        # Sometimes module may encase the text with < > which is an invalid character for a file name
        fileName = fileName.replace("<", "").replace(">", "")
        
        # Grab the pg
        pg = record.args['pg']
        
        # Format a log message that details the page
        ret = "Message: " + record.msg + "\nLine Number: " + str(record.lineno) + "\nURL: " + str(pg.url) + "\nPost Data: " + str(pg.postData) + "\nAdditional Vars: " + str(pg.vars)
        ret += "\n\n\n" + str(pg.header) + "\n\n" + pg.content
        
        # Write the file
        f = open(fileName, "w", encoding='utf-8')
        f.write(ret)
        f.close()
1155445
def _view(self, request, extra_context=None):
        
        if not self.has_permission(request.user):
            raise PermissionDenied

        return self.view(request, self.construct_context(request))
295816
def obtain_the_content(check = nil)
    	post = obtain_record(check)
    	render :inline => prep_content(post).html_safe if !post.blank?
    end
92878
def show
      @page = @element.page
      @options = params[:options]

      respond_to do |format|
        format.html
        format.js { @container_id = params[:container_id] }
      end
    end
449436
public function pagePermissionsAction()
    {

        $view = new ViewModel();
        //fixes rendering site's header and footer in the dialog
        $view->setTerminal(true);

        /** @var \Rcm\Entity\Site $currentSite */
        $currentSite = $this->getServiceLocator()->get(
            \Rcm\Service\CurrentSite::class
        );

        $currentSiteId = $currentSite->getSiteId();

        $sourcePageName = $this->getEvent()
            ->getRouteMatch()
            ->getParam(
                'rcmPageName',
                'index'
            );

        $pageType = $this->getEvent()
            ->getRouteMatch()
            ->getParam(
                'rcmPageType',
                'n'
            );

        /** @var ResourceName $resourceName */
        $resourceName = $this->getServiceLocator()->get(
            ResourceName::class
        );

        $resourceId = $resourceName->get(
            ResourceName::RESOURCE_SITES,
            $currentSiteId,
            ResourceName::RESOURCE_PAGES,
            $pageType,
            $sourcePageName
        );

        /** @var \RcmUser\Acl\Service\AclDataService $aclDataService */
        $aclDataService = $this->getServiceLocator()->get(
            \RcmUser\Acl\Service\AclDataService::class
        );

        //getting all set rules by resource Id
        $rules = $aclDataService->getRulesByResource($resourceId)->getData();

        //getting list of all dynamically created roles
        $allRoles = $aclDataService->getNamespacedRoles()->getData();

        $rolesHasRules = [];

        foreach ($rules as $setRuleFor) {
            //getting only the ones that are allow
            if ($setRuleFor->getRule() == 'allow') {
                $rolesHasRules[] = $setRuleFor->getRoleId();
            }
        }

        $selectedRoles = [];

        foreach ($allRoles as $key => $role) {
            $roleId = $role->getRoleId();
            if (in_array($roleId, $rolesHasRules)) {
                $selectedRoles[$roleId] = $role;
            }
        }

        $data = [
            'siteId' => $currentSiteId,
            'pageType' => $pageType,
            'pageName' => $sourcePageName,
            'roles' => $allRoles,
            'selectedRoles' => $selectedRoles,
        ];

        $view->setVariable('data', $data);

        $view->setVariable(
            'rcmPageName',
            $sourcePageName
        );
        $view->setVariable(
            'rcmPageType',
            $pageType
        );

        return $view;
    }
290167
def _get_record(self):
        
        if not self.pk:
            raise AJAXError(400, _('Invalid request for record.'))

        try:
            return self.model.objects.get(pk=self.pk)
        except self.model.DoesNotExist:
            raise AJAXError(404, _('%s with id of "%s" not found.') % (
                self.model.__name__, self.pk))
9686
def obtain_the_title(check = nil)
    	post = obtain_record(check)
    	render :inline => post.post_title if !post.blank?
    end
1366787
def as_detail(cls, protocol=Protocol.http, *args, **kwargs):
        '''  '''
        return cls.as_view('detail', protocol, *args, **kwargs)