<commit_before><?php

class WebstreamController extends Zend_Controller_Action
{
    public function init()
    {
        $ajaxContext = $this->_helper->getHelper('AjaxContext');
        $ajaxContext->addActionContext('new', 'json')
                    ->addActionContext('save', 'json')
                    ->addActionContext('edit', 'json')
                    ->addActionContext('delete', 'json')
                    ->initContext();
        //TODO
        //$this->pl_sess = new Zend_Session_Namespace(UI_PLAYLIST_SESSNAME);
    }

    public function newAction()
    {

        $webstream = new CcWebstream();

        //we're not saving this primary key in the DB so it's OK
        $webstream->setDbId(-1);
        $webstream->setDbName("Untitled Webstream");
        $webstream->setDbDescription("");
        $webstream->setDbUrl("http://");
        $webstream->setDbLength("00:00:00");
        $webstream->setDbName("Untitled Webstream");

        $this->view->ws = new Application_Model_Webstream($webstream);
        $this->view->action = "new";
        $this->view->html = $this->view->render('webstream/webstream.phtml');
    }

    public function editAction()
    {
        $request = $this->getRequest();

        $id = $request->getParam("id");
        if (is_null($id)) {
            throw new Exception("Missing parameter 'id'"); 
        }

        $webstream = CcWebstreamQuery::create()->findPK($id);
        $this->view->ws = new Application_Model_Webstream($webstream);
        $this->view->action = "edit";
        $this->view->html = $this->view->render('webstream/webstream.phtml');
    }

    public function deleteAction()
    {
        $request = $this->getRequest();
        $id = $request->getParam("ids");

        $webstream = CcWebstreamQuery::create()->findPK($id)->delete();

    }

    public function saveAction()
    {
        $request = $this->getRequest();

        <commit_msg>CC-1665: Scheduled stream rebroadcasting and recording<commit_after><?php

class WebstreamController extends Zend_Controller_Action
{
    public function init()
    {
        $ajaxContext = $this->_helper->getHelper('AjaxContext');
        $ajaxContext->addActionContext('new', 'json')
                    ->addActionContext('save', 'json')
                    ->addActionContext('edit', 'json')
                    ->addActionContext('delete', 'json')
                    ->initContext();
        //TODO
        //$this->pl_sess = new Zend_Session_Namespace(UI_PLAYLIST_SESSNAME);
    }

    public function newAction()
    {

        $webstream = new CcWebstream();

        //we're not saving this primary key in the DB so it's OK
        $webstream->setDbId(-1);
        $webstream->setDbName("Untitled Webstream");
        $webstream->setDbDescription("");
        $webstream->setDbUrl("http://");
        $webstream->setDbLength("00:00:00");
        $webstream->setDbName("Untitled Webstream");

        $this->view->ws = new Application_Model_Webstream($webstream);
        $this->view->action = "new";
        $this->view->html = $this->view->render('webstream/webstream.phtml');
    }

    public function editAction()
    {
        $request = $this->getRequest();

        $id = $request->getParam("id");
        if (is_null($id)) {
            throw new Exception("Missing parameter 'id'"); 
        }

        $webstream = CcWebstreamQuery::create()->findPK($id);
        $this->view->ws = new Application_Model_Webstream($webstream);
        $this->view->action = "edit";
        $this->view->html = $this->view->render('webstream/webstream.phtml');
    }

    public function deleteAction()
    {
        $request = $this->getRequest();
        $id = $request->getParam("ids");

        $webstream = CcWebstreamQuery::create()->findPK($id)->delete();

        $this->view->ws = null;
        $this->view->action = "delete";
        $this->view->html = $this->view->render('webstream/webstream.phtml');

    }

    public function saveAction()
    {
        $request = $this->getRequest();

        
{'fraction_non_alphanumeric': 0.16319444444444445, 'fraction_numerical': 0.004464285714285714, 'mean_word_length': 2.4558697514995718, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 87, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7318672', 'n_tokens_mistral': 1201, 'n_tokens_neox': 1152, 'n_words': 197}