How to order articles within a category? - joomla2.5

Problem: I have some articles within the same category. in the field ordering, some articles have the same number:
As in the picture, I can't control which one of the two articles with ordering = 0 goes up.
Question: How to get unique ordering-numbers to accomplish decent ordering?
I tried moving the articles to a new category, but they didn't change their order-numbers.

As #isherwood pointed out, check how the ordering is set in the menu link.
You mention that it is by article ordering so now
- go to content > article manager
at the top of the article table, click ordering
change the numbers for each article as required (or use the up / down arrows)
click the save icon
Good luck

Related

Dynamics Nav - How to highlight a row in a FactBox that contains a list

Relatively new to C/AL development. We have a FactBox page that contains a repeater with a Temporary table page source. The number of lines in the FactBox matches the number of lines in the parent page. The temporary records in the FactBox are accumulated one at a time based on a call from the parent page OnAfterGetRecord trigger. They are loaded into the FactBox based on a call from the parent page OnAfterGetCurrRecord trigger.
1a. For purposes of discussion, lets say there are 10 records in the parent page and in the FactBox page. How do I highlight the matching row in the FactBox when the user selects a given row in the parent page (e.g. they select row 3, I want to highlight row 3 in the FactBox)?
1b. How do I highlight multiple rows if the user selects multiple rows with Shift+Click or Ctrl+Click?
In the case of 1a above, OnAfterGetRecord is fired in the parent page with a filter equal to the key. In the second case, OnAfterGetRecord is fired in the parent page for each record selected by the user with a filter equal to 'Marked: Yes'. If I try to use Mark in the FactBox page, it filters the records so that only the selected ones are displayed in the FactBox, which is not what I want.
We are using 2013R2, although I would be interested in answers for other versions as well.
Thanks in advance for any ideas and/or suggestions.
PS. The FactBox is kind of a summary at a glance idea for each list row contained in the parent page. It contains a handful of temporary table fields that are populated from the parent page row primary key when the parent page OnAfterGetRecord and OnAfterGetCurrRecord triggers are fired. There is a 1 to 1 relationship between parent page lines and FactBox lines.
Basically, instead of having the FactBox oriented vertically displaying data only for the active parent page row, we transposed the FactBox vertical fields into a horizontal row of fields and display one row of FactBox data for each row of parent page data. The FactBox resyncs when the user sorts the parent page by clicking on the headers, etc.
Now I can’t even imagine your business case. Maybe if you spill it you will get a better advice.
Short answer for what you’re asking is.. you can’t. And you don’t want to. This is a factbox. It should provide extended information about line which you don’t want to put into repeater or fasttab because it is from related table. Hence the limitations.
And one more thing. Nav is very limited in terms of different fancy events and triggers. The only way to make it more advance is to write your own visual plugin which will replace most of the page’s interface. There you can do whatever JS (for example) allows you to do.

Select one record from related table if exists, else return None

I have this two models:
class Box(models.Model):
class BoxImages(models.Model):
box=models.ForeignKey(Box)
img=models.ImageField()
cover=models.IntegerField(default=0)
Only one image can be a cover image for a box and a box might not have any images at all. What I want now is to get list of boxes along with their cover image. But django uses inner join and brings boxes that have corresponding cover images only.
Box.objects.filter(box_boximages__cover=1).values('id','box_label')
How do I force it to go with left join or left outer join since i read the ORM decides on its own which join to use?
If you want to have all boxes, no matter whether they have a cover image or not, just drop the filter. The filter effectively reduces your queryset to only those Boxes that have a cover image.
Box.objects.select_related('box_boximages').values('id','box_label', 'box_boximages__cover')
select_related will fetch the related BoxImages in the same query (if they exist). The queryset will contain all Box objects, even if they don't have BoxImages.
EDIT:
It returns all images; the box appears 5 items cos there are 5 pictures for it.
Yes, you are correct. values will add entries per fkey relation. There are several ways to cope with that.
(a) simplest is, not to use values but simply iterate over the queryset and use the Box instances with their related BoxImages. The code will be easy to understand. With the select_related you should also be fine performance wise.
(b) use aggregation to only fetch the box images that are covers. Have a look at the aggregate function. You can use it in combination with Exists to find the cover images (or Max).
(c) Create two QuerySets, one with Boxes without BoxImages and the other using the BoxImage Covers to get all the related Box instances. Combine those two.
Personally, I think (a) is the simplest and therefore best to understand when reading the code at a later point or for other developers.
If you always end up selecting based on cover versus not-a-cover image and you have the freedom to change the models then you could think about using two models + model inheritance and create BoxCover (OneToOneRelation to Box) and BoxImage (n:1 to Box) models. This would be the easiest to understand and handle.

My test script is not finding items in dynamic web list control - list in code not updated with current info

I am having a problem in QTP with selection of a web list box and I have exhausted what I know to do to resolve it. I am hoping someone can help.
There are 5 controls in a container, 2 webedit controls and 3 weblist controls. Together, they allow entry of accounts associated with a customer, and there can be 16 accounts for any customer. There are only ever five controls active at any time, whether editing or entering information for an account. When the information for an account is entered and accepted, it changes to a read-only table row and a new set of controls appears below it for entry of the next account.
The information entered in these controls is the account number, type, description, designation, and status. The status value is contingent on the designation, and the items in the list change dynamically depending on what the user specifies for the designation. The status list is not enabled until the designation is specified.
After some experimenting with timing, I was able to get past an issue where the status list for the first account was seen by QTP as disabled even though it was clearly enabled. I was then able to advance to entry of the second account.
I change the designation on the second account and try to select an appropriate item (specified in a data table) in the status list. My specification from the data table is never found. I figured it was a problem with verbiage differences and also that I should probably anticipate that and address it now, so I wrote a function to accept three parameters, the list and up to two search items. My function searches the listbox passed to it and looks for a match (full or partial) on the search items it receives. Here is where I encountered a significant problem.
The list of the control my function received was from the previous iteration of the test, corresponding to the designation of that account. This is why my function was not finding the selection item. The list on the screen shows the appropriate items, which suggests that I am looking at the wrong object. I also get the ‘object is disabled’ message when I put my data table value directly into the list with the select statement.
The active controls are displayed below the readonly presentation of the previously entered accounts. I am very new to QTP, but I also read documentation. My only theory at this point is that ATP is not passing the right list to my function… that perhaps that how it was learned included the position, which will change each time. However, the spy identifies the screen control as the same item I processed for the preceding account, which makes my theory suspect. In addition, the other four controls, which are not dynamically changing, do not present the same problem. I can put the information in them consistently.
I apologize for the length of this question, but I wanted to be as thorough and clear as possible. Can anyone help me get past this obstacle.
There are many possiblities why it is exposing this behaviour, so let's start with something simple:
Did you try a myWebList.Refresh call before you do something with the listbox? Refresh re-identifies the object.
Have you put a break point (red dot) inside the custom function. Just see what is happening there. With the debug viewer you can enter a realtime command in the scope of that function like msgbox myWebList.exist(0) or myWebList.Highlight
Can you see how the disabled property is propagated to the webpage? If you can 'Object Spy' it as TO property, you can add it in the GUI Map description.
A more sophisticated aproach is to create a Description with the weblist properties. If you can read the disabled property as an RO property from the 'Object Spy', you can use it as an identifier like "attribute/customDisabledProperty:=false".
If you cannot correctly read the disabled property, you can create a description object and do a count on the amount of items that match that description on that page with numberOfLists = Browser("my browser").Page("my page").ChildObjects(myDescription).Count and get the last list with Set lastList = Browser("my browser").Page("my page").ChildObjects(myDescription)(numberOfLists-1)
Keep us informed. Depending on how this works out, we can work into a direction for a solution.
I figured this out early this morning. There are 4 different list boxes used, each made visible or enabled dependent on the selection of the previous list. This is why the spy found the one listed when I was using it and also why the items in the list were not appropriate to what I had selected and also why it appeared disabled to QTP but enabled to me.
I was selecting the same designation when trying to spy it. It was intuitive that the controls were all the same. I am also a windows programmer and I would have populated the same list each time with the appropriate list items, and I presumed that was what the web developer was doing. It was not and it took some time to figure that out. Now that I figured it out, everything is working fine, and I came back to report that. This was a significant, time-intensive lesson.
Thank you very much for your input. It is still useful because I am very new to QTP and every thing I learn is of value.

Best practice for many-to-many relationship between content tree items?

In my content tree, I have a tree of content items which represent cities. For each of those I want to have logical connections to a set of... let's say... National Parks that are within 2 hours driving distance. So a city will have multiple parks... and each set will be different... but of course a park will also be associated with more than one city.
What kind of Item and field setup works well for this sort of situation? I will be creating a custom renderer for these items, so I'm mostly concerned with how this should look in Sitecore to maximize ease of use and performance.
I'm using Sitecore 6.2.
(cross-posting from SDN, please forgive me... but I want to encourage more Sitecore community here on StackOverflow)
For this kind of relationship you'll need the following structure:
Home
Cities
NY
London
Paris
Parks
Park1
Park2
Park3
The "City" template should have the Multilist type field called "Parks". The soulrce of this field should look to the root of Parks (Home > Parks). The same way the "Park" template has the Multilist field called "Cities". The source of this field should look to the root of Cities (Home > Cities).
In this way you'll be easily able to perform any kind of request.
Hope this helps.
If the connection has to be both ways one way you could handle it is by adding some code to the save event.
Let's assume we have a City template with a field called "Related Parks", and a Park template with a "Related Cities" field.
Say we save a City item with two parks in the "Related Parks" field. On the save event we could retrieve the two parks and insert the current city being saved into the "Related Cities" field on those parks.
I am not necessarily saying this is the best way to go about it, just another option.
Are you going to be doing any lookups from park to city? For instance, would you need to say "find all the cities that are associated with a given park"? Or will it just be "find all the parks that are associated with a given city"? If you need to do the lookups in both directions, things get a little trickier and I would probably recommend using a search index. However, if your lookup is only in one direction, you could just use a treelist field to make associations from one item to many others.
From your description I'm not entirely sure if you actually need to use that many-to-many relationship, or if a one-to-many path is all you need?

Long check list ui pattern for web

I have a data entry page where the user is required so make some selections from a list. Currently it is just a check list with about 10 items they can tick, but is will expand soon to about 230. What is a good UI paradigm for dealing with a large number of selectable items? I am considering dual list type control.
Dual list, BUT, for a large # of non-groupable elements:
MUST have ability to select multiple elements (Duh!)
SHOULD have ability to select ALL elements with a click
SHOULD have ability to search (in either list), and select all matching elements
Also, if the lists are REALLY big (1k+), you may run into trouble with slow rendering.
If so, you can also "paginate" the list - e.g. display only first N elements, allow selection from those, and then ability to shift the "frame" to next N elements.
(all the above, BTW, are real attributes of a solution we implemented in an enterprise web app needing a selection list with 30k possible values which could not be grouped).
Are the items grouped in any way? If so, a collapsible tree-type navigation might be useful.
It really depends on the situation and how much space you have but in most cases I prefer the dual list control, aka list builder, you where thinking about.
Here's a nice link for inspiration (requires silverlight): http://good.ly/qh7aeg8
Here's an accessible way using only HTML and Javascript:
Use the HTML fieldset tag to chunk them into logical groups;
use (say) JQuery to show/hide each group;
add navigation at the top to jump to each group.
If you hide all the groups initially, users can click the link for the groups they want to complete. Further, if you add a rollover (could just be a tooltip title attribute on the links for accessibility) with a description of each group, users will have a 'preview' before visiting it.
Finally, if the labels are short enough, give the fieldsets a width and make them into columns using CSS float or absolute positioning.
Try to stick to valid (X)HTML, CSS and Javascript - there are plenty of precedents for this.