Render the add property sub form.
@throws Exception
@throws common_exception_BadRequest
@return void
@requiresRight id WRITE
334094
public function addClassProperty()
    {
        if(!$this->isXmlHttpRequest()){
            throw new common_exception_BadRequest('wrong request mode');
        }

        $clazz = $this->getClass($this->getRequestParameter('id'));

        if($this->hasRequestParameter('index')){
            $index = intval($this->getRequestParameter('index'));
        }
        else{
            $index = count($clazz->getProperties(false)) + 1;
        }

        $propMode = 'simple';
        if($this->hasSessionAttribute('property_mode')){
            $propMode = $this->getSessionAttribute('property_mode');
        }

        //instanciate a property form
        $propFormClass = 'tao_actions_form_'.ucfirst(strtolower($propMode)).'Property';
        if(!class_exists($propFormClass)){
            $propFormClass = 'tao_actions_form_SimpleProperty';
        }

        $propFormContainer = new $propFormClass($clazz, $clazz->createProperty('Property_'.$index), array('index' => $index));
        $myForm = $propFormContainer->getForm();

        $this->setData('data', $myForm->renderElements());
        $this->setView('blank.tpl', 'tao');
    }
76580
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WSubordinateControl subordinate = (WSubordinateControl) component;
		XmlStringBuilder xml = renderContext.getWriter();

		if (!subordinate.getRules().isEmpty()) {
			int seq = 0;

			for (Rule rule : subordinate.getRules()) {
				xml.appendTagOpen("ui:subordinate");
				xml.appendAttribute("id", subordinate.getId() + "-c" + seq++);
				xml.appendClose();
				paintRule(rule, xml);
				xml.appendEndTag("ui:subordinate");
			}
		}
	}
821225
protected function buildForm()
    {
        if ($this->form) {
            return;
        }

        // append parent object if any
        // todo : clean the way the Admin class can retrieve set the object
        if ($this->isChild() && $this->getParentAssociationMapping()) {
            $parent = $this->getParent()->getObject($this->request->get($this->getParent()->getIdParameter()));

            $propertyAccessor = $this->getConfigurationPool()->getPropertyAccessor();
            $propertyPath = new PropertyPath($this->getParentAssociationMapping());

            $object = $this->getSubject();

            $value = $propertyAccessor->getValue($object, $propertyPath);

            if (\is_array($value) || ($value instanceof \Traversable && $value instanceof \ArrayAccess)) {
                $value[] = $parent;
                $propertyAccessor->setValue($object, $propertyPath, $value);
            } else {
                $propertyAccessor->setValue($object, $propertyPath, $parent);
            }
        }

        $formBuilder = $this->getFormBuilder();
        $formBuilder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
            $this->preValidate($event->getData());
        }, 100);

        $this->form = $formBuilder->getForm();
    }
1253896
private function renderForm()
    {
        /** @var ActiveRecord $model */
        $model = new $this->modelClass;

        echo <<<HTML
<div class="modal" id="{$this->id}-new-node-modal" tabindex="-1" role="dialog" aria-labelledby="newNodeModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
HTML;
        /** @var ActiveForm $form */
        $form = ActiveForm::begin([
            'id' => $this->id . '-new-node-form'
        ]);

        echo <<<HTML
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="newNodeModalLabel">New node</h4>
      </div>
      <div class="modal-body">
HTML;

        echo call_user_func($this->formFieldsCallable, $form, $model);

        echo <<<HTML
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="submit" class="btn btn-primary">Create node</button>
      </div>
HTML;
        $form->end();
        echo <<<HTML
    </div>
  </div>
</div>
HTML;
    }
479360
function render() {
		if ($this->show_metainfo) {
			$this->appendtagbody($this->hidden('form')
				->value_is($this->signature()));
		}

		return parent::render();
	}
162186
public function addPropertyIndex()
    {
        if(!$this->isXmlHttpRequest()){
            throw new common_exception_BadRequest('wrong request mode');
        }
        if(!$this->hasRequestParameter('uri')){
            throw new Exception("wrong request Parameter");
        }
        $uri = $this->getRequestParameter('uri');

        $clazz = $this->getCurrentClass();

        $index = 1;
        if($this->hasRequestParameter('index')){
            $index = $this->getRequestParameter('index');
        }

        $propertyIndex = 1;
        if($this->hasRequestParameter('propertyIndex')){
            $propertyIndex = $this->getRequestParameter('propertyIndex');
        }

        //create and attach the new index property to the property
        $property = $this->getProperty(tao_helpers_Uri::decode($uri));
        $class = $this->getClass("http://www.tao.lu/Ontologies/TAO.rdf#Index");

        //get property range to select a default tokenizer
        /** @var core_kernel_classes_Class $range */
        $range = $property->getRange();
        //range is empty select item content
        $tokenizer = null;
        if (is_null($range)) {
            $tokenizer = $this->getResource('http://www.tao.lu/Ontologies/TAO.rdf#RawValueTokenizer');
        } else {
            $tokenizer = $range->getUri() === OntologyRdfs::RDFS_LITERAL
                ? $this->getResource('http://www.tao.lu/Ontologies/TAO.rdf#RawValueTokenizer')
                : $this->getResource('http://www.tao.lu/Ontologies/TAO.rdf#LabelTokenizer');
        }

        $indexClass = $this->getClass('http://www.tao.lu/Ontologies/TAO.rdf#Index');
        $i = 0;
        $indexIdentifierBackup = preg_replace('/[^a-z_0-9]/','_',strtolower($property->getLabel()));
        $indexIdentifierBackup = ltrim(trim($indexIdentifierBackup, '_'),'0..9');
        $indexIdentifier = $indexIdentifierBackup;
        do{
            if($i !== 0){
                $indexIdentifier = $indexIdentifierBackup.'_'.$i;
            }
            $resources = $indexClass->searchInstances(array(OntologyIndex::PROPERTY_INDEX_IDENTIFIER => $indexIdentifier), array('like' => false));
            $count = count($resources);
            $i++;
        }while($count !== 0);

        $indexProperty = $class->createInstanceWithProperties(array(
                OntologyRdfs::RDFS_LABEL => preg_replace('/_/',' ',ucfirst($indexIdentifier)),
                OntologyIndex::PROPERTY_INDEX_IDENTIFIER => $indexIdentifier,
                OntologyIndex::PROPERTY_INDEX_TOKENIZER => $tokenizer,
                OntologyIndex::PROPERTY_INDEX_FUZZY_MATCHING => GenerisRdf::GENERIS_TRUE,
                OntologyIndex::PROPERTY_DEFAULT_SEARCH  => GenerisRdf::GENERIS_FALSE,
            ));

        $property->setPropertyValue($this->getProperty(OntologyIndex::PROPERTY_INDEX), $indexProperty);

        //generate form
        $indexFormContainer = new tao_actions_form_IndexProperty(new OntologyIndex($indexProperty), $propertyIndex.$index);
        $myForm = $indexFormContainer->getForm();
        $form = trim(preg_replace('/\s+/', ' ', $myForm->renderElements()));
        $this->returnJson(array('form' => $form));
    }
997504
public function ssecfg() {
		Configure::write('debug', 0);
		if (!$this->request->is('ajax') || !$this->request->is('post') ||
			!$this->RequestHandler->prefers('json')) {
			throw new BadRequestException();
		}

		$data = $this->ConfigTheme->getSseConfig();
		$this->set(compact('data'));
		$this->set('_serialize', 'data');
	}
212776
public function init()
    {
        if (!isset($this->options['id'])) {
            $this->options['id'] = $this->getId();
        }
        ob_start();
        ob_implicit_flush(false);

        $props = [
            'formId' => $this->id,
            'contentId' => $this->id . '-content',
            'action' => $this->action,
            'method' => $this->method,
            'layout' => $this->layout,
            'layoutCols' => $this->layoutCols,
        ];

        if (Yii::$app->has('frontendState')) {
            Yii::$app->frontendState->add('config.types.toRenderForm', [$this->id, $props]);
        } else {
            $jsArgs = [Json::encode($this->id), Json::encode($props)];
            \Yii::$app->view->registerJs('__appTypes.renderForm(' . implode(', ', $jsArgs) . ')', View::POS_END, $this->id . '-form');
        }
    }
1265561
public function render()
    {
        if (($this->arguments['src'] === null && $this->arguments['image'] === null) || ($this->arguments['src'] !== null && $this->arguments['image'] !== null)) {
            throw new Exception('You must either specify a string src or a File object.', 1382284106);
        }

        try {
            $image = $this->imageService->getImage($this->arguments['src'], $this->arguments['image'], $this->arguments['treatIdAsReference']);
            $cropString = $this->arguments['crop'];
            if ($cropString === null && $image->hasProperty('crop') && $image->getProperty('crop')) {
                $cropString = $image->getProperty('crop');
            }
            $cropVariantCollection = CropVariantCollection::create((string)$cropString);
            $cropVariant = $this->arguments['cropVariant'] ?: 'default';
            $cropArea = $cropVariantCollection->getCropArea($cropVariant);
            $processingInstructions = [
                'width' => $this->arguments['width'],
                'height' => $this->arguments['height'],
                'minWidth' => $this->arguments['minWidth'],
                'minHeight' => $this->arguments['minHeight'],
                'maxWidth' => $this->arguments['maxWidth'],
                'maxHeight' => $this->arguments['maxHeight'],
                'crop' => $cropArea->isEmpty() ? null : $cropArea->makeAbsoluteBasedOnFile($image),
                // Added by me
                'additionalParameters' => $this->generateAdditionalProcessingParameters(),
                'skipProcessing' => !ConfigurationUtility::isProcessingEnabled(),
            ];
            $processedImage = $this->imageService->applyProcessingInstructions($image, $processingInstructions);
            $imageUri = $this->imageService->getImageUri($processedImage, $this->arguments['absolute']);

            if (!$this->tag->hasAttribute('data-focus-area')) {
                $focusArea = $cropVariantCollection->getFocusArea($cropVariant);
                if (!$focusArea->isEmpty()) {
                    $this->tag->addAttribute('data-focus-area', $focusArea->makeAbsoluteBasedOnFile($image));
                }
            }
            $this->tag->addAttribute('src', $imageUri);
            $this->tag->addAttribute('width', $processedImage->getProperty('width'));
            $this->tag->addAttribute('height', $processedImage->getProperty('height'));

            $alt = $image->getProperty('alternative');
            $title = $image->getProperty('title');

            // The alt-attribute is mandatory to have valid html-code, therefore add it even if it is empty
            if (empty($this->arguments['alt'])) {
                $this->tag->addAttribute('alt', $alt);
            }
            if (empty($this->arguments['title']) && $title) {
                $this->tag->addAttribute('title', $title);
            }
        } catch (ResourceDoesNotExistException $e) {
            // thrown if file does not exist
            throw new Exception($e->getMessage(), 1509741911, $e);
        } catch (\UnexpectedValueException $e) {
            // thrown if a file has been replaced with a folder
            throw new Exception($e->getMessage(), 1509741912, $e);
        } catch (\RuntimeException $e) {
            // RuntimeException thrown if a file is outside of a storage
            throw new Exception($e->getMessage(), 1509741913, $e);
        } catch (\InvalidArgumentException $e) {
            // thrown if file storage does not exist
            throw new Exception($e->getMessage(), 1509741914, $e);
        }

        return $this->tag->render();
    }
9308
protected function submitAddCountry()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->setSubmittedJson('format');
        $this->validateComponent('country');
        $this->addCountry();
    }
165040
public function addInstance()
    {
        if (!$this->isXmlHttpRequest()) {
            throw new common_exception_BadRequest('wrong request mode');
        }

        $id = $this->getRequestParameter('id');

        $this->validateInstanceRoot($id);

        $this->signatureValidator->checkSignature(
            $this->getRequestParameter('signature'),
            $id
        );

        $response = [];

        $clazz = $this->getClass($id);
        $label = $this->getClassService()->createUniqueLabel($clazz);

        $instance = $this->getClassService()->createInstance($clazz, $label);

        if(!is_null($instance) && $instance instanceof core_kernel_classes_Resource){
            $response = [
                'label' => $instance->getLabel(),
                'uri'   => $instance->getUri()
            ];
        }

        $this->returnJson($response);
    }
1326342
protected function addFieldValue()
    {
        if (!$this->isError()) {
            $id = $this->field_value->add($this->getSubmitted());
            if (empty($id)) {
                $this->errorAndExit($this->text('Unexpected result'));
            }
            $this->line($id);
        }
    }
370616
public function displaySubscriptionDetails($sub)
	{
		echo 'ID:            '.$sub->getId().PHP_EOL;
		echo 'Name:          '.$sub->getName().PHP_EOL;
		echo 'Status:        '.$sub->getStatus().PHP_EOL;
		echo 'Created at:    '.(is_null($sub->getCreatedAt()) ? 'null' : date('r', $sub->getCreatedAt())).PHP_EOL;
		echo 'Last request:  '.(is_null($sub->getLastRequest()) ? 'null' : date('r', $sub->getLastRequest())).PHP_EOL;
		echo 'Last success:  '.(is_null($sub->getLastSuccess()) ? 'null' : date('r', $sub->getLastSuccess())).PHP_EOL;
		echo 'Output Type:   '.$sub->getOutputType().PHP_EOL;

		echo 'Output Params:'.PHP_EOL;
		foreach ($sub->getOutputParams() as $key => $val) {
			echo '  '.$key.' = '.$val.PHP_EOL;
		}
	}
1159319
public function indexAction() {
        $request = $this->getRequest();
        if (!$request->getParam('id') || !$request->getParam('chunk')) {
            throw new Exception('Not enough parameters: "id" and "chunk" are required.');
        }
        $bb = $this->_initBrowsebox($request);
        $this->view->bb = $bb;
        $this->_helper->layout->setLayout('blank');
    }
1211192
private function renderProperties(&$form, $property)
	{
		$htmlOptions = array(
			'class' => 'pure-input-2-3'
		);

		$validators = $this->model->getValidators($property->name);
		$stringValidators = $this->model->getStringValidator($property->name, $validators);

		if (in_array('required', $stringValidators))
			$htmlOptions['required'] = true;

		echo CHtml::openTag('div', array('class' => 'pure-control-group'));

			if (in_array('boolean', $stringValidators))
				$form->toggleButtonRow($this->model, $property->name, $htmlOptions, $validators);
			else if (in_array('number', $stringValidators) && isset($validators[0]->max) && isset($validators[0]->min))
				$form->rangeFieldRow($this->model, $property->name, $htmlOptions, $validators);
			else if (in_array('number', $stringValidators) && (isset($validators[0]->max) || isset($validators[0]->min)))
				$form->numberFieldRow($this->model, $property->name, $htmlOptions, $validators);
			else if (in_array('password', $stringValidators))
				echo $form->passwordFieldRow($this->model, $property->name, $htmlOptions, $validators);
			else
				echo $form->textFieldRow($this->model, $property->name, $htmlOptions, $validators);

		echo CHtml::closeTag('div');
	}
1082687
private function addAjaxPropertyForEditAll()
    {
        $inputProvider = $this->getEnvironment()->getInputProvider();

        if (('select' !== $inputProvider->getParameter('act'))
            && ('edit' !== $inputProvider->getParameter('select'))
            && ('edit' !== $inputProvider->getParameter('mode'))
        ) {
            return;
        }

        $originalProperty = $this->findOriginalPropertyByModelId($inputProvider->getValue('name'));
        if (null === $originalProperty) {
            return;
        }

        $propertiesDefinition = $this->getEnvironment()->getDataDefinition()->getPropertiesDefinition();

        $propertyClass = \get_class($originalProperty);

        $property = new $propertyClass($inputProvider->getValue('name'));
        $property->setLabel($originalProperty->getLabel());
        $property->setDescription($originalProperty->getDescription());
        $property->setDefaultValue($originalProperty->getDefaultValue());
        $property->setExcluded($originalProperty->isExcluded());
        $property->setSearchable($originalProperty->isSearchable());
        $property->setFilterable($originalProperty->isFilterable());
        $property->setWidgetType($originalProperty->getWidgetType());
        $property->setExplanation($originalProperty->getExplanation());
        $property->setExtra($originalProperty->getExtra());

        $propertiesDefinition->addProperty($property);
    }
977912
public function load() {

        if (!$this->hasRequestParameter('uri')) {
            throw new common_exception_MissingParameter('uri', __METHOD__);
        }
        if (!$this->hasRequestParameter('stylesheetUri')) {
            throw new common_exception_MissingParameter('stylesheetUri', __METHOD__);
        }
        if (!$this->hasRequestParameter('lang')) {
            throw new common_exception_MissingParameter('lang', __METHOD__);
        }
        
        $item = new \core_kernel_classes_Resource($this->getRequestParameter('uri'));
        $lang = $this->getRequestParameter('lang');
        $styleSheet = $this->getRequestParameter('stylesheetUri');
        if (!\tao_helpers_File::securityCheck($styleSheet, true)) {
            throw new \common_exception_Error('invalid stylesheet path "'.$styleSheet.'"');
        }



        $cssArray = CssHelper::loadCssFile($item, $lang, $styleSheet);
        echo json_encode($cssArray);
    }