Google 網上論壇首頁
說明 | 登入
Check out this CakePHP Job Board - Small Problem
目前本群組有太多主題設為優先顯示。 要優先顯示這個主題,請將其他主題的這個選項取消。
在處理您的要求時發生錯誤。 請再試一次。
標幟
  14 個訊息 - 全部摺疊
您要留言的群組是 Usenet 群組。在此群組留言,網際網路上的任何使用者將可以看到您的電郵地址。
您的回覆郵件尚未寄出。
您已成功留言
kujina  
檢視個人資料
 更多選項 9月2日, 上午3時36分
寄件者: kujina <the_S...@hotmail.com>
日期: Mon, 1 Sep 2008 12:36:32 -0700 (PDT)
當地時間: 2008年9月2日(星期二) 上午3時36分
主旨: Check out this CakePHP Job Board - Small Problem
Please check out my simple job board here:

http://82.34.51.7/jobboard

My problem is with the "Application Pack" documents, the url path to
the file is not complete!

When you click to open a file, this error displays "Error: The
requested address '/uploads/App-Form_010908-202743.doc' was not found
on this server."

In the "application_config.php" file I have this:

// URL path where the uploaded docs can be accessed
define('UPLOADS_URL', 'http://82.34.51.7/jobboard/uploads');

In the "view.ctp" file I have this:

<legend>Application Pack</legend>
        <?php echo $html->image('pdf-icon.gif', array('alt'=>'',
'style'=>'vertical-align: bottom; margin-right: 5px')) ?><?php echo
$html->link('Application Form', UPLOADS_URL . "/{$job['Job']
['application_form_doc']}", array('style'=>'color: #000; text-
decoration: none')); ?><br />
        <?php echo $html->image('pdf-icon.gif', array('alt'=>'',
'style'=>'vertical-align: bottom; margin-right: 5px')) ?><?php echo
$html->link('Job Description', UPLOADS_URL . "/{$job['Job']
['job_description_doc']}", array('style'=>'color: #000; text-
decoration: none')); ?><br />
        <?php echo $html->image('pdf-icon.gif', array('alt'=>'',
'style'=>'vertical-align: bottom; margin-right: 5px')) ?><?php echo
$html->link('Information', UPLOADS_URL . "/{$job['Job']
['information_doc']}", array('style'=>'color: #000; text-decoration:
none')); ?>
    </fieldset>

Can anyone please help?

...Thanks...


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
spub  
檢視個人資料
 更多選項 9月2日, 上午5時35分
寄件者: spub <si...@interiorgoodsdirect.com>
日期: Mon, 1 Sep 2008 14:35:18 -0700 (PDT)
當地時間: 2008年9月2日(星期二) 上午5時35分
主旨: Re: Check out this CakePHP Job Board - Small Problem
look at previous posts on routing. You need to either use some rule
in .htaccess or add some custome routes.

cakephp is expecting to see a controller called uploads..

On Sep 1, 8:36 pm, kujina <the_S...@hotmail.com> wrote:


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
kujina  
檢視個人資料
 更多選項 9月2日, 上午6時47分
寄件者: kujina <the_S...@hotmail.com>
日期: Mon, 1 Sep 2008 15:47:22 -0700 (PDT)
當地時間: 2008年9月2日(星期二) 上午6時47分
主旨: Re: Check out this CakePHP Job Board - Small Problem
Thanks for the reply.

I'm at a losss really, as I didnt put this together and I have no
familiarity with cakephp.

Can give me more detail?

I'll paypal $5 if somebody can lead me to sorting this ; )


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
AD7six  
檢視個人資料
 更多選項 9月2日, 上午7時11分
寄件者: AD7six <andydawso...@gmail.com>
日期: Mon, 1 Sep 2008 16:11:24 -0700 (PDT)
當地時間: 2008年9月2日(星期二) 上午7時11分
主旨: Re: Check out this CakePHP Job Board - Small Problem

On Sep 2, 12:47 am, kujina <the_S...@hotmail.com> wrote:

> Thanks for the reply.

> I'm at a losss really, as I didnt put this together and I have no
> familiarity with cakephp.

> Can give me more detail?

> I'll paypal $5 if somebody can lead me to sorting this ; )

move uploads alongside css and js in your webroot folder.

    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
kujina  
檢視個人資料
 更多選項 9月2日, 上午7時50分
寄件者: kujina <the_S...@hotmail.com>
日期: Mon, 1 Sep 2008 16:50:50 -0700 (PDT)
當地時間: 2008年9月2日(星期二) 上午7時50分
主旨: Re: Check out this CakePHP Job Board - Small Problem
The $5 goes to AD7six!!!

On Sep 2, 12:11 am, AD7six <andydawso...@gmail.com> wrote:


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
AD7six  
檢視個人資料
 更多選項 9月2日, 下午10時07分
寄件者: AD7six <andydawso...@gmail.com>
日期: Tue, 2 Sep 2008 07:07:34 -0700 (PDT)
當地時間: 2008年9月2日(星期二) 下午10時07分
主旨: Re: Check out this CakePHP Job Board - Small Problem

On Sep 2, 1:50 am, kujina <the_S...@hotmail.com> wrote:

> The $5 goes to AD7six!!!

$kujina->donate('http://www.cakephp.org');

    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
kujina  
檢視個人資料
 更多選項 9月4日, 下午11時20分
寄件者: kujina <the_S...@hotmail.com>
日期: Thu, 4 Sep 2008 08:20:17 -0700 (PDT)
當地時間: 2008年9月4日(星期四) 下午11時20分
主旨: Re: Check out this CakePHP Job Board - Small Problem
Ok' I'll donate to the project.

The school job board is nearly useable now!

The last thing I need to do is make it so the "Information" download
in the "application pack" section only apears if you upload a file for
it.

If I get the "jobs_controller.php" and "view.ctp" available (or the
relevant code) would you be so kind to show me what I need to change.
I could zip the whole job board up too, available for download.

...Thanks...

On Sep 2, 3:07 pm, AD7six <andydawso...@gmail.com> wrote:


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Wayne Fay  
檢視個人資料
 更多選項 9月5日, 上午6時44分
寄件者: "Wayne Fay" <wayne...@gmail.com>
日期: Thu, 4 Sep 2008 15:44:08 -0700
當地時間: 2008年9月5日(星期五) 上午6時44分
主旨: Re: Check out this CakePHP Job Board - Small Problem
I would have a db entry that indicates if Information (and the other
PDF files) has been uploaded with a true/false indicator stored in the
db. Then you simply show or hide the link depending on the indicator.

This should be super simple for you to implement.

Wayne


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
kujina  
檢視個人資料
 更多選項 9月8日, 上午3時40分
寄件者: kujina <the_S...@hotmail.com>
日期: Sun, 7 Sep 2008 12:40:41 -0700 (PDT)
當地時間: 2008年9月8日(星期一) 上午3時40分
主旨: Re: Check out this CakePHP Job Board - Small Problem
Wayne,
I just worked out how to remove "not null" in the "information_doc"
entry in the DB, so that you dont have to attach a file.
But as I said previously I dont really know any thing about cakephp/
php.
How can I make the "Information" download link only appear if there is
a file uploaded for it, like so http://82.34.51.7/examp.png

I'm assuming (from my very limited knowledge) that I need to make
changes in these two files?

The following is the contents of the application_config.php

<?php

class JobsController extends AppController
{
    var $uses = array('Job', 'JobType');

    function beforeFilter()
    {
        if (substr($this->action, 0, 5) == 'admin')
        {
            $this->__checkSession();
        }
    }

    function index($jobTypeId = null)
    {
        $conditions = array();
        $conditions['AND'] = array('OR' =>
array('UNIX_TIMESTAMP(Job.expires) > UNIX_TIMESTAMP(NOW())',
'Job.expires IS NULL'));
        if (intval($jobTypeId) > 0)
        {
            array_push($conditions['AND'], "JobType.id =
'$jobTypeId'");
        }

        $this->set('jobTypes', $this->JobType->find('list',
array('id', 'name')));
        $this->set('currentJobType', $jobTypeId);
        $this->set('jobs', $this->Job->findAll($conditions, null,
'Job.expires DESC'));
    }

    function view($id = null)
    {
        if ($id == null)
        {
            $this->redirect('index');
        }
        $this->Job->id = $id;
        $job = $this->Job->read();
        if (empty($job))
        {
            $this->redirect('index');
        }
        $this->set('job', $job);
    }

    function admin_index()
    {
        $this->set('jobs', $this->Job->findAll(null, null,
'Job.expires DESC'));
    }

    function admin_add()
    {
        $this->set('job_types', $this->JobType->find('list',
array('id', 'name')));
        if (!empty($this->data))
        {
            // Handle the Application Pack uploads
            $this->data['Job']['application_form_doc'] = $this-

>__handleUpload($_FILES['application_form_doc']);

            $this->data['Job']['job_description_doc'] = $this-
>__handleUpload($_FILES['job_description_doc']);

            $this->data['Job']['information_doc'] = $this-

>__handleUpload($_FILES['information_doc']);

            if ($this->Job->save($this->data))
            {
                $this->flash('The job has been added successfully.',
'index');
            }
        }
    }

    function admin_edit($id = null)
    {
        $this->set('job_types', $this->JobType->find('list',
array('id', 'name')));
        if (!empty($this->data))
        {

            // Handle the Application Pack uploads
            $this->data['Job']['application_form_doc'] = $this-

>__handleUpload($_FILES['application_form_doc'],

                $this->data['Job']['__afdoc']);
            $this->data['Job']['job_description_doc'] = $this-
>__handleUpload($_FILES['job_description_doc'],

                $this->data['Job']['__jddoc']);
            $this->data['Job']['information_doc'] = $this-
>__handleUpload($_FILES['information_doc'],

                $this->data['Job']['__ifdoc']);

            // If the expiry date is empty, set it to null
            if (trim($this->data['Job']['expires']) == '')
            {
                // Update the job expires data to null in the DB
                $this->Job->query('UPDATE jobs SET jobs.expires = NULL
WHERE jobs.id = ' . $this->data['Job']['id']);
            }

            // Save the edit data
            if ($this->Job->save($this->data))
            {
                $this->flash('The job has been edited successfully.',
'index');
            }
        }
        else
        {
            if ($id == null)
            {
                $this->redirect('index');
            }
            $this->Job->id = $id;
            $job = $this->Job->read();
            if (empty($job))
            {
                $this->redirect('index');
            }
            $this->data = $job;
        }
    }

    function admin_delete($id = null)
    {
        $this->Job->id = $id;
        $this->Job->del();
        $this->flash('The job has been deleted successfully.',
'index');
    }

    function nonteaching()
    {
        $this->layout = 'application';
        $this->pageTitle = 'Non-Teaching Application Form';
    }

    function teaching()
    {
        $this->layout = 'application';
        $this->pageTitle = 'Teaching Application Form';
    }

    function confirmapplication()
    {
        $this->layout = 'application';
        $this->pageTitle = 'Confirm Application';
    }

    function sendapplication()
    {
        //$this->layout = 'plain';
        $htmlData = $_POST['appData'];
        $htmlData = '<html><head><title>Job Application</title></
head><body>' . $htmlData . '</body></html>';

        $mailHeaders = "From: " . MAIL_FROM . "\r\n";
        $mailHeaders .= "X-Mailer: Job Board 1.0";
        $mailHeaders .= "MIME-Version: 1.0\r\n";
        $mailHeaders .= "Content-type: text/html; charset=utf-8";

        @mail(MAIL_TO, 'New Job Application', $htmlData,
$mailHeaders);
        $this->flash('Thank you for submitting your job application.
Your application has been received and will be reviewed shortly. You
will now be redirected to the job index', 'index', 10);
    }

    function __handleUpload($fData, $tgtFilename = null)
    {
        // First assign the default target (in case this is an edit)
        $filename = $tgtFilename;

        // If a file is uploaded
        if (!empty($fData['tmp_name']))
        {
            // Generate a friendly filename
            $extIdx = intval(strrpos($fData['name'],
'.'));
            // Get the name of the original file without the extension
            $oldname = substr($fData['name'], 0, $extIdx);
            // Replace spaces on the oldname with dashes
            $newfilename = str_replace(' ', '-', $oldname);
            // Append the current date and time to the filename in the
format DDMMYY-HHMMSS
            $newfilename .= '_' . date('dmy-His');
            // Get the file extension
            $newfilename .= substr($fData['name'], $extIdx);

            // Remove the old file and write the new one
            $oldtarget = UPLOADS_PATH . "/$filename";
            $target = UPLOADS_PATH . "/$newfilename";
            // Remove the old target if it exists
            if (file_exists($oldtarget))
            {
                unlink($oldtarget);
            }
            // Assign the filename and save the new target
            $filename = $newfilename;
            copy($fData['tmp_name'], $target);
            unlink($fData['tmp_name']);
        }

        return $filename;
    }

}

?>

AND THE FOLLOWING IS THE view.ctp FILE

<div class="jobleftpane">
<h2><?php echo $job['Job']['title'] ?></h2>
<div class="content">
    <b>Closing Date: <?php echo empty($job['Job']['expires']) ? 'No
closing date specified' : date(DT_FORMAT, strtotime($job['Job']
['expires'])) ?></b>
    <div style="margin-top: 12px">
        <?php echo str_replace("\r\n", "<br />", $job['Job']
['description']) ?>
    </div>
</div>
</div>

<div class="jobrightpane">
    <fieldset>
        <legend>Salary</legend>
        <?php echo $job['Job']['salary'] ?>
    </fieldset>

    <fieldset>
        <legend>Hours</legend>
        <?php echo $job['Job']['hours'] ?>
    </fieldset>

    <fieldset>
        <legend>Qualifications Needed</legend>
        <?php echo $job['Job']['qualifications'] ?>
    </fieldset>

    <fieldset>
        <legend>Application Pack</legend>
        <?php echo $html->image('pdf-icon.gif', array('alt'=>'',
'style'=>'vertical-align: bottom; margin-right: 5px')) ?><?php echo
$html->link('Application Form', UPLOADS_URL . "/{$job['Job']
['application_form_doc']}", array('style'=>'color: #000; text-
decoration: none')); ?><br />
        <?php echo $html->image('pdf-icon.gif', array('alt'=>'',
'style'=>'vertical-align: bottom; margin-right: 5px')) ?><?php echo
$html->link('Job Description', UPLOADS_URL . "/{$job['Job']
['job_description_doc']}", array('style'=>'color: #000; text-
decoration: none')); ?><br />
        <?php echo $html->image('pdf-icon.gif', array('alt'=>'',
'style'=>'vertical-align: bottom; margin-right: 5px')) ?><?php echo
$html->link('Information', UPLOADS_URL . "/{$job['Job']
['information_doc']}", array('style'=>'color: #000; text-decoration:
none')); ?>
    </fieldset>

    <fieldset style="text-align: center">
        <legend>Online Form</legend>
        <?php $linkUrl = (trim($job['Job']['leadership_form_url']) !=
'') ? $job['Job']['leadership_form_url'] : (($job['JobType']['rtype']
== 'T') ? 'teaching' : 'nonteaching') ?>
        <?php echo $html->link('Apply Online', $linkUrl) ?>
    </fieldset>
</div>

<div class="clear"></div>


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Wayne Fay  
檢視個人資料
 更多選項 9月8日, 上午11時33分
寄件者: "Wayne Fay" <wayne...@gmail.com>
日期: Sun, 7 Sep 2008 20:33:06 -0700
當地時間: 2008年9月8日(星期一) 上午11時33分
主旨: Re: Check out this CakePHP Job Board - Small Problem
Yes, you would alter the view.ctp file. Something along these lines...

Wayne

> AND THE FOLLOWING IS THE view.ctp FILE

   <fieldset>
       <legend>Application Pack</legend>

<?php if ({$job['Job']['application_form_doc] != null) { ?>
       <?php echo $html->image('pdf-icon.gif', array('alt'=>'',
'style'=>'vertical-align: bottom; margin-right: 5px')) ?><?php echo
$html->link('Application Form', UPLOADS_URL . "/{$job['Job']
['application_form_doc']}", array('style'=>'color: #000; text-
decoration: none')); ?><br />
<?php } ?>

<?php if ({$job['Job']['job_description_doc] != null) { ?>
       <?php echo $html->image('pdf-icon.gif', array('alt'=>'',
'style'=>'vertical-align: bottom; margin-right: 5px')) ?><?php echo
$html->link('Job Description', UPLOADS_URL . "/{$job['Job']
['job_description_doc']}", array('style'=>'color: #000; text-
decoration: none')); ?><br />
<?php } ?>

<?php if ({$job['Job']['information_doc] != null) { ?>
       <?php echo $html->image('pdf-icon.gif', array('alt'=>'',
'style'=>'vertical-align: bottom; margin-right: 5px')) ?><?php echo
$html->link('Information', UPLOADS_URL . "/{$job['Job']
['information_doc']}", array('style'=>'color: #000; text-decoration:
none')); ?>
<?php } ?>

   </fieldset>


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
kujina  
檢視個人資料
 更多選項 9月8日, 下午5時21分
寄件者: kujina <the_S...@hotmail.com>
日期: Mon, 8 Sep 2008 02:21:25 -0700 (PDT)
當地時間: 2008年9月8日(星期一) 下午5時21分
主旨: Re: Check out this CakePHP Job Board - Small Problem
Hi Wayne

After I made my last post I could see that the changes probably should
be made in the "view.ctp" file.
I put in the code you sugested, (I'm 99.9% sure I did it correctly)
but the job listings pages come up completely blank.
Is it becuase the syntax (is that what you call it?) has a mistake in
it?
I did add an apostrophe to the end of ['information_doc] but that
didnt help.

...Thanks...

On Sep 8, 4:33 am, "Wayne Fay" <wayne...@gmail.com> wrote: