protected function getInlineJavaScriptTranslations()
 {
     $accept_text = CME::_('I Have Read the CME Information / Continue');
     $cancel_text = CME::_('Cancel and Return');
     $confirm_text = CME::_('Before you view %s, please attest to reading the following:');
     return sprintf("CMEFrontMatterDisplay.accept_text = %s;\n" . "CMEFrontMatterDisplay.cancel_text = %s;\n" . "CMEFrontMatterDisplay.confirm_text = %s;\n", SwatString::quoteJavaScriptString($accept_text), SwatString::quoteJavaScriptString($cancel_text), SwatString::quoteJavaScriptString($confirm_text));
 }
 protected function getInlineJavaScript()
 {
     $photo_id = $this->getArgument('photo_id');
     $script = sprintf("var map_obj = new PinholeMap(%s, %s, %s);\n", SwatString::quoteJavaScriptString('map'), SwatString::quoteJavaScriptString($this->tag_list->__toString()), $photo_id !== null ? $photo_id : 'null');
     $photos = $this->tag_list->getGpsData();
     $markers = array();
     foreach ($photos as $photo) {
         // group photos that are very close to each other
         $rounded_lat = round($photo->gps_latitude, 4);
         $rounded_long = round($photo->gps_longitude, 4);
         $key = $rounded_lat . '_' . $rounded_long;
         if (array_key_exists($key, $markers)) {
             $markers[$key]->photos[] = $photo->id;
         } else {
             $marker = new StdClass();
             $marker->photos = array($photo->id);
             $marker->latitude = $rounded_lat;
             $marker->longitude = $rounded_long;
             $markers[$key] = $marker;
         }
     }
     foreach ($markers as $marker) {
         $script .= sprintf("map_obj.addMarker(new PinholeMapMarker(%s, %s, [%s]));\n", (double) $marker->latitude, (double) $marker->longitude, implode(', ', $marker->photos));
     }
     return $script;
 }
 protected function getInlineJavaScript()
 {
     $id = SwatString::quoteJavaScriptString($this->id);
     $size = SwatString::quoteJavaScriptString($this->getValue('size'));
     $limit = $this->getValue('limit');
     return sprintf("BlorgFlickrJsonGadget.div = %s\n\t\t\tBlorgFlickrJsonGadget.size = %s;\n\t\t\tBlorgFlickrJsonGadget.limit = %s;", $id, $size, $limit);
 }
 /**
  * Gets translatable string resources for the JavaScript object for
  * this widget
  *
  * @return string translatable JavaScript string resources for this widget.
  */
 protected function getInlineJavaScriptTranslations()
 {
     $attach_text = SwatString::quoteJavaScriptString(Blorg::_('Attach'));
     $detach_text = SwatString::quoteJavaScriptString(Blorg::_('Detach'));
     $attached_text = SwatString::quoteJavaScriptString(Blorg::_('(attached)'));
     $detached_text = SwatString::quoteJavaScriptString(Blorg::_('(not attached)'));
     return "BlorgFileAttachControl.attach_text = {$attach_text};\n" . "BlorgFileAttachControl.detach_text = {$detach_text};\n" . "BlorgFileAttachControl.attached_text = {$attached_text};\n" . "BlorgFileAttachControl.detached_text = {$detached_text};\n";
 }
Exemple #5
0
 protected function getInlineJavaScript()
 {
     $config = $this->app->config->pinhole;
     $start_latitude = $config->map_last_latitude === null ? "''" : $config->map_last_latitude;
     $start_longitude = $config->map_last_longitude === null ? "''" : $config->map_last_longitude;
     $start_zoom_level = $config->map_last_zoom_level === null ? "''" : $config->map_last_zoom_level;
     $script = sprintf("var map_obj = new PinholeGeoTagMap(" . "%s, %s, %s, %s);\n", SwatString::quoteJavaScriptString('map'), $start_latitude, $start_longitude, $start_zoom_level);
     return $script;
 }
Exemple #6
0
 /**
  * Gets the inline JavaScript for this embed markup view
  *
  * @return string the inline JavaScript for this embed markup view.
  */
 protected function getInlineJavaScript()
 {
     $options = $this->getOptions();
     $values = array();
     $titles = array();
     foreach ($options as $option) {
         $values[] = SwatString::quoteJavaScriptString($option->value);
         $titles[] = SwatString::quoteJavaScriptString($option->title);
     }
     $values = implode(', ', $values);
     $titles = implode(', ', $titles);
     return sprintf("var %s_obj = new BlorgMarkupView('%s', [%s], [%s]);", $this->id, $this->id, $values, $titles);
 }
 /**
  * Gets translatable string resources for the JavaScript object for
  * this gadget
  *
  * @return string translatable JavaScript string resources for this gadget.
  */
 protected function getInlineJavaScriptTranslations()
 {
     $throbber_text = Blorg::_('loading …');
     $visit_text = Blorg::_('Visit the Last.fm page for this track');
     $none_text = Blorg::_('‹none›');
     $months = array();
     $short_months = array();
     $date = new SwatDate('2000-01-01T00:00:00Z');
     for ($i = 1; $i <= 12; $i++) {
         $months[] = SwatString::quoteJavaScriptString($date->formatLikeIntl('MMMM'));
         $short_months[] = SwatString::quoteJavaScriptString($date->formatLikeIntl('MMM'));
         $date->setMonth($i + 1);
     }
     $months = implode(', ', $months);
     $short_months = implode(', ', $short_months);
     return sprintf("BlorgLastFmGadget.throbber_text = '%s';\n" . "BlorgLastFmGadget.visit_text = '%s';\n" . "BlorgLastFmGadget.none_text = '%s';\n" . "BlorgLastFmGadget.months = [%s];\n" . "BlorgLastFmGadget.short_months = [%s];\n", $throbber_text, $visit_text, $none_text, $months, $short_months);
 }
 /**
  * Gets translatable string resources for the JavaScript object for
  * this widget
  *
  * @return string translatable JavaScript string resources for this widget.
  */
 protected function getInlineJavaScriptTranslations()
 {
     $delete_text = SwatString::quoteJavaScriptString(Blorg::_('Delete Image'));
     $confirm_text = SwatString::quoteJavaScriptString(Blorg::_('Delete header image?'));
     return "BlorgHeaderImageDisplay.delete_text  = {$delete_text};\n" . "BlorgHeaderImageDisplay.confirm_text = {$confirm_text};\n";
 }
 /**
  * Gets the inline JavaScript required for this control
  *
  * @return string the inline JavaScript required for this control.
  */
 protected function getInlineJavaScript()
 {
     $javascript = sprintf("var %s_obj = " . "new BlorgPublishRadioTable('%s', %d, %d, %s);\n", $this->id, $this->id, self::PUBLISH_NOW, self::PUBLISH_AT, SwatString::quoteJavaScriptString(Blorg::_('Edit Publish Date')));
     return $javascript;
 }
Exemple #10
0
 protected function getInlineJavaScript()
 {
     $unprocessed_photos_array = array();
     foreach ($this->unprocessed_photos as $photo) {
         $unprocessed_photos_array[] = $photo->id;
     }
     $javascript = '';
     $javascript .= sprintf("Pinhole.page.PendingPhotosPage.processing_complete_text = %s;\n", SwatString::quoteJavaScriptString(Pinhole::_('Processing complete!')));
     $javascript .= sprintf("Pinhole.page.PendingPhotosPage.processing_text = %s;\n", SwatString::quoteJavaScriptString(Pinhole::_('Processing photo %s of %s')));
     $javascript .= sprintf("Pinhole.page.PendingPhotosPage.edit_tag_text = %s;\n", SwatString::quoteJavaScriptString(Pinhole::_('edit')));
     $javascript .= sprintf("Pinhole.page.PendingPhotosPage.merge_tag_text = %s;\n", SwatString::quoteJavaScriptString(Pinhole::_('merge')));
     $javascript .= sprintf("Pinhole.page.PendingPhotosPage.merge_tag_text = %s;\n", SwatString::quoteJavaScriptString(Pinhole::_('merge')));
     $javascript .= sprintf("Pinhole.page.PendingPhotosPage.processor_server = %s;\n", SwatString::quoteJavaScriptString($this->getComponentName() . '/ProcessorServer'));
     $javascript .= sprintf("var page = new Pinhole.page.PendingPhotosPage([%s]);\n", implode(', ', $unprocessed_photos_array));
     return $javascript;
 }
 /**
  * Gets translatable string resources for the JavaScript object for
  * this widget
  *
  * @return string translatable JavaScript string resources for this widget.
  */
 protected function getInlineJavaScriptTranslations()
 {
     $confirm_text = SwatString::quoteJavaScriptString(Blorg::_('Delete the file “%s”?'));
     $delete_text = SwatString::quoteJavaScriptString(Blorg::_('Delete'));
     return "BlorgFileDeleteControl.confirm_text = {$confirm_text};\n" . "BlorgFileDeleteControl.delete_text = {$delete_text};\n";
 }
Exemple #12
0
 protected function getInlineJavaScriptTranslations()
 {
     $strings = array('start_text' => CME::_('Start Quiz'), 'continue_text' => CME::_('Continue Quiz'), 'next_text' => CME::_('Next Question'), 'previous_text' => CME::_('Previous Question'), 'quiz_status_text' => CME::_('Question %s of %s'), 'submit_text' => CME::_('Submit Quiz'), 'review_text' => CME::_('Review Answers'), 'intro_text' => CME::_('Return to Introduction'), 'close_text' => CME::_('Close'), 'question_title_text' => CME::_('Question %s'), 'change_text' => CME::_('Change'), 'answer_text' => CME::_('Answer'), 'intro_status_review_text' => CME::_('%s of %s questions completed'), 'intro_status_start_text' => CME::_('%s questions, about %s'), 'intro_status_continue_text' => CME::_('%s of %s questions completed, about %s remaining'), 'review_status_text_0' => CME::_('All questions are answered.'), 'review_status_text_1' => CME::_('%s is not answered.'), 'review_status_text_2_to_5' => CME::_('%s are unanswered.'), 'review_status_text_many' => CME::_('%s questions are unanswered.'), 'review_status_required_text' => CME::_('All questions must be answered before the quiz can be ' . 'submitted.'), 'time_hours_text_1' => CME::_('one hour'), 'time_hours_text_many' => CME::_('%s hours'), 'time_minutes_text_many' => CME::_('%s minutes'));
     $javascript = '';
     foreach ($strings as $key => $text) {
         $javascript .= sprintf("CMEQuizPage.%s = %s;\n", $key, SwatString::quoteJavaScriptString($text));
     }
     return $javascript;
 }