/**
  * Similar to Folder::uploadLink except this one takes a internship id as parameter
  * and links to intern module instead of filecabinet.
  */
 public function documentUpload($internshipId)
 {
     $link_var['folder_id'] = $this->id;
     $link_var['action'] = 'upload_document_form';
     $link_var['internship'] = $internshipId;
     $link = new PHPWS_Link(null, 'intern', $link_var, true);
     $link->convertAmp(false);
     $link->setSalted();
     $vars['address'] = $link->getAddress();
     $label = dgettext('filecabinet', 'Add document');
     javascript('open_window');
     return '<button type="button" class="btn btn-default btn-sm" onClick="javascript:open_window(\'' . $link->getAddress() . '\', 600, 600, \'default970975506\', 1); return false;"><i class="fa fa-upload"></i> ' . $label . '</button>';
 }
Exemplo n.º 2
0
 public function getAddress($include_http = TRUE)
 {
     PHPWS_Core::initCoreClass('Link.php');
     $link = new PHPWS_Link();
     $link->full_url = $include_http;
     $link->setRewrite();
     $link->setModule('rss');
     $link->addValues(array('mod_title' => $this->module));
     return $link->getAddress();
 }
Exemplo n.º 3
0
 public function editAddress($fid = null)
 {
     $add_vars = $this->linkInfo();
     $add_vars['fop'] = 'open_file_manager';
     if (isset($fid)) {
         $add_vars['fid'] = $fid;
     }
     $link = new PHPWS_Link(null, 'filecabinet', $add_vars, true);
     $link->convertAmp(false);
     $link->setSalted();
     return $link->getAddress();
 }
Exemplo n.º 4
0
 /**
  * @deprecated
  * @param type $icon
  * @return type
  */
 public function editLink($icon = false)
 {
     $vars['mop'] = 'upload_multimedia_form';
     $vars['multimedia_id'] = $this->id;
     $vars['folder_id'] = $this->folder_id;
     $jsvars['width'] = 550;
     $jsvars['height'] = 620;
     $link = new PHPWS_Link(null, 'filecabinet', $vars);
     $link->setSecure();
     $link->setSalted();
     $jsvars['address'] = $link->getAddress();
     $jsvars['window_name'] = 'edit_link';
     if ($icon) {
         $jsvars['label'] = Icon::show('edit', dgettext('filecabinet', 'Edit multimedia file'));
     } else {
         $jsvars['label'] = dgettext('filecabinet', 'Edit');
     }
     return javascript('open_window', $jsvars);
 }
Exemplo n.º 5
0
 /**
  * @deprecated
  * @param type $icon
  * @return type
  */
 public function editLink($icon = false)
 {
     $vars['iop'] = 'upload_image_form';
     $vars['image_id'] = $this->id;
     $vars['folder_id'] = $this->folder_id;
     $jsvars['width'] = 550;
     $jsvars['height'] = 600 + PHPWS_Settings::get('filecabinet', 'max_thumbnail_size');
     $link = new PHPWS_Link(null, 'filecabinet', $vars);
     $link->setSecure();
     $link->setSalted();
     $jsvars['address'] = $link->getAddress();
     $jsvars['window_name'] = 'edit_link';
     if ($icon) {
         $jsvars['label'] = Icon::show('edit');
     } else {
         $jsvars['label'] = dgettext('filecabinet', 'Edit');
     }
     return javascript('open_window', $jsvars);
 }
Exemplo n.º 6
0
 /**
  * @deprecated
  */
 private function addLink($type, $mode = null, $force_width = 0, $force_height = 0, $id = 0)
 {
     $vars['width'] = 400;
     $vars['height'] = 400;
     $link_var['folder_id'] = $this->id;
     if ($id) {
         $link_var['file_id'] = $id;
     }
     switch ($type) {
         case 'image':
             $link_var['iop'] = 'upload_image_form';
             $link_var['fw'] = $force_width;
             $link_var['fh'] = $force_height;
             $label = dgettext('filecabinet', 'Add image');
             break;
         case 'document':
             $link_var['dop'] = 'upload_document_form';
             $label = dgettext('filecabinet', 'Add document');
             break;
         case 'media':
             $link_var['mop'] = 'upload_multimedia_form';
             $label = dgettext('filecabinet', 'Add media');
             break;
     }
     $link = new PHPWS_Link(null, 'filecabinet', $link_var, true);
     $link->convertAmp(false);
     $link->setSalted();
     $vars['address'] = $link->getAddress();
     $vars['title'] =& $label;
     switch ($mode) {
         case 'button':
             $vars['label'] = $label;
             $vars['type'] = 'button';
             $vars['class'] = 'btn btn-success';
             break;
         case 'icon':
             $vars['label'] = '<i class="fa fa-upload" title="' . dgettext('filecabient', 'Upload') . '"></i>';
             break;
         default:
             $vars['label'] = $label;
     }
     return javascript('open_window', $vars);
 }
Exemplo n.º 7
0
    public function settings()
    {
        $sizes = Cabinet::getMaxSizes();
        $form = new PHPWS_Form('settings');
        $form->addHidden('module', 'filecabinet');
        $form->addHidden('aop', 'save_settings');
        $form->addTplTag('DOCUMENT_SETTINGS', dgettext('filecabinet', 'Document settings'));
        $form->addTplTag('IMAGE_SETTINGS', dgettext('filecabinet', 'Image settings'));
        $form->addTplTag('MULTIMEDIA_SETTINGS', dgettext('filecabinet', 'Multimedia settings'));
        $form->addText('base_doc_directory', PHPWS_Settings::get('filecabinet', 'base_doc_directory'));
        $form->setSize('base_doc_directory', '50');
        $form->setLabel('base_doc_directory', dgettext('filecabinet', 'Base document directory'));
        $form->addCheckBox('autofloat', 1);
        $form->setMatch('autofloat', PHPWS_Settings::get('filecabinet', 'autofloat'));
        $form->setLabel('autofloat', dgettext('filecabinet', 'Float new images under 300px to the right of content'));
        $form->addText('max_image_dimension', PHPWS_Settings::get('filecabinet', 'max_image_dimension'));
        $form->setLabel('max_image_dimension', dgettext('filecabinet', 'Maximum image pixel dimension'));
        $form->setSize('max_image_dimension', 4, 4);
        $form->addText('max_image_size', $sizes['image']);
        $form->setLabel('max_image_size', dgettext('filecabinet', 'Maximum image file size (in bytes)'));
        $form->setSize('max_image_size', 10, 10);
        $form->addText('max_document_size', $sizes['document']);
        $form->setLabel('max_document_size', dgettext('filecabinet', 'Maximum document file size (in bytes)'));
        $form->setSize('max_document_size', 10, 10);
        $form->addText('max_multimedia_size', $sizes['multimedia']);
        $form->setLabel('max_multimedia_size', dgettext('filecabinet', 'Maximum multimedia file size (in bytes)'));
        $form->setSize('max_multimedia_size', 10, 10);
        $form->addText('max_pinned_images', PHPWS_Settings::get('filecabinet', 'max_pinned_images'));
        $form->setLabel('max_pinned_images', dgettext('filecabinet', 'Maximum pinned images shown (0 for all)'));
        $form->setSize('max_pinned_images', 3, 3);
        $form->addText('max_pinned_documents', PHPWS_Settings::get('filecabinet', 'max_pinned_documents'));
        $form->setLabel('max_pinned_documents', dgettext('filecabinet', 'Maximum pinned documents shown (0 for all)'));
        $form->setSize('max_pinned_documents', 3, 3);
        $form->addText('crop_threshold', PHPWS_Settings::get('filecabinet', 'crop_threshold'));
        $form->setLabel('crop_threshold', dgettext('filecabinet', 'Crop pixel threshold'));
        $form->setSize('crop_threshold', 4, 4);
        $form->addCheck('use_ffmpeg', 1);
        $form->setMatch('use_ffmpeg', PHPWS_Settings::get('filecabinet', 'use_ffmpeg'));
        $form->addCheck('caption_images', 1);
        $form->setMatch('caption_images', PHPWS_Settings::get('filecabinet', 'caption_images'));
        $form->setLabel('caption_images', dgettext('filecabinet', 'Caption images'));
        $form->addCheck('allow_direct_links', 1);
        $form->setMatch('allow_direct_links', PHPWS_Settings::get('filecabinet', 'allow_direct_links'));
        $form->setLabel('allow_direct_links', dgettext('filecabinet', 'Allow direct links to documents'));
        $form->addCheck('force_thumbnail_dimensions', 1);
        $form->setMatch('force_thumbnail_dimensions', PHPWS_Settings::get('filecabinet', 'force_thumbnail_dimensions'));
        $form->setLabel('force_thumbnail_dimensions', dgettext('filecabinet', 'Force thumbnail dimensions on display'));
        $form->addCheck('popup_image_navigation', 1);
        $form->setMatch('popup_image_navigation', PHPWS_Settings::get('filecabinet', 'popup_image_navigation'));
        $form->setLabel('popup_image_navigation', dgettext('filecabinet', 'Popup images allow folder navigation'));
        $form->addText('max_thumbnail_size', PHPWS_Settings::get('filecabinet', 'max_thumbnail_size'));
        $form->setLabel('max_thumbnail_size', dgettext('filecabinet', 'Maximum thumbnail pixel dimension'));
        $form->setSize('max_thumbnail_size', 3, 3);
        $ffmpeg_directory = PHPWS_Settings::get('filecabinet', 'ffmpeg_directory');
        if (empty($ffmpeg_directory) || !is_file($ffmpeg_directory . 'ffmpeg')) {
            $form->setDisabled('use_ffmpeg');
            $form->setLabel('use_ffmpeg', dgettext('filecabinet', 'Enable FFMpeg thumbnails (enabled on ffmpeg confirmation)'));
        } else {
            $form->setLabel('use_ffmpeg', dgettext('filecabinet', 'Enable FFMpeg thumbnails'));
        }
        $form->addTplTag('CLASSIFY_SETTINGS', dgettext('filecabinet', 'Classify settings'));
        $form->addText('ffmpeg_directory', $ffmpeg_directory);
        $form->setLabel('ffmpeg_directory', dgettext('filecabinet', 'FFMpeg directory'));
        $form->setSize('ffmpeg_directory', 40);
        if (FC_ALLOW_CLASSIFY_DIR_SETTING) {
            $form->addText('classify_directory', PHPWS_Settings::get('filecabinet', 'classify_directory'));
            $form->setLabel('classify_directory', dgettext('filecabinet', 'Incoming classify directory'));
            $form->setSize('classify_directory', 50, 255);
        }
        $form->addRadioAssoc('jcaro_type', array(0 => dgettext('filecabinet', 'Horizontal'), 1 => dgettext('filecabinet', 'Vertical')));
        $form->setMatch('jcaro_type', (int) PHPWS_Settings::get('filecabinet', 'vertical_folder'));
        $num = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8);
        $form->addSelect('number_visible', $num);
        $form->setMatch('number_visible', PHPWS_Settings::get('filecabinet', 'number_visible'));
        $form->setLabel('number_visible', dgettext('filecabinet', 'Number of thumbnails visible'));
        $form->addSubmit(dgettext('filecabinet', 'Save settings'));
        $tpl = $form->getTemplate();
        $tpl['CAROUSEL'] = dgettext('filecabinet', 'Carousel defaults');
        $tpl['SYSTEM_SIZE'] = dgettext('filecabinet', 'System upload limits');
        $tpl['SYSTEM_LABEL'] = dgettext('filecabinet', 'Server upload limit');
        $tpl['FORM_LABEL'] = dgettext('filecabinet', 'Form upload limit');
        $tpl['ABSOLUTE_LABEL'] = dgettext('filecabinet', 'Absolute upload limit');
        $tpl['MAX_SYSTEM_SIZE'] = File_Common::humanReadable($sizes['system']);
        $tpl['MAX_FORM_SIZE'] = File_Common::humanReadable($sizes['form']);
        $tpl['ABSOLUTE_SIZE'] = File_Common::humanReadable($sizes['absolute']);
        if (Current_User::isDeity()) {
            $link = new PHPWS_Link(null, 'filecabinet', array('aop' => 'fix_document_dir'), true);
            $js = array('question' => dgettext('filecabinet', 'This process will update all of your document files with the current base directory.
Do not run this process unless you are sure it will fix download problems.
If you are sure, type Y-E-S below.'), 'address' => $link->getAddress(), 'value_name' => 'confirm', 'link' => dgettext('filecabinet', 'Reindex document directories'));
            $tpl['FIX_DIRECTORIES'] = javascript('prompt', $js);
        }
        return PHPWS_Template::process($tpl, 'filecabinet', 'Forms/settings.tpl');
    }
 /**
  * Get the link to delete this document.
  */
 public function getDeleteLink()
 {
     $vars = array();
     $vars['doc_id'] = $this->id;
     $vars['action'] = 'delete_document';
     $link = new \PHPWS_Link(null, 'intern', $vars);
     $jsVars = array();
     $jsVars['QUESTION'] = 'Are you sure you want to delete this document?';
     $jsVars['ADDRESS'] = $link->getAddress();
     $jsVars['LINK'] = '<i class="fa fa-trash-o close"></i>';
     return javascript('confirm', $jsVars);
 }
Exemplo n.º 9
0
 /**
  * Makes the index string for moduleLink. Can also be called alone
  * User module must be in use.
  *
  * @author Matthew McNaney <mcnaney at gmail dot com>
  * @param string  module      Name of module for link
  * @param array   getVars     Associative array of get values
  * @param boolean secure      If true, adds authkey to link
  * @param boolean add_base    If true, add the site url to the address
  * @param boolean convert_amp If true, use "&amp;" instead of "&"
  */
 public static function linkAddress($module = null, $getVars = null, $secure = false, $add_base = false, $convert_amp = true, $rewrite = false)
 {
     $link = new PHPWS_Link('void', $module, $getVars);
     $link->secure = $secure;
     $link->full_url = $add_base;
     $link->convert_amp = $convert_amp;
     $link->rewrite = $rewrite;
     return $link->getAddress();
 }
Exemplo n.º 10
0
 public function getUserTpl()
 {
     // Don't let a deity change their deity status
     // Don't let non-deities change status
     if (Current_User::isDeity() && !Current_User::isUser($this->id)) {
         if ($this->isDeity()) {
             $dvars['QUESTION'] = dgettext('users', 'Are you sure you want to remove deity status?');
             $dvars['ADDRESS'] = PHPWS_Text::linkAddress('users', array('action' => 'admin', 'command' => 'mortalize_user', 'user_id' => $this->id), 1);
             $dvars['LINK'] = sprintf('<i class="fa fa-cloud" title="%s"></i>', dgettext('users', 'Deity'));
             $links[] = javascript('confirm', $dvars);
         } else {
             $dvars['QUESTION'] = dgettext('users', 'Are you sure you want to deify this user?');
             $dvars['ADDRESS'] = PHPWS_Text::linkAddress('users', array('action' => 'admin', 'command' => 'deify_user', 'user_id' => $this->id), 1);
             $dvars['LINK'] = sprintf('<i class="fa fa-male" title="%s"></i>', dgettext('users', 'Mortal'));
             $links[] = javascript('confirm', $dvars);
         }
     }
     $linkVar['action'] = 'admin';
     $linkVar['user_id'] = $this->id;
     if ($this->isActive()) {
         if (!$this->deity) {
             $linkVar['command'] = 'deactivateUser';
             $template['ACTIVE'] = PHPWS_Text::secureLink(dgettext('users', 'Yes'), 'users', $linkVar, null, dgettext('users', 'Deactivate this user'));
         } else {
             $template['ACTIVE'] = dgettext('users', 'Yes');
         }
     } else {
         if (!$this->deity) {
             $linkVar['command'] = 'activateUser';
             $template['ACTIVE'] = PHPWS_Text::secureLink(dgettext('users', 'No'), 'users', $linkVar, null, dgettext('users', 'Activate this user'));
         } else {
             $template['ACTIVE'] = dgettext('users', 'No');
         }
     }
     $logged = $this->getLastLogged('%Y/%m/%d %H:%M');
     if (empty($logged)) {
         $template['LAST_LOGGED'] = dgettext('users', 'Never');
     } else {
         $template['LAST_LOGGED'] = $logged;
     }
     $template['EMAIL'] = $this->getEmail(true, true);
     $jsvar['QUESTION'] = sprintf(dgettext('users', 'Are you certain you want to delete the user &quot;%s&quot; permanently?'), $this->getUsername());
     $link = new PHPWS_Link(null, 'users', array('action' => 'admin', 'command' => 'deleteUser', 'user_id' => $this->id), true);
     $link->setSalted();
     $jsvar['ADDRESS'] = $link->getAddress();
     $jsvar['LINK'] = '<i class="fa fa-trash-o" title="' . dgettext('users', 'Delete user') . '"></i>';
     $linkVar['command'] = 'editUser';
     $links[] = PHPWS_Text::secureLink('<i class="fa fa-edit"></i>', 'users', $linkVar);
     $linkVar['command'] = 'setUserPermissions';
     $links[] = PHPWS_Text::secureLink('<i class="fa fa-key" title="' . dgettext('users', 'Permissions') . '"></i>', 'users', $linkVar);
     if (!$this->isDeity() && $this->id != Current_User::getId()) {
         $links[] = Layout::getJavascript('confirm', $jsvar);
     }
     $template['ACTIONS'] = implode('&nbsp;', $links);
     if ($this->deity && !Current_User::isDeity()) {
         unset($template['ACTIONS']);
     }
     return $template;
 }
Exemplo n.º 11
0
 /**
  * @deprecated
  * @param type $icon
  * @return type
  */
 public function editLink($icon = false)
 {
     $vars['document_id'] = $this->id;
     $vars['folder_id'] = $this->folder_id;
     $vars['dop'] = 'upload_document_form';
     $link = new PHPWS_Link(null, 'filecabinet', $vars, true);
     $link->setSalted(1);
     $js['address'] = $link->getAddress();
     $js['width'] = 550;
     $js['height'] = 500;
     if ($icon) {
         $js['label'] = Icon::show('edit', dgettext('filecabinet', 'Edit document'));
     } else {
         $js['label'] = dgettext('filecabinet', 'Edit');
     }
     return javascript('open_window', $js);
 }
Exemplo n.º 12
0
 public function getViewLink($bare = false)
 {
     $link = new PHPWS_Link(dgettext('blog', 'View'), 'blog', array('id' => $this->id));
     $link->rewrite = MOD_REWRITE_ENABLED;
     if ($bare) {
         return $link->getAddress();
     } else {
         return $link->get();
     }
 }