Пример #1
0
 static function drti_func($fieldName, $inputType, $defaultValue = '', $possibleValues = NULL, $attributes = NULL, $noSubmit = FALSE)
 {
     if (!is_array($attributes)) {
         $attributes = array();
     }
     if (isset($attributes['class'])) {
         $attributes['class'] .= ' ckEditReplace';
     } else {
         $attributes['class'] = 'ckEditReplace';
     }
     if (!isset($attributes['data-toolbar'])) {
         if ($inputType == itRICHTEXT) {
             $attributes['data-toolbar'] = 'Basic';
         }
     }
     if (isset($attributes['contenteditable'])) {
         $attributes['class'] = str_replace(array('inputtype-html', 'inputtype'), '', $attributes['class']);
         $attr = BuildAttrString($attributes);
         return '<div' . $attr . '>' . $defaultValue . '</div>';
     }
     return utopia::DrawInput($fieldName, itTEXTAREA, $defaultValue, $possibleValues, $attributes, $noSubmit);
 }
Пример #2
0
 public function GetFilterBox($filterInfo, $attributes = NULL, $spanAttributes = NULL)
 {
     if (is_string($filterInfo)) {
         $filterInfo = $this->GetFilterInfo($filterInfo);
     }
     // already filtered?
     if ($filterInfo['it'] === itNONE) {
         return '';
     }
     $fieldName = $filterInfo['fieldName'];
     $default = $this->GetFilterValue($filterInfo['uid']);
     $pre = '';
     $emptyVal = '';
     if (!empty($filterInfo['title'])) {
         $emptyVal = $filterInfo['title'];
     } elseif (isset($this->fields[$fieldName])) {
         switch ($filterInfo['ct']) {
             case ctGT:
             case ctGTEQ:
                 $emptyVal = $this->fields[$fieldName]['visiblename'] . ' After';
                 break;
             case ctLT:
             case ctLTEQ:
                 $emptyVal = $this->fields[$fieldName]['visiblename'] . ' Before';
                 break;
             case ctEQ:
             case ctLIKE:
                 $emptyVal = $this->fields[$fieldName]['visiblename'];
                 break;
             default:
                 $emptyVal = $this->fields[$fieldName]['visiblename'] . ' ' . htmlentities($filterInfo['ct']);
                 break;
         }
     }
     //$vals = $filterInfo['values'];
     //if (!is_array($vals))
     $vals = $this->GetValues($filterInfo['uid']);
     if (isset($vals['']) && $vals[''] === FALSE && isset($vals[$filterInfo['default']])) {
         $vals[''] = $vals[$filterInfo['default']];
         if ($default == $filterInfo['default']) {
             $default = '';
         }
         unset($vals[$filterInfo['default']]);
     }
     if (!$attributes) {
         $attributes = array();
     }
     if (isset($filterInfo['attributes'])) {
         $attributes = array_merge((array) $filterInfo['attributes'], $attributes);
     }
     $attributes['placeholder'] = trim(strip_tags($emptyVal));
     if (array_key_exists('class', $attributes)) {
         $attributes['class'] .= ' uFilter';
     } else {
         $attributes['class'] = 'uFilter';
     }
     $spanAttr = BuildAttrString($spanAttributes);
     return '<span ' . $spanAttr . '>' . $pre . utopia::DrawInput('_f_' . $filterInfo['uid'], $filterInfo['it'], $default, $vals, $attributes, false) . '</span>';
 }
Пример #3
0
 static function DrawToggleSwitch($fieldName, $inputType, $defaultValue = '', $possibleValues = NULL, $attributes = NULL, $noSubmit = FALSE)
 {
     return utopia::DrawInput($fieldName, itCHECKBOX, $defaultValue, $possibleValues, $attributes, $noSubmit);
 }
Пример #4
0
    static function show_fileman($fieldName, $inputType, $defaultValue = '', $possibleValues = NULL, $attributes = NULL, $noSubmit = FALSE)
    {
        list($path) = self::Init();
        //if (!is_array($attributes)) $attributes = array();
        //$attributes['onclick'] = 'alert("moo");return false;';
        uJavascript::AddText(<<<FIN
\tfunction filesel(id,item) {
\t\tif (item.type != 0) return;
\t\t\$('#fileMan').dialog('close');
\t\tuf(id,item.fullPath,'{$fieldName}');
\t}
//\t\$(document).ready(function() {
//\t\t\$('#fileMan').dialog({autoOpen: false});
//\t}
FIN
);
        return '<div id="fileMan"></div>' . utopia::DrawInput($fieldName, itTEXT, $defaultValue, $possibleValues, $attributes, $noSubmit) . '<input id="' . $fieldName . '" type="button" onclick="$(\'#fileMan\').fileManager({ajaxPath:\'' . $path . '\'}).on(\'dblclick\',\'.fmFile\',function(event) {filesel(\'' . $fieldName . '\',$(this).data(\'item\'))}).dialog();" value="Choose File">';
        //return $out.$defaultValue.utopia::DrawInput($fieldName,itBUTTON,'Choose File',$possibleValues,$attributes,$noSubmit);
    }
Пример #5
0
 public function publishLinks($field, $pkVal, $v, $rec)
 {
     if ($rec['is_published'] && $rec['content_time'] == $rec['content_published_time']) {
         return utopia::DrawInput('published', itBUTTON, 'Published') . $this->DrawSqlInput('unpublish', 'Unpublish', $pkVal, array('title' => 'Remove this page from public view', 'class' => 'page-unpublish'), itBUTTON);
     }
     // preview, publish, revert (red)
     $obj = utopia::GetInstance('uCMS_View');
     $preview = CreateNavButton('Preview', $obj->GetURL(array('cms_id' => $pkVal, 'preview' => 1)), array('target' => '_blank', 'title' => 'Preview this page'));
     $revert = $this->DrawSqlInput('revert', 'Revert', $pkVal, array('title' => 'Reset to published version', 'class' => 'page-revert'), itBUTTON);
     $publish = $this->DrawSqlInput('publish', 'Publish', $pkVal, array('title' => 'Make this page live', 'class' => 'page-publish btn-green'), itBUTTON);
     return $preview . $revert . $publish;
 }
Пример #6
0
 public function RunModule()
 {
     $email = array_key_exists('e', $_REQUEST) ? $_REQUEST['e'] : '';
     $notice = '';
     $rec = $this->LookupRecord(array('username' => $email));
     if (!empty($email) && !$rec) {
         uNotices::AddNotice('No account was found with this email address. Please try again.', NOTICE_TYPE_ERROR);
     }
     if (empty($email) || !$rec) {
         echo '<h1>Reset Password</h1>';
         echo '<form id="reset-password-form" action="' . $this->GetURL(array()) . '" method="post">';
         echo '<p>What is your email address?</p>';
         echo '<div style="margin-left:20px;">My e-mail address is ' . utopia::DrawInput('e', itTEXT) . '</div>';
         echo '<input type="submit" class="btn" value="Reset Password" />';
         echo '</form>';
         return;
     }
     if (!array_key_exists('c', $_REQUEST)) {
         // reset pw
         echo '<p>An email has been sent to &quot;' . $email . '&quot; with your password reset link. Please click the link and enter a new password for your account.</p><p>Please be patient; the delivery of email may be delayed. Remember to confirm that the email above is correct and to check your junk or spam folder or filter if you do not receive this email.</p>';
         $this->ResetPW($email);
         return true;
     }
     if ($rec['email_confirm_code'] !== $_REQUEST['c']) {
         echo '<p>Unfortunately we could not validate this request.</p><p>If you are trying to activate your account or reset your password, please <a href="' . $this->GetURL(array('e' => $email)) . '">click here</a> for a new link.</p>';
         return;
     }
     if (array_key_exists('__newpass_c', $_POST)) {
         if ($_POST['__newpass'] !== $_POST['__newpass_c']) {
             uNotices::AddNotice('Password confirmation did not match, please try again.', NOTICE_TYPE_ERROR);
         } else {
             $this->SetFieldOptions('email_confirm_code', ALLOW_EDIT);
             $this->SetFieldOptions('password', ALLOW_EDIT);
             $this->UpdateFields(array('email_confirm_code' => '', 'password' => $_POST['__newpass']), $rec['user_id']);
             $this->SetFieldOptions('email_confirm_code', NULL);
             $this->SetFieldOptions('password', NULL);
             echo '<p>You have successfully reset your password.</p>';
             return;
         }
     }
     if (empty($rec['password'])) {
         $action = 'Activate Account';
     } else {
         $action = 'Reset Password';
     }
     echo '<h1>' . $action . '</h1>';
     echo '<form id="loginForm" action="" method="post"><input type="hidden" name="e" value="' . $email . '"><input type="hidden" name="c" value="' . $_REQUEST['c'] . '">';
     echo '<table style="margin-left:20px;margin-top:10px;" cellpadding="5">';
     echo '<tr><td align="right">New Password:</td><td>' . utopia::DrawInput('__newpass', itPASSWORD) . '</td></tr>';
     echo '<tr><td align="right">Confirm Password:</td><td>' . utopia::DrawInput('__newpass_c', itPASSWORD) . '</td></tr>';
     echo '<tr><td colspan="2" align="right"><input type="submit" class="btn" value="Set Password" /></td></tr>';
     echo '</table></form>';
 }