00001 <?php
00002
00011 class TKSnapMediaImagePreview extends TKSnapPreview {
00019 protected function getTranslators() {
00020 return array(
00021 'Media Image (Thumb)' => 'STransMediaImage',
00022 'Media Image (Medium)' => 'STransMediaImage',
00023 'Media Image (Display)' => 'STransMediaImage',
00024 'Media Image (Original)' => 'STransMediaImage',
00025 );
00026 }
00027
00036 protected function getParameters($name) {
00037 switch($name) {
00038 case 'Media Image (Thumb)':
00039 return array('which' => 'thumb');
00040 case 'Media Image (Medium)':
00041 return array('which' => 'medium');
00042 case 'Media Image (Display)':
00043 return array('which' => 'display');
00044 case 'Media Image (Original)':
00045 return array('which' => 'original');
00046 default:
00047 return array();
00048 }
00049 }
00050
00058 protected function showAdditionalInfo() {
00059 $cm = $this->version->getContentModule();
00060 if(!$cm->isValid())
00061 return null;
00062 $res = $this->version->getResource();
00063
00064 $table = new TKTable();
00065
00066 $table->addTextTo('header', "Size");
00067 $table->addTextTo('header', "Width");
00068 $table->addTextTo('header', "Height");
00069 $table->addTextTo('header', "Media Tag");
00070
00071 $table->addText("Thumb", array('class' => array('snapInfoLabel')));
00072 $table->addText($cm->getWidth('thumb'));
00073 $table->addText($cm->getHeight('thumb'));
00074 $table->addText("<tt><media snapid=\"" . $res->getId() . "\" which=\"thumb\" /></tt>");
00075
00076 $table->addRow();
00077 $table->addText("Medium", array('class' => array('snapInfoLabel')));
00078 $table->addText($cm->getWidth('medium'));
00079 $table->addText($cm->getHeight('medium'));
00080 $table->addText("<tt><media snapid=\"" . $res->getId() . "\" which=\"medium\" /></tt>");
00081
00082 $table->addRow();
00083 $table->addText("Display", array('class' => array('snapInfoLabel')));
00084 $table->addText($cm->getWidth('display'));
00085 $table->addText($cm->getHeight('display'));
00086 $table->addText("<tt><media snapid=\"" . $res->getId() . "\" which=\"display\" /></tt>");
00087
00088 $table->addRow();
00089 $table->addText("Original", array('class' => array('snapInfoLabel')));
00090 $table->addText($cm->getWidth('original'));
00091 $table->addText($cm->getHeight('original'));
00092 $table->addText("<tt><media snapid=\"" . $res->getId() . "\" /></tt>");
00093
00094 $table->addRow();
00095 switch($this->version->getStatus()) {
00096 case SnapVersion::STATUS_DEV:
00097 $msg = "<b>NOTE</b>: This image is only visible on the dev site";
00098 break;
00099 case SnapVersion::STATUS_LIVE:
00100 if($res->getDevVersion() == null)
00101 $msg = "<b>NOTE</b>: This image is visible on both the dev and live sites";
00102 else
00103 $msg = "<b>NOTE</b>: This image is only visible on the live site";
00104 break;
00105 default:
00106 $msg = "<b>NOTE</b>: This image is not visible by default on either the dev or live site";
00107 break;
00108 }
00109 $table->addText($msg, array('colspan' => 4));
00110
00111 return $table;
00112 }
00113
00121 protected function getFormattedSource() {
00122 $table = new TKTable();
00123 $table->addTextTo('header', 'Size');
00124 $table->addTextTo('header', 'File Path');
00125 $table->addTextTo('header', 'URL');
00126 $table->addTextTo('header', 'Width');
00127 $table->addTextTo('header', 'Height');
00128
00129 $cm = $this->version->getContentModule();
00130
00131 $thumbURL = $cm->getURL('thumb');
00132 $mediumURL = $cm->getURL('medium');
00133 $displayURL = $cm->getURL('display');
00134 $originalURL = $cm->getURL('original');
00135
00136 $thumbPath = $cm->getPath('thumb');
00137 $mediumPath = $cm->getPath('medium');
00138 $displayPath = $cm->getPath('display');
00139 $originalPath = $cm->getPath('original');
00140
00141 $table->addText('Thumb');
00142 $table->addText("<tt>$thumbPath</tt>");
00143 $table->addText("<tt><a href=\"$thumbURL\">$thumbURL</a></tt>");
00144 $table->addText($cm->getWidth('thumb'));
00145 $table->addText($cm->getHeight('thumb'));
00146
00147 $table->addRow();
00148 $table->addText('Medium');
00149 $table->addText("<tt>$mediumPath</tt>");
00150 $table->addText("<tt><a href=\"$mediumURL\">$mediumURL</a></tt>");
00151 $table->addText($cm->getWidth('medium'));
00152 $table->addText($cm->getHeight('medium'));
00153
00154 $table->addRow();
00155 $table->addText('Display');
00156 $table->addText("<tt>$displayPath</tt>");
00157 $table->addText("<tt><a href=\"$displayURL\">$displayURL</a></tt>");
00158 $table->addText($cm->getWidth('display'));
00159 $table->addText($cm->getHeight('display'));
00160
00161 $table->addRow();
00162 $table->addText('Original');
00163 $table->addText("<tt>$originalPath</tt>");
00164 $table->addText("<tt><a href=\"$originalURL\">$originalURL</a></tt>");
00165 $table->addText($cm->getWidth('original'));
00166 $table->addText($cm->getHeight('original'));
00167
00168 return $table->render();
00169 }
00170 }
00171
00172 ?>