Ejemplo n.º 1
0
 protected function getTitleLink()
 {
     $meta =& $this->item->metadata;
     if ($this->item->name == 'directory') {
         if ($this->client_id) {
             $link = 'index.php?option=' . $this->item->extension . '&filter_project=' . $this->item->xref_id . '&filter_parent_id=' . (int) $this->item->item_id;
         } else {
             $item_slug = $this->item->item_id . ':' . $meta->get('alias');
             $p_slug = $this->item->xref_id . ':' . $meta->get('p_alias');
             $link = PFrepoHelperRoute::getRepositoryRoute($p_slug, $item_slug, $meta->get('path'));
         }
     }
     if ($this->item->name == 'note') {
         if ($this->client_id) {
             $link = 'index.php?option=' . $this->item->extension . '&task=note.edit' . '&filter_project=' . $this->item->xref_id . '&filter_parent_id=' . $meta->get('d_id') . '&id=' . $this->item->item_id;
         } else {
             $item_slug = $this->item->item_id . ':' . $meta->get('alias');
             $p_slug = $this->item->xref_id . ':' . $meta->get('p_alias');
             $d_slug = $meta->get('d_id') . ':' . $meta->get('d_alias');
             $link = PFrepoHelperRoute::getNoteRoute($item_slug, $p_slug, $d_slug, $meta->get('path'));
         }
     }
     if ($this->item->name == 'file') {
         if ($this->client_id) {
             $link = 'index.php?option=' . $this->item->extension . '&task=file.download' . '&filter_project=' . $this->item->xref_id . '&filter_parent_id=' . $meta->get('d_id') . '&id=' . $this->item->item_id;
         } else {
             $item_slug = $this->item->item_id . ':' . $meta->get('alias');
             $p_slug = $this->item->xref_id . ':' . $meta->get('p_alias');
             $d_slug = $meta->get('d_id') . ':' . $meta->get('d_alias');
             $link = PFrepoHelperRoute::getFileRoute($item_slug, $p_slug, $d_slug, $meta->get('path'));
         }
     }
     return JRoute::_($link);
 }
Ejemplo n.º 2
0
 /**
  * Returns a list with attachments
  *
  * @param     array     $items    The attachment objects
  *
  * @return    string
  */
 public static function attachments($items = array())
 {
     if (!is_array($items) || !count($items)) {
         return '';
     }
     $user = JFactory::getUser();
     $levels = $user->getAuthorisedViewLevels();
     $admin = $user->authorise('core.admin', 'com_pfrepo');
     $html[] = '<ul class="unstyled">';
     foreach ($items as $item) {
         if (!isset($item->repo_data) || empty($item->repo_data)) {
             continue;
         }
         $data =& $item->repo_data;
         if (!$admin && !in_array($data->access, $levels)) {
             continue;
         }
         list($asset, $id) = explode('.', $item->attachment, 2);
         $icon = '<i class="icon-file"></i> ';
         $link = '#';
         if ($asset == 'directory') {
             $icon = '<i class="icon-folder"></i> ';
             $link = PFrepoHelperRoute::getRepositoryRoute($data->project_id . ':' . $data->project_alias, $data->id . ':' . $data->alias, $data->path);
         }
         if ($asset == 'note') {
             $icon = '<i class="icon-pencil"></i> ';
             $link = PFrepoHelperRoute::getNoteRoute($data->id . ':' . $data->alias, $data->project_id . ':' . $data->project_alias, $data->dir_id . ':' . $data->dir_alias, $data->path);
         }
         if ($asset == 'file') {
             $link = PFrepoHelperRoute::getFileRoute($data->id . ':' . $data->alias, $data->project_id . ':' . $data->project_alias, $data->dir_id . ':' . $data->dir_alias, $data->path);
         }
         $html[] = '<li>';
         $html[] = $icon;
         $html[] = '<a href="' . JRoute::_($link) . '">';
         $html[] = htmlspecialchars($data->title, ENT_COMPAT, 'UTF-8');
         $html[] = '</a>';
         $html[] = '</li>';
     }
     $html[] = '</ul>';
     return implode('', $html);
 }
Ejemplo n.º 3
0
 /**
  * Returns a list of buttons for the frontend
  *
  * @return    array
  */
 public static function getSiteButtons()
 {
     $user = JFactory::getUser();
     $app = JFactory::getApplication();
     $pid = (int) $app->getUserState('com_projectfork.project.active.id');
     $buttons = array();
     if (!$pid || defined('PFDEMO')) {
         return $buttons;
     }
     // Get the project root dir
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('attribs')->from('#__pf_projects')->where('id = ' . $pid);
     $db->setQuery($query);
     $project_attribs = $db->loadResult();
     $project_params = new JRegistry();
     $project_params->loadString($project_attribs);
     $repo_dir = (int) $project_params->get('repo_dir');
     if (!$repo_dir) {
         return $buttons;
     }
     // Get the access of the dir
     $query->clear()->select('access')->from('#__pf_repo_dirs')->where('id = ' . $repo_dir);
     $db->setQuery($query);
     $access = (int) $db->loadResult();
     // Check viewing access
     if (!in_array($access, $user->getAuthorisedViewLevels()) && !$user->authorise('core.admin')) {
         return $buttons;
     }
     // Check permission
     if (!$user->authorise('core.create', 'com_pfrepo.directory.' . $repo_dir)) {
         return $buttons;
     }
     $buttons[] = array('title' => 'MOD_PF_DASH_BUTTONS_ADD_FILE', 'link' => PFrepoHelperRoute::getRepositoryRoute($pid, $repo_dir) . '&task=fileform.add', 'icon' => JHtml::image('com_projectfork/projectfork/header/icon-48-repoform.add.png', JText::_('MOD_PF_DASH_BUTTONS_ADD_FILE'), null, true));
     return $buttons;
 }
Ejemplo n.º 4
0
        echo (int) $item->tasks;
        ?>
 <?php 
        echo JText::_('JGRID_HEADING_TASKS');
        ?>
	                                    </a>
	    	    	    			</div>
    	    	    			<?php 
    }
    ?>
    	    	    			<?php 
    if ($repo_enabled) {
        ?>
    	    	    				<div class="btn-group">
    	    	    			        <a class="btn btn-mini" href="<?php 
        echo JRoute::_(PFrepoHelperRoute::getRepositoryRoute($item->slug, $repo_dir));
        ?>
">
    	    	    			            <span aria-hidden="true" class="icon-flag-2"></span>
    	    	    			            <?php 
        echo (int) $item->attachments;
        ?>
 <?php 
        echo JText::_('COM_PROJECTFORK_FIELDSET_ATTACHMENTS');
        ?>
    	    	    			        </a>
    	    	    				</div>
    	    	    			<?php 
    }
    ?>
    	    	    			<?php 
Ejemplo n.º 5
0
    <?php 
if ($this->params->get('show_page_heading', 1)) {
    ?>
        <h1><?php 
    echo $this->escape($this->params->get('page_heading'));
    ?>
</h1>
    <?php 
}
?>

    <div class="clearfix"></div>

    <div class="cat-items">
        <form name="adminForm" id="adminForm" action="<?php 
echo JRoute::_(PFrepoHelperRoute::getRepositoryRoute($dir->project_id, $dir->id) . $link_append);
?>
" method="post" enctype="multipart/form-data">

            <fieldset class="filters">
                <div class="well btn-toolbar">
                    <div class="filter-search btn-group pull-left">
                        <input type="text" name="filter_search" placeholder="<?php 
echo JText::_('JSEARCH_FILTER');
?>
" id="filter_search" value="<?php 
echo $this->escape($this->state->get('filter.search'));
?>
" />
                    </div>
                    <div class="filter-search-buttons btn-group pull-left">
Ejemplo n.º 6
0
    <tr class="row1">
        <td></td>
        <td colspan="2">
            <i class="icon-arrow-up"></i>&nbsp;
            <a href="<?php 
    echo JRoute::_(PFrepoHelperRoute::getRepositoryRoute($this_dir->project_id, $this_dir->parent_id, $this_dir->path) . $link_append);
    ?>
">
                ..
            </a>
        </td>
    </tr>
<?php 
}
foreach ($this->items['directories'] as $i => $item) {
    $link = PFrepoHelperRoute::getRepositoryRoute($item->project_slug, $item->slug, $item->path);
    $icon = $item->protected == '1' ? 'icon-warning' : 'icon-folder';
    if ($item->parent_id == '1') {
        $icon = 'icon-folder-2';
    }
    $js = 'if (window.parent) window.parent.' . $this->escape($function) . '(\'' . $item->id . '\', \'' . $this->escape(addslashes($item->title)) . '\', \'directory\'' . ');';
    ?>
    <tr class="row<?php 
    echo $i % 2;
    ?>
">
        <td>
            <a class="btn btn-mini" onclick="<?php 
    echo $js;
    ?>
">
            </label>
        </td>
        <td>
            <?php 
    if ($item->checked_out) {
        ?>
<span aria-hidden="true" class="icon-lock"></span> <?php 
    }
    ?>

            <span class="item-title pull-left">
            	<?php 
    if (!$item->orphaned) {
        ?>
	                <a href="<?php 
        echo JRoute::_(PFrepoHelperRoute::getRepositoryRoute($item->project_slug, $item->slug, $item->path));
        ?>
" class="hasPopover" rel="popover" title="<?php 
        echo JText::_($this->escape($item->title));
        ?>
" data-content="<?php 
        echo $this->escape($item->description);
        ?>
" data-placement="right">
	                	<span aria-hidden="true" class="<?php 
        echo $icon;
        ?>
"></span>
	                    <?php 
        echo JText::_($this->escape($item->title));
        ?>
Ejemplo n.º 8
0
 /**
  * Generates the toolbar for the top of the view
  *
  * @return    string    Toolbar with buttons
  */
 protected function getToolbar()
 {
     $access = PFrepoHelper::getActions('note', $this->item->id);
     $link = PFrepoHelperRoute::getRepositoryRoute($this->item->project_id, $this->item->dir_id, $this->item->path);
     $back_opts = array('access' => true, 'href' => $link);
     $edit_opts = array('access' => $access->get('core.edit'));
     PFToolbar::button('COM_PROJECTFORK_ACTION_BACK', '', false, $back_opts);
     PFToolbar::button('COM_PROJECTFORK_ACTION_EDIT', 'noteform.edit', false, $edit_opts);
     PFToolbar::filterButton($this->state->get('filter.isset'));
     return PFToolbar::render();
 }
Ejemplo n.º 9
0
    $query->select('attribs')->from('#__pf_projects')->where('id = ' . $db->quote($pid));
    $db->setQuery($query);
    $project_attribs = $db->loadResult();
    $project_params = new JRegistry();
    $project_params->loadString($project_attribs);
    $repo_dir = (int) $project_params->get('repo_dir');
} else {
    $repo_dir = 1;
}
// Prepare component base links
$link_tasks = class_exists('PFtasksHelperRoute') ? PFtasksHelperRoute::getTasksRoute() : 'index.php?option=com_pftasks';
$link_projects = class_exists('PFprojectsHelperRoute') ? PFprojectsHelperRoute::getProjectsRoute() : 'index.php?option=com_pfprojects';
$link_time = class_exists('PFtimeHelperRoute') ? PFtimeHelperRoute::getTimesheetRoute() : 'index.php?option=com_pftime';
$link_ms = class_exists('PFmilestonesHelperRoute') ? PFmilestonesHelperRoute::getMilestonesRoute() : 'index.php?option=com_pfmilestones';
$link_forum = class_exists('PFforumHelperRoute') ? PFforumHelperRoute::getTopicsRoute() : 'index.php?option=com_pfforum';
$link_repo = class_exists('PFrepoHelperRoute') ? PFrepoHelperRoute::getRepositoryRoute($pid, $repo_dir) : 'index.php?option=com_pfrepo&filter_project=' . $pid . '&parent_id=' . $repo_dir;
// Logout link return
$return = base64_encode($this->baseurl);
?>
<!DOCTYPE html>
<html>
<head>
	<jdoc:include type="head" />
    <?php 
// Detecting Home
$site_app = JFactory::getApplication('Site');
$menu = $site_app->getMenu();
if ($menu->getActive() == $menu->getDefault()) {
    $siteHome = 1;
} else {
    $siteHome = 0;
Ejemplo n.º 10
0
        $icon = 'icon-checkbox';
        $rev_tt = JText::_('COM_PROJECTFORK_REV_HEAD_DESC');
        $link = PFrepoHelperRoute::getNoteRoute($item->slug, $item->project_slug, $item->dir_slug, $item->path);
        $desc = $item->text;
    } elseif ($item->ordering == 1) {
        $rev_id = $txt_root;
        $rev_class = ' badge-inverse';
        $icon = 'icon-checkbox-partial';
        $rev_tt = JText::_('COM_PROJECTFORK_REV_ROOT_DESC');
        $desc = $item->description;
    } else {
        $rev_id = (int) $item->ordering;
        $desc = $item->description;
    }
    if (empty($link)) {
        $link = PFrepoHelperRoute::getNoteRoute($file->slug, $file->project_slug, $file->dir_slug, $file->path, $item->id);
    }
    ?>
                        <tr class="row<?php 
    echo $i % 2;
    ?>
">
                            <td class="nowrap">
                                <span class="badge hasTip hasTooltip<?php 
    echo $rev_class;
    ?>
" title="<?php 
    echo $rev_tt;
    ?>
">
                                    <i class="<?php 
Ejemplo n.º 11
0
    <?php 
if ($this->params->get('show_page_heading', 1)) {
    ?>
        <h1><?php 
    echo $this->escape($this->params->get('page_heading'));
    ?>
</h1>
    <?php 
}
?>

    <div class="clearfix"></div>

    <div class="cat-items">
        <form name="adminForm" id="adminForm" action="<?php 
echo JRoute::_(PFrepoHelperRoute::getRepositoryRoute($dir->project_id, $dir->id));
?>
"
            method="post" autocomplete="off">
            <div class="btn-toolbar btn-toolbar-top">
                <?php 
echo $this->toolbar;
?>
                <div class="filter-project btn-group">
                    <?php 
echo JHtml::_('pfhtml.project.filter');
?>
                </div>
            </div>

            <div class="<?php 
Ejemplo n.º 12
0
 /**
  * Displays the current view
  *
  * @param     boolean    $cachable    If true, the view output will be cached  (Not Used!)
  * @param     array      $urlparams   An array of safe url parameters and their variable types (Not Used!)
  *
  * @return    JController             A JController object to support chaining.
  */
 public function display($cachable = false, $urlparams = false)
 {
     // Load CSS and JS assets
     JHtml::_('pfhtml.style.bootstrap');
     JHtml::_('pfhtml.style.projectfork');
     JHtml::_('pfhtml.script.jQuery');
     JHtml::_('pfhtml.script.bootstrap');
     JHtml::_('pfhtml.script.projectfork');
     JHtml::_('behavior.tooltip');
     $view = JRequest::getCmd('view');
     $id = JRequest::getUInt('id');
     $urlparams = array('id' => 'INT', 'cid' => 'ARRAY', 'limit' => 'INT', 'limitstart' => 'INT', 'showall' => 'INT', 'return' => 'BASE64', 'filter' => 'STRING', 'filter_order' => 'CMD', 'filter_order_Dir' => 'CMD', 'filter_search' => 'STRING', 'filter_published' => 'CMD');
     // Inject default view if not set
     if (empty($view)) {
         JRequest::setVar('view', $this->default_view);
         $view = $this->default_view;
     }
     if ($view == $this->default_view) {
         $parent_id = JRequest::getUInt('filter_parent_id');
         $project = PFApplicationHelper::getActiveProjectId('filter_project');
         if ($parent_id && $project === "") {
             $this->setRedirect(JRoute::_(PFrepoHelperRoute::getRepositoryRoute()));
             return $this;
         } elseif ($parent_id > 1 && $project > 0) {
             // Check if the folder belongs to the project
             $db = JFactory::getDbo();
             $query = $db->getQuery(true);
             $query->select('project_id')->from('#__pf_repo_dirs')->where('id = ' . (int) $parent_id);
             $db->setQuery($query);
             $pid = $db->loadResult();
             if ($pid != $project) {
                 // No match, redirect to the project root dir
                 $query->clear();
                 $query->select('id, path')->from('#__pf_repo_dirs')->where('parent_id = 1')->where('project_id = ' . (int) $project);
                 $db->setQuery($query, 0, 1);
                 $dir = $db->loadObject();
                 if ($dir) {
                     $this->setRedirect(JRoute::_(PFrepoHelperRoute::getRepositoryRoute($project, $dir->id, $dir->path)));
                     return $this;
                 }
             }
         }
     }
     // Check for directory edit form.
     if ($view == 'directoryform' && !$this->checkEditId('com_pfrepo.edit.directoryform', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         return JError::raiseError(403, JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
     }
     // Check for note edit form.
     if ($view == 'noteform' && !$this->checkEditId('com_pfrepo.edit.noteform', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         return JError::raiseError(403, JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
     }
     // Check for file edit form.
     if ($view == 'fileform' && !$this->checkEditId('com_pfrepo.edit.fileform', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         return JError::raiseError(403, JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
     }
     // Display the view
     parent::display($cachable, $urlparams);
     // Return own instance for chaining
     return $this;
 }
Ejemplo n.º 13
0
 /**
  * Method to generate the frontend input markup.
  *
  * @return    array     $html     The html field markup
  */
 protected function getSiteHTML($project)
 {
     $html = array();
     if (JFactory::getApplication()->isSite()) {
         $link = PFrepoHelperRoute::getRepositoryRoute($project) . '&amp;layout=modal&amp;tmpl=component' . '&amp;function=pfSelectAttachment_' . $this->id;
     } else {
         $link = 'index.php?option=com_pfrepo&amp;view=repository' . '&amp;filter_project=' . (int) $project . '&amp;layout=modal&amp;tmpl=component' . '&amp;function=pfSelectAttachment_' . $this->id;
     }
     $html[] = '<ul id="' . $this->id . '_list" class="unstyled">';
     foreach ($this->value as $item) {
         if (!isset($item->repo_data)) {
             continue;
         }
         if (empty($item->repo_data)) {
             continue;
         }
         list($asset, $id) = explode('.', $item->attachment, 2);
         $icon = '<i class="icon-file"></i> ';
         if ($asset == 'directory') {
             $icon = '<i class="icon-folder"></i> ';
         }
         if ($asset == 'note') {
             $icon = '<i class="icon-pencil"></i> ';
         }
         $html[] = '<li>';
         $html[] = '<div class="btn-group pull-left"><a class="btn btn-mini" onclick="pfRemoveAttachment_' . $this->id . '(this);"><i class="icon-remove"></i> </a></div>';
         $html[] = '&nbsp;';
         $html[] = '<span class="label">' . $icon . htmlspecialchars($item->repo_data->title, ENT_COMPAT, 'UTF-8') . '</span>';
         $html[] = '<input type="hidden" name="' . $this->name . '[]" value="' . htmlspecialchars($item->attachment, ENT_COMPAT, 'UTF-8') . '"/>';
         $html[] = '<div class="clearfix clr"></div>';
         $html[] = '</li>';
     }
     $html[] = '</ul>';
     $html[] = '<input type="hidden" name="' . $this->name . '[]" value=""/>';
     // Create the select button.
     if ($this->element['readonly'] != 'true') {
         $html[] = '<a class="modal_' . $this->id . ' btn" title="' . JText::_('COM_PROJECTFORK_SELECT_ATTACHMENT') . '"' . ' href="' . JRoute::_($link) . '" rel="{handler: \'iframe\', size: {x: 720, y: 500}}">';
         $html[] = JText::_('COM_PROJECTFORK_SELECT_ATTACHMENT') . '</a>';
     }
     return $html;
 }
Ejemplo n.º 14
0
        ?>
                    <span class="item-count badge badge-info"><?php 
        echo $item->revision_count;
        ?>
</span>
                <?php 
    }
    ?>
        	</span>

        	<span class="dropdown pull-left">
	        	<?php 
    $this->menu->start(array('class' => 'btn-mini btn-link'));
    $this->menu->itemEdit('noteform', $item->id, $can_edit || $can_edit_own);
    if ($item->revision_count) {
        $link_revs = PFrepoHelperRoute::getNoteRevisionsRoute($item->slug, $item->project_slug, $item->dir_slug, $item->path);
        $this->menu->itemLink('icon-flag', 'COM_PROJECTFORK_VIEW_REVISIONS', JRoute::_($link_revs));
    }
    $this->menu->itemDelete('repository', $x, $can_edit || $can_edit_own);
    $this->menu->end();
    echo $this->menu->render(array('class' => 'btn-mini'));
    ?>
        	</span>

            <?php 
    if ($filter_project && $is_search) {
        ?>
                <div class="small">
                    <?php 
        echo str_replace($this_path, '.', $item->path) . '/';
        ?>
Ejemplo n.º 15
0
 /**
  * Method to generate the email message
  *
  * @param     object     $lang         Instance of the default user language
  * @param     object     $receiveer    Instance of the the receiving user
  * @param     object     $user         Instance of the user who made the change
  * @param     object     $after        Instance of the item table after it was updated
  * @param     object     $before       Instance of the item table before it was updated
  * @param     boolean    $is_new       True if the item is new ($before will be null)
  *
  * @return    string
  */
 public static function getNoteMessage($lang, $receiver, $user, $after, $before, $is_new)
 {
     // Get the changed fields
     $props = array('description', 'created_by', 'access');
     $changes = array();
     if (is_object($before) && is_object($after)) {
         $changes = PFObjectHelper::getDiff($before, $after, $props);
     }
     if ($is_new) {
         $changes = PFObjectHelper::toArray($after, $props);
     }
     $txt_prefix = self::$prefix . '_' . ($is_new ? 'NEW' : 'UPD');
     $format = $lang->_($txt_prefix . '_MESSAGE');
     $changes = PFnotificationsHelper::formatChanges($lang, $changes);
     $footer = sprintf($lang->_('COM_PROJECTFORK_EMAIL_FOOTER'), JURI::root());
     $link = JRoute::_(JURI::root() . PFrepoHelperRoute::getNoteRoute($after->id, $after->project_id, $after->dir_id));
     $txt = sprintf($format, $receiver->name, $user->name, $changes, $link);
     $txt = str_replace('\\n', "\n", $txt . "\n\n" . $footer);
     return $txt;
 }