public static function internalDataTest(){ $isError = 0; $dataPath = _FM_HOME_DIR . DS."data"; $rightsPath = $dataPath . DS . "rights"; $isRightsFolder = 0; $isRightsFolderWritable = 0; $isDataFolderWritable = 0; $isDataFolder = (int) MFile::is($dataPath); if($isDataFolder){ $isDataFolderWritable = (int) MFile::isWritable($dataPath); $isRightsFolder = (int) MFile::is($rightsPath); if($isRightsFolder){ $isRightsFolderWritable = (int) MFile::isWritable($rightsPath); }else{ $isRightsFolderWritable = 1; } }else{ $isRightsFolderWritable = 1; $isDataFolderWritable = 1; } $dataPath = str_replace("\\", "/", $dataPath); $rightsPath = str_replace("\\", "/", $rightsPath); $isError = !($isRightsFolder && $isRightsFolderWritable && $isDataFolder && $isDataFolderWritable); $c = new MContainer(); $c->add('<div class="mMaskHeading"><span>'); $c->add(MText::_("heading_data", "diagnostics")); $c->add('</span></div>'); $c->add('<div style="padding-top:10px;">'); $isErr = $isError ? " error" : ""; $c->add('<div class="mSummary'.$isErr.'"><div style="padding: 10px;">'); $c->add('<div class="mSummaryHeading">' . MText::_("summary","diagnostics") . '</div><br/>'); $c->add( MText::_("data_intro","diagnostics") . '<br/><br/>'); if($isError){ if(! $isDataFolder){ $c->add( sprintf( MText::_("data_error_nodata","diagnostics"), $dataPath) ."<br/><br/>"); } if(! $isDataFolderWritable){ $c->add( sprintf( MText::_("data_error_nodatawrite","diagnostics"), $dataPath) ."<br/><br/>"); } if(! $isRightsFolder){ $c->add( sprintf( MText::_("data_error_norights","diagnostics"), $rightsPath) ."<br/><br/>"); } if(! $isRightsFolderWritable){ $c->add( sprintf( MText::_("data_error_norightswrite","diagnostics"), $rightsPath) ."<br/>"); } }else{ $c->add( MText::_("data_success","diagnostics") ); } $c->add('</div></div></div>'); return $c->get(); }
public function addControl($control) { parent::addControl($control, $control->getId()); }
/** * * @param MContainer $c * @param string $name * @param any $value */ public static function getFormElement(& $c, $name, $value){ $form = isset(self::$form2config[$name]) ? self::$form2config[$name] : array( "form" => 'text', "class" => '', "style" => '', "id" => '', "vertical" => 0 ); $style = isset($form["style"]) ? $form["style"] : ''; $class = isset($form["class"]) ? ' class="'. $form["class"] .'"' : ''; $id = isset($form["id"]) ? ' class="'. $form["id"] . '"' : ''; $parameters = $class.$id; switch($form['form']){ default: case 'text': $c->add( MForms::field($name,$value,null, $style, $parameters ) ); break; case 'textarea': $c->add( MForms::textArea($name,$value, $style, $parameters ) ); break; case 'select': $parameters .= $style ? ' style="'.$style.'"' : ''; foreach($form["options"] as & $option){ if(isset($option["text"])){ $option["text"] = MText::_($option["text"]); } } $c->add( MForms::select($name,$form['options'],$value,1, null, $parameters) ); break; }//EOF switch }
public function init($name = NULL, $controls = NULL) { parent::init($name, $controls, MContainer::DISPOSITION_HORIZONTAL); }
/** * * @param MDO $data * @param int $id */ public static function rootsMask($data = null, $id = -1){ $disabled = _FM_IS_DEMO ? ' disabled="disabled"' : ''; $c = new MContainer(); // $c->add('ID: '.$id); $c->add('<div class="mMaskHeading"><span>'); if($id === null || $id <0){ $c->add(MText::_("addnewroot")); }else{ $c->add(MText::_("rootfolderconfig") .": ".$data->get("name") ); } $c->add('</span></div><div style="padding:10px;">'); $c->add('<label>'.MText::_("title").'</label>'); $c->add('<div class="mSpacer"></div>'); $c->add(MForms::field("name",$data->get("name"),80,'','class="mRootsTitle" ')); $c->add($data->get("nameError", "")); $c->add('<div class="mSpacer"></div>'); $c->add('<label>'.MText::_("path").'</label>'); $c->add('<div class="mSpacer"></div>'); $path = _FM_IS_DEMO ? MText::_("notfordemo") : $data->get("path"); $c->add(MForms::field("path",$path ,null,'','class="mRootsPath"'. $disabled)); $c->add($data->get("pathError", "")); $c->add('<div class="clr"></div>'); $c->add('</div>'); return self::form($c->get(),null,array("id"=>$id)); }
public function init($name = NULL, $controls = NULL, $labelMode = MFieldLabel::LABEL_ABOVE) { parent::init($name, $controls, MContainer::DISPOSITION_VERTICAL, $labelMode); }
function fmGetFiles(){ global $dir; $maxThumbnailSize = (int) MConfig::instance()->get("max_tn_size", 51200); $filesView = $GLOBALS['filesView']; $c = new MContainer(); $classPostFix = ($filesView==2)? "XXL":null; $mt = "margin-top: 0px;"; $files = MFile::filesInfo($dir); $dirs = MFile::getDir($dir,false); $canOpen= MRights::can("open"); if($files || $dirs){ $c->add('<form id="filesFormNode" method="post" action="'.MURL::_("xhrfiles").'">'); $c->add('<input type="hidden" name="task" value="move" id="selectFilesTask">'); $c->add('<input type="hidden" name="dir" value="'.MURL::safePath($dir).'" id="currentDir">'); $c->add('<input type="hidden" name="file" value="" id="selectedFile">'); $c->add('<input type="hidden" name="newname" value="" id="newFileName">'); $c->add('<input type="hidden" name="destination" value="" id="destinationFolder">'); $c->add('<input type="hidden" name="zipname" value="" id="zipName">'); $c->add('<input type="hidden" name="chmod" value="" id="changeMode">'); $c->add('<div class="mSelectable fullSpace" style="height:auto; '.$mt.'" namespace="files" selecttype="winlike" dragable="folders" ordering="1" dblc="filesDblc" dropfunc="filesDropp">'); $c->add('<div id="mSortWrap">'); $counter = 0; foreach($dirs as $_dir){ $odd = ($counter&1 && $classPostFix!="XXL")? " odd": ""; $_dir->mode = modeStandard($_dir->mode); $wp =""; $wpList=""; if( ! $_dir->isWritable){ $wp = '<span class=\'writeProtected\'>'.MText::_("write_protected")."</span><br>"; $wpList = ' style="color:red;" '; } // processing image thumbnails $image = ""; if($classPostFix=="XXL"){ // is XXL $baseNameWrapInfo = wordwrap($_dir->baseName,20,'<br>',true); if(strlen($_dir->baseName)>17){ $baseNameWrap = substr($_dir->baseName,0,14)."..."; }else{ $baseNameWrap = $_dir->baseName; } // Not an Image or not a browser supported image $info = "<b style='color:#517ab9;'>".$baseNameWrapInfo."</b><br>".MText::_('type').": ".MText::_('folder')."<br>".MText::_('mode').": ".$_dir->mode.'<br>'.MText::_('owner').": ".$_dir->owner."<br>".$wp; $image = '<div class="mImgWrapper"><center><img src="'._FM_HOME_FOLDER.'/images/bigicons/folder.png" info="'.$info.'" style="width:96px;height:96px;"/></center></div>'; $c->add('<div class="mSelect'.$classPostFix.$odd. ' mSelectFolder" droppable="folders" sid="'.$counter++.'" href="'.MURL::safePath($_dir->fileName).'" array="selectedFiles" type="" baseName="'.$_dir->baseName.'" chmod="'.$_dir->mode.'">'.$image. '<span>'.$baseNameWrap.'</span>'. ' <div class="mListingName mHide" data="'.urlencode(strtolower($_dir->baseName) ).'"></div> <div class="mListingSize mHide" data="-1"></div> <div class="mListingType mHide" data="'.urlencode(MText::_("folder")).'"></div> <div class="mListingChanged mHide" data="'.urlencode($_dir->lastModifiedTimestamp).'"></div> <div class="mListingRights mHide" data="'.urlencode($_dir->mode).'"></div> <div class="mListingOwner mHide" data="'.urlencode($_dir->owner).'"></div> '. '</div>'); }else{ // is not XXL $image = '<img src="'._FM_HOME_FOLDER.'/images/icons/folder.png" align="left"/>'; $c->add('<div class="mSelect'.$classPostFix.$odd. ' mSelectFolder" droppable="folders" sid="'.$counter++.'" href="'.MURL::safePath($_dir->fileName).'" array="selectedFiles" type="" baseName="'.$_dir->baseName.'" chmod="'.$_dir->mode.'">' .' <div class="mListingName" data="'.urlencode(strtolower($_dir->baseName) ).'">'.'<span>'.$image.$_dir->baseName.'</span></div> <div class="mListingSize" data="-1"><span></span></div> <div class="mListingType" data="'.urlencode(MText::_("folder")).'"><span>'.MText::_("folder").'</span></div> <div class="mListingChanged" data="'.urlencode($_dir->lastModifiedTimestamp).'"><span>'.$_dir->lastModified.'</span></div> <div class="mListingRights" data="'.urlencode($_dir->mode).'"><span'.$wpList.'>('.$_dir->mode.') '.$_dir->permmask.'</span></div> <div class="mListingOwner" data="'.urlencode($_dir->owner).'"><span>'.$_dir->owner.'</span></div> '. '</div>'); }//EOF not XXL // EOF processing image thumbnails }//EOF DIR loop // Files loop if($files){ foreach($files as $file){ $odd = ($counter&1 && $classPostFix!="XXL")? " odd": ""; $file->mode = modeStandard($file->mode); $audio =""; if($file->extension == "mp3"){ $audio = 'audio="mp3" '; } $wp =""; $wpList=""; $wpXXL =""; if( ! $file->isWritable){ $wp = '<span class=\'writeProtected\'>'.MText::_("write_protected")."</span><br>"; $wpList = ' style="color:red;" '; $wpXXL = '<img class="wp" src="'._FM_HOME_FOLDER.'/images/wp.png" />'; } // processing image thumbnails $image = ""; if($classPostFix=="XXL"){ // is XXL $baseNameWrapInfo = wordwrap($file->baseName,20,'<br>',true); if(strlen($file->baseName)>17){ $baseNameWrap = substr($file->baseName,0,14)."..."; }else{ $baseNameWrap = $file->baseName; } if($file->isImage){ $size = getimagesize($file->fileName); $w = (int) $size[0]; $h = (int) $size[1]; if(!$canOpen){ $w = 96; $h = 76; if(_M_IMAGE_VIEW_STATE){ $wp .= '<span class=\'noAuthPreview\'>'.MText::_("rights_noauth_preview")."</span><br>"; } } if(!_M_IMAGE_VIEW_STATE){ $info = "<b style='color:#517ab9;'>".$baseNameWrapInfo."</b><br>".MText::_('dim').": ".$w." x ".$h.'<br>'.MText::_('type').": ".$file->extension."<br>".MText::_('size').": ".$file->smartSize."<br>".MText::_('mode').": ".$file->mode.'<br>'.MText::_('owner').": ".$file->owner."<br>".$wp; $image = '<div class="mImgWrapper"><center><img src="'._FM_HOME_FOLDER.'/images/bigicons/image.png" info="'.$info.'" style="width:96px;height:96px;"/></center>'.$wpXXL.'</div>'; }else{ if($file->size <= (int) $maxThumbnailSize ){ $fit = fitImage2Box(96,96,$w,$h); $x = $fit["w"]; $y = $fit["h"]; $info = "<b style='color:#517ab9;'>".$baseNameWrapInfo."</b><br>".MText::_('dim').": ".$w." x ".$h.'<br>'.MText::_('type').": ".$file->extension."<br>".MText::_('size').": ".$file->smartSize."<br>".MText::_('mode').": ".$file->mode.'<br>'.MText::_('owner').": ".$file->owner."<br>".$wp; $image = '<div class="mImgWrapper" align="center"><center><img align="center" src="'.MURL::_("xhrimage",MURL::safePath($file->fileName)).'" style="width:'.$x.'px; height:'.$y.'px;" info="'.$info.'" /><center>'.$wpXXL.'</div>'; }else{ // Image is too large $info = "<b style='color:#517ab9;'>".$baseNameWrapInfo."</b><br>".MText::_('dim').": ".$w." x ".$h.'<br>'.MText::_('type').": ".$file->extension."<br>".MText::_('size').": ".$file->smartSize."<br>".MText::_('mode').": ".$file->mode.'<br>'.MText::_('owner').": ".$file->owner."<br>".$wp; $image = '<div class="mImgWrapper"><center><img src="'._FM_HOME_FOLDER.'/images/bigicons/image.png" info="'.$info.'<span class=\'itb\'>'.MText::_("imagetoolarge").'</span>'.'" style="width:96px;height:96px;"/></center>'.$wpXXL.'</div>'; } } }else{ // Not an Image or not a browser supported image $info = "<b style='color:#517ab9;'>".$baseNameWrapInfo."</b><br>".MText::_('type').": ".$file->extension."<br>".MText::_('size').": ".$file->smartSize."<br>".MText::_('mode').": ".$file->mode.'<br>'.MText::_('owner').": ".$file->owner."<br>".$wp; $image = '<div class="mImgWrapper"><center><img src="'.MIcon::_($file->extension,1).'" info="'.$info.'" style="width:96px;height:96px;"/></center>'.$wpXXL.'</div>'; } $c->add('<div class="mSelect'.$classPostFix.$odd. '" sid="'.$counter++.'" href="'.MURL::safePath($file->fileName).'" array="selectedFiles" type="'.$file->extension.'" baseName="'.$file->baseName.'" chmod="'.$file->mode.'">'.$image. '<span>'.$baseNameWrap.'</span>'. ' <div class="mListingName mHide" data="'.urlencode(strtolower($file->baseName) ).'"></div> <div class="mListingSize mHide" data="'.urlencode($file->size).'"></div> <div class="mListingType mHide" data="'.urlencode($file->extension).'"></div> <div class="mListingChanged mHide" data="'.urlencode($file->lastModifiedTimestamp).'"></div> <div class="mListingRights mHide" data="'.urlencode($file->mode).'"></div> <div class="mListingOwner mHide" data="'.urlencode($file->owner).'"></div> '. '</div>'); }else{ // is not XXL $image = '<img src="'. MIcon::_($file->extension).'" align="left"/>'; $c->add('<div class="mSelect'.$classPostFix.$odd. ' mSelectFile" sid="'.$counter++.'" href="'.MURL::safePath($file->fileName).'" array="selectedFiles" type="'.$file->extension.'" baseName="'.$file->baseName.'" chmod="'.$file->mode.'">' .' <div class="mListingName" data="'.urlencode(strtolower($file->baseName) ).'">'.'<span'.$wpList.'>'.$image.$file->baseName.'</span></div> <div class="mListingSize" data="'.urlencode($file->size).'"><span>'.$file->smartSize.'</span></div> <div class="mListingType" data="'.urlencode($file->extension).'"><span>'.strtoupper($file->extension).'</span></div> <div class="mListingChanged" data="'.urlencode($file->lastModifiedTimestamp).'"><span>'.$file->lastModified.'</span></div> <div class="mListingRights" data="'.urlencode($file->mode).'"><span'.$wpList.'>('.$file->mode. ') ' . $file->permmask. '</span></div> <div class="mListingOwner" data="'.urlencode($file->owner).'"><span>'.$file->owner.'</span></div> '. '</div>'); }//EOF not XXL // EOF processing image thumbnails }//EOF files loop }//EOF is files $c->add('</div">'); // EOF sortWrap if($counter!=0){ $c->add("<span style='display:none;' id='selectStopNo' value='".($counter-1)."'></span>"); } $c->add('</div></form>'); }else{ $c->add('<form id="filesFormNode" method="post" action="'.MURL::_("xhrfiles").'">'); $c->add('<input type="hidden" name="task" value="move" id="selectFilesTask">'); $c->add('<input type="hidden" name="dir" value="'.MURL::safePath($dir).'" id="currentDir">'); $c->add('<input type="hidden" name="file" value="" id="selectedFile">'); $c->add('<input type="hidden" name="newname" value="" id="newFileName">'); $c->add('<input type="hidden" name="destination" value="" id="destinationFolder">'); $c->add('<input type="hidden" name="zipname" value="" id="zipName">'); $c->add('<input type="hidden" name="chmod" value="" id="changeMode">'); $c->add('</form>'); } $c->add('<div id="mCleanOrder" style="display:none;" unique="'.md5(uniqid()).'"></div>'. "\n"); $c->add('<div id="mFetchTitle" style="display:none;">'. str_replace(array("/","\\"), " - ", str_replace(_START_FOLDER, "", $dir) ).'</div>'. "\n"); $c->add('<div id="mGoUpUrl" style="display:none;">'. MURL::safePath($dir).'</div>'. "\n"); return $c->get(); }
/** * Processa o arquivo da view e inclui o conteudo no objeto Page. * @param type $controller * @param type $parameters * @return type */ public function process($controller, $parameters) { mtrace('view file = ' . $this->viewFile); $path = $this->getPath(); Manager::addAutoloadPath($path); $extension = pathinfo($this->viewFile, PATHINFO_EXTENSION); $baseName = basename($this->viewFile); $content = ''; $page = Manager::getPage(); $this->controller = $controller; $this->data = $parameters; // $mlabelTemporario = new MFieldLabel(); // remover esta linha if ($extension == 'php') { $viewName = basename($this->viewFile, '.php'); mtrace($viewName); include_once $this->viewFile; $view = new $viewName(); $view->setView($this); $view->load(); if ($page->isPostBack()) { $view->eventHandler($this->data); $view->postback(); } $page->addContent($view); } elseif ($extension == 'xml') { $container = new MContainer(); $container->setView($this); $controls = $container->getControlsFromXML($this->viewFile); if (is_array($controls)) { foreach ($controls as $view) { if (is_object($view)) { //$view->setView($this); $view->load(); if ($page->isPostBack()) { $view->postback(); } $page->addContent($view); } } } } elseif ($extension == 'js' || $extension == 'html') { $template = new MTemplate(dirname($this->viewFile)); $template->context('manager', Manager::getInstance()); $template->context('page', Manager::getPage()); $template->context('view', $this); $template->context('data', $parameters); $template->context('template', $template); $content = $template->fetch($baseName); mtrace($baseName); $page->setContent($content); } elseif ($extension == 'wiki') { $wikiPage = file_get_contents($this->viewFile); $wiki = new MWiki(); $content = $wiki->parse('', $wikiPage); $page->setContent($content); } // return $content; }
public function insert($pos, $control, $width = '', $float = 'left', $class = '') { $cell = new MDiv('', $control, 'mPanelCellBox mPanelCell' . ucfirst($float) . ' ' . $class); parent::insertControl($cell, $pos); }
/** * Brief Description. * Complete Description. * * @param $name (tipo) desc * * @returns (tipo) desc * */ public function __get($name) { $value = $this->fields->{$name}; if ($value == NULL) { $value = $this->buttons[$name]; if ($value == NULL) { $value = parent::__get($name); } } return $value; }