Editing Redmine calendar in dashboard - calendar

In Redmine's calendar, I would like to show all Tasks/Issues on which a currently logged in person in the account is a Member, Task Creator, Assignee, Reporter, or Watcher.
Now, from the following two arrays of helper.rb, I have created another array which merges issues_only and tasks_only. Then I wish to call that array in view part.
def issues_only
issues_all = issuesreportedbyme_items
issues_all.push *issueswatched_items
issues_all.push *issuesassignedtome_items
all = issues_all.reject{|v| v.tracker_id == 4}
rest = all.reject {|k| k.status_id == 5 }
rest.inject([]) { |result,h| result << h unless result.include?(h); result }
end
def tasks_only
tasks_all = issuesreportedbyme_items
tasks_all.push *issueswatched_items
tasks_all.push *issuesassignedtome_items
all = tasks_all.reject{|v|v.tracker_id == 5}
rest = all.reject {|k| k.status_id == 5 }
rest.inject([]) { |result,h| result << h unless result.include?(h); result }
end
Now, my question is what to include in view part in order to show the required calendar.

As you can see on this image the Calendar tab has filter options same as all other lists in Redmine. First you click on the filter switch icon (the little triangle on the image) and then you can add your filters to a report, list, gantt chart etc by selecting the filters from the filter selection combo box.
Your main problem will be that this filters don't have any logical operator feature. All the filters you select will be connected with the 'AND' operator so you can't define a list, gantt or report which corresponds to your 'OR' operator.
To get all the activities of all members of a specific project you only have to select the project and then unselect the "is : open" filter on the project calendar and click on "Apply Settings".
PS : This image is taken from our customized Redmine installation which has the Easyredmine plugin but the basics of filters are the same with Redmine.
Edit:
A way achieving your 'OR' requirement would be just selecting the filters which don't belong to your requirements and applying those filters. This way you would exclude those specific criteria that you want to apply the 'OR' statement to.
Don't forget to select the appropriate status filter in your filters. (Status is open/close/any/is not/is)

Related

drupal7 Filter content type based on session in view

I have created a custom type with multiple fields.
1 field is a checkbox to "show for all people"
2nd field is a textfield ( you can add multiple textfields ) for adding a code.
I created a view where all those content types are being shown in a page. ( this works )
But now:
When a person enters the site, he has to insert a code. This code is saved into a cookie because it needs to be remembered for about 2 weeks.
So I can't use the contextual filters.
If the checkbox "show for all people" is checked, this block is shown.
if the checkbox "show for all people" is unchecked, this block is hidden, except for people who came in without a code, or if the code is one of the values that was inserted in the 2nd field.
I don't wan't to use views php_filter. But I have no clue how to proceed with this problem.
I tried some solutions on the web to create a custom filter, but the problem here is, that we can't access the form values.
I found a solution, but I'm not sure if this is the correct drupal way.
I used the hook_node_view function to get all nodes that are printed on that page. I check if the code that was inserted into a cookie with the codes that are allowed ( created in the text fields of the content type )
function code_node_view($node, $view_mode, $langcode) {
if ($node->type == 'winning_codes') {
$code = _code_read_cookie('code');
$winning_codes = (!empty($node->field_winning_codes['und'])) ? $node->field_winning_codes['und'] : array();
$winning_codes = array_map(function ($ar) {
return $ar['value'];
}, $winning_codes);
if (!empty($code) && (!in_array($code, $winning_codes))) {
hide($node->content);
}
}
}

Visualforce RemoteObjectModels Query filtering using "OR"

I am using in visualforce page of Salesforce.com. For demo purposes, I have used the following code snippet from the example docs shown in
http://docs.releasenotes.salesforce.com/en-us/spring14/release-notes/rn_vf_remote_objects.htm
In my code snippet i have a 'Where' clause in which i am trying to filter using 3 fields. My requirement is that the records must match the criteria A or criteria B or criteria C.
Code Example
<apex:page >
<!-- Remote Objects definition to set accessible sObjects and fields -->
<apex:remoteObjects >
<apex:remoteObjectModel name="Group_Donor__c" jsShorthand="Groupdonor"
fields="Name,Id">
<apex:remoteObjectField name="State__c" jsShorthand="State"/>
<apex:remoteObjectField name="Org_Phone__c" jsShorthand="Phone"/>
<apex:remoteObjectField name="Billing_Type__c" jsShorthand="billingtype"/>
</apex:remoteObjectModel>
</apex:remoteObjects>
<!-- JavaScript to make Remote Objects calls -->
<script>
var fetchWarehouses = function(){
// Create a new Remote Object
var wh = new SObjectModel.Groupdonor();
// Use the Remote Object to query for 10 warehouse records
wh.retrieve({
where: {
or: {
Name : {like:"%Helloworld%"}, // Error
State: {like:"%chennai%"},
//Phone: {like:"%098765432344%"},
billingtype: {like:"%Credit Card%"}
}
},
limit: 10 ,
}, function(err, records, event){
if(err) {
alert(err.message);
}
else {
var ul = document.getElementById("warehousesList");
records.forEach(function(record) {
// Build the text for a warehouse line item
var whText = record.get("Name");
whText += " -- ";
whText += record.get("Phone");
whText += " -- ";
whText += record.get("billingtype");
// Add the line item to the warehouses list
var li = document.createElement("li");
li.appendChild(document.createTextNode(whText));
ul.appendChild(li);
});
}
});
};
</script>
<h1>Retrieve Group Donors via Remote Objects</h1>
<p>Warehouses:</p>
<ul id="warehousesList">
</ul>
<button onclick="fetchWarehouses()">Retrieve Group Donors</button>
</apex:page>
When i execute this code i get the following error.
Error Message :
Invalid criteria specified for retreival. ValidationError [code=11, message=Data does not match any schemas from "oneOf" path=/where, schemaKey=null]
This issue occurs only during the following conditions.
When i use Standard field like Name in the OR condition. ( Even 2 or 1 filter)
When i use more than 3 Custom fields in the OR condition ( More than 2 Query filter)
But when i use just any 2 custom fields mentioned in the RemoteObjectModel as filters, i get the expected results.
Kindly let me know what am i missing here. If i have use more than 2 filters in or condition, how do i achieve it ? is the usage of 'OR' proper in the remote-objects?. And has anyone come across this issue. if so kindly provide me some pointers.
Thanks in advance.
I've been doing some looking and there's some bad news and some good news.
First, it's a (obscure)known limitation that you can't have more than 2 predicates for AND and OR queries - Docs here
However, you seem to have discovered another bug in that an Standard Field (Name, Id) seems to not work when used with a custom one. My workaround was to redefine ALL fields, even standard ones like this:
<apex:remoteObjectModel name="Group_Donor__c" jsShorthand="GroupDonor">
<apex:remoteObjectField name="Name" jsShorthand="NameJS"/>
<apex:remoteObjectField name="State__c" jsShorthand="State"/>
<apex:remoteObjectField name="Org_Phone__c" jsShorthand="Phone"/>
<!--.... etc-->
At least you'll be able to query standard fields this way.
As an ultimate work around, you'll probably have to retrieve two lists of records and use JavaScript to create your ultimate OR list.
Good luck!

ADF Cascading Lov Search and Select popup customization

I have built a cascading LOV with Group and division fields (Combo box with list of values). When I select a value for Group and click on Search and Select dialog for Division field, the SearchAndSelect popup has both Group and Division fields as search criteria(as defined in my view criteria).
Now, is there a way to populate the Group value in the popup criteria, I know the where clause uses the already entered Group value but I want to display it to the user in the SearchAndSelect popup search region.
There is no declarative way of pre setting search field values in lov popup. Although it can be done by using a custom launchPopupListener for lov component. To know more about how to use lov popup listeners refer to Building Custom Lovs
Create a launchPopupListener method for your dependent lov.
<af:inputComboboxListOfValues id="inpClv2"
popupTitle="Search and Select: #{bindings.StateProvince.hints.label}"
value="#{bindings.StateProvince.inputValue}"
label="#{bindings.StateProvince.hints.label}"
model="#{bindings.StateProvince.listOfValuesModel}"
required="#{bindings.StateProvince.hints.mandatory}"
columns="#{bindings.StateProvince.hints.displayWidth}"
shortDesc="#{bindings.StateProvince.hints.tooltip}"
partialTriggers="inpClv1"
launchPopupListener="#{backingBeanScope.lovBean.stateLaunchPopupListener}">
</af:inputComboboxListOfValues>
In launchPopupListener set the value of search criteria attribute with the value from first lov.
public void stateLaunchPopupListener(LaunchPopupEvent launchPopupEvent)
{
UIXInputPopup lovComponent = (UIXInputPopup)launchPopupEvent.getSource();
ListOfValuesModel model = lovComponent.getModel();
if (model != null)
{
QueryDescriptor queryDesc = model.getQueryDescriptor();
/** Code to pre populate a Search and Select field**/
ConjunctionCriterion conCrit = queryDesc.getConjunctionCriterion();
List<Criterion> criterionList = conCrit.getCriterionList();
for (Criterion criterion: criterionList)
{
AttributeDescriptor attrDesc = ((AttributeCriterion) criterion).getAttribute();
if (attrDesc.getName().equalsIgnoreCase("CountryId"))
{
List values = ((AttributeCriterion) criterion).getValues();
values.set(0, "US"); //use the value from first lov
}
}
}
}

Agile Toolkit - OR statement in combination with Model

I have a Model from which I want to select all rows for which 'caller' or 'callee' is a given value for presentation in a Grid.
I have tried lots of different avenues of accomplishing this and cannot get anywhere with it.
I have a working filter on the Grid which narrows down the results by date (starting and ending dates), by status ("ANSWERED","NO_ANSWER"), I can also add conditions for 'caller' and 'callee', but how do I get it to show all rows where either 'caller' or 'callee' is a match to the current $UserID? Basically showing all calls (rows) a user was involved in?
The MySQL query itself is a simple OR construction, but how do I 'feed' it into the Model or the Grid so that it plays nicely with the other filters on the page?
You can use orExpr() method of DSQL to generate SQL for your needs.
For example,
$m = $this->model->debug(); // enable debug mode
$user_id = $this->api->auth->model->id;// currently logged in user ID
$q = $m->_dsql(); // get models DSQL
$or = $q->orExpr(); // initialize OR DSQL object
$or->where('caller', $user_id) // where statements will be joined with OR
->where('callee', $user_id);
// use one of these below. see which one works better for you
$q->where($or); // add condition with OR statements
$q->having($or); // add condition with OR statements
Of course you can write all of this shorter:
$m = $this->model->debug(); // enable debug mode
$user_id = $this->api->auth->model->id;// currently logged in user ID
$q = $m->_dsql(); // get models DSQL
$q->where($q->orExpr()
->where('caller', $user_id)
->where('callee', $user_id)
);

What is the variable that refers to the number of likes on sharepoint 2013?

I want to write a request on the search result request webpart. My request should enables me to retrieve all documents that have the biggest number of likes. There is no variable for the number of likes proposed on the drop list while writing a request , that why I decided to set a refinableInt00 variable and give it the value : LikesCount but it doesn't work? it means that LikesCount doesn't exist as a variable on sharepoint so what is the variable on sharepoint that would enable me to have the number of likes?
You can get the number of likes using the listitem property "Number of Likes"
This is a code from a Sample console application
using (SPSite site=new SPSite("your site URL"))
{
using (SPWeb web=site.OpenWeb())
{
SPList list = web.Lists["Your List Name"];
foreach (SPListItem item in list.Items)
{
//Print the number of likes
Console.WriteLine(item["Number of Likes"].ToString());
}
}
}
I know this is old but I had the same question. The problem is the LikesCount property does not default to Sortable. To fix this:
-Open up Central Administration
-Go to Search Service Application
-Click on Search Schema
-Locate the "LikesCount" property and click edit
-Scroll down to Sortable and change to Yes
-Run a full crawl on your content source
Ratings for list must be enable.
List -> List settings -> Rating settings ->
Allow items in this list to be rated?
yes ? no
and
Which voting/rating experience you would like to enable for this list?
Likes ? Star Ratings
After that you can access likes by "Number of Likes" field name "LikesCount".
"Number of Ratings" field name "RatingCount"

Resources