Skip to content

Commit

Permalink
QGIS Server: Exclude composers in OWS tab does not work
Browse files Browse the repository at this point in the history
In the current QGIS server, if one uses a list of "Exclude composers" in the OWS tab, QGIS server lists only the excluded composers and not the composers the map author actually wants. So it acts as a white list and not as a black list.
  • Loading branch information
rldhont authored and mhugent committed Sep 4, 2013
1 parent ad942b6 commit b833897
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/app/qgsprojectproperties.cpp
Expand Up @@ -316,7 +316,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
grpWMSList->setChecked( mWMSList->count() > 0 );

//composer restriction for WMS
values = QgsProject::instance()->readListEntry( "WMSComposerList", "/", QStringList(), &ok );
values = QgsProject::instance()->readListEntry( "WMSRestrictedComposers", "/", QStringList(), &ok );
mWMSComposerGroupBox->setChecked( ok );
if ( ok )
{
Expand Down Expand Up @@ -699,11 +699,11 @@ void QgsProjectProperties::apply()
{
composerTitles << mComposerListWidget->item( i )->text();
}
QgsProject::instance()->writeEntry( "WMSComposerList", "/", composerTitles );
QgsProject::instance()->writeEntry( "WMSRestrictedComposers", "/", composerTitles );
}
else
{
QgsProject::instance()->removeEntry( "WMSComposerList", "/" );
QgsProject::instance()->removeEntry( "WMSRestrictedComposers", "/" );
}

//WMS layer restrictions
Expand Down
12 changes: 6 additions & 6 deletions src/mapserver/qgsprojectparser.cpp
Expand Up @@ -2407,8 +2407,8 @@ QList<QDomElement> QgsProjectParser::publishedComposerElements() const
QDomNodeList composerNodeList = mXMLDoc->elementsByTagName( "Composer" );

QDomElement propertiesElem = mXMLDoc->documentElement().firstChildElement( "properties" );
QDomElement wmsComposerListElem = propertiesElem.firstChildElement( "WMSComposerList" );
if ( wmsComposerListElem.isNull() )
QDomElement wmsRestrictedComposersElem = propertiesElem.firstChildElement( "WMSRestrictedComposers" );
if ( wmsRestrictedComposersElem.isNull() )
{
for ( unsigned int i = 0; i < composerNodeList.length(); ++i )
{
Expand All @@ -2417,11 +2417,11 @@ QList<QDomElement> QgsProjectParser::publishedComposerElements() const
return composerElemList;
}

QSet<QString> publishedComposerNames;
QDomNodeList valueList = wmsComposerListElem.elementsByTagName( "value" );
QSet<QString> restrictedComposerNames;
QDomNodeList valueList = wmsRestrictedComposersElem.elementsByTagName( "value" );
for ( int i = 0; i < valueList.size(); ++i )
{
publishedComposerNames.insert( valueList.at( i ).toElement().text() );
restrictedComposerNames.insert( valueList.at( i ).toElement().text() );
}

//remove unpublished composers from list
Expand All @@ -2431,7 +2431,7 @@ QList<QDomElement> QgsProjectParser::publishedComposerElements() const
{
currentElem = composerNodeList.at( i ).toElement();
currentComposerName = currentElem.attribute( "title" );
if ( publishedComposerNames.contains( currentComposerName ) )
if ( !restrictedComposerNames.contains( currentComposerName ) )
{
composerElemList.push_back( currentElem );
}
Expand Down

0 comments on commit b833897

Please sign in to comment.