Can't access the Velocity ProjectManager in an admin configuration form for a JIRA plugin - velocity

I build an admin configuration form for an existing JIRA plugin based on Atlassian's own admin configuration form tutorial.
By now the template appears when clicking the configure button, except one problem: I can't access the Velocity ProjectManager class. When explicitly testing it by simply writing $projectManager into the Velocity template, the string itself appears on the website instead of being resolved as a variable. How can I resolve it as a variable?
Here are some shortened versions of the code files 'admin.vm' and 'atlassian-plugin.xml':
admin.vm
<html>
<head>
<title>$i18n.getText("com.example.jira.PluginConfiguration.head")</title>
<meta content="admin_plugins_menu/upm_section" name="admin.active.section">
<meta content="upm-admin-link" name="admin.active.tab">
<meta name="decorator" content="atl.admin">
<meta name="application-base-url" content="$applicationProperties.getBaseUrl()">
$webResourceManager.requireResource("com.example.jira:resources")
</head>
<body id="jira" class="page-type-admin ">
<form name="PluginConfigurationForm" action="/secure/PluginConfiguration.jspa" method="post" style="padding: 0; margin: 0;">
<input type="hidden" name="atl_token" value="${atl_token}" class="aui">
<div>
<h2 class="aui top-label">$i18n.getText('com.example.jira.PluginConfiguration.title')</h2>
</div>
<div class="hidden">
<input name="id" type="hidden" value="${action.id}"> <input
name="returnUrl" type="hidden" value="$!{action.returnUrl}">
</div>
$projectManager
<div class="buttons-container form-footer">
<div class="buttons">
<input accesskey="s" class="button" id="PluginConfiguration-submit"
name="PluginConfiguration" title="Press Ctrl+Alt+s to submit this form"
type="submit" value="$i18n.getText('com.example.jira.PluginConfiguration.input.button.save')">
<a accesskey="`" class="cancel" href="/plugins/servlet/upm"
id="PluginConfiguration-cancel" title="Press Ctrl+Alt+` to cancel">$i18n.getText('com.example.jira.PluginConfiguration.input.button.cancel')</a>
</div>
</div>
</form>
</body>
</html>
atlassian-plugin.xml
<atlassian-plugin key="${project.groupId}.${project.artifactId}"
name="${project.artifactId}" plugins-version="2">
<plugin-info>
<description>${project.description}</description>
<version>${project.version}</version>
<vendor name="${project.organization.name}" url="${project.organization.url}" />
<param name="plugin-icon">img/Project_Logo.png</param>
<param name="plugin-logo">img/Project_Logo.png</param>
<param name="configure.url"><![CDATA[/plugins/servlet/ConfigurePlugin/admin]]></param>
</plugin-info>
<resource type="i18n" name="i18n_PluginConfiguration" location="com.example.jira/PluginConfiguration" />
<component-import key="pluginScheduler">
<description>SAL Scheduler</description>
<interface>com.atlassian.sal.api.scheduling.PluginScheduler
</interface>
</component-import>
<component-import key="pluginSettingsFactory"
interface="com.atlassian.sal.api.pluginsettings.PluginSettingsFactory" />
<component-import key="transactionTemplate"
interface="com.atlassian.sal.api.transaction.TransactionTemplate" />
<component-import key="userManager"
interface="com.atlassian.sal.api.user.UserManager" />
<component-import key="loginUriProvider"
interface="com.atlassian.sal.api.auth.LoginUriProvider" />
<component-import key="renderer"
interface="com.atlassian.templaterenderer.velocity.one.six.VelocityTemplateRenderer" />
<component-import key="applicationProperties"
interface="com.atlassian.sal.api.ApplicationProperties" />
<servlet key="admin-servlet"
class="${project.groupId}.PluginConfigurationServlet">
<url-pattern>/ConfigurePlugin/admin</url-pattern>
</servlet>
<rest key="rest"
path="/project-admin"
version="1.0">
<description>Provides REST resources for the admin UI.</description>
</rest>
<template-context-item key="applicationPropertiesContextItem"
component-ref="applicationProperties" context-key="applicationProperties"
name="Application Properties Context Item" />
<web-section key="ProjectAdminMenu" name="Project Admin Section"
location="admin_plugins_menu" weight="10">
<label>Project</label>
<description key="Project Administration Section"></description>
</web-section>
<web-item key="PluginConfiguration-web-item" name="Plugin Configuration Web Item"
i18n-name-key="com.example.jira.PluginConfiguration-web-item.name"
section="admin_plugins_menu/ProjectAdminMenu" weight="46">
<description i18n-name-key="PluginConfiguration-web-item.description"></description>
<label key="com.example.jira.PluginConfiguration-web-item.label" />
<link linkId="PluginConfiguration-web-item-link">/plugins/servlet/ConfigurePlugin/admin?decorator=admin/</link>
<tooltip>Configure the Project Jira Plugin</tooltip>
</web-item>
<web-resource name="PluginConfiguration Web Resource"
i18n-name-key="com.example.jira.PluginConfiguration-web-resource.name"
key="PluginConfiguration-web-resource">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<description i18n-name-key="PluginConfiguration-web-resource.description"></description>
<context>jira.admin</context>
<transformation extension="js">
<transformer key="jsI18n" />
</transformation>
<resource type="download" name="PluginConfiguration.js"
location="javascript/PluginConfiguration.js">
<property key="content-type" value="text/javascript" />
</resource>
</web-resource>
</atlassian-plugin>

Related

Success PresignedPost uploads on HTML but failed in Postman

So I just tried PresignedPost from AWS Documentation and have this code
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<form action="http://sigv4examplebucket.s3.amazonaws.com/" method="post" enctype="multipart/form-data">
Key to upload:
<input type="input" name="key" value="user/user1/${filename}" /><br />
Content-Type:
<input type="input" name="Content-Type" value="image/jpeg" /><br />
<input type="text" name="X-Amz-Credential" value="AKIAIOSFODNN7EXAMPLE/20151229/us-east-1/s3/aws4_request" />
<input type="text" name="X-Amz-Algorithm" value="AWS4-HMAC-SHA256" />
<input type="text" name="X-Amz-Date" value="20151229T000000Z" />
Tags for File:
<input type="hidden" name="Policy" value='<Base64-encoded policy string>' />
<input type="hidden" name="X-Amz-Signature" value="<signature-value>" />
File:
<input type="file" name="file" /> <br />
<!-- The elements after this will be ignored -->
<input type="submit" name="submit" value="Upload to Amazon S3" />
</form>
</html>
And my conditions I have set to
Conditions: [
['content-length-range', 1, 10 * 1024 * 1024],
['starts-with', '$Content-Type', 'image/'],
],
When I send it from HTML file, the upload success with 204 Status Code. But when I try from Postman I have error with the message:
Invalid according to Policy: Policy Condition failed: ["starts-with", "$Content-Type", "image/"]
Even I already included "Content-Type" field and still get Error. I wondering what the problem is.
I found the solution. It's the order of fields.
When Content-Type is set before file then the upload success, But when Content-Type set after file then the error show up.
I confirm this behavior in the HTML file too.

How to use KendoDatePicker within x-kendo-template in .NET Core

I have a popup editor template working for when I want to add/edit a row in my Kendo grid and it is bound to the model's properties. The issue is that I am unable to get Kendo widgets (e.g. datepicker or dropdownlist) to generate inside the kendo-template (primarily wanting to use taghelpers). Nor have I been able to use jQuery to convert inputs into kendo widgets on $(document).ready(). How can I do this?
My grid:
<kendo-grid name="accountsGrid" height="500" on-detail-init="onDetailInit">
<datasource type="DataSourceTagHelperType.Ajax" page-size="10">
<transport>
<read url="?handler=Accounts&id=#Model.Id" data="getAntiForgeryKeyValue" type="POST" />
<create url="?handler=CreateAccount&id=#Model.Id" data="getAntiForgeryKeyValue" type="POST" />
<update url="?handler=EditAccount&id=#Model.Id" data="getAntiForgeryKeyValue" type="POST" />
</transport>
<schema>
<model id="AccountId">
<fields>
<field name="LastUpdateDate" type="Date"></field>
</fields>
</model>
</schema>
</datasource>
<columns>
<column field="Id" hidden="true" />
<column field="AccountName"
title="Account Name"
header-html-attributes='HeaderHtmlAttribute(title:"Account Name")' />
<column field="LastUpdateDate"
title="Last Updated"
format="{0:MMMM dd, yyyy}"
header-html-attributes='HeaderHtmlAttribute(title:"Last Updated")' />
<column title="Actions"
header-html-attributes='HeaderHtmlAttribute(title:"Actions")'
html-attributes='new Dictionary<string, object> {["class"] = "center-cell" }'>
<commands>
<column-command name="edit" />
</commands>
</column>
</columns>
<toolbar>
<toolbar-button name="create" template="getTelerikButton('Add')" />
</toolbar>
<editable mode="popup" template-id="accountEditorTemplate" />
<pageable button-count="5" refresh="true" page-sizes="new int[] { 5, 10, 20 }">
</pageable>
<scrollable enabled="true" />
My Editor Template:
<script id="accountEditorTemplate" type="text/x-kendo-template">
<div class="row editor-padding">
#*Account Details*#
<div class="col-md-6 col-xs-12">
<h5 class="editorTemplateHeader">Account Details</h5>
<div class="k-edit-label">
<label for="AccountName">Account Name</label>
</div>
<div class="k-edit-field">
<input required type="text" class="k-input k-textbox" name="AccountName" validationmessage="Account Name is required" maxlength="8" />
</div>
<div class="k-edit-label">
<label for="Description">Description</label>
</div>
<div class="k-edit-field">
<input type="text" class="k-input k-textbox" name="Description" maxlength="100" />
</div>
<div class="k-edit-label">
<label for="ExpirationDate">Expiration Date</label>
</div>
<div class="k-edit-field">
#*I would like to do this, but nothing appears*#
<kendo-datepicker name="ExpirationDate"></kendo-datepicker>
</div>
</div>
</div>
I resolved the problem. It involved using data- syntax. Below is the solution:
<div class="k-edit-field">
<input required type="text"
name="ExpirationDate"
data-type="date"
data-bind="value:ExpirationDate"
data-role="datepicker"
validationmessage="Expiration Date is required" />
</div>

how to add radio button in front end customer registration form and store it into database

kindly help me, how to add radion button in magento 1.9 in customer registration form and store it into database
<div class="field">
<div class="input-box">
<input type="radio" name="login_reference" value="customer_login" title="<?php echo $this->__('Customer Login') ?>" class="radio" checked />
<label for="login_reference"><?php echo $this->__('Customer Login') ?></label>
</div>
</div>
<div class="field">
<div class="input-box">
<input type="radio" name="login_reference" value="store_user_login" title="<?php echo $this->__('Store User Login') ?>" class="radio" />
<label for="login_reference"><?php echo $this->__('Store User Login') ?></label>
</div>
</div>
i just created like this.how to save that value into database...
You have overwrite customer controller and create one field in customer table as a login_reference .
you have to overwrite customer controller Accountcontroller.php file using below code in config.xml within Tag.
<routers>
<customer>
<args>
<modules>
<companyname_modulename before="Mage_Customer">New_Mage_Customer</companyname_modulename>
</modules>
</args>
</customer>
</routers>
after that you have to create a function createPostAction() and set your field value in it.you can pass 0 or 1 value for save login_reference field.

Submit a method in webbrowser

I have a problem invoking a submit method in web page
This is my code
Webbrowser.document.forms(0).invokemember("submit")
It does nothing.
Here is the html
<form name="myWebForm" action="myServerSideScript.php" method="post">
<input type="checkbox" /> Checkbox 1<br />
<input type="text" /> Text Field 1<br />
<input type="submit" value="SUBMIT" />
</form>
You must set .AllowNavigation property to "TRUE"
Webbrowser.AllowNavigation = True
And call submit method like this
Webbrowser.Document.Forms(0).InvokeMember("submit")
Or
Webbrowser.Document.Forms.GetElementsByName("myWebForm").Item(0).InvokeMember("submit")

[Symfony]--sfGuardPlugin--SignIn

I use symfony 1.4
In my index page, I have created some fields as login form.
When using sfGuardPlugin, it generate automaticly its form.
So, what I'm searching for is how to replace the default form created by the new which I have created.
thanks
By default, sfGuardAuth module comes with 2 very simple templates:
signinSuccess.php
secureSuccess.php
If you want to customize one of these templates:
Create a sfGuardAuth module in your application (don't use the
init-module task, just create a sfGuardAuth directory)
Create a template with the name of the template you want to customize in
the sfGuardAuth/templates directory
symfony now renders your template instead of the default one
More info: https://github.com/Garfield-fr/sfDoctrineGuardPlugin
Edit:
You must set up the settings.yml
enabled_modules: [default, sfGuardAuth, sfGuardUser]
.actions:
login_module: sfGuardAuth
login_action: signin
This is my signinSuccess.php
<h2>Bejelentkezés</h2>
<form id="loginform" action="<?php echo url_for('#sf_guard_signin') ?>" method="post">
<input type="hidden" name="signin[_csrf_token]" value="2a831d070cdd61d81bb1572be3f52d21" id="signin__csrf_token" /> <p>
<label class="required" for="username">Felhasználónév vagy Email:</label><br/>
<input type="text" name="signin[username]" id="signin_username" class="text" /> </p>
<p>
<label class="required" for="password">Jelszó:</label><br/>
<input type="password" name="signin[password]" id="signin_password" class="text" /> </p>
<p>
<input type="submit" class="btn btn-green big" value="Signin" />
</p>
<div class="clear"> </div>
<?php echo $form->renderHiddenFields(); ?>
</form>