From 97879cf3206b74ce671e33d111a125fa188bd0ee Mon Sep 17 00:00:00 2001 From: nchutchind Date: Wed, 22 Feb 2012 17:18:19 -0500 Subject: [PATCH 1/3] Changed name of Athletics Schedule Parser class in admin-module.json from ICSDataParser to the correct name of ICSAthleticParser. Added check to see if a Photo publish date had been set and not try to format an empty date. Also, added photo description to the list of properties set for an image from RSS. Modified the photo show template to only attempt to show description if it exists and only show photoDate if it exists. Added check to HTTPDataResponse.php so that when we determine whether or not there has been an HTTP error, we also make sure that out url started with "http". This was causing errors to be set on the object when some other class (which I can't recall now) was using the HTTPData classes to obtain data from files on the system, rather than files via URL. --- app/modules/athletics/config/admin-module.json | 2 +- app/modules/photos/PhotosWebModule.php | 17 +++++++++++------ app/modules/photos/templates/show.tpl | 9 ++++++++- lib/DataResponse/HTTPDataResponse.php | 2 +- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/app/modules/athletics/config/admin-module.json b/app/modules/athletics/config/admin-module.json index b3b7f4ba4..c700341d8 100644 --- a/app/modules/athletics/config/admin-module.json +++ b/app/modules/athletics/config/admin-module.json @@ -37,7 +37,7 @@ "section":{"labelKey":"ATHLETICS_ADMIN_SCHEDULE_SECTION_TITLE", "descriptionKey":"ATHLETICS_ADMIN_SCHEDULE_SECTION_DESCRIPTION", "type":"label"}, "BASE_URL":{"key":"BASE_URL","labelKey":"ATHLETICS_ADMIN_SCHEDULE_URL_TITLE", "descriptionKey":"ATHLETICS_ADMIN_SCHEDULE_URL_DESCRIPTION", "type":"text","omitBlankValue":true}, "RETRIEVER_CLASS":{"labelKey":"ATHLETICS_ADMIN_SCHEDULE_RETRIEVER_TITLE", "descriptionKey":"ATHLETICS_ADMIN_SCHEDULE_RETRIEVER_DESCRIPTION", "type":"select","optionsMethod":["AthleticEventsDataModel","getAthleticScheduleRetrievers"],"omitBlankValue":true}, - "PARSER_CLASS":{"labelKey":"ATHLETICS_ADMIN_SCHEDULE_PARSER_TITLE", "descriptionKey":"ATHLETICS_ADMIN_SCHEDULE_PARSER_DESCRIPTION", "type":"text","omitBlankValue":true,"showIf":["RETRIEVER_CLASS","URLDataRetriever"],"default":"ICSDataParser"} + "PARSER_CLASS":{"labelKey":"ATHLETICS_ADMIN_SCHEDULE_PARSER_TITLE", "descriptionKey":"ATHLETICS_ADMIN_SCHEDULE_PARSER_DESCRIPTION", "type":"text","omitBlankValue":true,"showIf":["RETRIEVER_CLASS","URLDataRetriever"],"default":"ICSAthleticParser"} }, "sectionindex":"string", "sectionsmethod":"loadScheduleData", diff --git a/app/modules/photos/PhotosWebModule.php b/app/modules/photos/PhotosWebModule.php index 9a87c02e1..7c704c846 100644 --- a/app/modules/photos/PhotosWebModule.php +++ b/app/modules/photos/PhotosWebModule.php @@ -43,8 +43,12 @@ private function getSectionsFromFeeds($feeds) { } protected function timeText($photo, $timeOnly=false) { - includePackage('Calendar'); - return DateFormatter::formatDate($photo->getPublished(), DateFormatter::SHORT_STYLE, DateFormatter::SHORT_STYLE); + if ($photo->getPublished()) { + includePackage('Calendar'); + return DateFormatter::formatDate($photo->getPublished(), DateFormatter::SHORT_STYLE, DateFormatter::SHORT_STYLE); + } else { + return ""; + } } protected function initializeForPage() { @@ -132,10 +136,11 @@ protected function initializeForPage() { $controller = $this->getFeed($album); $id = base64_decode($this->getArg('id')); $photo = $controller->getPhoto($id); - $this->assign('photoURL', $photo->getUrl()); - $this->assign('photoTitle', $photo->getTitle()); - $this->assign('photoAuthor', $photo->getAuthor()); - $this->assign('photoDate', $this->timeText($photo)); + $this->assign('photoURL', $photo->getUrl()); + $this->assign('photoTitle', $photo->getTitle()); + $this->assign('photoAuthor', $photo->getAuthor()); + $this->assign('photoDate', $this->timeText($photo)); + $this->assign('photoDescription', $photo->getDescription()); break; } diff --git a/app/modules/photos/templates/show.tpl b/app/modules/photos/templates/show.tpl index 9c79d7559..7cc565db9 100644 --- a/app/modules/photos/templates/show.tpl +++ b/app/modules/photos/templates/show.tpl @@ -7,8 +7,15 @@

{$photoTitle}

+ {if $photoDescription} +
+ {$photoDescription} + {/if} {$photoAuthor}
- {$photoDate} + {if $photoDate} +
+ {$photoDate} + {/if}

{include file="findInclude:common/templates/share.tpl" shareURL={$storyURL} shareRemark={$shareRemark} shareEmailURL={$shareEmailURL}}
diff --git a/lib/DataResponse/HTTPDataResponse.php b/lib/DataResponse/HTTPDataResponse.php index 94e2c89cf..f8e9d0403 100644 --- a/lib/DataResponse/HTTPDataResponse.php +++ b/lib/DataResponse/HTTPDataResponse.php @@ -48,7 +48,7 @@ protected function parseHTTPResponseHeaders($http_response_header) { } } - if (!$this->responseCode) { + if (!$this->responseCode && substr($this->requestURL,0,4) === "http") { $this->responseError = 'Error Retrieving Data'; } } From 9a8e693743a8a6237a35b181f5b5e9e021bb8e33 Mon Sep 17 00:00:00 2001 From: nchutchind Date: Thu, 1 Mar 2012 18:01:57 -0500 Subject: [PATCH 2/3] Removed break that was causing Maps to display an infowindow by default no matter how many placemarks were added. Modified Admin module css and js to allow for dynamic groups that extend to more than one line to fit without overlapping content. Add several groups to the Maps app to see this. Modified the DateFormatter to allow for defining and passing in your own patterns. If the parameter you pass in is non-numeric, then we don't bother looking at the preset constants and instead use whatever pattern was passed in. Changed GoogleJSMap to get the Description from the KML file since there is no subtitle entry. Also changed several occurrences of misnamed variables. --- app/common/javascript/maps.js | 2 +- app/modules/admin/css/compliant-computer.css | 4 +++- app/modules/admin/javascript/modules-common.js | 1 + lib/DateTime/DateFormatter.php | 6 ++++++ lib/Maps/GoogleJSMap.php | 6 +++--- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/common/javascript/maps.js b/app/common/javascript/maps.js index 5d0b7f9e3..e8d7ab069 100644 --- a/app/common/javascript/maps.js +++ b/app/common/javascript/maps.js @@ -32,7 +32,7 @@ KGOMapLoader.prototype.showDefaultCallout = function() { for (var id in this.placemarks) { count++; thePlacemark = id; - break; + //break; } if (count == 1) { diff --git a/app/modules/admin/css/compliant-computer.css b/app/modules/admin/css/compliant-computer.css index 88c5691f9..b5124d413 100644 --- a/app/modules/admin/css/compliant-computer.css +++ b/app/modules/admin/css/compliant-computer.css @@ -140,6 +140,8 @@ nav ul ul a { -webkit-box-shadow: 1px 1px 3px #999; -moz-box-shadow: 1px 1px 3px #999; padding: 18px 16px; + overflow:auto; + width:610px; } #content h1 { font-size: 30px; @@ -691,7 +693,7 @@ h1 img { } #adminSections { - height:30px; + min-height:30px; margin: 0; padding: 0 0 10px 0; border-bottom: 1px solid #ddd; diff --git a/app/modules/admin/javascript/modules-common.js b/app/modules/admin/javascript/modules-common.js index a134be6d4..b7426c114 100644 --- a/app/modules/admin/javascript/modules-common.js +++ b/app/modules/admin/javascript/modules-common.js @@ -154,6 +154,7 @@ function processModuleSections(data) { } $("#adminSections").append(li); }); + $("#adminSections").append('
'); } function processModuleData(data) { diff --git a/lib/DateTime/DateFormatter.php b/lib/DateTime/DateFormatter.php index 7e835b7fd..45502d093 100644 --- a/lib/DateTime/DateFormatter.php +++ b/lib/DateTime/DateFormatter.php @@ -57,6 +57,9 @@ public static function formatDate($date, $dateStyle, $timeStyle) { } private static function getTimeConstant($timeStyle) { + if (!is_numeric($timeStyle)) { + return $timeStyle; + } switch ($timeStyle) { case self::NO_STYLE: @@ -73,6 +76,9 @@ private static function getTimeConstant($timeStyle) { } private static function getDateConstant($dateStyle) { + if (!is_numeric($dateStyle)) { + return $dateStyle; + } switch ($dateStyle) { case self::NO_STYLE: diff --git a/lib/Maps/GoogleJSMap.php b/lib/Maps/GoogleJSMap.php index 327960103..08604e26f 100644 --- a/lib/Maps/GoogleJSMap.php +++ b/lib/Maps/GoogleJSMap.php @@ -102,7 +102,7 @@ private function getMarkerJS() '___LONGITUDE___' => $coord['lon'], '___TITLE___' => json_encode($marker->getTitle()), '___OPTIONS___' => $options, - '___SUBTITLE___' => json_encode($marker->getSubtitle()), + '___SUBTITLE___' => json_encode($marker->getDescription()), '___URL___' => $this->urlForPlacemark($marker), )); } @@ -141,7 +141,7 @@ private function getPolygonJS() $coord = $this->mapProjector->projectPoint($coord); } $template->appendValues(array( - '___ID___' => $marker->getId(), + '___ID___' => $placemark->getId(), '___LATITUDE___' => $coord['lat'], '___LONGITUDE___' => $coord['lon'], '___MULTIPATHSTRING___' => implode(',', $polyString), @@ -184,7 +184,7 @@ private function getPathJS() $coord = $this->mapProjector->projectPoint($coord); } $template->appendValues(array( - '___ID___' => $marker->getId(), + '___ID___' => $placemark->getId(), '___LATITUDE___' => $coord['lat'], '___LONGITUDE___' => $coord['lon'], '___PATHSTRING___' => $coordString, From a4a874da6ce333c2d00ee091a9556c34fd0c6f8d Mon Sep 17 00:00:00 2001 From: nchutchind Date: Fri, 2 Mar 2012 08:45:30 -0500 Subject: [PATCH 3/3] Reverted change back to getSubtitle() --- lib/Maps/GoogleJSMap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Maps/GoogleJSMap.php b/lib/Maps/GoogleJSMap.php index 08604e26f..efaeecf53 100644 --- a/lib/Maps/GoogleJSMap.php +++ b/lib/Maps/GoogleJSMap.php @@ -102,7 +102,7 @@ private function getMarkerJS() '___LONGITUDE___' => $coord['lon'], '___TITLE___' => json_encode($marker->getTitle()), '___OPTIONS___' => $options, - '___SUBTITLE___' => json_encode($marker->getDescription()), + '___SUBTITLE___' => json_encode($marker->getSubtitle()), '___URL___' => $this->urlForPlacemark($marker), )); }