I'm using mapnik 0.7.1 and tilelite with openlayers. I would like to prescribe two rules under a style for a shapefile layer (within layers-shapefiles.xml.inc), however, liteserv.py will not start if I do this. I also tried two styles for this layer (one rule per style), but same result. Here is the style block:
<Style name="wilderness_boundaries">
<Rule>
&maxscale_zoom0;
&minscale_zoom9;
<PolygonSymbolizer>
<CssParameter name="fill">#72B656</CssParameter>
</PolygonSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">grey</CssParameter>
<CssParameter name="stroke-width">1.0</CssParameter>
<CssParameter name="stroke-dasharray">4,2</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
&maxscale_zoom10;
&minscale_zoom20;
<PolygonSymbolizer>
<CssParameter name="fill">#72B656</CssParameter>
</PolygonSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">grey</CssParameter>
<CssParameter name="stroke-width">1.0</CssParameter>
<CssParameter name="stroke-dasharray">4,2</CssParameter>
</LineSymbolizer>
<TextSymbolizer name="NAME" fontset_name="book-fonts" size="8" dy="2" fill="grey" halo_radius="1" />
</Rule>
</Style>
and the corresponding layer definition:
<Layer name="wilderness_boundaries" status="on" srs="&srs4326;">
<StyleName>wilderness_boundaries</StyleName>
<Datasource>
<Parameter name="type">shape</Parameter>
<Parameter name="file">&world_boundaries;/wilderness_EPSG4326.shp</Parameter>
<Parameter name="encoding">latin1</Parameter>
</Datasource>
</Layer>
If I execute generate_image.py with this configuration, I get a segmentation fault.
As you can see, I am trying to show wilderness area polygons at all zoom levels, but label them only at zoom levels above 10. Multiple rules are allowed for a given style in osm.xml, what am I missing?
Thanks,
John
a segfault indicates you forgot to run generate_xml.py - in other words the styles sheet still has files in the inc/ directory that have %(something)s that need filled in. libxml2, the library mapnik uses under the hood, has a silly bug that causes segfaults when entities cannot be loaded.
Related
I have some Styles-Files.
For example ButtonStyles.xaml looks like this:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style
x:Key="CustomButtonStyle"
TargetType="Button">
<Setter
Property="Foreground"
Value="White" />
<Setter
Property="Background"
Value="Black" />
<Setter
Property="Height"
Value="32" />
</Style>
<Style
TargetType="Button"
BasedOn="{StaticResource CustomButtonStyle}">
</Style>
</ResourceDictionary>
And I have Pages which extend from my BasePage.
If I want my new Styles to override the controls I have to add this Code in every Page:
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Styles/ButtonStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Page.Resources>
However if I have this code in my BasePage it won't theme my controls.
Is there a way to import my styles in every Page without copy-pasting this code over and over?
I can't reproduce this issue with using BasePage in my side. It would be better if you can post a sample that can reproduce your issue.
However, to use the custom styles in every page, I recommend merging resource dictionaries into Application.Resources. Application.Resources is the best place to put any app-specific resources that are referenced by multiple pages in your app's navigation structure. If the requested resource is not found in the Page.Resources, the XAML resources system will tries to check the Application.Resources property. So if we merged resource dictionaries into Application.Resources, we can use them in all pages of the app. And if we want to use some different styles in certain pages, we can specify new Style in their Page.Resources. For more information, see Lookup behavior for XAML resource references.
So we can merge resource dictionaries into Application.Resources like following:
(Note that ../Styles/ButtonStyles.xaml can't be used in WinRT XAML, we should use "/" to refer to the package root.)
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Styles/ButtonStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Then in other pages, if we don't specify the Style for Button, it will use the style defined in ButtonStyles.xaml.
I am developing a class where I wish to databind the attributes of a class to a dataset.
I have managed to get the following to work in the following simplified version of my class:
<class name="myclass">
<dataset name="attSettings"><settings>
<property name="applyshadow" defaultvalue="false" type="boolean" />
</settings></dataset>
<attribute name="default_applyshadow" type="boolean" value="$once{(this.attSettings.getPointer()).xpathQuery('settings/property[#name="applyshadow"]/#defaultvalue')}" />
</class>
However, this syntax is very cumbersome and does not feel right so I am wondering if there is a better way to do this.
This doesn't answer your question but explains why you cannot use a local dataset in your situation. When you have a local dataset in a class, the dataset can only be addressed in children of the class, e.g.:
<canvas debug="true">
<class name="myclass">
<dataset name="myds">
<root>
<property name="applyshadow" defaultvalue="false" type="boolean" />
</root>
</dataset>
<text datapath="local:classroot.myds:/root/property[#name='applyshadow']/#defaultvalue" />
</class>
<myclass />
</canvas>
The <text> element can access the dataset of the parent class by prepending local: to the datapath value. If you don't select a name for your dataset, OpenLaszlo will automatically use the name localdata for the dataset. Datasets using that name can be addressed by omitting the dataset name in the datapath/xpath value, e.g.
<class name="myclass">
<dataset>
<root>
<property name="applyshadow" defaultvalue="false" type="boolean" />
</root>
</dataset>
<text datapath="local:classroot:/root/property[#name='applyshadow']/#defaultvalue" />
</class>
Note that the datapath does not have a name and that the datapath used for the <text> component is now local:classroot:/root/..., while local:classroot.localdata:/root/... would work as well.
I don't understand the design decision which makes it impossible to allow the use a local dataset in the datapath of a class containing that dataset, but maybe there were some technical reasons (initialization order, etc.) for it.
I figured out the proper syntax to do what I wanted:
<dataset name="myclass_settings">
<root>
<property name="applyshadow" defaultvalue="false" type="boolean" />
</root>
</dataset>
<class name="myclass" datapath="myclass_settings:/root">
<attribute name="default_applyshadow" type="boolean" value=$path{'property[#name="applyshadow"]/#defaultvalue'}" />
</class>
The $path{} constraint is used on the class attribute to link the value to the dataset via a relative xpath query. I also had to move the dataset outside of the class to get it to work.
Is there any way to have a custom recipe add some text and image fields to the page? It looks like part of the recipe handles commands, but I can't find any commands that do this at # http://docs.orchardproject.net/Documentation/Using-the-command-line-interface
Update
Thanks for the response Bertrand, but there are some issues with that.
I exported everything for a recipe from a tenant that has 1. added fields, 2. added parts to the Page along with 3. an added List and 4. an added container widget to the Default layer that shows the list.
<Metadata>
<Types>
<Page ContentTypeSettings.Draftable="True" TypeIndexing.Included="true">
<TagsPart />
<LocalizationPart />
<TitlePart/>
<AutoroutePart />
<ContainablePart />
<AmazonProductsPart />
<YouTubeVideosPart />
</Page>
</Types>
<Parts>
<BodyPart BodyPartSettings.FlavorDefault="html" />
<Page ContentPartSettings.Attachable="True">
<Thumbnail.ImageField DisplayName="Thumbnail" ImageFieldSettings.MaxHeight="75" ImageFieldSettings.MaxWidth="75" ImageFieldSettings.Required="False" ImageFieldSettings.AlternateText="True" ImageFieldSettings.ResizeAction="Validate" />
<PageImage.ImageField DisplayName="PageImage" ImageFieldSettings.MaxHeight="250" ImageFieldSettings.MaxWidth="0" ImageFieldSettings.Required="False" ImageFieldSettings.AlternateText="True" ImageFieldSettings.ResizeAction="Resize" />
<PreContent.TextField DisplayName="PreContent" ImageFieldSettings.MaxHeight="0" ImageFieldSettings.MaxWidth="0" ImageFieldSettings.Required="False" ImageFieldSettings.AlternateText="False" ImageFieldSettings.ResizeAction="Validate" TextFieldSettings.Flavor="Html" TextFieldSettings.Required="False" />
<PostContent.TextField DisplayName="PostContent" ImageFieldSettings.MaxHeight="0" ImageFieldSettings.MaxWidth="0" ImageFieldSettings.Required="False" ImageFieldSettings.AlternateText="False" ImageFieldSettings.ResizeAction="Validate" TextFieldSettings.Flavor="Html" TextFieldSettings.Required="False" />
</Page>
</Parts>
</Metadata>
...
<Data>
<List Id="/alias=page-list" Status="Published">
<CommonPart Owner="/User.UserName=admin" CreatedUtc="2012-05-26T22:52:20Z" PublishedUtc="2012-05-26T22:57:37Z" ModifiedUtc="2012-05-26T22:57:37Z" />
<AutoroutePart Alias="page-list" UseCustomPattern="false" />
<AdminMenuPart AdminMenuPosition="2" OnAdminMenu="false" />
<MenuPart MenuText="Page List" MenuPosition="3" OnMainMenu="false" />
<ContainerPart ItemContentType="Page" ItemsShown="true" Paginated="true" PageSize="10" OrderByProperty="CommonPart.CreatedUtc" OrderByDirection="1" />
<TitlePart Title="Page List" />
</List>
<ContainerWidget Id="" Status="Published">
<CommonPart Owner="/User.UserName=admin" Container="/Layer.LayerName=Default" CreatedUtc="2012-05-26T22:55:42Z" PublishedUtc="2012-05-26T22:55:42Z" ModifiedUtc="2012-05-26T22:55:42Z" />
<WidgetPart Title="Page List" Position="1" Zone="AsideFirst" RenderTitle="false" />
<ContainerWidgetPart Container="/alias=page-list" PageSize="5" OrderByProperty="CommonPart.CreatedUtc" OrderByDirection="1" ApplyFilter="false" FilterByProperty="CustomPropertiesPart.CustomOne" FilterByOperator="=" />
</ContainerWidget>
</Data>
I then inject that into a copy of the default recipe with the appropriate modules activated.
When creating a new tenant from that recipe,
All the modules are enabled, good
The list is created, good
The page has the added parts, good
The page does not have the added fields, bad
The container widget does not exist, bad
It looks like the part fields are not added, and the widget was not created.
I did another simple test, and it looks like a bug?
Repro Steps:
Add fields to the page
Add a widget
Export everything
delete the widget
Import the exported xml
Expected: The widget to be back
Actual: the widget is still missing
is the recipe suppose to honor page fields and widgets, did I do something wrong, or is this a bug?
Update
Okay, this has to be a bug. When manually adding the fields, I get this message even though it isn't showing the fields: "A field with the same name already exists."
You don't need a command, this is supported by recipes without that. The easiest way to get an example is to add a field from the admin UI, and then export the metadata and examine the recipe that created.
I had created a static block containing images aligned vertically then I added an xml block for calling it in the right column in catalog.xml.
Now it is showing that block on all pages .
BUt I dont want just this specific block to be displayed on detail page . So how can I restrict it not to be shown on detail page while showing on rest of the pages.
I did tried to remove it by this:
<remove name="right.info" />
And this is the block I'm calling:
<block type="core/text_list" name="banners">
<block type="cms/block" name="right.info">
<action method="setBlockId"><block_id>right_logos</block_id></action>
</block>
</block>
<reference name="banners">
<action method="unsetChild"><name>right.info</name></action>
</reference>
I'm trying to use Magento for my shopping cart and want to switch from a right col layout to left col. I've turned on ID/CLASS display on the Web Developer Toolbar in firefox, and am seeing ".main col2-right-layout", which i believe i must switch to ".main col2-left-layout", the alternate style is predefined. but running searches for files with the phrase "col2-right-layout" in them is only pulling up the style sheet. I am searching THE ENTIRE Magento directory. How is this possible? Not case sensitive, and I'm even searching hidden folders. How can it be?
**i have looked in that file, the div is not mentioned. **
Files are in app/layout/default/default/templates/page/
I've not got a dev copy of magento at home, thats all I can remember off the top of my head - will try and remember to confirm when at work.
If you want to swap the templates, you need to look in app/layout/default/default/layout/page.xml, plus some of the other xml files - the templates are defined there.
(Yes, magento's layout/templating system is complicated, and has a steep learning curve, but its worth it!)
col2-right-layout is mentioned in
app/design/frontend/base/default/template/page/2columns-right.phtml
or in Magento 1.3
app/design/frontend/default/default/template/page/2columns-right.phtml
If you want to swap the layout I'd suggest changing it in one of the layout xml files. For the shopping cart edit app/design/frontend/base/default/layout/checkout.xml
change
<checkout_cart_index translate="label">
<label>Shopping Cart</label>
<remove name="right"/>
<remove name="left"/>
<!-- Mage_Checkout -->
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
to
<checkout_cart_index translate="label">
<label>Shopping Cart</label>
<remove name="right"/>
<remove name="left"/>
<!-- Mage_Checkout -->
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
And similarly for the checkout page in the same file change
<checkout_onepage_index translate="label">
<label>One Page Checkout</label>
<!-- Mage_Checkout -->
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
</reference>
to
<checkout_onepage_index translate="label">
<label>One Page Checkout</label>
<!-- Mage_Checkout -->
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
As always it is better to make a copy of the file you are editing to your own theme.