Generates and send a button template.
354434
async def _send_button_template(self, request: Request, stack: Stack):
        

        gt = stack.get_layer(ButtonTemplate)

        payload = {
            'template_type': 'button',
            'text': await render(gt.text, request),
            'buttons': [await b.serialize(request) for b in gt.buttons],
        }

        msg = {
            'attachment': {
                'type': 'template',
                'payload': payload
            }
        }

        await self._add_qr(stack, msg, request)
        await self._send(request, msg, stack)
1289666
public function generateAction()
    {
        /**
         * Determine if it comes from an ajax call
         * so we can send back different datas with the html
         */
        $isXmlHttpRequest = false;
        if ($this->getRequest()->isXmlHttpRequest()) {
            $isXmlHttpRequest = true;
        }

        /**
         * Get the params from php call
         */
        $appconfigpath = $this->params()->fromRoute('appconfigpath', '/');
        $keyView = $this->params()->fromRoute('keyview', 'melis');

        /**
         * Else get the params from GET if ajax
         */
        $datasParameters = [];
        if ($isXmlHttpRequest) {
            $appconfigpath = $this->getRequest()->getQuery('cpath');
            $lastKey = explode('/', $appconfigpath);
            $keyView = $lastKey[count($lastKey) - 1];
        }

        /**
         * Forcing to set the request to http request
         */
        if ($this->getRequest()->getQuery('forceFlagXmlHttpRequestTofalse', false))
            $isXmlHttpRequest = false;

        /**
         * Get the appConfig
         */
        $melisAppConfig = $this->getServiceLocator()->get('MelisCoreConfig');

        /**
         * Get the real path, from the MelisKey, if needed
         */
        $melisKeys = $melisAppConfig->getMelisKeys();

        if (!empty($melisKeys[$appconfigpath])) {
            $appconfigpath = $melisKeys[$appconfigpath];
        }

        $appsConfig = $melisAppConfig->getItem($appconfigpath);

        if ($isXmlHttpRequest && !empty($appsConfig['interface'])) {
            $appsConfig['interface'] = $this->orderInterfaceChildren($keyView, $appsConfig['interface']);
        }

        list($jsCallBacks, $datasCallback) = $melisAppConfig->getJsCallbacksDatas($appsConfig);


        /**
         * Generate the views recursively
         * and add the corresponding appConfig part to make it accessible in the view
         */
        $zoneView = $this->generateRec($keyView, $appconfigpath, $datasParameters);
        $zoneView->setVariable('zoneconfig', $appsConfig);
        $zoneView->setVariable('parameters', $datasParameters);
        $zoneView->setVariable('keyInterface', $keyView);

        /**
         * Add JS calls and datas found in config,
         * so that it will be added in head when generating
         */
        if (!empty($zoneView->getVariable('jsCallBacks')) && is_array($zoneView->getVariable('jsCallBacks')))
        {
            $jsCallBacks = ArrayUtils::merge($zoneView->getVariable('jsCallBacks'), $jsCallBacks);
        }
        $zoneView->setVariable('jsCallBacks', $jsCallBacks);

        if (!empty($zoneView->getVariable('datasCallback')) && is_array($zoneView->getVariable('datasCallback')))
        {
            $datasCallback = ArrayUtils::merge($zoneView->getVariable('datasCallback'), $datasCallback);
        }
        $zoneView->setVariable('datasCallback', $datasCallback);

        /**
         * If ajax, return json
         * else, return the normal view
         */
        if ($isXmlHttpRequest) {
            $htmlZoneView = $this->renderViewRec($zoneView);

            $jsonModel = new JsonModel();
            $jsonModel->setVariables([
                'html' => $htmlZoneView,
                'jsCallbacks' => $jsCallBacks,
                'jsDatas' => $datasCallback,
            ]);

            return $jsonModel;
        } else {
            /**
             * Return view
             */
            return $zoneView;
        }
    }
863849
private void createButtonBar() {
		// Update and reset controls for the repeater.
		WPanel buttonPanel = new WPanel(WPanel.Type.FEATURE);
		buttonPanel.setMargin(new Margin(Size.MEDIUM, null , Size.LARGE, null));
		buttonPanel.setLayout(new BorderLayout());

		WButton updateButton = new WButton("Update");
		updateButton.setImage("/image/document-save-5.png");
		updateButton.setImagePosition(WButton.ImagePosition.EAST);
		buttonPanel.add(updateButton, BorderLayout.EAST);

		WButton resetButton = new WButton("Reset");
		resetButton.setImage("/image/edit-undo-8.png");
		resetButton.setImagePosition(WButton.ImagePosition.WEST);
		resetButton.setAction(new Action() {
			@Override
			public void execute(final ActionEvent event) {
				repeater.setData(fetchDataList());
			}
		});
		buttonPanel.add(resetButton, BorderLayout.WEST);
		add(buttonPanel);
		add(new WAjaxControl(updateButton, repeater));
		add(new WAjaxControl(resetButton, repeater));
	}
1317663
public function editTemplate()
    {
        $this->defaultData();

        $clazz = $this->getCurrentClass();
        $delivery = $this->getCurrentInstance();

        $formContainer = new DeliveryForm($clazz, $delivery);
        $myForm = $formContainer->getForm();

        $myForm->evaluate();

        if ($myForm->isSubmited()) {
            if ($myForm->isValid()) {
                $propertyValues = $myForm->getValues();

                // then save the property values as usual
                $binder = new tao_models_classes_dataBinding_GenerisFormDataBinder($delivery);
                $delivery = $binder->bind($propertyValues);

                // edit process label:
                $this->getClassService()->onChangeLabel($delivery);

                $this->setData("selectNode", tao_helpers_Uri::encode($delivery->getUri()));
                $this->setData('message', __('Delivery saved'));
                $this->setData('reload', true);
            }
        }

        $this->setData('contentForm', $this->getContentForm());

        $this->setData('uri', tao_helpers_Uri::encode($delivery->getUri()));
        $this->setData('classUri', tao_helpers_Uri::encode($clazz->getUri()));

        $this->setData('hasContent', !is_null($this->getClassService()->getContent($delivery)));

        $this->setData('formTitle', __('Delivery properties'));
        $this->setData('myForm', $myForm->render());

        if ($this->getServiceLocator()->get(\common_ext_ExtensionsManager::SERVICE_ID)->isEnabled('taoCampaign')) {
            $this->setData('campaign', \taoCampaign_helpers_Campaign::renderCampaignTree($delivery));
        }
        $this->setView('DeliveryTemplate/editDelivery.tpl');
    }
870036
function( buttonName, buttonLabel, commandName, styleDefiniton )
		{
			var style = new CKEDITOR.style( styleDefiniton );

			editor.attachStyleStateChange( style, function( state )
				{
					!editor.readOnly && editor.getCommand( commandName ).setState( state );
				});

			editor.addCommand( commandName, new CKEDITOR.styleCommand( style ) );

			editor.ui.addButton( buttonName,
				{
					label : buttonLabel,
					command : commandName
				});
		}
229001
function() {
      webhookit.WiringEditor.superclass.renderButtons.call(this);

      var toolbar = YAHOO.util.Dom.get('toolbar');

		
      var editTemplateButton = new YAHOO.widget.Button({ label:"Edit template", id:"WiringEditor-templateButton", container: toolbar });
      editTemplateButton.on("click", webhookit.editTemplateButton, webhookit, true);

		// "Run" button
      var runButton = new YAHOO.widget.Button({ label:"Run", id:"WiringEditor-runButton", container: toolbar });
      runButton.on("click", webhookit.run, webhookit, true);

   }
784019
function( button ) {
            var $element = $('<a/>').addClass( 'wysiwyg-toolbar-icon' )
                                    .prop('href','#')
                                    .prop('unselectable','on')
                                    .append(button.image);
            // pass other properties as "prop()"
            $.each( button, function( name, value )
            {
                switch( name )
                {
                    // classes
                    case 'class':
                        $element.addClass( value );
                        break;
                    // special meaning
                    case 'image':
                    case 'html':
                    case 'popup':
                    case 'click':
                    case 'showstatic':
                    case 'showselection':
                        break;
                    default: // button.title, ...
                        $element.attr( name, value );
                        break;
                }
            });
            return $element;
        }
171738
public function prepare(Template $template): void
    {
        $formLayout = $this->layoutManager->getDefaultLayout();

        if ($formLayout instanceof HorizontalFormLayout) {
            $template->labelColClass  = $formLayout->getLabelColumnClass();
            $template->colClass       = $formLayout->getColumnClass();
            $template->colOffsetClass = $formLayout->getColumnClass(true);
            $template->rowClass       = $formLayout->getRowClass();
            $template->isHorizontal   = true;
        } else {
            $template->labelColClass  = null;
            $template->colClass       = null;
            $template->colOffsetClass = null;
            $template->rowClass       = null;
            $template->isHorizontal   = false;
        }

        $template->formLayout  = $formLayout;
        $template->buttonClass = $this->getButtonClass();
    }
1223845
private function generateTemplatesCache()
    {
        /** @var \Twig_Loader_Filesystem $loader */
        $loader = $this->tpl->getLoader();
        $availablePaths = $loader->getPaths();
        if (!empty($availablePaths)) {
            foreach ($availablePaths as $path) {
                $this->generateTemplate($path);
            }
        }
    }
793446
def template(colors, input_file, output_file=None):
    """"""
    template_data = util.read_file_raw(input_file)

    try:
        template_data = "".join(template_data).format(**colors)
    except ValueError:
        logging.error("Syntax error in template file '%s'.", input_file)
        return

    util.save_file(template_data, output_file)
405964
def template(cls, address=None, target=None, commandtuple=None,
                 userdata=None, cmd2=-1, flags=None):
        """"""
        msgraw = bytearray([0x02, cls._code])
        msgraw.extend(bytes(cls._receivedSize))
        msg = ExtendedReceive.from_raw_message(msgraw)

        if commandtuple:
            cmd1 = commandtuple.get('cmd1')
            cmd2out = commandtuple.get('cmd2')
        else:
            cmd1 = None
            cmd2out = None

        if cmd2 is not -1:
            cmd2out = cmd2

        msg._address = Address(address)
        msg._target = Address(target)
        msg._messageFlags = MessageFlags(flags)
        msg._cmd1 = cmd1
        msg._cmd2 = cmd2out
        msg._userdata = Userdata.create_pattern(userdata)
        return msg
328944
private void buttonAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAboutActionPerformed
    JOptionPane.showMessageDialog(this, new AboutPanel(), "About", JOptionPane.PLAIN_MESSAGE);
  }
115188
def add_button(self, button):
    """"""
    self._buttons.append(button)
    self._components[button.component_number] = button
552052
def template(cls, userdata):
        """"""
        ud = Userdata(cls.normalize(cls.create_empty(None), userdata))
        return ud
1296030
private function generatePageTemplateConfiguration()
    {
        $this->copyTemplates();
        $this->installDefaultPagePartConfiguration($this->bundle);
        $this->copyTemplateConfig();
        $this->assistant->writeLine('Generating template configuration : <info>OK</info>');
    }
501711
function createButton(opts) {
    opts = _.defaults(opts || {}, {
        // Aria label for the button
        label: '',

        // Icon to show
        icon: '',

        // Inner text
        text: '',

        // Right or left position
        position: 'left',

        // Other class name to add to the button
        className: '',

        // Triggered when user click on the button
        onClick: defaultOnClick,

        // Button is a dropdown
        dropdown: null,

        // Position in the toolbar
        index: null
    });

    buttons.push(opts);
    updateButton(opts);
}
888461
function generate() {
    var parsed = ensureConfig();
    if (!parsed.name)
        mu.log.error('cannot generate template using name of undefined.\n').write().exit();
    // Generate the template.
    mu.render(parsed.name, parsed.output, parsed.options);
}