function pp_content($project_id, $content) { $html = ''; foreach ($content as $page) { $html .= "<h1>{$page['project_name']}</h1>"; $html .= "<h2>{$page['page_name']}</h2>"; $c = do_textile(pp_wiki_links($project_id, $page[page_name], $page['content'])); $html .= "<div class=content>{$c}</div>"; $html .= "<h3>{$page['created_on']} {$page['log_message']}</h3>"; } return $html; }
function task_list_description() { global $the_task_list; if ($the_task_list->getDescription()) { ?> <div class="desc"> <?php echo do_textile($the_task_list->getDescription()); ?> </div> <?php } }
/** * Replaces wiki links in format [wiki:{PAGE_ID}] with a textile link to the page * * @param mixed $content * @return */ function wiki_replace_link_callback($matches) { //print_r($matches); if (count($matches) >= 2) { if (is_numeric($matches[1])) { $object_id = $matches[1]; $object = Wiki::instance()->findById($object_id); if ($object instanceof WikiPage) { if ($matches[2] == ',content') { $revision = $object->getLatestRevision(); return do_textile(plugin_manager()->apply_filters('wiki_text', $revision->getContent())); } return '<a href="' . externalUrl($object->getViewUrl()) . '" title="' . lang('wiki page') . "({$object_id})" . '">' . $object->getObjectName() . '</a>'; } } } return '<del>' . lang('invalid reference', $matches[0]) . '</del>'; }
?> <?php echo lang('file revision title long', $revision->getDownloadUrl(), $revision->getRevisionNumber(), $revision->getCreatedBy()->getCardUrl(), $revision->getCreatedBy()->getDisplayName(), format_datetime($revision->getCreatedOn())); } else { ?> <?php echo lang('file revision title short', $revision->getDownloadUrl(), $revision->getRevisionNumber(), format_datetime($revision->getCreatedOn())); } // if ?> </div> <?php if (trim($revision->getComment())) { ?> <div class="revisionComment"><?php echo do_textile($revision->getComment()); ?> </div> <?php } // if $options = array(); if ($revision->canEdit(logged_user())) { $options[] = '<a href="' . $revision->getEditUrl() . '">' . lang('edit') . '</a>'; } if ($revision->canDelete(logged_user())) { $options[] = '<a href="' . $revision->getDeleteUrl() . '">' . lang('delete') . '</a>'; } if ($revision->canDownload(logged_user())) { $options[] = '<a href="' . $revision->getDownloadUrl() . '" class="downloadLink">' . lang('download') . ' <span>(' . format_filesize($revision->getFileSize()) . ')</span></a>'; }
} else { ?> <span class="assignedTo"><?php echo lang('anyone'); ?> </span> <?php } // if $taskDueDate = $assigned_task->getDueDate(); if (!is_null($taskDueDate)) { echo ' | ' . lang('due date') . ': <strong>' . format_date($taskDueDate) . '</strong>'; } ?> <?php echo do_textile('[' . $assigned_task->getId() . '] ' . $assigned_task->getText()); if ($assigned_task->getTaskList() instanceof ProjectTaskList) { ?> (<?php echo lang('in'); ?> <a href="<?php echo $assigned_task->getTaskList()->getViewUrl(); ?> "><?php echo clean($assigned_task->getTaskList()->getName()); ?> </a>) <div class="options"> <?php if ($assigned_task->canEdit(logged_user())) {
?> <div id="projectForms"> <?php foreach ($forms as $form) { ?> <div class="block"> <div class="header"><?php echo clean($form->getName()); ?> </div> <div class="content"> <?php if (trim($form->getDescription())) { ?> <div class="description"><?php echo do_textile($form->getDescription()); ?> </div> <?php } // if ?> <div class="successMessage"><em><?php echo lang('success message'); ?> :</em> <?php echo clean($form->getSuccessMessage()); ?> </div> <?php
<?php trace(__FILE__, 'begin'); /** * @author Alex Mayhew * @copyright 2008 */ set_page_title(!$iscurrev ? lang('viewing revision of', $revision->getRevision(), $revision->getName()) : $revision->getName() . ' [' . $revision->getPageId() . ']'); project_tabbed_navigation(); project_crumbs(array(array(lang('wiki'), get_url('wiki')), array($revision->getName()))); if ($page->canAdd(logged_user(), active_project())) { add_page_action(lang('add wiki page'), $page->getAddUrl()); } // if if ($page->canEdit(logged_user(), active_project()) && !$page->isNew()) { add_page_action(lang('edit wiki page'), $page->getEditUrl()); add_page_action(lang('view page history'), $page->getViewHistoryUrl()); } // if if ($page->canDelete(logged_user(), active_project()) && !$page->isNew() && $iscurrev) { add_page_action(lang('delete wiki page'), $page->getDeleteUrl()); } add_page_action(lang('wiki public wiki'), externalUrl(ROOT_URL . '/' . PUBLIC_FOLDER . '/wiki')); ?> <div id="wiki-page-content"><?php echo do_textile(plugin_manager()->apply_filters('wiki_text', do_textile($revision->getContent()))); ?> </div>
} } if ($task->canChangeStatus(logged_user())) { if ($task->isOpen()) { $options[] = '<a href="' . $task->getCompleteUrl() . '">' . lang('mark task as completed') . '</a>'; } else { $options[] = '<a href="' . $task->getOpenUrl() . '">' . lang('open task') . '</a>'; } // if } // if ?> <div id="taskDetails" class="block"> <div class="header"><?php echo do_textile('[' . $task->getId() . '] ' . $task->getText()); ?> </div> <div class="content"> <div id="taskInfo"> <?php if (!is_null($task->getStartDate())) { if ($task->getStartDate()->getYear() > DateTimeValueLib::now()->getYear()) { ?> <div class="startDate"><span><?php echo lang('start date'); ?> :</span> <?php echo format_date($task->getStartDate(), null, 0); ?> @ <?php
<?php $content = $milestone->getDescription(); if (strlen($content) > 150) { echo do_textile(substr($content, 0, 150)); ?> <a href="<?php echo $milestone->getViewUrl(); ?> " title="<?php echo lang('view milestone'); ?> "><?php echo lang('read more'); ?> </a> <?php } else { echo do_textile($content); } ?> </div> </div> <div class="clear"></div> </div> <?php } // if } // if
<div id="wiki-field-name"> <?php echo label_tag(lang('name'), 'wikiFormName', true); echo text_field('wiki[name]', $revision->getName(), array('class' => 'long', 'id' => 'wikiFormName')); ?> </div> <div id="wiki-field-content"> <?php echo label_tag(lang('wiki page content'), 'wikiFormContent', true); echo textarea_field('wiki[content]', $data['content'], array('cols' => 132, 'class' => 'shot', 'id' => 'wikiFormContent')); echo submit_button(lang('preview'), 'p', array('name' => 'wiki[preview]')); echo label_tag(lang('preview'), 'wikiFormPreview', false); ?> <div class="preview"><?php echo do_textile(plugin_manager()->apply_filters('wiki_text', $data['preview_content'])); ?> </div> </div> <div id="wiki-field-log"> <?php echo label_tag(lang('wiki log message'), 'wikiFormLog'); echo text_field('wiki[log_message]', $page->isNew() ? lang('wiki page created') : '', array('class' => 'long', 'id' => 'wikiFormLog')); if (plugin_active('tags')) { echo label_tag(lang('tags'), 'wikiFormTags'); echo text_field('wiki[tags]', $tags, array('class' => 'long', 'id' => 'wikiFormTags')); } ?> </div> <div> <?php
<form action="<?php echo $page->getAddUrl() ?>" method="POST"> <?php else: ?> <form action="<?php echo $page->getEditUrl() ?>" method="POST"> <?php endif;?> <?php tpl_display(get_template_path('form_errors')) ?> <div id="wiki-field-name"> <?php echo label_tag(lang('name'), 'wikiFormName', true) ?> <?php echo text_field('wiki[name]', $revision->getName(), array('class' => 'long', 'id' => 'wikiFormName')) ?> </div> <div id="wiki-field-content"> <?php echo label_tag(lang('wiki page content'), 'wikiFormContent', true) ?> <?php echo textarea_field('wiki[content]', $data['content'], array('cols' => 132, 'class' => 'shot', 'id' => 'wikiFormContent')) ?> <?php echo submit_button(lang('preview'), 'p', array( 'name' => 'wiki[preview]') ) ?> <?php echo label_tag(lang('preview'), 'wikiFormPreview', false) ?> <div class="preview"><?php echo do_textile(plugin_manager()->apply_filters('wiki_text', $data['preview_content'])); ?></div> </div> <div id="wiki-field-log"> <?php echo label_tag(lang('wiki log message'), 'wikiFormLog'); echo text_field('wiki[log_message]', ($page->isNew() ? lang('wiki page created') : ''), array('class' => 'long', 'id' => 'wikiFormLog')); ?> <?php if (plugin_active('tags')) { echo label_tag(lang('tags'), 'wikiFormTags'); echo text_field('wiki[tags]', $tags, array('class' => 'long', 'id' => 'wikiFormTags')); } ?> </div> <div> <?php echo label_tag(lang('parent page'), 'wikiFormParentId', true) ?>
</td> <?php } // if ?> </tr> </table> <br /> <div> <span class="bold"><?php echo lang('description'); ?> :</span> <div class="desc"><?php echo do_textile($ticket->getDescription()); ?> </div> </div> </div> <?php if ($canEdit) { ?> <?php echo submit_button($ticket->isNew() ? lang('add ticket') : lang('save')); } // if ?> </form> <br />
?> </div> <?php } else { ?> <div class="messageAuthor"><?php echo lang('posted on', format_datetime($message->getCreatedOn())); ?> </div> <?php } // if ?> <div class="messageText"> <?php echo plugin_manager()->apply_filters('all_messages_message_text', do_textile($message->getText())); ?> <p><a href="<?php echo $message->getViewUrl(); ?> "><?php echo lang('read more'); ?> </a></p> </div> <?php echo render_object_files($message, $message->canEdit(logged_user())); ?> <div class="messageCommentCount"> <?php if ($message->countComments()) {
echo lang('private comment'); ?> </span></div> <?php } // if ?> </td> <td> <?php echo format_datetime($comment->getCreatedOn(), "m/d/Y, h:ia"); ?> </td> <td> <?php echo plugin_manager()->apply_filters('comment_text', do_textile($comment->getText())); ?> </td> <td> <a href="<?php echo $comment->getCreatedBy()->getCardUrl(); ?> "><?php echo clean($comment->getCreatedBy()->getDisplayName()); ?> </a> </td> </tr> <?php } // foreach
<?php if ($object->isPrivate()) { echo "<em>" . lang('private message') . "</em>"; } // if echo do_textile($object->getText());
} // if if (ProjectFile::canAdd(logged_user(), active_project())) { add_page_action(lang('add file'), get_url('files', 'add_file')); } // if add_stylesheet_to_page('project/project_log.css'); if (trim(active_project()->getDescription()) && active_project()->getShowDescriptionInOverview()) { ?> <div class="hint"> <div class="header"><?php echo clean(active_project()->getName()); ?> </div> <div class="content"><?php echo do_textile(active_project()->getDescription()); ?> </div> </div> <?php } // if ?> <?php if ($late_milestones || $today_milestones || $upcoming_milestones) { ?> <h2><?php echo lang('milestones'); ?> </h2>
echo lang('goal'); ?> :</span> <?php echo $milestone->getGoal(); ?> </div> <?php } // if ?> <?php if ($milestone->getDescription()) { ?> <div class="description"><?php echo do_textile($milestone->getDescription()); ?> </div> <?php } // if ?> <?php if (plugin_active('tags')) { ?> <p><span><?php echo lang('tags'); ?> :</span> <?php echo project_object_tags($milestone, $milestone->getProject());
<?php if ($comment->getCreatedBy() instanceof User && $comment->getCreatedBy()->hasAvatar()) { ?> <div class="commentUserAvatar"><img src="<?php echo $comment->getCreatedBy()->getAvatarUrl(); ?> " alt="<?php echo clean($comment->getCreatedBy()->getDisplayName()); ?> " /></div> <?php } // if ?> <div class="commentText"><?php echo do_textile($comment->getText()); ?> </div> <div class="clear"></div> <?php echo render_object_files($comment, $comment->canEdit(logged_user())); ?> </div> <?php $options = array(); if ($comment->canEdit(logged_user())) { $options[] = '<a href="' . $comment->getEditUrl() . '">' . lang('edit') . '</a>'; } if ($comment->canDelete(logged_user())) { $options[] = '<a href="' . $comment->getDeleteUrl() . '" onclick="return confirm(\'' . lang('confirm delete comment') . '\')">' . lang('delete') . '</a>'; }
<div class="emptyAttachment"> <?php echo plugin_manager()->apply_filters('pageattachment_text', do_textile($attachment->getText())); ?> </div>
<div class="configCategory" id="category_<?php echo $config_category->getName(); ?> "> <h2><a href="<?php echo $config_category->getUpdateUrl(); ?> "><?php echo clean($config_category->getDisplayName()); ?> </a></h2> <?php if (trim($config_category->getDisplayDescription())) { ?> <div class="configCategoryDescription"><?php echo do_textile($config_category->getDisplayDescription()); ?> </div> <?php } // if ?> </div> <?php } // if } // foreach } // if
<a href="<?php echo $file->getDetailsUrl(); ?> " title="<?php echo lang('view file details'); ?> "><?php echo $file->getObjectName(); ?> </a></div> <div class="content"> <?php if ($file->getDescription()) { ?> <div class="fileDescription"><?php echo do_textile($file->getDescription()); ?> </div> <?php } // if if (($last_revision = $file->getLastRevision()) instanceof ProjectFileRevision) { if ($last_revision->getCreatedBy() instanceof User) { ?> <div class="fileLastRevision"><?php echo lang('file revision info long', $last_revision->getRevisionNumber(), $last_revision->getCreatedBy()->getCardUrl(), clean($last_revision->getCreatedBy()->getDisplayName()), format_descriptive_date($last_revision->getCreatedOn())); ?> </div> <?php } else { ?>
echo clean($assigned_to->getDisplayName()); ?> :</span> <?php } else { ?> <span class="assignedTo"><?php echo lang('anyone'); ?> :</span> <?php } // if ?> <?php echo do_textile($assigned_task->getText()); ?> <?php if ($assigned_task->getTaskList() instanceof ProjectTaskList) { ?> (<?php echo lang('in'); ?> <a href="<?php echo $assigned_task->getTaskList()->getViewUrl(); ?> "><?php echo clean($assigned_task->getTaskList()->getName()); ?> </a>)
" /></div> <?php } // if ?> <div class="text"> <?php echo do_textile($message->getText()); if (trim($message->getAdditionalText())) { ?> <div class="messageSeparator"><?php echo lang('message separator'); ?> </div> <?php echo do_textile($message->getAdditionalText()); } // if ?> </div> <?php echo render_object_files($message, $message->canEdit(logged_user())); ?> <div class="messageCommentCount"> <?php if ($message->countComments()) { ?> <span><?php echo lang('comments'); ?> :</span> <a href="<?php
if (is_array($versions = $versions_feed->getNewVersions(product_version())) && count($versions)) { ?> <div id="availableVersions"> <?php foreach ($versions as $version) { ?> <div class="availableVerion"> <h2><a href="<?php echo $version->getDetailsUrl(); ?> "><?php echo clean($version->getSignature()); ?> </a></h2> <div class="releaseNotes"><?php echo do_textile($version->getReleaseNotes()); ?> </div> <?php $download_links = array(); foreach ($version->getDownloadLinks() as $download_link) { $download_links[] = '<a href="' . $download_link->getUrl() . '">' . clean($download_link->getFormat()) . ' (' . format_filesize($download_link->getSize()) . ')</a>'; } // foreach ?> <div class="downloadLinks"><strong><?php echo lang('download'); ?> :</strong> <?php echo implode(' | ', $download_links); ?>
echo $option->getName(); ?> "> <div class="configOptionLabel"><label><?php echo clean($option->getDisplayName()); ?> :</label></div> <div class="configOptionControl"><?php echo $option->render('options[' . $option->getName() . ']'); ?> </div> <?php if (trim($option_description = $option->getDisplayDescription())) { ?> <div class="configOptionDescription desc"><?php echo do_textile($option_description); ?> </div> <?php } // if ?> <div class="clear"></div> </div> <?php } // foreach ?> </div> <div style="float:right"><button style="margin-top: 10px;" type="reset"><?php
} // if ?> <div class="hours"><span><?php echo lang('hours'); ?> :</span> <?php echo $time->getHours(); ?> </div> <?php if ($time->getDescription()) { ?> <div class="description"><?php echo do_textile($time->getDescription()); ?> </div> <?php } // if ?> <?php $options = array(); if ($time->canEdit(logged_user())) { $options[] = '<a href="' . $time->getEditUrl() . '">' . lang('edit') . '</a>'; } if ($time->canDelete(logged_user())) { $options[] = '<a href="' . $time->getDeleteUrl() . '" onclick="return confirm(\'' . lang('confirm delete time') . '\')">' . lang('delete') . '</a>'; }
?> <div class="icon"><img src="<?php echo active_project()->getLogoUrl(); ?> " alt="<?php echo active_project()->getName(); ?> " /></div> <?php } // if echo clean(active_project()->getName()); ?> </div> <div class="content"><?php echo plugin_manager()->apply_filters('project_description', do_textile(active_project()->getDescription())); ?> <div class="clear"></div> <div id="pageAttachments"> <?php if (is_array($page_attachments) && count($page_attachments)) { foreach ($page_attachments as $page_attachment) { tpl_assign('attachment', $page_attachment); if ($page_attachment->getRelObjectManager() != '') { if (file_exists(get_template_path('view_' . $page_attachment->getRelObjectManager(), 'page_attachment'))) { $this->includeTemplate(get_template_path('view_' . $page_attachment->getRelObjectManager(), 'page_attachment')); } else { $this->includeTemplate(get_template_path('view_DefaultObject', 'page_attachment')); } } else { $this->includeTemplate(get_template_path('view_EmptyAttachment', 'page_attachment'));
<div class="sidebarBlock"> <h2><?php echo $sidebar_revision->getName(); ?> </h2> <div class="blockContent"> <?php echo do_textile(wiki_links($sidebar_revision->getContent())); ?> <?php if (!$sidebar_page->isNew() && $sidebar_page->canEdit(logged_user())) { ?> <p><a href="<?php echo $sidebar_page->getEditUrl(); ?> "><?php echo lang('edit'); ?> </a></p><?php } ?> </div> </div> <?php if (isset($sidebar_links) && count($sidebar_links)) { ?> <div class="sidebarBlock"> <ul> <?php foreach ($sidebar_links as $spage) { ?>
} // if ?> <div class="header"><h2><a href="<?php echo $project->getOverviewUrl(); ?> "><?php echo clean($project->getName()); ?> </a></h2></div> <div class="content"> <?php if (trim($project->getDescription())) { ?> <div class="description"><?php echo do_textile($project->getDescription()); ?> </div> <?php } // if if (is_array($project_companies = $project->getCompanies())) { $project_company_names = array(); foreach ($project_companies as $project_company) { $project_company_names[] = '<a href="' . $project_company->getCardUrl() . '">' . clean($project_company->getName()) . '</a>'; } // foreach ?> <div class="involvedCompanies"><em><?php echo lang('companies involved in project'); ?>
/** * Edit a wiki page * * @return void */ function edit() { if (!WikiPage::canEdit(logged_user())) { flash_error(lang('no wiki page edit permissions')); $this->redirectToReferer(get_url('wiki')); } //Get the page from the url params $page = Wiki::getPageById(get_id(), active_project()); if (!instance_of($page, 'WikiPage')) { //If the page doesn't exist, redirect to wiki index flash_error(lang('wiki page dnx')); $this->redirectToReferer(get_url('wiki')); } // if //Check that the user can edit this entry if (!$page->canEdit(logged_user())) { flash_error(lang('no access permissions')); $this->redirectTo(get_url('wiki')); } // if // Check that the page isn't locked if ($page->isLocked() && !$page->canUnlock(logged_user())) { flash_error(lang('wiki page locked by', $page->getLockedByUser()->getUsername())); $this->redirectToUrl($page->getViewUrl()); } // if //Here we will edit a wiki page $preview = false; $data = array_var($_POST, 'wiki', false); if (false !== $data) { $preview = array_key_exists('preview', $data); } if (!$preview && $data) { //if(null !== ($data = array_var($_POST, 'wiki'))){ //If we have received data //Make a new revision $revision = $page->makeRevision(); $revision->setFromAttributes($data); $page->setProjectIndex($data['project_index']); $page->setProjectSidebar($data['project_sidebar']); $page->setPublish($data['publish']); $page->setParentId($data['parent_id']); // Check to see if we want to lock this page if (isset($data['locked'])) { if ($data['locked'] == 1 && $page->canLock(logged_user()) && !$page->isLocked()) { // If we want to lock this page and the user has permissions to lock it, and the page is not already locked $page->setLocked(true); $page->setLockedById(logged_user()->getId()); $page->setLockedOn(DateTimeValueLib::now()); } elseif ($data['locked'] == 0 & $page->canUnlock(logged_user()) && $page->isLocked()) { // Else if we want to unlock the page, and the user is allowed to, and the page is locked $page->setLocked(false); } // if } // if //Set the users ID $revision->setCreatedById(logged_user()->getId()); try { //Start the transaction DB::beginWork(); //Save the page and create revision //The page will make sure that the revision's project and page Id are correct $page->save(); ApplicationLogs::createLog($page, active_project(), ApplicationLogs::ACTION_EDIT); if (plugin_active('tags')) { //Set the tags $page->setTagsFromCSV($data['tags']); } //Commit changes DB::commit(); flash_success(lang('success edit wiki page')); //Redirect to the page we just created $this->redirectToUrl($page->getViewUrl()); } catch (Exception $e) { //Get rid of any Db changes we've made DB::rollback(); //Assign the problem to the template so we can tell the user tpl_assign('error', $e); } //try } else { if (array_var($_GET, 'revision')) { //If we want to make a new revision based off a revision $revision = $page->getRevision($_GET['revision']); } else { $revision = $page->getLatestRevision(); } } //if if (!$data) { // there was no input POSTed $data['content'] = $revision->getContent(); } $data['preview_content'] = do_textile($data['content']); //Assign revision object tpl_assign('revision', $revision); tpl_assign('data', $data); //Assign the page object tpl_assign('page', $page); $tag_names = plugin_active('tags') ? $page->getTagNames() : ''; $tags = is_array($tag_names) ? implode(', ', $tag_names) : ''; tpl_assign('tags', $tags); //Set the template $this->setTemplate('edit'); $this->setSidebar(get_template_path('textile_help_sidebar')); }