[MediaWiki-commits] [Gerrit] UEModulePDF: Support for target name in upload - change (mediawiki...BlueSpiceExtensions)
Robert Vogel has uploaded a new change for review. https://gerrit.wikimedia.org/r/205536 Change subject: UEModulePDF: Support for target name in upload .. UEModulePDF: Support for target name in upload * Added new BShtml2PDF servlet which supports a target name when uploading files * Adapted PHP code to support this new feature * Fixed issue with entities in CSS Change-Id: Ic7a507e689a4bd8a6bdd9ff86ead8a65625e410e (cherry picked from commit 62e78588044271606dae78f82823f72dd83eb859) --- M UEModulePDF/includes/PDFServlet.class.php M UEModulePDF/includes/PDFTemplateProvider.class.php M UEModulePDF/webservices/BShtml2PDF.war 3 files changed, 30 insertions(+), 22 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions refs/changes/36/205536/1 diff --git a/UEModulePDF/includes/PDFServlet.class.php b/UEModulePDF/includes/PDFServlet.class.php index 3521c86..e86b4a7 100644 --- a/UEModulePDF/includes/PDFServlet.class.php +++ b/UEModulePDF/includes/PDFServlet.class.php @@ -44,9 +44,10 @@ 'timeout' = 120, 'postData' = array( 'fileType' = '', //Need to stay empty so UploadAsset servlet saves file to document root directory - 'documentToken' = $this-aParams['document-token'], + 'documentToken' = $this-aParams['document-token'], + 'sourceHtmlFile_name' = basename( $sTmpHtmlFile ), 'sourceHtmlFile' = '@'.$sTmpHtmlFile, - 'wikiId' = wfWikiID() + 'wikiId' = wfWikiID() ) ); @@ -65,8 +66,8 @@ //Upload HTML source //TODO: Handle $sResponse $sResponse = Http::post( - $this-aParams['soap-service-url'].'/UploadAsset', - $aOptions + $this-aParams['soap-service-url'].'/UploadAsset', + $aOptions ); //Now do the rendering @@ -123,7 +124,9 @@ $aErrors[] = $sFilePath; continue; } - $aPostData['file'.$iCounter++] = '@'.$sFilePath; + $aPostData['file'.$iCounter.'_name'] = $sFileName; + $aPostData['file'.$iCounter] = '@'.$sFilePath; + $iCounter++; } if( !empty( $aErrors ) ) { @@ -142,6 +145,7 @@ global $bsgUEModulePDFCURLOptions; $aOptions = array_merge_recursive($aOptions, $bsgUEModulePDFCURLOptions); + $vHttpEngine = Http::$httpEngine; Http::$httpEngine = 'curl'; $sResponse = Http::post( diff --git a/UEModulePDF/includes/PDFTemplateProvider.class.php b/UEModulePDF/includes/PDFTemplateProvider.class.php index 4b0de00..438c78e 100644 --- a/UEModulePDF/includes/PDFTemplateProvider.class.php +++ b/UEModulePDF/includes/PDFTemplateProvider.class.php @@ -19,9 +19,9 @@ * @subpackage UEModulePDF */ class BsPDFTemplateProvider { - + /** -* Provides a array suitable for the MediaWiki HtmlFormField class +* Provides a array suitable for the MediaWiki HtmlFormField class * HtmlSelectField. * @param array $aParams Has to contain the 'template-path' that has to be * searched for valid templates. @@ -45,13 +45,13 @@ wfDebugLog( 'BS::UEModulePDF', 'BsPDFTemplateProvider::getTemplatesForSelectOptions: Error: '.$e-getMessage() ); return array( '-' = '-' ); } - + return $aOptions; - + } - + /** -* Reads in a template file to a DOMDocuments and collects additional +* Reads in a template file to a DOMDocuments and collects additional * information. * @param array $aParams Has to contain a valid 'template' entry. * @return array with the DOMDocument and some references. @@ -77,23 +77,23 @@ $oTemplateDOM = new DOMDocument(); $oTemplateDOM-formatOutput = true; $oTemplateDOM-load( $sTemplateMarkup ); - + $oHeadElement = $oTemplateDOM-getElementsByTagName( 'head' )-item( 0 ); $oBodyElement = $oTemplateDOM-getElementsByTagName( 'body' )-item( 0 ); $oTitleElement = $oTemplateDOM-getElementsByTagName( 'title' )-item( 0 ); - + $aResources = array();
[MediaWiki-commits] [Gerrit] UEModulePDF: Support for target name in upload - change (mediawiki...BlueSpiceExtensions)
Robert Vogel has submitted this change and it was merged. Change subject: UEModulePDF: Support for target name in upload .. UEModulePDF: Support for target name in upload * Added new BShtml2PDF servlet which supports a target name when uploading files * Adapted PHP code to support this new feature * Fixed issue with entities in CSS Change-Id: Ic7a507e689a4bd8a6bdd9ff86ead8a65625e410e (cherry picked from commit 62e78588044271606dae78f82823f72dd83eb859) --- M UEModulePDF/includes/PDFServlet.class.php M UEModulePDF/includes/PDFTemplateProvider.class.php M UEModulePDF/webservices/BShtml2PDF.war 3 files changed, 30 insertions(+), 22 deletions(-) Approvals: Robert Vogel: Verified; Looks good to me, approved diff --git a/UEModulePDF/includes/PDFServlet.class.php b/UEModulePDF/includes/PDFServlet.class.php index 3521c86..e86b4a7 100644 --- a/UEModulePDF/includes/PDFServlet.class.php +++ b/UEModulePDF/includes/PDFServlet.class.php @@ -44,9 +44,10 @@ 'timeout' = 120, 'postData' = array( 'fileType' = '', //Need to stay empty so UploadAsset servlet saves file to document root directory - 'documentToken' = $this-aParams['document-token'], + 'documentToken' = $this-aParams['document-token'], + 'sourceHtmlFile_name' = basename( $sTmpHtmlFile ), 'sourceHtmlFile' = '@'.$sTmpHtmlFile, - 'wikiId' = wfWikiID() + 'wikiId' = wfWikiID() ) ); @@ -65,8 +66,8 @@ //Upload HTML source //TODO: Handle $sResponse $sResponse = Http::post( - $this-aParams['soap-service-url'].'/UploadAsset', - $aOptions + $this-aParams['soap-service-url'].'/UploadAsset', + $aOptions ); //Now do the rendering @@ -123,7 +124,9 @@ $aErrors[] = $sFilePath; continue; } - $aPostData['file'.$iCounter++] = '@'.$sFilePath; + $aPostData['file'.$iCounter.'_name'] = $sFileName; + $aPostData['file'.$iCounter] = '@'.$sFilePath; + $iCounter++; } if( !empty( $aErrors ) ) { @@ -142,6 +145,7 @@ global $bsgUEModulePDFCURLOptions; $aOptions = array_merge_recursive($aOptions, $bsgUEModulePDFCURLOptions); + $vHttpEngine = Http::$httpEngine; Http::$httpEngine = 'curl'; $sResponse = Http::post( diff --git a/UEModulePDF/includes/PDFTemplateProvider.class.php b/UEModulePDF/includes/PDFTemplateProvider.class.php index 4b0de00..438c78e 100644 --- a/UEModulePDF/includes/PDFTemplateProvider.class.php +++ b/UEModulePDF/includes/PDFTemplateProvider.class.php @@ -19,9 +19,9 @@ * @subpackage UEModulePDF */ class BsPDFTemplateProvider { - + /** -* Provides a array suitable for the MediaWiki HtmlFormField class +* Provides a array suitable for the MediaWiki HtmlFormField class * HtmlSelectField. * @param array $aParams Has to contain the 'template-path' that has to be * searched for valid templates. @@ -45,13 +45,13 @@ wfDebugLog( 'BS::UEModulePDF', 'BsPDFTemplateProvider::getTemplatesForSelectOptions: Error: '.$e-getMessage() ); return array( '-' = '-' ); } - + return $aOptions; - + } - + /** -* Reads in a template file to a DOMDocuments and collects additional +* Reads in a template file to a DOMDocuments and collects additional * information. * @param array $aParams Has to contain a valid 'template' entry. * @return array with the DOMDocument and some references. @@ -77,23 +77,23 @@ $oTemplateDOM = new DOMDocument(); $oTemplateDOM-formatOutput = true; $oTemplateDOM-load( $sTemplateMarkup ); - + $oHeadElement = $oTemplateDOM-getElementsByTagName( 'head' )-item( 0 ); $oBodyElement = $oTemplateDOM-getElementsByTagName( 'body' )-item( 0 ); $oTitleElement = $oTemplateDOM-getElementsByTagName( 'title' )-item( 0 ); - + $aResources = array(); foreach( $aTemplate['resources'] as $sType = $aFiles ) {
[MediaWiki-commits] [Gerrit] UEModulePDF: Support for target name in upload - change (mediawiki...BlueSpiceExtensions)
Robert Vogel has uploaded a new change for review. https://gerrit.wikimedia.org/r/200161 Change subject: UEModulePDF: Support for target name in upload .. UEModulePDF: Support for target name in upload * Added new BShtml2PDF servlet which supports a target name when uploading files * Adapted PHP code to support this new feature * Fixed issue with entities in CSS Change-Id: Ic7a507e689a4bd8a6bdd9ff86ead8a65625e410e --- M UEModulePDF/includes/PDFServlet.class.php M UEModulePDF/includes/PDFTemplateProvider.class.php M UEModulePDF/webservices/BShtml2PDF.war 3 files changed, 30 insertions(+), 22 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions refs/changes/61/200161/1 diff --git a/UEModulePDF/includes/PDFServlet.class.php b/UEModulePDF/includes/PDFServlet.class.php index 3521c86..e86b4a7 100644 --- a/UEModulePDF/includes/PDFServlet.class.php +++ b/UEModulePDF/includes/PDFServlet.class.php @@ -44,9 +44,10 @@ 'timeout' = 120, 'postData' = array( 'fileType' = '', //Need to stay empty so UploadAsset servlet saves file to document root directory - 'documentToken' = $this-aParams['document-token'], + 'documentToken' = $this-aParams['document-token'], + 'sourceHtmlFile_name' = basename( $sTmpHtmlFile ), 'sourceHtmlFile' = '@'.$sTmpHtmlFile, - 'wikiId' = wfWikiID() + 'wikiId' = wfWikiID() ) ); @@ -65,8 +66,8 @@ //Upload HTML source //TODO: Handle $sResponse $sResponse = Http::post( - $this-aParams['soap-service-url'].'/UploadAsset', - $aOptions + $this-aParams['soap-service-url'].'/UploadAsset', + $aOptions ); //Now do the rendering @@ -123,7 +124,9 @@ $aErrors[] = $sFilePath; continue; } - $aPostData['file'.$iCounter++] = '@'.$sFilePath; + $aPostData['file'.$iCounter.'_name'] = $sFileName; + $aPostData['file'.$iCounter] = '@'.$sFilePath; + $iCounter++; } if( !empty( $aErrors ) ) { @@ -142,6 +145,7 @@ global $bsgUEModulePDFCURLOptions; $aOptions = array_merge_recursive($aOptions, $bsgUEModulePDFCURLOptions); + $vHttpEngine = Http::$httpEngine; Http::$httpEngine = 'curl'; $sResponse = Http::post( diff --git a/UEModulePDF/includes/PDFTemplateProvider.class.php b/UEModulePDF/includes/PDFTemplateProvider.class.php index 4b0de00..438c78e 100644 --- a/UEModulePDF/includes/PDFTemplateProvider.class.php +++ b/UEModulePDF/includes/PDFTemplateProvider.class.php @@ -19,9 +19,9 @@ * @subpackage UEModulePDF */ class BsPDFTemplateProvider { - + /** -* Provides a array suitable for the MediaWiki HtmlFormField class +* Provides a array suitable for the MediaWiki HtmlFormField class * HtmlSelectField. * @param array $aParams Has to contain the 'template-path' that has to be * searched for valid templates. @@ -45,13 +45,13 @@ wfDebugLog( 'BS::UEModulePDF', 'BsPDFTemplateProvider::getTemplatesForSelectOptions: Error: '.$e-getMessage() ); return array( '-' = '-' ); } - + return $aOptions; - + } - + /** -* Reads in a template file to a DOMDocuments and collects additional +* Reads in a template file to a DOMDocuments and collects additional * information. * @param array $aParams Has to contain a valid 'template' entry. * @return array with the DOMDocument and some references. @@ -77,23 +77,23 @@ $oTemplateDOM = new DOMDocument(); $oTemplateDOM-formatOutput = true; $oTemplateDOM-load( $sTemplateMarkup ); - + $oHeadElement = $oTemplateDOM-getElementsByTagName( 'head' )-item( 0 ); $oBodyElement = $oTemplateDOM-getElementsByTagName( 'body' )-item( 0 ); $oTitleElement = $oTemplateDOM-getElementsByTagName( 'title' )-item( 0 ); - + $aResources = array(); foreach( $aTemplate['resources'] as $sType = $aFiles ) {