示例#1
0
 /**
  * Create the html for Ajax upload widget
  *
  * @param   array  $str            Current html output
  * @param   int    $repeatCounter  Repeat group counter
  * @param   array  $values         Existing files
  *
  * @return	array	Modified fileupload html
  */
 protected function plupload($str, $repeatCounter, $values)
 {
     FabrikHelperHTML::stylesheet(COM_FABRIK_LIVESITE . 'media/com_fabrik/css/slider.css');
     $id = $this->getHTMLId($repeatCounter);
     $j3 = FabrikWorker::j3();
     $params = $this->getParams();
     $winWidth = $params->get('win_width', 400);
     $winHeight = $params->get('win_height', 400);
     $runtimes = $params->get('ajax_runtime', 'html5,html4');
     $w = (int) $params->get('ajax_dropbox_width', 0);
     $h = (int) $params->get('ajax_dropbox_hight', 200);
     $dropBoxStyle = 'height:' . $h . 'px';
     if ($w !== 0) {
         $dropBoxStyle .= 'width:' . $w . 'px;';
     }
     // Add span with id so that element fxs work.
     $pstr = array();
     $pstr[] = '<span id="' . $id . '"></span>';
     $pstr[] = '<div id="' . $id . '-widgetcontainer">';
     $pstr[] = '<canvas id="' . $id . '-widget" width="' . $winWidth . '" height="' . $winHeight . '"></canvas>';
     if ($this->canCrop()) {
         $pstr[] = '<div class="zoom" style="float:left;margin-top:10px;padding-right:10x;width:180px">';
         $pstr[] = '	zoom:';
         $pstr[] = '	<div class="fabrikslider-line" style="width: 100px;float:left;">';
         $pstr[] = '		<div class="knob"></div>';
         $pstr[] = '	</div>';
         $pstr[] = '	<input name="zoom-val" value="" size="3"  class="input-mini"/>';
         $pstr[] = '</div>';
         $pstr[] = '<div class="rotate" style="float:left;margin-top:10px;width:180px">' . JText::_('PLG_ELEMENT_FILEUPLOAD_ROTATE') . ':';
         $pstr[] = '	<div class="fabrikslider-line" style="width: 100px;float:left;">';
         $pstr[] = '		<div class="knob"></div>';
         $pstr[] = '	</div>';
         $pstr[] = '	<input name="rotate-val" value="" size="3"  class="input-mini"/>';
         $pstr[] = '</div>';
     }
     if (FabrikHelperHTML::canvasSupport()) {
         $pstr[] = '<div style="text-align: right;float:right;margin:10px 0; width: 205px">';
         $pstr[] = '<input type="button" class="button btn btn-primary" name="close-crop" value="' . JText::_('CLOSE') . '" />';
         $pstr[] = '</div>';
     }
     $pstr[] = '</div>';
     $pstr[] = '<div class="plupload_container fabrikHide" id="' . $id . '_container" style="' . $dropBoxStyle . '">';
     $pstr[] = '<div class="plupload" id="' . $id . '_dropList_container">';
     if ($j3) {
         $pstr[] = '	<table class="table table-striped table-condensed">';
         $pstr[] = '		<thead style="display:none"><tr>';
         $pstr[] = '			<th class="span4">' . JText::_('PLG_ELEMENT_FILEUPLOAD_FILENAME') . '</th>';
         $pstr[] = '			<th class="span1 plupload_crop">&nbsp;</th>';
         $pstr[] = '			<th class="span5 plupload_file_status"></th>';
         $pstr[] = '			<th class="span1 plupload_file_action">&nbsp;</th>';
         $pstr[] = '		</tr></thead>';
         $pstr[] = '		<tbody class="plupload_filelist" id="' . $id . '_dropList">';
         $pstr[] = ' </tbody>';
         $pstr[] = ' <tfoot><tr><td colspan="4">';
         $pstr[] = '				<a id="' . $id . '_browseButton" class="btn btn-mini" href="#"><i class="icon-plus-sign icon-plus"></i>' . JText::_('PLG_ELEMENT_FILEUPLOAD_ADD_FILES') . '</a>';
         $pstr[] = '				<a class="btn btn-mini disabled" data-action="plupload_start" href="#"><i class="icon-upload"></i>' . JText::_('PLG_ELEMENT_FILEUPLOAD_START_UPLOAD') . '</a>';
         $pstr[] = '			<span class="plupload_upload_status"></span>';
         $pstr[] = '</td></tr></tfoot>';
         $pstr[] = '	</table>';
     } else {
         $pstr[] = '	<div class="plupload_header">';
         $pstr[] = '		<div class="plupload_header_content">';
         $pstr[] = '			<div class="plupload_header_title">' . JText::_('PLG_ELEMENT_FILEUPLOAD_PLUP_HEADING') . '</div>';
         $pstr[] = '			<div class="plupload_header_text">' . JText::_('PLG_ELEMENT_FILEUPLOAD_PLUP_SUB_HEADING') . '</div>';
         $pstr[] = '		</div>';
         $pstr[] = '	</div>';
         $pstr[] = '	<div class="plupload_content">';
         $pstr[] = '		<div class="plupload_filelist_header">';
         $pstr[] = '			<div class="plupload_file_name">' . JText::_('PLG_ELEMENT_FILEUPLOAD_FILENAME') . '</div>';
         $pstr[] = '			<div class="plupload_file_action">&nbsp;</div>';
         $pstr[] = '			<div class="plupload_file_status"><span>' . JText::_('PLG_ELEMENT_FILEUPLOAD_STATUS') . '</span></div>';
         $pstr[] = '			<div class="plupload_file_size">' . JText::_('PLG_ELEMENT_FILEUPLOAD_SIZE') . '</div>';
         $pstr[] = '			<div class="plupload_clearer">&nbsp;</div>';
         $pstr[] = '		</div>';
         $pstr[] = '		<ul class="plupload_filelist" id="' . $id . '_dropList">';
         $pstr[] = '		</ul>';
         $pstr[] = '		<div class="plupload_filelist_footer">';
         $pstr[] = '		<div class="plupload_file_name">';
         $pstr[] = '			<div class="plupload_buttons">';
         $pstr[] = '				<a id="' . $id . '_browseButton" class="plupload_button plupload_add" href="#">' . JText::_('PLG_ELEMENT_FILEUPLOAD_ADD_FILES') . '</a>';
         $pstr[] = '				<a class="plupload_button plupload_start plupload_disabled" href="#">' . JText::_('PLG_ELEMENT_FILEUPLOAD_START_UPLOAD') . '</a>';
         $pstr[] = '			</div>';
         $pstr[] = '			<span class="plupload_upload_status"></span>';
         $pstr[] = '		</div>';
         $pstr[] = '		<div class="plupload_file_action"></div>';
         $pstr[] = '			<div class="plupload_file_status">';
         $pstr[] = '				<span class="plupload_total_status"></span>';
         $pstr[] = '			</div>';
         $pstr[] = '		<div class="plupload_file_size">';
         $pstr[] = '			<span class="plupload_total_file_size"></span>';
         $pstr[] = '		</div>';
         $pstr[] = '		<div class="plupload_progress">';
         $pstr[] = '			<div class="plupload_progress_container">';
         $pstr[] = '			<div class="plupload_progress_bar"></div>';
         $pstr[] = '		</div>';
         $pstr[] = '	</div>';
         $pstr[] = '	<div class="plupload_clearer">&nbsp;</div>';
         $pstr[] = '	</div>';
         FabrikHelperHTML::stylesheet(COM_FABRIK_LIVESITE . 'plugins/fabrik_element/fileupload/lib/plupload/css/plupload.queue.css');
     }
     $pstr[] = '	</div>';
     $pstr[] = '</div>';
     $pstr[] = '<!-- FALLBACK; SHOULD LOADING OF PLUPLOAD FAIL -->';
     $pstr[] = '<div class="plupload_fallback">' . JText::_('PLG_ELEMENT_FILEUPLOAD_FALLBACK_MESSAGE');
     $pstr[] = '<br />';
     array_merge($pstr, $str);
     $pstr[] = '</div>';
     return $pstr;
 }
示例#2
0
 /**
  * Create the html for Ajax upload widget
  *
  * @param   array  $str            Current html output
  * @param   int    $repeatCounter  Repeat group counter
  * @param   array  $values         Existing files
  *
  * @return	array	Modified file-upload html
  */
 protected function plupload($str, $repeatCounter, $values)
 {
     FabrikHelperHTML::stylesheet(COM_FABRIK_LIVESITE . 'media/com_fabrik/css/slider.css');
     $params = $this->getParams();
     $w = (int) $params->get('ajax_dropbox_width', 0);
     $h = (int) $params->get('ajax_dropbox_height', 200);
     $dropBoxStyle = 'height:' . $h . 'px;';
     if ($w !== 0) {
         $dropBoxStyle .= 'width:' . $w . 'px;';
     }
     $layout = $this->getLayout('widget');
     $displayData = new stdClass();
     $displayData->id = $this->getHTMLId($repeatCounter);
     $displayData->winWidth = $params->get('win_width', 400);
     $displayData->winHeight = $params->get('win_height', 400);
     $displayData->canCrop = $this->canCrop();
     $displayData->canvasSupport = FabrikHelperHTML::canvasSupport();
     $displayData->dropBoxStyle = $dropBoxStyle;
     $displayData->field = implode("\n", $str);
     $displayData->j3 = FabrikWorker::j3();
     $str = (array) $layout->render($displayData);
     FabrikHelperHTML::jLayoutJs('fabrik-progress-bar', 'fabrik-progress-bar', (object) array('context' => '', 'animated' => true));
     FabrikHelperHTML::jLayoutJs('fabrik-progress-bar-success', 'fabrik-progress-bar', (object) array('context' => 'success', 'value' => 100));
     FabrikHelperHTML::jLayoutJs('fabrik-icon-delete', 'fabrik-icon', (object) array('icon' => 'delete'), array('debug' => true));
     return $str;
 }
示例#3
0
 /**
  * Create the upload modal and its content
  * Needs to be a unique $modalId to ensure that multiple modals can be created
  * each with unique content
  *
  * @param   int $repeatCounter
  */
 protected function pluploadModal($repeatCounter)
 {
     $params = $this->getParams();
     $modalContentLayout = $this->getLayout('modal-content');
     $modalData = (object) array('id' => $this->getHTMLId($repeatCounter), 'canCrop' => $this->canCrop(), 'canvasSupport' => FabrikHelperHTML::canvasSupport(), 'width' => $params->get('win_width', 400), 'height' => $params->get('win_height', 400));
     $modalContent = $modalContentLayout->render($modalData);
     $modalTitle = $this->canCrop() ? 'PLG_ELEMENT_FILEUPLOAD_CROP_AND_SCALE' : 'PLG_ELEMENT_FILEUPLOAD_PREVIEW';
     $modalId = $this->modalId($repeatCounter);
     $modalOpts = array('content' => $modalContent, 'id' => $modalId, 'title' => JText::_($modalTitle), 'modal' => true);
     FabrikHelperHTML::jLayoutJs($modalId, 'fabrik-modal', (object) $modalOpts);
 }