How to sort a pi_list_query (or pi_exec_query) listing - typo3

I am using the extension feuserlisting to present my visitors a list of site members, but I'd like to sort the list on the full name. I know I can click the table heading to sort it when it is presented on the screen, but somehow it should be possible to set the default sorting by TypoScript?

The way of doing it is to use the _DEFAULT_PI_VARS mechanism.
plugin.tx_feuserlisting_pi1._DEFAULT_PI_VARS {
sort = name:0
}
The list view method of feuserlisting initilizes with a call to $this->pi_setPiVarDefaults() (which is inherited from tslib_pibase), where the key _DEFAULT_PI_VARS is taken into account when establishing the piVars.
This technique should be available in all pibase extensions which initialize their piVars with such a call.

Related

How to make a custom ListView page in SuiteCRM

I need to make a page in SuiteCRM (v7.9 -- based loosely on Sugar 6.5 CE) that has a list of objects (of a custom module), with checkboxes in front of each one. So far, so good: that's a standard ListView.
The catch is that only some records should be in the list (filtering on whether there is an associated row in a related custom module/object).
This page needs to be distinct from the "regular" list for this module, which should indeed list all records.
It seems to me it makes sense to use a custom "action" to access this page view, and I can get my custom action code to fire with the right URL.
But I don't see how to hook in the filtering. At first, it looked like the process_record logic hook might be helpful here, but it just gives the bean for every record to be displayed. Unless there's a flag "display this record" that I'm not seeing, that's not so helpful.
Ideally, of course, I'd like to be able to inject a different WHERE clause in my custom controller action before calling
parent::action_listview();
to display the page, but I'm not seeing doc to indicate how that might work. I would include source code, but so far, the line above is everything (but boilerplate) that's in the controller.php file.
Create a copy of listview in custom folder and then override the listview's listViewProcess() method and insert your query there:
function listViewProcess() // generating listview
{
$this->processSearchForm();
if($this->where==''){
$this->where.="leads.status='Converted'";
}
$this->lv->searchColumns = $this->searchForm->searchColumns;
if(!$this->headers)
return;
$this->lv->setup($this->seed, 'custom/modules/Leads/ListView/ListViewGeneric.tpl', $this->where, $this->params);
echo $this->lv->display();
}
More info: http://wiki-crm-forum.com/forum/viewtopic.php?f=2&t=9420&p=32674&hilit=listViewProcess&sid=21907ecd28734a726f61f7017a7e9a24#p32674
Another tested working example can be found here:
How to hard code the where condition in list view ,basic search,advance search in sugar CE
P.S: I'm not so sure about "v7.9 -- based loosely on Sugar 6.5 CE" I'd say it's 95% identical apart from API stuff
for custom modules in SuiteCRM.
You may change in function create_new_list_query.

enterprise architect api: Add element to a collection

I have few short questions regarding Enterprise architect.
My question is regarding the automation interface. When following the instructions provided on this page: http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/colle... in order to add a new element to the collection ( and the .eap file) it does not add the element. I can get data from the elements, modify and even delete them, but adding a new element does not work?
Instructions provided:
Call AddNew to add a new item.
Modify the item as required.
Call Update on the item to save it to the database.
Call Refresh on the collection to include it in the current set.
my java example:
elements is a collection of all the elements in the model...
org.sparx.Element elementEa = elements.AddNew("Requirement", "non-functional");
elementEa.Update();
elements.Refresh();
With the api is it possible to change the id or guid of an element since there are no methods specified in org.sparx for that?
One last thing... Is it possible to create a custom element in EA, for example a requirement which will not have the standard properties like difficulty, priority etc.. , but will have others? (normal properties, not tagged values)
The arguments to AddNew() are Name and Type, so to create a Requirement element you should specify "SomeRequirementName" and "Requirement".
You can't change the ID or GUID through the API, and your models would crash and burn if you did (connectors would be left dangling, elements would vanish from diagrams, etc, etc).
With an MDG Technology you can create very detailed stereotyped elements if you like, with their own visual representations (shape scripts) etc, but if you're after creating an element type with its own properties dialog the answer is no; there is no hook for a custom dialog in the API.
Collection<Package> packageCollection = myPackage.GetPackages();
Package consolidatedCfsSpecPackage = packageCollection.AddNew("somePackageName", "");
if (!consolidatedCfsSpecPackage.Update()) {
System.err.println("Not Updated: somePackageName");
}
packageCollection.Refresh();
This works for me. I suggest you to check return value of elementEa.Update() method you called. If it returns false, you can get the reason by calling elementEa.GetLastError().

bugzilla: how to create custom field in advanced search to search custom field created through admin

I know that Bugzilla 3.0 and up supports the creation of custom fields for your bugs and that this can be done through admin.
My question was, is there any way that I would be able to create a custom field in the advanced search that would be able to search for the bugs that had the values from that custom field.
I know the current bugzilla supported solution is to use the boolean search under custom search which is on the advanced search page, but I would like to create my own custom field.
The current modifications I have done so far have been through the form.tmpl file under the custom folder which is a copy of the default folder. I have managed to play around with the default fields, but no luck in creating a custom field.
Source: http://www.bugzilla.org/docs/2.18/html/cust-templates.html
I found another source: http://mozilla.6506.n7.nabble.com/Adding-Custom-Field-drop-downs-to-Advanced-Search-Page-td80291.html
That somewhat directed me towards understanding how to solve the issue. As of now, it appears I need to go to the search.pm file under bugzilla folder which is responsible for the queries that generate the reports for the searches. This is described in the file itself, and the https://wiki.mozilla.org/Bugzilla:Search.pm source.
yes, you can manage custom bugzilla fields through Search.pm file, which is inside the Bugzilla folder.
for that, you need to push the custom select fields into the legal fields array and loop through that,
my #legal_fields = (<enter whatever legal fields, you have with the comma seperator>);
push(#legal_fields, map { $_->name } #select_fields);
foreach my $field ($params->param()) {
if (lsearch(\#legal_fields, $field) != -1) {
push(#specialchart, [$field, "anyexact",
join(',', $params->param($field))]);
}
}
select_fields array should contains your custom fields. and legal_fields contains your legal fields.

ExtJS 4 - How to load grid store with its params carrying latest values from a form?

I have a window with a search form at the top and grid at the bottom.
User can enter values in the search form and click button - Get Records.
At the click of this button, I load the store of the grid by passing the values in form fields as parameters in following way:
store.load({
params:{
key1:Ext.getCmp('field1').getValue();
}
});
I tried giving parameters in the store proxy itself, but it unfortunately always takes up initial values (values when the form is rendered) and not the latest one entered by the users in the form fields. Following is the method I used for assigning values to params while creating the store:
extraParams:{
key1:Ext.getCmp('field1').getValue();
}
I wanted to seek guidance at two things:
a. While defining a store, can I ensure that store takes latest/current values from the form fields before querying server, so that I don't have to provide these values while calling load function?
This becomes more necessary as I have a paging toolbar at the bottom which carries a refresh button (along with next, last, previous, first icons for navigation).
Now, whenever user clicks at refresh (or any navigation icon), the store gets loaded without the query parameters.
Thus the second thing is:
b. If the answer of 'a' is that - Pass the latest values to parameters manually when calling load function - then how can I write the handler for 'refresh' button and navigation icons (that is, next, last, previous and first) in the paging toolbar, so that I can pass the latest form values to load function.
Thanks for any help in advance.
PS: I am using ExtJS 4.
yourStore.on('beforeload',function(store, operation,eOpts){
operation.params={
status:cmbStatus.getValue(),
value:txtBuscarPor.getValue(),
empresa:'saasd',
app:'dsads'
};
},this);
Related to your question (b) (and because you especially asked for this in the comments section):
I see only one standard way to hook into the PagingToolbar button handlers which is very limited.
Ext.toolbar.Paging fires a 'beforechange' event before it actually changes the current page. See API docs. A listener that returns false will stop the page change.
All other methods require extending Ext classes which wouldn't be a problem if the ComboBox would make it easier to use your own implementation of BoundList (which is the class that renders the dropdown) or pass through config parameters to BoundList resp. the paging toolbar.
I tried to bring this lack of flexibility up on the Ext message board once but was pretty much ignored.
A possible solution for this is to use 'beforeload' event of the store and provide the list of parameters in it. This way, whenever the store is loaded, then its beforeload event is fired and the values picked up are always the latest. Hope this helps someone looking for something similar.

symfony form - delete embedded form object

I have a two Symfony forms:
ShoppingListForm
ShoppingListItemForm
I'm embedding the ShoppingListItemForm inside the ShoppingListForm many times. i.e. A shopping list contains many items.
So the ShoppingListItemForm consists of two widgets:
item_id (checkbox)
shopping_list_id (hidden - foreign key)
What I would like to do is delete the corresponding ShoppingListItem object if the object exists and the checkbox is left unchecked.
I'm not sure how this delete would occur? Would I use a post validator to see which fields have/haven't been checked? I'm a bit lost on this one.
I'd do this by over-riding the ShoppingListForm's updateObject method and putting your custom delete() etc calls in there (be sure to call parent::updateObject() within it).
Depending how you implement it, you may also need to remove the embedded forms and their values to ensure saving still works correctly for the remaining objects. Try without, but if you do, you need to clear the following:
unset($taintedValues['ShoppingListItem'][$key]);
unset($this->embeddedForms['ShoppingListItem'][$key]);
unset($this->validatorSchema['ShoppingListItem'][$key]);
unset($taintedFiles['ShoppingListItem'][$key]);
If you want to see a custom updateObject method to get an idea how to interact with values etc:
http://www.symfony-project.org/forms/1_2/en/11-Doctrine-Integration#chapter_11_sub_customizing_the_updateobject_method
personnally, I would loop through the existing list items to see whether the corresponding checkboxes are checked in the action, and call the delete() method on the items for which it is not the case. I don't think it is the purpose of a post validator, I would do this directly in the action.